feat(mobile): balance card with Lens fiat value - #595
Open
Lazyartist1 wants to merge 1 commit into
Open
Conversation
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 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! 🚀 |
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
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