-
Notifications
You must be signed in to change notification settings - Fork 13
chore: sync prod hot fixes to staging #1211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…pdate fixed twitter username and some other fixes
feat: recover funds
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Hugo Montenegro <[email protected]>
hot-fix: poland guest link claim issue
fix: increase min claim amount to 2 usd
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughProject-wide updates replace peanut.to with peanut.me across docs and metadata, adjust social/Twitter handles, surface an optional Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/utils/sdkErrorHandler.utils.tsx (1)
56-58
: Typo in user-facing message (“occured” → “occurred”).- return 'A network error occured. Please refresh and try again.' + return 'A network error occurred. Please refresh and try again.'src/components/AddWithdraw/DynamicBankAccountForm.tsx (2)
157-161
: Reset submitting state on early return (existing account).Otherwise the form may remain disabled/spinning until unmount.
- if (existingAccount) { + if (existingAccount) { setSelectedBankAccount(existingAccount) router.push(`/withdraw/${country}/bank`) - return + setIsSubmitting(false) + return }
351-353
: Use the same country identifier when validating IBAN (slug vs title).getCountryFromIban(...) returns country.path (URL slug, e.g. "united-kingdom"); selectedCountry is derived from props/params and lowercased (e.g. "united kingdom"). Normalize/compare the same identifier: either compare ISO codes (use getCountryCodeForWithdraw / country.id) or normalize selectedCountry to the path (slugify spaces → hyphens) before the check at src/components/AddWithdraw/DynamicBankAccountForm.tsx (around lines 348–353). getCountryFromIban is implemented in src/utils/withdraw.utils.ts and currently returns country.path.
🧹 Nitpick comments (16)
src/components/Profile/views/IdentityVerification.view.tsx (2)
48-52
: Trim fullName to avoid trailing spaces when lastName is empty.Prevents persisting a trailing space when a user has a single-name profile.
Apply:
- fullName: `${data.firstName} ${data.lastName}`, + fullName: `${data.firstName} ${data.lastName}`.trim(),
34-41
: Tighten useMemo deps.Since firstName/lastName are derived from user.user.fullName, listing them as dependencies is redundant.
Apply:
- [user?.user.fullName, user?.user.email, firstName, lastName] + [user?.user.fullName, user?.user.email]redirects.json (1)
4-7
: Consider making the /docs redirect permanent.If docs.peanut.me is the canonical docs host, a permanent redirect helps SEO and caching.
- "permanent": false, + "permanent": true,README.md (1)
22-22
: Fix duplicate word.-# Note: run pnpm run dev:https if you need to work in a secure secure context +# Note: run pnpm run dev:https if you need to work in a secure contextsrc/utils/sdkErrorHandler.utils.tsx (3)
53-54
: Improve phrasing of chain availability message.- return 'Bulk is not able on this chain, please try another chain.' + return 'Bulk is not available on this chain. Please try another chain.'
115-116
: Make “contact support” actionable.If you have a Support page/route, consider returning a CTA-friendly string the UI can link, e.g., “Please visit Support” and render it as a link.
47-47
: Avoid noisy logs in production.Use console.error and/or guard logging behind an env check to reduce noise and PII risk.
- console.log(error.toString()) + if (process.env.NODE_ENV !== 'production') { + // eslint-disable-next-line no-console + console.error(error); + }src/components/Global/Footer/consts.ts (1)
5-7
: LGTM: social/docs URLs migrated. Also consider centralizing DOCS_URL and SOCIAL handles.Define DOCS_URL and SOCIAL_TWITTER in a single config to avoid future drift.
Also applies to: 20-22, 33-35
src/components/LandingPage/Footer.tsx (1)
42-42
: LGTM: X/Twitter link updated.Consider sourcing these URLs from Global/Footer/consts to avoid duplication.
src/constants/tooltips.ts (1)
6-6
: Add rel="noopener noreferrer" to external links opened with target="_blank".Prevents reverse tabnabbing and is a low-effort security hardening.
-<a href="https://docs.peanut.me/cashout/supported-geographies" target="_blank" class="underline text-blue-600">Supported regions</a> +<a href="https://docs.peanut.me/cashout/supported-geographies" target="_blank" rel="noopener noreferrer" class="underline text-blue-600">Supported regions</a>-<a href="https://docs.peanut.me/cashout/supported-geographies" target="_blank" class="underline text-blue-600">Learn more about supported regions</a> +<a href="https://docs.peanut.me/cashout/supported-geographies" target="_blank" rel="noopener noreferrer" class="underline text-blue-600">Learn more about supported regions</a>Also applies to: 14-14
src/components/AddWithdraw/DynamicBankAccountForm.tsx (1)
152-154
: Normalize identifiers when checking for existing accounts.Make the comparison space- and case-insensitive to avoid false negatives.
- const existingAccount = savedAccounts.find( - (account) => account.identifier === (data.accountNumber.toLowerCase() || data.clabe.toLowerCase()) - ) + const normalize = (s: string) => s.replace(/\s/g, '').toLowerCase() + const inputId = normalize(data.accountNumber || data.clabe) + const existingAccount = savedAccounts.find((account) => normalize(account.identifier) === inputId)src/components/Global/Icons/Icon.tsx (1)
124-126
: Remove duplicate 'shield' from IconName union.Harmless but noisy for types.
- | 'chevron-down' - | 'shield' - | 'question-mark' - | 'shield' + | 'chevron-down' + | 'shield' + | 'question-mark'src/components/Common/ActionList.tsx (2)
64-67
: Extract min bank-amount thresholds to constants and keep flows aligned.Prevents drift between claim ($5) and request ($1) and eases future changes.
- if (method.id === 'bank' && amountInUsd < 5) { + if (method.id === 'bank' && amountInUsd < MIN_BANK_CLAIM_USD) {Add near imports:
const MIN_BANK_CLAIM_USD = 5 const MIN_BANK_REQUEST_USD = 1And update the request check accordingly:
- if (method.id === 'bank' && amountInUsd < 1) { + if (method.id === 'bank' && amountInUsd < MIN_BANK_REQUEST_USD) {
178-179
: Minor copy/format nit.Remove trailing space and standardize casing.
- title="Minimum Amount " + title="Minimum amount"src/app/actions/external-accounts.ts (1)
10-14
: Propagate error.source to consumers for field-level hints.Consider returning both error and source up the chain (e.g., map 'iban'/'bic' to setError on specific inputs).
src/components/Claim/Link/views/BankFlowManager.view.tsx (1)
468-473
: Do the same uppercasing when deriving the form country prop.Keeps IBAN/US/MX branching consistent.
- country={getCountryCodeForWithdraw(selectedCountry?.id ?? '')} + country={getCountryCodeForWithdraw((selectedCountry?.id ?? '').toUpperCase())}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
README.md
(1 hunks)public/game/peanut-game.html
(1 hunks)redirects.json
(1 hunks)src/app/actions/external-accounts.ts
(2 hunks)src/components/AddWithdraw/DynamicBankAccountForm.tsx
(1 hunks)src/components/Claim/Link/views/BankFlowManager.view.tsx
(1 hunks)src/components/Common/ActionList.tsx
(3 hunks)src/components/Global/Footer/consts.ts
(3 hunks)src/components/Global/Icons/Icon.tsx
(3 hunks)src/components/LandingPage/Footer.tsx
(1 hunks)src/components/Profile/index.tsx
(3 hunks)src/components/Profile/views/IdentityVerification.view.tsx
(1 hunks)src/components/Setup/Views/SetupPasskey.tsx
(1 hunks)src/config/wagmi.config.tsx
(1 hunks)src/constants/tooltips.ts
(1 hunks)src/utils/sdkErrorHandler.utils.tsx
(1 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
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.
📚 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/LandingPage/Footer.tsx
src/components/Setup/Views/SetupPasskey.tsx
src/constants/tooltips.ts
src/config/wagmi.config.tsx
src/components/Global/Footer/consts.ts
src/components/Profile/index.tsx
📚 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/constants/tooltips.ts
📚 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/components/AddWithdraw/DynamicBankAccountForm.tsx
src/components/Claim/Link/views/BankFlowManager.view.tsx
📚 Learning: 2025-08-26T15:25:53.328Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1132
File: src/app/[...recipient]/client.tsx:394-397
Timestamp: 2025-08-26T15:25:53.328Z
Learning: In `src/components/Common/ActionListDaimoPayButton.tsx`, the `handleCompleteDaimoPayment` function should not display error messages to users when DB update fails because the Daimo payment itself has succeeded - showing errors would be confusing since the payment was successful.
Applied to files:
src/components/AddWithdraw/DynamicBankAccountForm.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/components/Claim/Link/views/BankFlowManager.view.tsx
📚 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/components/Claim/Link/views/BankFlowManager.view.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/components/Claim/Link/views/BankFlowManager.view.tsx
📚 Learning: 2025-08-20T09:08:19.266Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#1112
File: src/components/Claim/Link/views/BankFlowManager.view.tsx:336-343
Timestamp: 2025-08-20T09:08:19.266Z
Learning: In the KYC flow implementation, `setJustCompletedKyc` must be called after `await fetchUser()` in the `handleKycSuccess` callback. Setting `justCompletedKyc` before fetching the user would cause a re-fetching loop because `handleKycSuccess` is set in a useEffect inside the KYC hook, which would cause the UI flow to get stuck in one view.
Applied to files:
src/components/Profile/views/IdentityVerification.view.tsx
🧬 Code graph analysis (3)
src/components/Claim/Link/views/BankFlowManager.view.tsx (1)
src/utils/withdraw.utils.ts (1)
getCountryCodeForWithdraw
(137-147)
src/app/actions/external-accounts.ts (1)
src/interfaces/interfaces.ts (1)
IBridgeAccount
(162-198)
src/components/Global/Icons/Icon.tsx (1)
src/components/Global/Icons/shield.tsx (1)
ShieldIcon
(3-16)
🪛 GitHub Actions: Tests
src/app/actions/external-accounts.ts
[warning] 1-1: Prettier formatting issues found in this file. Run 'pnpm prettier --write' to fix.
⏰ 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 (9)
src/components/Profile/views/IdentityVerification.view.tsx (1)
56-59
: LGTM: fetch user before initiating KYC.Correct ordering to avoid loops in the KYC flow; aligns with prior KYC flow learnings.
redirects.json (1)
1-48
: Quick audit — find legacy peanut.to/docs.peanut.to, http://peanut.me, and old Twitter/X handles
- Sandbox automated search failed; run from the repo root and fix any matches (prefer https://peanut.me and current domains):
# ripgrep (recommended) rg -n -uu -S -e 'peanut\.to|docs\.peanut\.to' || true rg -n -uu -S -e 'http://(www\.)?peanut\.me' || true rg -n -uu -S -e 'twitter\.com/(peanutprotocol|PeanutProtocol)|x\.com/(PeanutProtocol)' || true # fallback (if ripgrep behaves oddly) git grep -nE 'peanut\.to|docs\.peanut\.to|http://(www\.)?peanut\.me|twitter\.com/(peanutprotocol|PeanutProtocol)|x\.com/(PeanutProtocol)' || true
- If matches are found, replace legacy.peanut.to/docs.peanut.to with the current targets and convert any http://peanut.me links to https://peanut.me; update/remove old Twitter/X handles as needed.
README.md (1)
1-1
: LGTM: updated live domains.src/components/Setup/Views/SetupPasskey.tsx (1)
117-117
: LGTM: docs link migrated to peanut.me.public/game/peanut-game.html (1)
9-10
: LGTM: updated Twitter handle to @joinpeanut.src/components/AddWithdraw/DynamicBankAccountForm.tsx (1)
446-450
: LGTM: single-source error rendering.Preferring submissionError over parent error avoids double alerts.
src/app/actions/external-accounts.ts (2)
26-31
: Good: expose API-provided “source” on invalid_parameters.This will help field-level UX downstream.
1-44
: Install dev deps and run Prettier to unblock CI
- Local verification failed: pnpm reported "prettier" / "next" not found and node_modules missing; current Node v24.3.0 doesn't match engines ("node": ">=21.1.0 <22.0.0 || ^18.18.0 || ^20.9.0").
- Action: switch to a supported Node (e.g., 20.9.0 or 18.18.x), run
pnpm install
, thenpnpm prettier --write src/app/actions/external-accounts.ts && pnpm lint --fix || true
.src/components/Claim/Link/views/BankFlowManager.view.tsx (1)
370-373
: LGTM: return guest error to form without duplicating local error state.Prevents double-reporting; DynamicBankAccountForm now owns the submission error.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Hugo Montenegro <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Hugo Montenegro <[email protected]>
No description provided.