Repository navigation
feat(wallet): unify fiat-backed assets as accounts - #771
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughAdds 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. ChangesWallet account flow
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
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
Deploying wallet-bitcoin with
|
| 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 |
Deploying wallet-mutinynet with
|
| 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 |
✅ Action performedReview finished.
|
1942e37 to
5232cc4
Compare
Deploying tmp-boltz-upstream-mainnet-arkade-wallet with
|
| 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 |
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
There was a problem hiding this comment.
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
📒 Files selected for processing (33)
src/components/TokenLogo.tsxsrc/components/TransactionsList.tsxsrc/hooks/usePortfolioFiat.tssrc/index.csssrc/lib/accountAssets.tssrc/lib/fiat.tssrc/lib/format.tssrc/lib/marketData.tssrc/lib/types.tssrc/providers/fiat.tsxsrc/providers/navigation.tsxsrc/screens/Settings/Fiat.tsxsrc/screens/Wallet/AccountDetail.tsxsrc/screens/Wallet/AssetsSection.tsxsrc/screens/Wallet/BitcoinDetail.tsxsrc/screens/Wallet/Receive/QrCode.tsxsrc/screens/Wallet/Receive/Success.tsxsrc/screens/Wallet/Send/Details.tsxsrc/screens/Wallet/Send/Form.tsxsrc/screens/Wallet/Send/Success.tsxsrc/screens/Wallet/Swap/Index.tsxsrc/screens/Wallet/Transaction.tsxsrc/test/hooks/usePortfolioFiat.test.tsxsrc/test/lib/accountAssets.test.tssrc/test/lib/format.test.tssrc/test/screens/settings/fiat.test.tsxsrc/test/screens/wallet/account-detail.test.tsxsrc/test/screens/wallet/account-market-data.test.tssrc/test/screens/wallet/bitcoin-detail.test.tsxsrc/test/screens/wallet/index.test.tsxsrc/test/screens/wallet/swap.test.tsxsrc/test/screens/wallet/transaction.test.tsxsrc/tokens.css
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
517040c to
e5b0306
Compare
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.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
BRL, neverR$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:
51,502.00 BRLand neverR$#3c3b6e)Testing
bun run test -- --exclude src/test/screens/settings/delegates.test.tsx— 347 passed, 3 skippedbunx tsc --noEmitbun run lintbun run format:checkbun run build/simplify— no changes requiredThe excluded delegates test is a pre-existing deterministic failure inherited from the #727 parent branch and is unrelated to this diff.
Affected areas
Summary by CodeRabbit