Skip to content

fix: only show token and network field when its not peanut token/chain#1279

Merged
jjramirezn merged 3 commits intopeanut-wallet-devfrom
fix/token-row-in-receipt
Oct 9, 2025
Merged

fix: only show token and network field when its not peanut token/chain#1279
jjramirezn merged 3 commits intopeanut-wallet-devfrom
fix/token-row-in-receipt

Conversation

@kushagrasarathe
Copy link
Copy Markdown
Contributor

@kushagrasarathe kushagrasarathe commented Oct 3, 2025

  • contributes to TASK-14498 : only show token and network field in receipt when its not peanut token/chain
  • also fixes TASK-15141 : format token balance in send flow

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Ready Ready Preview Comment Oct 9, 2025 8:42am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Adds a Peanut-wallet-specific detection in TransactionDetailsReceipt to hide the "Token and network" row for Peanut USDC, and changes Peanut wallet balance formatting in PaymentForm to use formatCurrency(formatUnits(...)). No public API changes.

Changes

Cohort / File(s) Summary of Changes
TransactionDetailsReceipt logic update
src/components/TransactionDetails/TransactionDetailsReceipt.tsx
Added isPeanutWalletToken computed flag using PEANUT_WALLET_CHAIN and PEANUT_WALLET_TOKEN_SYMBOL; conditionally hides the "Token and network" row when the token is Peanut USDC; added new constant imports.
PaymentForm balance formatting
src/components/Payment/PaymentForm/index.tsx
Replaced formatAmount(formatUnits(...)) with formatCurrency(formatUnits(...)) when formatting peanutWalletBalance; retains same data flow but changes display formatting.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • jjramirezn

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title explicitly describes the primary fix of conditionally hiding the token and network field for non-Peanut token chains, which aligns with the main change in the pull request; it is concise and focused on the core behavior being addressed.
Description Check ✅ Passed The description clearly references the tasks implemented and describes hiding the token/network field for the Peanut token/chain and formatting the token balance, which directly corresponds to the changes made in the code.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/token-row-in-receipt

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 96a0eb2 and 9b0eb81.

📒 Files selected for processing (1)
  • src/components/Payment/PaymentForm/index.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Payment/PaymentForm/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy-Preview

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 and usage tips.

@notion-workspace
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0792ee0 and c35a9f8.

📒 Files selected for processing (1)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#919
File: src/components/Withdraw/views/Initial.withdraw.view.tsx:87-87
Timestamp: 2025-06-18T19:56:55.443Z
Learning: In withdraw flows for Peanut Wallet, the PeanutActionDetailsCard should always display "USDC" as the token symbol because it shows the amount being withdrawn from the Peanut Wallet (which holds USDC), regardless of the destination token/chain selected by the user. The TokenSelector is used for choosing the withdrawal destination, not the source display.
📚 Learning: 2025-06-18T19:56:55.443Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#919
File: src/components/Withdraw/views/Initial.withdraw.view.tsx:87-87
Timestamp: 2025-06-18T19:56:55.443Z
Learning: In withdraw flows for Peanut Wallet, the PeanutActionDetailsCard should always display "USDC" as the token symbol because it shows the amount being withdrawn from the Peanut Wallet (which holds USDC), regardless of the destination token/chain selected by the user. The TokenSelector is used for choosing the withdrawal destination, not the source display.

Applied to files:

  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx
🧬 Code graph analysis (1)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)
src/utils/general.utils.ts (1)
  • isPeanutWalletToken (1272-1276)
src/constants/zerodev.consts.ts (2)
  • PEANUT_WALLET_TOKEN_SYMBOL (21-21)
  • PEANUT_WALLET_CHAIN (18-18)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (2)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)

41-41: LGTM!

The import correctly adds the necessary constants for the Peanut wallet token detection logic.


355-406: Conditional rendering logic is correct.

The addition of !isPeanutWalletToken to hide the token/network row when dealing with Peanut USDC aligns with the PR objectives. However, ensure that the isPeanutWalletToken computation is fixed per the previous comment to use address-based comparison.

@notion-workspace
Copy link
Copy Markdown

@notion-workspace
Copy link
Copy Markdown

jjramirezn
jjramirezn previously approved these changes Oct 7, 2025
@jjramirezn jjramirezn merged commit a3db2b1 into peanut-wallet-dev Oct 9, 2025
5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants