Skip to content

Show NFT portfolio value using MintGarden floor prices#792

Open
nick8319 wants to merge 2 commits into
xch-dev:mainfrom
nick8319:nft-portfolio-value
Open

Show NFT portfolio value using MintGarden floor prices#792
nick8319 wants to merge 2 commits into
xch-dev:mainfrom
nick8319:nft-portfolio-value

Conversation

@nick8319

Copy link
Copy Markdown

Summary

  • Adds NFT valuation to the portfolio: collection floor price (MintGarden) × owned NFT count, converted to USD via the existing XCH/USD rate
  • Backend: nft_count (visible NFTs only) computed per collection via a correlated subquery and exposed on NftCollectionRecord — no migrations, no new endpoints
  • Frontend: new NftPriceContext (mirrors PriceContext) with a 15-minute TTL floor cache persisted in localStorage per network, concurrency-capped MintGarden fetches (4 at a time, 10s timeout), and pure valuation math in src/lib/nftValue.ts
  • Surfaces the value in four places: main "Total Estimated Balance" (+ "Includes ~$X in NFTs"), NFT collections view summary, per-collection-card floor lines, and a "Collection Floor" row on the NFT detail page
  • Privacy: only public collection IDs are sent to MintGarden — never addresses or holdings; testnet uses api.testnet.mintgarden.io
  • Hidden NFTs and the "Uncategorized" pseudo-collection are excluded from valuation; never-fetched/unlisted collections contribute nothing rather than blocking the UI
  • Translations extracted for all four locales

Test Plan

  • cargo t -p sage-wallet — 45/45 pass
  • cargo clippy --workspace — clean; cargo sqlx prepare cache committed (offline build verified)
  • pnpm lint (0 errors), tsc -b, pnpm build — clean
  • Manual: mainnet wallet with NFT collections — totals, collection cards, NFT detail floor all render; values spot-checked against mintgarden.io
  • Cold start shows tokens-only total (no layout shift); floors appear as fetched; restart shows cached values instantly
  • Testnet wallet smoke test

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.

1 participant