Skip to content

feat(mobile): balance card with Lens fiat value - #595

Open
Lazyartist1 wants to merge 1 commit into
Miracle656:mainfrom
Lazyartist1:feat/mobile-balance-card
Open

feat(mobile): balance card with Lens fiat value#595
Lazyartist1 wants to merge 1 commit into
Miracle656:mainfrom
Lazyartist1:feat/mobile-balance-card

Conversation

@Lazyartist1

Copy link
Copy Markdown

Summary

Adds the dashboard's primary balance card (backlog item 30) — native XLM plus its fiat value from the Lens price oracle — the most-looked-at element in the product, so it loads fast and degrades gracefully.

Changes

  • lib/fetchPrice.ts — native port of the web wallet's oracle client (frontend/wallet/lib/fetchPrice.ts), reading EXPO_PUBLIC_LENS_URL. Best-effort: every failure (402 x402 gating, 404, timeout, malformed body) collapses to null. Adds pure usdValue/formatUsd helpers.
  • components/BalanceCard.tsx — self-loading card. Balance comes from Horizon (unfunded accounts read as 0, not an error) and is authoritative; the fiat line shows an em dash whenever the price feed is unavailable, so a slow/gated oracle never blocks the card. Loading, no-wallet, and error states included.
  • Mounts the card on the home route (app/index.tsx).

Acceptance

  • Shows XLM balance + USD via Lens
  • Handles price-fetch failure (fiat degrades to , balance still renders)

Testing

  • tsc --noEmit clean
  • jest lib/__tests__/fetchPrice.test.ts — 10/10 passing (USDC pin, success, non-OK/402, missing-price, network-error → null; usdValue + formatUsd)

Closes #458

Show the primary XLM balance on the dashboard the moment the app opens,
with its USD value from the Lens price oracle. The balance is loaded from
Horizon (unfunded accounts read as zero) and is always shown once ready;
the fiat line degrades to an em dash whenever the oracle is slow, gated, or
offline, so pricing never blocks the card.

Adds lib/fetchPrice.ts (native port of the web wallet's oracle client) and
components/BalanceCard.tsx, and mounts the card on the home route.

Closes Miracle656#458
@Lazyartist1
Lazyartist1 requested a review from Miracle656 as a code owner July 30, 2026 06:48
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Lazyartist1 is attempting to deploy a commit to the miracle656's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Lazyartist1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

30. Balance card

1 participant