feat: chain + token icon mapping#374
Merged
Philippoes merged 1 commit intomainfrom May 22, 2025
Merged
Conversation
🦋 Changeset detectedLatest commit: 26effd0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a new feature for mapping chain and token icons by adding configurable mapping options in settings and applying them throughout the widget. Key changes include:
- Enhancing the wagmi configuration by introducing a new chainIconMapping parameter.
- Updating settings to include tokenIconMapping and chainIconMapping with support for both record and function types.
- Replacing default network logo utilities with new variant hooks for more flexible icon URL mapping.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/widget/src/providers/wagmi/index.ts | Updated buildWagmiConfig to incorporate chainIconMapping in mapping the wagmiChain icons |
| packages/widget/src/providers/settings.tsx | Added tokenIconMapping and chainIconMapping properties in SettingsProps |
| packages/widget/src/components/atoms/token-icon/token-icon-container/index.tsx | Refactored token icon component to use new variant network URL hook |
| packages/widget/src/components/atoms/token-icon/token-icon-container/hooks/use-variant-token-urls.ts | Modified token URL hook to consider tokenIconMapping from settings |
| packages/widget/src/components/atoms/token-icon/token-icon-container/hooks/use-variant-network-urls.ts | Introduced new hook for variant network URL mapping based on chainIconMapping |
| .changeset/rich-moments-act.md | Created changeset file for the new feature |
Comments suppressed due to low confidence (2)
packages/widget/src/providers/wagmi/index.ts:142
- [nitpick] Consider renaming the parameter 'val' in the mapWagmiChain function to a more descriptive name (e.g., 'chainMapping') to improve code readability.
const mapWagmiChain = (val: { wagmiChain: RainbowkitChain; skChainName: Networks; }) => {
packages/widget/src/providers/settings.tsx:55
- [nitpick] Consider adding inline documentation for the tokenIconMapping and chainIconMapping properties to clarify the expected formats and usage, benefiting future maintainers.
tokenIconMapping?: | Record<TokenDto["symbol"], string> | ((token: TokenDto) => string);
Philippoes
approved these changes
May 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
Description of new functionality, feature, or content that has been added in this pull request.
Changed
Description of the modifications made to existing functionality, feature, or content in this pull request. This could include changes to code, CI, documentation, etc.