fix: register correct coin decimals when suggesting chain to wallets#672
Closed
Ehsan-saradar wants to merge 18 commits into
Closed
fix: register correct coin decimals when suggesting chain to wallets#672Ehsan-saradar wants to merge 18 commits into
Ehsan-saradar wants to merge 18 commits into
Conversation
- add qbtc mainnet and testnet configs pointing to odindex.io endpoints - add qbtc logo asset - remove other chains (axelar, cosmos, neutron, nolus, osmosis, xion, bfhevm, crossfi) since this fork is dedicated to qbtc Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rewrite all non-asset paths to / so the Vue Router can handle deep links like /qbtc directly without Vercel returning 404. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Visiting / now 308-redirects to /qbtc so users land on the qbtc explorer directly instead of the chain list page. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When Keplr lacks a chain in its modular registry, calling enable/getKey
throws "There is no modular chain info for {chainId}" and the connect
modal surfaces the error inline without ever opening a popup. Wire the
ping-connect-wallet keplr-config event to call experimentalSuggestChain
directly so Keplr prompts the user to add the chain, instead of routing
to a separate manual /wallet/keplr page. Falls back to the manual page
if Keplr is missing or the suggestion rejects.
Extracts the ChainInfo builder from modules/wallet/keplr.vue into a
shared libs/keplr.ts helper to avoid duplicating the payload shape.
ping-widget@0.3.8's <ping-connect-wallet> only emits keplr-config when
the user clicks the gear icon, not when CONNECT fails — so the prior
walletStore.suggestChain() patch alone didn't reach the inline error
path. Its built-in "Suggest a chain to Keplr" fallback link is also
gated by error.search('no chain info'), which doesn't match Keplr's
new "no modular chain info" message.
Watch chainStore.current and call experimentalSuggestChain proactively
once Keplr is available. The call is idempotent — Keplr no-ops if the
chain is already registered — so a one-time approval popup eliminates
the inline error for all subsequent visits.
fix: auto-suggest chain to Keplr on connect
Replaces the placeholder ping-dashboard-five.vercel.app logo with the official qBTC svg from vultisig/vultisig-windows.
chore: update qbtc logo to vultisig-hosted svg
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chore: point mainnet qbtc logo to vultisig-hosted svg
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
docs: rewrite README for qbtc-explorer fork
- public/logo.svg → 256×256 qbtc logo (rendered from vultisig-hosted SVG; kept .svg extension so index.html reference is unchanged — browsers sniff the PNG content) - public/favicon.ico → multi-size ICO (16/32/48) of the qbtc logo - .gitattributes pins both files to merge=ours so upstream syncs from ping-pub do not silently revert qbtc branding Note: collaborators must run once per clone for merge=ours to take effect: git config merge.ours.driver true Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chore: replace logo and favicon with qbtc branding
The default formatToken format string '0,0.[0]' rounds amounts to a single decimal place, so a 0.989925 QBTC balance rendered as "1 QBTC" and amounts under 0.05 collapsed to "0". Pass '0,0.[000000]' explicitly on the account page assets card and the chain home wallet card so sub-unit balances are displayed accurately. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The coinDecimals lookup matched a denom_unit by symbol against the runtime-built denom_units list, but for chains where base equals symbol.toLowerCase() (e.g. QBTC) both entries share the same denom and .find() returns the base entry with exponent 0 — which then falls through `0 || 6` to 6. Suggested chains end up registered with 6 decimals while the chain actually uses 8, so balances render 100x off. Read the asset exponent directly instead. Applied to keplr.ts, the Keplr/Metamask suggest screens, and the Unisat suggest screen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Closing — opened in the wrong repo by mistake. Re-opening on the fork. |
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.
Summary
coinDecimals: 6for QBTC even though the chain uses 8 decimals — wallets then rendered balances 100× too large (e.g. an actual0.01 QBTCshowed as1.000000 QBTC).denom_units.find(x => x.denom === symbol.toLowerCase())?.exponent || 6matches the base unit (which hasexponent: 0) when the chain's base denom equals its lowercased symbol — as with QBTC wherebase = "qbtc"andsymbol = "QBTC". The result0then falls through0 || 6to6.exponentfield directly (already attached to the asset by the local-config converter inuseDashboard.ts) in all four call sites:src/libs/keplr.ts, the Keplr/Metamask Snap suggest screen, and the Unisat suggest screen.Assetinterface with the optionalexponentfield so TypeScript reflects the runtime shape.Test plan
yarn type-checkpasses.0.01 QBTCdisplays as0.01, not1.000000).base !== symbol.toLowerCase()) to make sure decimals there still match the chain config.🤖 Generated with Claude Code