Skip to content

fix(assets): resolve USDC price via primary-protocol fallback in transfer dropdowns#167

Merged
metodi96 merged 1 commit into
mainfrom
fix/usdc-dropdown-price-sort
May 29, 2026
Merged

fix(assets): resolve USDC price via primary-protocol fallback in transfer dropdowns#167
metodi96 merged 1 commit into
mainfrom
fix/usdc-dropdown-price-sort

Conversation

@metodi96
Copy link
Copy Markdown
Collaborator

Summary

Fix USDC (and other shared-IBC-denom assets) showing $0.00 and mis-sorting to the bottom of the Assets transfer modal's Swap/Deposit/Withdraw dropdowns despite a real balance. Closes #166.

The dropdowns priced each asset via pricesStore.prices[currency.key], where currency is resolved through tryGetCurrencyByDenom(denom). For a shared IBC denom (e.g. USDC), that denom-keyed map holds one arbitrary protocol entry (e.g. USDC@NEUTRON) whose key has no published price, so the value defaulted to 0. The main Assets table was unaffected because it resolves via the network's primary protocol, which is priced.

Changes

  • Add getPriceForCurrency(currency) in CurrencyLookup.ts: returns the currency's own price, or — when its key is absent from the feed — falls back to the network's primary-protocol key for the same ticker (the same path the Assets table uses via getCurrencyByTickerForNetwork), before defaulting to "0". The direct != null check distinguishes "unpriced" from "genuinely priced at 0".
  • Route all seven price lookups across the three forms through the helper — the dropdown asset lists and the amount estimators (calculatedBalance, firstCalculatedBalance, secondCalculatedBalance) — so the whole modal stays consistent, not just the dropdown listing.
  • Remove the now-unused prices-store wiring from the three forms.
  • Add CurrencyLookup.test.ts covering own-price, primary-protocol fallback, the double-miss "0" default, and the dropdown sort position for a held-balance asset whose denom-resolved key is unpriced.

Verification

  • npx tsc --noEmit — passed
  • npx prettier --check on changed files — passed
  • npx eslint --max-warnings=0 on changed files — passed
  • npx vitest run — 764 tests passed across 49 files (4 new regression tests added)
  • Diff review (fresh-context) — PASS on the 12-item checklist and all acceptance criteria
  • Security review — 0 critical / 0 high; 2 non-blocking notes (see below)

Notes

…sfer dropdowns

The Swap/Deposit/Withdraw dropdowns priced each asset via
pricesStore.prices[currency.key], where currency came from
tryGetCurrencyByDenom(denom). For shared-IBC-denom assets like USDC, that
denom-keyed map resolves to a single arbitrary protocol entry (e.g.
USDC@NEUTRON) whose key has no published price, so the value defaulted to 0:
USDC showed $0.00 and the stable-value comparator sorted it below
zero-balance tokens. The Assets table was unaffected because it resolves via
the network's primary protocol, which is priced.

Add a shared getPriceForCurrency helper that returns the currency's own price
or, when its key is absent from the feed, falls back to the network's
primary-protocol key for the same ticker — the same path the Assets table
uses — before defaulting to "0". Route all seven price lookups across the
three forms through it (dropdown lists and amount estimators) so the modal
stays consistent, and drop the now-unused prices-store wiring.
@metodi96 metodi96 merged commit 6c07655 into main May 29, 2026
2 checks passed
@metodi96 metodi96 deleted the fix/usdc-dropdown-price-sort branch May 29, 2026 09:28
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.

fix: USDC mis-sorted to bottom of Swap/Deposit/Withdraw asset dropdowns despite balance

1 participant