Skip to content

hotfix: bridge withdraw recent methods#1285

Merged
jjramirezn merged 8 commits intopeanut-walletfrom
peanut-wallet-dev
Oct 3, 2025
Merged

hotfix: bridge withdraw recent methods#1285
jjramirezn merged 8 commits intopeanut-walletfrom
peanut-wallet-dev

Conversation

@jjramirezn
Copy link
Contributor

No description provided.

@vercel
Copy link

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-ui (peanut-wallet-staging) Ready Ready Preview Comment Oct 3, 2025 8:37pm
peanut-wallet Canceled Canceled Oct 3, 2025 8:37pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Consolidates Jest asset mappings in package.json. Adjusts withdraw flow routing: updates guard logic on bank page, integrates selectedBankAccount into WithdrawPage, and routes based on derived country from account. Modifies AddWithdrawRouterView to set method selection instead of generic routing. Adds getCountryFromAccount utility.

Changes

Cohort / File(s) Summary of changes
Withdraw flow routing and guards
src/app/(mobile-ui)/withdraw/page.tsx, src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx
WithdrawPage now consumes selectedBankAccount and routes to bank flow using country derived from account; crypto path used if no bank and method is crypto. Bank page guard redirects to /withdraw if amount missing; otherwise routes to country method selection when bank account absent.
AddWithdraw selection behavior
src/components/AddWithdraw/AddWithdrawRouterView.tsx
Changes onAccountClick to set selected method (bridge/manteca) and only navigate for manteca; removes path-based routing for non-manteca accounts.
Bridge country resolver utility
src/utils/bridge.utils.ts
Adds getCountryFromAccount(account) to resolve CountryData from account via US special-case, countryName path, or 3-letter country code.
Jest asset mapping cleanup
package.json
Consolidates image/SVG moduleNameMapper entry; removes duplicate mapping and keeps ^next/cache$ mapping intact.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • beetrootw
  • kushagrasarathe

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive No description was provided, so there is no context to assess how the changes fulfill the pull request’s intent. Please add a concise summary of the pull request’s purpose and key changes to help reviewers understand its intent and scope.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title indicates a hotfix for the bridge withdrawal flow and references method handling, which aligns with changes to the withdraw method selection and bridge utilities, though it does not detail the full scope of routing and context updates.
✨ 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 peanut-wallet-dev

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.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Oct 3, 2025
Copy link
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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b211af and 2a8da32.

📒 Files selected for processing (5)
  • package.json (1 hunks)
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx (1 hunks)
  • src/app/(mobile-ui)/withdraw/page.tsx (3 hunks)
  • src/components/AddWithdraw/AddWithdrawRouterView.tsx (1 hunks)
  • src/utils/bridge.utils.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".
📚 Learning: 2025-08-14T14:42:54.411Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.

Applied to files:

  • src/utils/bridge.utils.ts
📚 Learning: 2025-05-22T15:38:48.586Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".

Applied to files:

  • src/components/AddWithdraw/AddWithdrawRouterView.tsx
  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx
  • src/app/(mobile-ui)/withdraw/page.tsx
📚 Learning: 2025-09-18T09:30:42.901Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1230
File: src/app/(mobile-ui)/withdraw/page.tsx:92-97
Timestamp: 2025-09-18T09:30:42.901Z
Learning: In src/app/(mobile-ui)/withdraw/page.tsx, the useEffect that calls setShowAllWithdrawMethods(true) when amountFromContext exists is intentionally designed to run only on component mount (empty dependency array), not when amountFromContext changes. This is the correct behavior for the withdraw flow where showing all methods should only happen on initial load when an amount is already present.

Applied to files:

  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx
  • src/app/(mobile-ui)/withdraw/page.tsx
📚 Learning: 2025-10-02T15:23:01.405Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1266
File: src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx:46-57
Timestamp: 2025-10-02T15:23:01.405Z
Learning: In the withdraw flow at src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx, the points calculation query intentionally uses crypto.randomUUID() in the queryKey dependency array to bypass React Query caching, ensuring fresh points estimates on every render. This is the intended behavior.

Applied to files:

  • src/app/(mobile-ui)/withdraw/[country]/bank/page.tsx
📚 Learning: 2024-10-29T12:19:41.968Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#495
File: src/components/Global/TokenAmountInput/index.tsx:23-30
Timestamp: 2024-10-29T12:19:41.968Z
Learning: In the `TokenAmountInput` component (`src/components/Global/TokenAmountInput/index.tsx`), when the 'Max' button is clicked, we intentionally set the input denomination to 'TOKEN' because we are setting the value as token.

Applied to files:

  • src/app/(mobile-ui)/withdraw/page.tsx
🧬 Code graph analysis (2)
src/utils/bridge.utils.ts (2)
src/interfaces/interfaces.ts (1)
  • Account (274-301)
src/components/AddMoney/consts/index.ts (1)
  • CountryData (153-162)
src/app/(mobile-ui)/withdraw/page.tsx (1)
src/utils/bridge.utils.ts (1)
  • getCountryFromAccount (83-95)
⏰ 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

@jjramirezn jjramirezn merged commit 1b374bf into peanut-wallet Oct 3, 2025
7 of 9 checks passed
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