You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements chain-specific SLIP-44 overrides for native BNB on Binance Smart Chain and opBNB in CAIP-19 asset formatting, adds regression tests, updates supported CAIP networks, and bumps the viem dependency and package version across the monorepo.
Class diagram for formatting utilities and CAIP network support updates
Flow diagram for CAIP-19 asset formatting with SLIP-44 overrides
flowchart TD
A["Call formatCaip19Asset(caipNetworkId, asset)"] --> B["ParseUtil.parseCaipNetworkId(caipNetworkId)\nextract chainNamespace, chainId"]
B --> C["Lookup chainInfo from CHAIN_ASSET_INFO_MAP using caipNetworkId"]
C --> D{Is asset equal to native?}
D -- "No, non-native asset" --> E["assetNamespace = chainInfo.defaultTokenNamespace\nassetReference = asset"]
E --> H["Build CAIP-19: chainNamespace:chainId/assetNamespace:assetReference"]
D -- "Yes, native asset" --> F{Is chainNamespace eip155 and override exists for chainId?}
F -- "Yes" --> G["assetNamespace = chainInfo.defaultNativeNamespace (unchanged)\nassetReference = EVM_NATIVE_SLIP44_OVERRIDES[chainId]\n(uses chain-specific SLIP-44 coin type, e.g. 714 for BNB)"]
G --> H
F -- "No" --> I["assetNamespace = chainInfo.defaultNativeNamespace\nassetReference = chainInfo.defaultNativeReference (existing behavior)"]
I --> H
H --> J["Return formatted CAIP-19 asset string"]
Loading
File-Level Changes
Change
Details
Files
Add CAIP-19 formatting override so native BNB on Binance Smart Chain and opBNB uses SLIP-44 coin type 714 instead of the generic EVM type.
Introduce EVM_NATIVE_SLIP44_OVERRIDES map keyed by EVM chainId to SLIP-44 coin type in controllers ExchangeUtil and pay AssetUtil utilities.
Update formatCaip19Asset to check for eip155 native assets in the overrides map and use the chain-specific SLIP-44 value for the assetReference when asset is 'native'.
Ensure non-native assets still use the chain default token namespace and asset address without being affected by overrides.
Expand the set of WC HTTP RPC supported chains to include a new EVM network.
Add eip155:55931 to WC_HTTP_RPC_SUPPORTED_CHAINS so it is recognized as supported for WalletConnect HTTP RPC flows.
packages/appkit-utils/src/CaipNetworkUtil.ts
Tips and commands
Interacting with Sourcery
Trigger a new review: Comment @sourcery-ai review on the pull request.
Continue discussions: Reply directly to Sourcery's review comments.
Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with @sourcery-ai issue to create an issue from it.
Generate a pull request title: Write @sourcery-ai anywhere in the pull
request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
Generate a pull request summary: Write @sourcery-ai summary anywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment @sourcery-ai summary on the pull request to
(re-)generate the summary at any time.
Generate reviewer's guide: Comment @sourcery-ai guide on the pull
request to (re-)generate the reviewer's guide at any time.
Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!
Reviewer's Guide
Implements chain-specific SLIP-44 overrides for native BNB on Binance Smart Chain and opBNB in CAIP-19 asset formatting, adds regression tests, updates supported CAIP networks, and bumps the viem dependency and package version across the monorepo.
Class diagram for formatting utilities and CAIP network support updates
classDiagram class ExchangeUtil { <<module>> CHAIN_ASSET_INFO_MAP EVM_NATIVE_SLIP44_OVERRIDES +getApiUrl() +formatCaip19Asset(caipNetworkId, asset) string } class AssetUtil { <<module>> CHAIN_ASSET_INFO_MAP EVM_NATIVE_SLIP44_OVERRIDES +formatCaip19Asset(caipNetworkId, asset) string } class CaipNetworkUtil { <<module>> WC_HTTP_RPC_SUPPORTED_CHAINS +someNetworkHelpers() +WC_HTTP_RPC_SUPPORTED_CHAINS includes eip155:55931 } class EVM_NATIVE_SLIP44_OVERRIDES_Map { <<value-object>> +key chainId string +value slip44CoinType string +entry 56 -> 714 +entry 204 -> 714 } ExchangeUtil --> EVM_NATIVE_SLIP44_OVERRIDES_Map : uses AssetUtil --> EVM_NATIVE_SLIP44_OVERRIDES_Map : uses class AppkitPackages { <<monorepo-packages>> +dependOnViem >= 2.45.0 +PACKAGE_VERSION 1.8.17 } AppkitPackages ..> ExchangeUtil : runtime usage AppkitPackages ..> AssetUtil : runtime usage AppkitPackages ..> CaipNetworkUtil : runtime usageFlow diagram for CAIP-19 asset formatting with SLIP-44 overrides
flowchart TD A["Call formatCaip19Asset(caipNetworkId, asset)"] --> B["ParseUtil.parseCaipNetworkId(caipNetworkId)\nextract chainNamespace, chainId"] B --> C["Lookup chainInfo from CHAIN_ASSET_INFO_MAP using caipNetworkId"] C --> D{Is asset equal to native?} D -- "No, non-native asset" --> E["assetNamespace = chainInfo.defaultTokenNamespace\nassetReference = asset"] E --> H["Build CAIP-19: chainNamespace:chainId/assetNamespace:assetReference"] D -- "Yes, native asset" --> F{Is chainNamespace eip155 and override exists for chainId?} F -- "Yes" --> G["assetNamespace = chainInfo.defaultNativeNamespace (unchanged)\nassetReference = EVM_NATIVE_SLIP44_OVERRIDES[chainId]\n(uses chain-specific SLIP-44 coin type, e.g. 714 for BNB)"] G --> H F -- "No" --> I["assetNamespace = chainInfo.defaultNativeNamespace\nassetReference = chainInfo.defaultNativeReference (existing behavior)"] I --> H H --> J["Return formatted CAIP-19 asset string"]File-Level Changes
packages/controllers/src/utils/ExchangeUtil.tspackages/pay/src/utils/AssetUtil.tspackages/controllers/tests/utils/ExchangeUtil.test.tsapps/browser-extension/package.jsonapps/demo/package.jsonapps/laboratory/package.jsonexamples/next-ak-basic-app-router/package.jsonexamples/next-ak-basic-sign-client-app-router/package.jsonexamples/next-ak-basic-up-app-router/package.jsonexamples/next-bitcoin-app-router/package.jsonexamples/next-ep-app-router/package.jsonexamples/next-ethers-app-router/package.jsonexamples/next-wagmi-app-router/package.jsonexamples/next-wagmi-solana-bitcoin-app-router/package.jsonexamples/nuxt-wagmi-solana-bitcoin/package.jsonexamples/nuxt-wagmi/package.jsonexamples/parcel/package.jsonexamples/react-wagmi/package.jsonexamples/sveltekit-4-wagmi/package.jsonexamples/sveltekit-wagmi/package.jsonexamples/vue-wagmi-solana/package.jsonexamples/vue-wagmi/package.jsonpackages/adapters/wagmi/package.jsonpackages/appkit-utils/package.jsonpackages/appkit/exports/constants.tspackages/appkit/package.jsonpackages/cdn/package.jsonpackages/common/package.jsonpackages/controllers/package.jsonpackages/experimental/package.jsonpackages/siwe/package.jsonpackages/siwx/package.jsonpnpm-lock.yamlpackages/appkit-utils/src/CaipNetworkUtil.tsTips and commands
Interacting with Sourcery
@sourcery-ai reviewon the pull request.issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it.@sourcery-aianywhere in the pullrequest title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time.@sourcery-ai summaryanywhere inthe pull request body to generate a PR summary at any time exactly where you
want it. You can also comment
@sourcery-ai summaryon the pull request to(re-)generate the summary at any time.
@sourcery-ai guideon the pullrequest to (re-)generate the reviewer's guide at any time.
@sourcery-ai resolveon thepull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
@sourcery-ai dismisson the pullrequest to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai reviewto trigger a new review!Customizing Your Experience
Access your dashboard to:
summary, the reviewer's guide, and others.
Getting Help
Originally posted by @sourcery-ai[bot] in #874 (comment)