Skip to content

feat(wallet): unify fiat-backed assets as accounts - #771

Merged
sahilc0 merged 6 commits into
wt-port-swap-ui-20260707from
wt-unify-fiat-accounts-stacked-20260713
Jul 14, 2026
Merged

sahilc0 merged 6 commits into
wt-port-swap-ui-20260707from
wt-unify-fiat-accounts-stacked-20260713

Conversation

@sahilc0

@sahilc0 sahilc0 commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • present USDT, USDC, and AUSD as a single wallet-facing USD account
  • present DPIX and DEPIX as BRL with the Brazilian flag and BRL denomination support
  • replace the wallet Assets section with Accounts while retaining raw issuer assets in Arkade Mint/admin surfaces
  • route fiat accounts into the bitcoin-style detail experience with price, actions, real historical cross-rate charts, balance, value, and filtered activity
  • value fiat activity and transaction details from asset amounts instead of bitcoin dust amounts
  • display Brazilian real amounts with the ISO code BRL, never R$
  • color supported account charts from the primary identity color of their currency flag

This is intentionally stacked on the head branch of draft PR #727 rather than master.

Issue tracking

These issues should be closed when this stack reaches the default branch; merging this PR into the non-default #727 branch will not close them automatically.

Visual QA

Verified with a restored Mutinynet wallet containing bitcoin and 10,000 USD:

  • account overview shows 51,502.00 BRL and never R$
  • USD detail shows a live USD/BRL cross-rate chart in US-flag navy (#3c3b6e)
  • account balance, value, filtered activity, and transaction Amount/Total remain consistent
  • desktop, laptop, tablet, and mobile widths have no horizontal overflow
  • screenshots are included in the Codex task handoff

Testing

  • bun run test -- --exclude src/test/screens/settings/delegates.test.tsx — 347 passed, 3 skipped
  • focused account/format/detail suite — 59 passed
  • bunx tsc --noEmit
  • bun run lint
  • bun run format:check
  • bun run build
  • browser console check — no errors
  • independent Codex code review — approved
  • /simplify — no changes required

The excluded delegates test is a pre-existing deterministic failure inherited from the #727 parent branch and is unrelated to this diff.

Affected areas

  • fiat currency formatting and conversion
  • account aggregation and issuer abstraction
  • wallet overview, send, receive, swap, activity, and transaction presentation
  • account detail navigation, charting, holdings, and activity filtering
  • account flags and chart identity tokens
  • regression tests for formatting, chart colors, market data, account presentation, and transaction values

Summary by CodeRabbit

  • New Features
    • Added Brazilian Real (BRL) support for currency selection, pricing, conversions, formatting, and account aggregation.
    • Added account detail views accessible from wallet account cards.
    • Improved wallet asset presentation with clearer names, tickers, icons, and currency-based chart colors.
    • Enhanced transaction and swap displays to show account-level fiat values and cleaner labels.
  • Bug Fixes
    • Added clearer unavailable-price and price-history states.
    • Improved market chart handling and account-specific activity filtering.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • next-version

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c0c86f6a-b879-4907-8e9f-a81f2cfd73d7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds Brazilian Real support and canonical wallet-account ticker handling. Portfolio balances, account detail screens, market charts, transaction displays, send/receive flows, swaps, navigation, styling, and tests are updated for account-level asset presentation.

Changes

Wallet account flow

Layer / File(s) Summary
Account ticker and BRL foundations
src/lib/accountAssets.ts, src/lib/fiat.ts, src/lib/format.ts, src/lib/marketData.ts, src/lib/types.ts, src/providers/fiat.tsx, src/screens/Settings/Fiat.tsx, src/tokens.css, src/test/lib/*, src/test/screens/settings/fiat.test.tsx, src/test/screens/wallet/account-market-data.test.ts
Canonical wallet tickers, wallet asset presentation, BRL pricing/conversion, account chart color tokens, cross-rate point construction, and related tests are added.
Portfolio accounts and account detail
src/hooks/usePortfolioFiat.ts, src/providers/navigation.tsx, src/screens/Wallet/AccountDetail.tsx, src/screens/Wallet/AssetsSection.tsx, src/screens/Wallet/BitcoinDetail.tsx, src/index.css, src/test/hooks/usePortfolioFiat.test.tsx, src/test/screens/wallet/*
Fiat-backed balances are emitted as account rows, asset cards navigate to account detail, and the detail screen renders asset-specific balances, actions, activity, and market-chart loading or unavailable states.
Wallet presentation and transaction rendering
src/components/TokenLogo.tsx, src/components/TransactionsList.tsx, src/screens/Wallet/Receive/*, src/screens/Wallet/Send/*, src/screens/Wallet/Swap/Index.tsx, src/screens/Wallet/Transaction.tsx, src/test/screens/wallet/swap.test.tsx, src/test/screens/wallet/transaction.test.tsx
Wallet-facing labels use canonical account tickers and shared metadata presentation, while transaction and swap amounts use per-asset fiat-equivalent values and normalized route labels.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WalletUser
  participant AssetsSection
  participant NavigationContext
  participant AccountDetail
  participant BitcoinDetail
  participant FiatContext
  WalletUser->>AssetsSection: select account asset
  AssetsSection->>NavigationContext: navigate to AccountDetail
  NavigationContext->>AccountDetail: render selected asset
  AccountDetail->>BitcoinDetail: pass assetId
  BitcoinDetail->>FiatContext: convert account balance and price
  BitcoinDetail-->>WalletUser: render account value and chart status
Loading

Possibly related PRs

  • arkade-os/wallet#627: Earlier wallet redesign changes in the same token logo and transaction-list areas.
  • arkade-os/wallet#628: Related prototype-driven ticker and logo mapping changes.
  • arkade-os/wallet#743: Related Brazilian Real support across currencies, pricing, formatting, and fiat conversion.

Suggested reviewers: bordalix, arkanaai, pietro909, louisinger

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.94% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main wallet change: presenting fiat-backed assets as unified accounts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wt-unify-fiat-accounts-stacked-20260713

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sahilc0
sahilc0 requested a review from bordalix July 13, 2026 21:36
@sahilc0

sahilc0 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Deploying wallet-bitcoin with  Cloudflare Pages  Cloudflare Pages

Latest commit: fd34efe
Status: ✅  Deploy successful!
Preview URL: https://4eb81a73.wallet-bitcoin.pages.dev
Branch Preview URL: https://wt-unify-fiat-accounts-stack.wallet-bitcoin.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Deploying wallet-mutinynet with  Cloudflare Pages  Cloudflare Pages

Latest commit: fd34efe
Status: ✅  Deploy successful!
Preview URL: https://323e4908.arkade-wallet.pages.dev
Branch Preview URL: https://wt-unify-fiat-accounts-stack.arkade-wallet.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sahilc0
sahilc0 force-pushed the wt-port-swap-ui-20260707 branch from 1942e37 to 5232cc4 Compare July 13, 2026 21:37
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Deploying tmp-boltz-upstream-mainnet-arkade-wallet with  Cloudflare Pages  Cloudflare Pages

Latest commit: fd34efe
Status: ✅  Deploy successful!
Preview URL: https://27ed3ac0.tmp-boltz-upstream-mainnet-arkade-wallet.pages.dev
Branch Preview URL: https://wt-unify-fiat-accounts-stack.tmp-boltz-upstream-mainnet-arkade-wallet.pages.dev

View logs

sahilc0 added 4 commits July 13, 2026 16:44
Normalize USDT, USDC, and AUSD wallet surfaces to USD and DPIX/DEPIX to BRL while preserving the underlying asset IDs for transfers. Aggregate equivalent fiat tokens into account balances, use currency flags, and keep issuer branding out of wallet-facing send, receive, swap, activity, and transaction views.\n\nRefs #760
Route wallet accounts to the bitcoin-style detail experience with price, actions, genuine historical cross-rate charts, balances, values, and filtered activity. Show an explicit unavailable state when a real market history cannot be derived, and rename the wallet section from Assets to Accounts.

Refs #763
Refs #759
Use normalized fiat asset quantities and live exchange rates for wallet activity and transaction details instead of bitcoin dust amounts. Keep sent detail values absolute while preserving signed asset labels and direction, with received and sent regressions covered.

Refs #760

Refs #763
Display Brazilian real amounts with the unambiguous BRL code across wallet surfaces. Color each supported account chart from the primary identity color of its currency flag, with centralized tokens and regression coverage.

Refs #759

Refs #760

Refs #763

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/TransactionsList.tsx`:
- Around line 54-64: The asset reducers in
src/components/TransactionsList.tsx#L54-L64 and
src/screens/Wallet/Transaction.tsx#L99-L108 must return an undefined fiat
subtotal whenever any asset conversion via fiatAccountAssetSatoshis fails,
rather than summing the successfully converted assets. Update both reducer
implementations to track conversion failure and suppress the partial amount
while preserving the existing total calculation when every asset converts
successfully.

In `@src/hooks/usePortfolioFiat.ts`:
- Around line 72-76: Update the aggregation around fiatAccountBalances and
normalizeMinorUnits so balances are summed at shared higher precision before
converting to each account’s minor-unit scale. Accumulate each sourceFiat
balance without per-asset truncation, then perform the existing downscaling once
after all asset balances are aggregated, preserving the combined remainder for
cases such as multiple BRL assets.
- Line 76: Update the unified fiat account flow around fiatAccountSourceAssetIds
and the send initialization path so account actions receive the complete
issuer/source-asset set rather than selecting sourceAssetIds[0] as the account’s
backing asset. In the send flow, choose or split spendable issuer balances
across those assets, preserving the displayed aggregate balance and avoiding
dependence on balance ordering.

In `@src/screens/Wallet/BitcoinDetail.tsx`:
- Around line 136-163: Update handleSend, handleReceive, and handleScan so
unified accounts preserve and route all sourceAssetIds instead of selecting only
sourceAssetId. Use the existing explicit issuer-selection or balance-aware
routing behavior, while keeping Bitcoin handling unchanged and ensuring the
displayed aggregate balance maps to the selected backing asset(s).

In `@src/screens/Wallet/Send/Details.tsx`:
- Around line 37-41: Update the assetLabel construction near assetPresentation
to handle missing ticker metadata: use the asset ID or asset name as the
fallback label, and append the ticker in parentheses only when it is present.
Preserve the existing simplified label when the asset name and ticker match.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1d91fa7c-6d24-47e7-bd87-3b735e7b84ba

📥 Commits

Reviewing files that changed from the base of the PR and between 1942e37 and 517040c.

📒 Files selected for processing (33)
  • src/components/TokenLogo.tsx
  • src/components/TransactionsList.tsx
  • src/hooks/usePortfolioFiat.ts
  • src/index.css
  • src/lib/accountAssets.ts
  • src/lib/fiat.ts
  • src/lib/format.ts
  • src/lib/marketData.ts
  • src/lib/types.ts
  • src/providers/fiat.tsx
  • src/providers/navigation.tsx
  • src/screens/Settings/Fiat.tsx
  • src/screens/Wallet/AccountDetail.tsx
  • src/screens/Wallet/AssetsSection.tsx
  • src/screens/Wallet/BitcoinDetail.tsx
  • src/screens/Wallet/Receive/QrCode.tsx
  • src/screens/Wallet/Receive/Success.tsx
  • src/screens/Wallet/Send/Details.tsx
  • src/screens/Wallet/Send/Form.tsx
  • src/screens/Wallet/Send/Success.tsx
  • src/screens/Wallet/Swap/Index.tsx
  • src/screens/Wallet/Transaction.tsx
  • src/test/hooks/usePortfolioFiat.test.tsx
  • src/test/lib/accountAssets.test.ts
  • src/test/lib/format.test.ts
  • src/test/screens/settings/fiat.test.tsx
  • src/test/screens/wallet/account-detail.test.tsx
  • src/test/screens/wallet/account-market-data.test.ts
  • src/test/screens/wallet/bitcoin-detail.test.tsx
  • src/test/screens/wallet/index.test.tsx
  • src/test/screens/wallet/swap.test.tsx
  • src/test/screens/wallet/transaction.test.tsx
  • src/tokens.css

Comment thread src/components/TransactionsList.tsx Resolved
Comment thread src/hooks/usePortfolioFiat.ts Resolved
Comment thread src/hooks/usePortfolioFiat.ts Resolved
Comment thread src/screens/Wallet/BitcoinDetail.tsx Resolved
Comment thread src/screens/Wallet/Send/Details.tsx Resolved
Keep non-fiat tokens on their administration detail screen while fiat accounts retain the wallet account experience. Carry normalized account context through send, allocate amounts across real backing assets with decimal-aware balances, and use the largest backing rail for receive.

Add regressions for multi-source USD sends and non-fiat detail routing.

Refs #759

Refs #760

Refs #763
@sahilc0

sahilc0 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Tracked the intentionally deferred prototype-credit spendability limitation in #772. The account UI and real backing-asset allocation remain in this draft PR; #772 separates displayed prototype deltas from spendable backing balances.

Prevent partial fiat subtotals for mixed-asset transactions, retain cross-issuer sub-cent precision until aggregation completes, and provide a stable fallback label when asset ticker metadata is unavailable. Add regression coverage for each corrected path.
@sahilc0

sahilc0 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sahilc0
sahilc0 marked this pull request as ready for review July 14, 2026 18:10
@sahilc0
sahilc0 merged commit b500d7d into wt-port-swap-ui-20260707 Jul 14, 2026
4 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Aug 4, 2026
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