Skip to content

[TASK-15019] support bolivia and brazil for withdraws#1244

Merged
jjramirezn merged 6 commits intofeat/manteca-integrationfrom
feat/manteca-withdraw
Sep 23, 2025
Merged

[TASK-15019] support bolivia and brazil for withdraws#1244
jjramirezn merged 6 commits intofeat/manteca-integrationfrom
feat/manteca-withdraw

Conversation

@jjramirezn
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Sep 19, 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 Sep 23, 2025 1:14pm

@jjramirezn jjramirezn requested a review from Hugo0 September 19, 2025 20:44
@notion-workspace
Copy link

Refund failed withdraws

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds country-config-driven bank fields and validation to the Manteca withdraw flow, introduces a new 'failure' step and error handling, extends types/constants for account types and bank codes, updates Select typings/usages, and adjusts AddMoney Brazil/PIX and input styling.

Changes

Cohort / File(s) Summary of changes
Manteca withdraw flow & types
src/app/(mobile-ui)/withdraw/manteca/page.tsx, src/types/manteca.types.ts, src/constants/manteca.consts.ts
Replaces bankDetails with destinationAddress, selectedBank, accountType; adds MANTECA_COUNTRIES_CONFIG, MantecaAccountType, MantecaBankCode; extends MantecaWithdrawStep with 'failure'; validates country-driven fields; updates withdraw API payload to include bankCode/accountType; adds optional message to response type.
Global Select refactor and adoption
src/components/Global/Select/index.tsx, src/components/Refund/index.tsx
Introduces SelectItem { id, title }; changes Select props to items: SelectItem[], `value: SelectItem
AddMoney constants (country methods)
src/components/AddMoney/consts/index.ts
Imports PIX; updates Brazil withdraw method to use PIX icon, description "Instant transfers", isSoon: false; removes 'BR' from enabledBankTransferCountries.
ValidatedInput styling
src/components/Global/ValidatedInput/index.tsx
Adjusts wrapper to rounded-sm and input text size from text-h8 to text-sm.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Hugo0
  • Zishan-7
  • 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 pull request description was provided, so the PR lacks explicit author context and is inconclusive for reviewers even though the branch and diffs indicate Bolivia/Brazil withdraw support; the missing description does not provide the intent, testing notes, or risk summary needed for a proper review. Please add a short PR description summarizing the intent and scope (e.g., BO/BR withdraw support), key files changed (MANTECA_COUNTRIES_CONFIG, types, withdraw UI/flow), any migration or behavior impacts, and basic testing steps so reviewers can assess correctness and risk quickly.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly states the main change — adding support for Bolivia and Brazil in withdraw flows — and aligns with the changeset which adds BO/BR entries to MANTECA_COUNTRIES_CONFIG and updates the Manteca withdraw flow, types, and UI for country-specific bank fields, so it succinctly reflects the primary work.

📜 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 4912aaa and 0c3ca7c.

📒 Files selected for processing (1)
  • src/constants/manteca.consts.ts (1 hunks)

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.

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: 0

🧹 Nitpick comments (2)
src/components/Claim/Link/views/MantecaReviewStep.tsx (1)

48-71: Consider adding link validation before withdrawal.

While the error handling is comprehensive, consider validating the sendLink format/structure before making the API call to catch potential issues early.

 const handleWithdraw = async () => {
     if (destinationAddress) {
         try {
+            // Validate sendLink format (e.g., URL structure, required parameters)
+            if (!sendLink || !sendLink.startsWith('http')) {
+                setError('Invalid transaction link. Please try again.')
+                return
+            }
             setError(null)
             setIsSubmitting(true)
             const { data, error: withdrawError } = await mantecaApi.withdraw({
src/app/(mobile-ui)/withdraw/manteca/page.tsx (1)

176-179: Consider providing more specific error messages.

The current error message is generic. Consider differentiating between different types of failures (e.g., network issues, invalid address format, API errors) to help users understand the problem better.

 if (result.error) {
-    setErrorMessage(
-        'Withdraw cancelled, please check that the destination address is correct. If problem persists contact support'
-    )
+    // Provide more specific error messages based on the error type
+    const errorMessage = result.error.includes('address') 
+        ? 'Invalid destination address. Please check and try again.'
+        : result.error.includes('network')
+        ? 'Network error. Please check your connection and try again.'
+        : 'Withdraw cancelled. If the problem persists, please contact support.';
+    setErrorMessage(errorMessage)
     setStep('failure')
     return
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5010e07 and db05011.

📒 Files selected for processing (6)
  • src/app/(mobile-ui)/qr-pay/page.tsx (1 hunks)
  • src/app/(mobile-ui)/withdraw/manteca/page.tsx (4 hunks)
  • src/app/actions/manteca.ts (0 hunks)
  • src/components/Claim/Link/MantecaFlowManager.tsx (1 hunks)
  • src/components/Claim/Link/views/MantecaReviewStep.tsx (2 hunks)
  • src/types/manteca.types.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • src/app/actions/manteca.ts
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-11-18T21:36:11.486Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#535
File: src/components/Claim/Claim.tsx:142-146
Timestamp: 2024-11-18T21:36:11.486Z
Learning: In `src/components/Claim/Claim.tsx`, external calls like token price fetching and cross-chain details retrieval are already encapsulated within existing `try...catch` blocks, so additional error handling may be unnecessary.

Applied to files:

  • src/components/Claim/Link/views/MantecaReviewStep.tsx
📚 Learning: 2025-07-24T13:26:10.290Z
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#1014
File: src/components/Claim/Link/Initial.view.tsx:413-413
Timestamp: 2025-07-24T13:26:10.290Z
Learning: In the peanut-ui repository, the change from `${SQUID_API_URL}/route` to `${SQUID_API_URL}/v2/route` in src/components/Claim/Link/Initial.view.tsx was a typo fix, not an API migration, as the codebase was already using Squid API v2.

Applied to files:

  • src/components/Claim/Link/views/MantecaReviewStep.tsx
  • src/components/Claim/Link/MantecaFlowManager.tsx
📚 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/app/(mobile-ui)/withdraw/manteca/page.tsx
📚 Learning: 2025-09-18T09:30:42.881Z
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.881Z
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/manteca/page.tsx
🧬 Code graph analysis (1)
src/app/(mobile-ui)/withdraw/manteca/page.tsx (5)
src/hooks/wallet/useWallet.ts (1)
  • useWallet (21-123)
src/components/Create/useCreateLink.tsx (1)
  • useCreateLink (22-438)
src/context/SupportModalContext.tsx (1)
  • useSupportModalContext (22-28)
src/constants/zerodev.consts.ts (1)
  • PEANUT_WALLET_TOKEN_DECIMALS (19-19)
src/services/manteca.ts (1)
  • mantecaApi (95-232)
🔇 Additional comments (11)
src/app/(mobile-ui)/qr-pay/page.tsx (1)

337-337: LGTM! Consistent addition of fullName field.

Adding fullName for transaction details improves consistency with other transaction types that use this field.

src/types/manteca.types.ts (1)

13-18: LGTM! Clean migration to link-based withdrawal.

The type change from txHash to sendLink aligns well with the architectural shift to link-based withdrawals, providing better refund capabilities on failure.

src/components/Claim/Link/MantecaFlowManager.tsx (1)

71-79: LGTM! Prop rename is consistent across the flow.

The prop rename from claimLink to sendLink better reflects its purpose in the withdrawal flow.

src/components/Claim/Link/views/MantecaReviewStep.tsx (1)

10-16: LGTM! Clean interface update.

The prop rename to sendLink is clear and accurately represents the parameter's purpose.

src/app/(mobile-ui)/withdraw/manteca/page.tsx (7)

29-30: LGTM! Good addition of support modal integration.

The integration with useSupportModalContext provides a centralized way to handle support requests, improving the user experience.


32-32: LGTM! Type update supports the new failure flow.

Adding the 'failure' step to the type enhances error recovery capabilities.


195-207: LGTM! Comprehensive state reset.

The enhanced resetState function properly cleans up all component state, preventing state pollution between different withdrawal attempts.


268-294: LGTM! Well-designed failure recovery UI.

The new failure state provides clear options for users to either retry or contact support, significantly improving the error recovery experience.


380-380: LGTM! Improved UX for Argentina users.

The country-specific placeholder text "CBU, CVU or Alias" provides clearer guidance for Argentinian users.


164-164: Verify error handling for createLink: include actionable context and surface the original error.

createLink can throw — confirm its implementation (check where it's exported; e.g. src/components/Create/useCreateLink.tsx) produces informative error messages (include parsed amount/token/operation) and that callers rethrow or attach the original error (use Error with cause or append original.message) instead of swallowing it.


164-173: Amounts are handled correctly — no change required.

createLink receives parseUnits(usdAmount, PEANUT_WALLET_TOKEN_DECIMALS) (a bigint in atomic token units used for the on-chain approve/makeDeposit), while mantecaApi.withdraw is sent the human-readable usdAmount string (MantecaWithdrawData.amount: string). These are consistent.

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: 3

🧹 Nitpick comments (2)
src/app/(mobile-ui)/withdraw/manteca/page.tsx (1)

506-506: Hardcoded label needs to be dynamic.

The hardcoded "CBU, CVU or Alias" label should use the dynamic country configuration label to support all countries properly.

Apply this fix to make the label dynamic:

- <PaymentInfoRow label="CBU, CVU or Alias" value={destinationAddress} />
+ <PaymentInfoRow label={countryConfig!.accountNumberLabel} value={destinationAddress} />
src/constants/manteca.consts.ts (1)

39-52: Guard discriminated-union checks to enable proper narrowing.

Optional chaining (countryConfig?.needsBankCode / countryConfig?.needsAccountType) does not narrow the discriminated union — use an explicit guard (e.g., if (countryConfig && countryConfig.needsBankCode)) before accessing validBankCodes / validAccountTypes.
Occurrences to update: src/app/(mobile-ui)/withdraw/manteca/page.tsx — lines ~144, 154, 173, 424. Search found no direct unsafe accesses to validBankCodes/validAccountTypes.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db05011 and 9c6c6de.

📒 Files selected for processing (7)
  • src/app/(mobile-ui)/withdraw/manteca/page.tsx (14 hunks)
  • src/components/AddMoney/consts/index.ts (3 hunks)
  • src/components/Global/Select/index.tsx (5 hunks)
  • src/components/Global/ValidatedInput/index.tsx (2 hunks)
  • src/components/Refund/index.tsx (1 hunks)
  • src/constants/manteca.consts.ts (1 hunks)
  • src/types/manteca.types.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/types/manteca.types.ts
🧰 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/constants/manteca.consts.ts
  • src/components/AddMoney/consts/index.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/app/(mobile-ui)/withdraw/manteca/page.tsx
  • src/components/AddMoney/consts/index.ts
📚 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/manteca/page.tsx
📚 Learning: 2024-10-25T11:33:46.776Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#484
File: src/components/Cashout/Components/Initial.view.tsx:273-274
Timestamp: 2024-10-25T11:33:46.776Z
Learning: In the `InitialCashoutView` component (`src/components/Cashout/Components/Initial.view.tsx`), linked bank accounts should not generate error states, and the `ValidatedInput` component will clear any error messages if needed. Therefore, it's unnecessary to manually clear the error state when selecting or clearing linked bank accounts.

Applied to files:

  • src/app/(mobile-ui)/withdraw/manteca/page.tsx
📚 Learning: 2025-08-13T18:22:01.941Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/components/AddWithdraw/DynamicBankAccountForm.tsx:0-0
Timestamp: 2025-08-13T18:22:01.941Z
Learning: In the DynamicBankAccountForm component, the countryName parameter from useParams will always resemble a country title, not a URL slug.

Applied to files:

  • src/app/(mobile-ui)/withdraw/manteca/page.tsx
🧬 Code graph analysis (2)
src/app/(mobile-ui)/withdraw/manteca/page.tsx (6)
src/constants/manteca.consts.ts (2)
  • MantecaBankCode (34-37)
  • MANTECA_COUNTRIES_CONFIG (54-102)
src/hooks/wallet/useWallet.ts (1)
  • useWallet (12-87)
src/components/Create/useCreateLink.tsx (1)
  • useCreateLink (22-438)
src/context/SupportModalContext.tsx (1)
  • useSupportModalContext (22-28)
src/constants/zerodev.consts.ts (1)
  • PEANUT_WALLET_TOKEN_DECIMALS (19-19)
src/services/manteca.ts (1)
  • mantecaApi (95-232)
src/components/Global/Select/index.tsx (1)
src/components/Global/Icons/Icon.tsx (1)
  • Icon (196-205)
🔇 Additional comments (19)
src/components/Global/ValidatedInput/index.tsx (2)

150-150: LGTM! Consistent border radius applied.

The addition of rounded-sm border radius to the wrapper provides visual consistency with the overall UI design system.


172-172: LGTM! Typography standardized.

The change from text-h8 to text-sm provides better consistency with the design system's typography scale.

src/components/AddMoney/consts/index.ts (3)

1-1: LGTM! PIX asset imported for Brazil integration.

The addition of PIX asset import aligns with the Brazil withdrawal method enhancement.


237-237: PIX configuration consistent with Manteca BR — no action required.

Manteca BR (src/constants/manteca.consts.ts) sets accountNumberLabel: 'PIX Key' and needsBankCode/needsAccountType: false; AddMoney Brazil (src/components/AddMoney/consts/index.ts) lists 'Pix' with PIX icon and isSoon: false; PIX asset exported at src/assets/payment-apps/index.ts.


2521-2521: Brazil (BR) withdrawal support verified — no action required.
Manteca config lists BR (src/constants/manteca.consts.ts — MantecaSupportedExchanges includes BR) and src/components/AddMoney/consts/index.ts contains BR in the country list and LATAM_COUNTRY_CODES; removing BR from enabledBankTransferCountries only disables bank-transfer routing — withdrawals remain available via Manteca.

src/constants/manteca.consts.ts (2)

25-32: LGTM! Account type enum well-structured.

The MantecaAccountType enum covers common banking account types used across different countries.


70-101: Verify bank-code scheme and align to ASFI siglas or add explicit mapping

File: src/constants/manteca.consts.ts Lines: 70–101 — current entries use numeric codes ('001'…'054') but ASFI 2024 publishes 3-letter siglas (e.g., BDP, BIS, BCR, BNA, BEC, BFO, BGA, BME, BNB, BIE, BPR, BSO, BUN, PCO, PEF).

  • Decide which identifier consumers expect (numeric IDs vs ASFI siglas).
  • If ASFI siglas are required, replace/update entries to use ASFI siglas + official names per ASFI 2024.
  • If numeric codes must remain, add a maintained one-to-one mapping to ASFI siglas and cite the ASFI registry; ensure all ASFI-registered institutions are present.
src/components/Global/Select/index.tsx (2)

7-10: LGTM! SelectItem type definition is clear and appropriate.

The SelectItem type with id and title fields provides a consistent structure for dropdown items.


58-62: LGTM! Value rendering updated correctly.

The conditional rendering properly displays value.title when a value exists and the placeholder otherwise.

src/app/(mobile-ui)/withdraw/manteca/page.tsx (10)

29-32: LGTM! New dependencies imported for enhanced functionality.

The imports for useCreateLink, useSupportModalContext, and Manteca constants are appropriate for the link-based withdrawal flow.


34-34: LGTM! Failure state added to withdrawal flow.

Adding 'failure' to MantecaWithdrawStep enhances error handling and user experience.


72-75: LGTM! Memoized country configuration lookup.

The memoized lookup for country configuration from MANTECA_COUNTRIES_CONFIG is efficient and properly typed.


141-147: LGTM! Comprehensive bank details validation.

The isCompleteBankDetails computed property properly validates all required fields based on country configuration.


149-173: LGTM! Enhanced form validation with country-specific requirements.

The validation logic properly checks for destination address and country-specific bank details requirements before proceeding.


289-315: LGTM! Well-structured failure state UI.

The failure state provides clear error messaging with options to retry or contact support, enhancing user experience.


401-402: Dynamic placeholder based on country configuration.

The placeholder now uses countryConfig!.accountNumberLabel for dynamic labeling. The non-null assertion (!) should be safe here since the component is only rendered when countryConfig exists.


413-437: LGTM! Country-specific bank selection components.

The conditional rendering of account type and bank code selection based on country configuration is well-implemented and follows the discriminated union pattern from the constants.


448-448: LGTM! Comprehensive form validation.

The button disabled state properly checks all validation requirements using the computed isCompleteBankDetails property.


44-46: No breaking change — Manteca withdraw state refactor is localized and consistent.
destinationAddress, selectedBank, and accountType are used consistently inside src/app/(mobile-ui)/withdraw/manteca/page.tsx (setters, validations, and payload updated); no leftover bankDetails object usage in that flow.
bankDetails remains used in unrelated areas (examples): src/context/ClaimBankFlowContext.tsx, src/components/Claim/Link/views/Confirm.bank-claim.view.tsx, src/components/AddMoney/components/AddMoneyBankDetails.tsx.

@jjramirezn jjramirezn changed the title [TASK-14985] feat(manteca-withdraw): allow refund on case of withdrawal failure [TASK-15019] support bolivia and brazil for withdraws Sep 23, 2025
@notion-workspace
Copy link

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/(mobile-ui)/withdraw/manteca/page.tsx (1)

149-173: Include isMantecaKycRequired in useCallback deps to avoid stale KYC gating.

Without it, the handler can read an outdated KYC status and skip/force KYC incorrectly.

Apply this diff:

-    }, [selectedBank, accountType, destinationAddress, countryConfig?.needsBankCode, countryConfig?.needsAccountType])
+    }, [
+        selectedBank,
+        accountType,
+        destinationAddress,
+        countryConfig?.needsBankCode,
+        countryConfig?.needsAccountType,
+        isMantecaKycRequired,
+    ])
🧹 Nitpick comments (4)
src/app/(mobile-ui)/withdraw/manteca/page.tsx (4)

149-156: Make the empty-input error message contextual (per-country label).

Improves UX and consistency with accountNumberLabel.

-        if (!destinationAddress.trim()) {
-            setErrorMessage('Please enter your account address')
-            return
-        }
+        if (!destinationAddress.trim()) {
+            const label = countryConfig?.accountNumberLabel ?? 'account number'
+            setErrorMessage(`Please enter your ${label.toLowerCase()}`)
+            return
+        }

420-429: Simplify account type selection mapping.

No need to index the enum; use the value as-is.

-                                <Select
-                                    value={accountType ? { id: accountType, title: accountType } : null}
-                                    onChange={(item) => {
-                                        setAccountType(MantecaAccountType[item.id as keyof typeof MantecaAccountType])
-                                    }}
+                                <Select
+                                    value={accountType ? { id: accountType, title: accountType } : null}
+                                    onChange={(item) => {
+                                        setAccountType(item.id as MantecaAccountType)
+                                    }}

452-456: Disable “Review” while KYC requirement is still being determined.

Prevents a no-op click path when isMantecaKycRequired === null.

-                            disabled={
-                                !isCompleteBankDetails || isDestinationAddressChanging || !isDestinationAddressValid
-                            }
+                            disabled={
+                                !isCompleteBankDetails ||
+                                isDestinationAddressChanging ||
+                                !isDestinationAddressValid ||
+                                isMantecaKycRequired === null
+                            }

512-519: Show bank and account type on the review screen (when required).

Users should confirm all submitted banking fields (Bolivia).

                     <Card className="space-y-0 px-4">
-                        <PaymentInfoRow label={countryConfig!.accountNumberLabel} value={destinationAddress} />
+                        <PaymentInfoRow
+                            label={countryConfig!.accountNumberLabel}
+                            value={destinationAddress}
+                            allowCopy
+                        />
+                        {countryConfig?.needsAccountType && accountType && (
+                            <PaymentInfoRow label="Account Type" value={accountType} />
+                        )}
+                        {countryConfig?.needsBankCode && selectedBank && (
+                            <PaymentInfoRow label="Bank" value={selectedBank.name} />
+                        )}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50af8da and 4912aaa.

📒 Files selected for processing (2)
  • src/app/(mobile-ui)/withdraw/manteca/page.tsx (16 hunks)
  • src/types/manteca.types.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/types/manteca.types.ts
🧰 Additional context used
🧠 Learnings (8)
📓 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-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/app/(mobile-ui)/withdraw/manteca/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/manteca/page.tsx
📚 Learning: 2024-10-25T11:33:46.776Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#484
File: src/components/Cashout/Components/Initial.view.tsx:273-274
Timestamp: 2024-10-25T11:33:46.776Z
Learning: In the `InitialCashoutView` component (`src/components/Cashout/Components/Initial.view.tsx`), linked bank accounts should not generate error states, and the `ValidatedInput` component will clear any error messages if needed. Therefore, it's unnecessary to manually clear the error state when selecting or clearing linked bank accounts.

Applied to files:

  • src/app/(mobile-ui)/withdraw/manteca/page.tsx
📚 Learning: 2024-11-18T21:36:11.486Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#535
File: src/components/Claim/Claim.tsx:142-146
Timestamp: 2024-11-18T21:36:11.486Z
Learning: In `src/components/Claim/Claim.tsx`, external calls like token price fetching and cross-chain details retrieval are already encapsulated within existing `try...catch` blocks, so additional error handling may be unnecessary.

Applied to files:

  • src/app/(mobile-ui)/withdraw/manteca/page.tsx
📚 Learning: 2024-10-23T09:38:27.670Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#469
File: src/app/request/pay/page.tsx:32-64
Timestamp: 2024-10-23T09:38:27.670Z
Learning: In `src/app/request/pay/page.tsx`, if `linkRes` is not OK in the `generateMetadata` function, the desired behavior is to use the standard title and preview image without throwing an error.

Applied to files:

  • src/app/(mobile-ui)/withdraw/manteca/page.tsx
📚 Learning: 2024-10-08T20:13:42.967Z
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#422
File: src/components/Request/Pay/Pay.tsx:113-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `PayRequestLink` component (`src/components/Request/Pay/Pay.tsx`), when resolving ENS names, handle errors by displaying an appropriate error message to the user if the ENS cannot be resolved.

Applied to files:

  • src/app/(mobile-ui)/withdraw/manteca/page.tsx
📚 Learning: 2025-08-13T18:22:01.941Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/components/AddWithdraw/DynamicBankAccountForm.tsx:0-0
Timestamp: 2025-08-13T18:22:01.941Z
Learning: In the DynamicBankAccountForm component, the countryName parameter from useParams will always resemble a country title, not a URL slug.

Applied to files:

  • src/app/(mobile-ui)/withdraw/manteca/page.tsx
🧬 Code graph analysis (1)
src/app/(mobile-ui)/withdraw/manteca/page.tsx (3)
src/constants/manteca.consts.ts (2)
  • MantecaBankCode (34-37)
  • MANTECA_COUNTRIES_CONFIG (54-102)
src/context/SupportModalContext.tsx (1)
  • useSupportModalContext (22-28)
src/components/Payment/PaymentInfoRow.tsx (1)
  • PaymentInfoRow (17-83)
🔇 Additional comments (5)
src/app/(mobile-ui)/withdraw/manteca/page.tsx (5)

175-201: Guard against missing txHash from sendMoney before calling API.

Be defensive if both receipt?.transactionHash and userOpHash are falsy.

             const txHash = receipt?.transactionHash ?? userOpHash
             setLoadingState('Withdrawing')
 
             // Call Manteca withdraw API
+            if (!txHash) {
+                throw new Error('Missing transaction hash from sendMoney')
+            }
             const result = await mantecaApi.withdraw({

Also verify the server treats “Unexpected error” reliably; comparing on message text is brittle. Prefer a stable code/enum if available.


141-148: Bank details completeness check looks good.

Covers destination address, bank code, and account type per-country config.


297-323: Nice failure state with retry and support.

Clear messaging, reset path, and support entry point are well integrated.


31-33: SupportModalProvider is applied at the app root — no action required.
ContextProvider (src/context/contextProvider.tsx) wraps children with , and ContextProvider is mounted in src/app/layout.tsx, so pages under (mobile-ui) are covered.


77-83: No action needed — useCurrency safely handles undefined input

The hook accepts string|null, converts undefined to null via currencyCode?.toUpperCase() ?? null, early-returns when code is falsy, and only calls getCurrencyPrice for validated codes, so passing selectedCountry?.currency! won’t throw or trigger an invalid fetch.

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