feat(mobile): balance card with Lens fiat value - #595
Conversation
|
@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. |
|
@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! 🚀 |
|
Thanks — the |
686576a to
c9f694d
Compare
|
Hi! I've rebased this branch onto main, resolved the conflicts in app/index.tsx, and wired the BalanceCard component directly into the dashboard tab screen (app/(tabs)/dashboard.tsx) in place of the static placeholder balance hero. I've also verified that the card degrades gracefully by showing an em dash (—) for the fiat value when the Lens oracle service is down or unreachable. Ready for review! |
|
Thanks for the rebase — moving the balance card into |
c9f694d to
6bf3b1a
Compare
|
Hi! I've rebased this branch onto the latest main (which now includes PR #587) and resolved the conflict in app/(tabs)/dashboard.tsx. The BalanceCard is successfully wired into the new dashboard screen alongside the pull-to-refresh and polling logic. Ready for merge! |
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
6bf3b1a to
debfe4c
Compare
|
Hi! I've updated the PR with a new unit test verifying that non-native assets are correctly formatted and encoded as CODE:ISSUER in the Lens price oracle requests, and verified that both fetchPrice and formatUsd/usdValue handle these assets generically. Ready for review! |
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), readingEXPO_PUBLIC_LENS_URL. Best-effort: every failure (402 x402 gating, 404, timeout, malformed body) collapses tonull. Adds pureusdValue/formatUsdhelpers.components/BalanceCard.tsx— self-loading card. Balance comes from Horizon (unfunded accounts read as0, 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.app/index.tsx).Acceptance
—, balance still renders)Testing
tsc --noEmitcleanjest lib/__tests__/fetchPrice.test.ts— 10/10 passing (USDC pin, success, non-OK/402, missing-price, network-error → null; usdValue + formatUsd)Closes #458