Skip to content

feat: chain + token icon mapping#374

Merged
Philippoes merged 1 commit intomainfrom
feat/icon-mapping
May 22, 2025
Merged

feat: chain + token icon mapping#374
Philippoes merged 1 commit intomainfrom
feat/icon-mapping

Conversation

@petar-omni
Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings May 22, 2025 11:27
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 22, 2025

🦋 Changeset detected

Latest commit: 26effd0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stakekit/widget Patch

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

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
staging-widget ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 11:29am
stakekit-widget ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 11:29am

@petar-omni petar-omni requested a review from Philippoes May 22, 2025 11:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Philippoes merged commit a4e8cb4 into main May 22, 2025
7 checks passed
@Philippoes Philippoes deleted the feat/icon-mapping branch May 22, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants