Skip to content

Peanut wallet#1522

Merged
Hugo0 merged 9 commits intopeanut-wallet-devfrom
peanut-wallet
Dec 1, 2025
Merged

Peanut wallet#1522
Hugo0 merged 9 commits intopeanut-wallet-devfrom
peanut-wallet

Conversation

@Hugo0
Copy link
Contributor

@Hugo0 Hugo0 commented Dec 1, 2025

No description provided.

@vercel
Copy link

vercel bot commented Dec 1, 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 Dec 1, 2025 8:23pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Changes introduce multi-chain balance support for the Recover Funds feature, including Linea network and USDC balance retrieval. A new environment variable for the recovery bundler URL is added to the configuration. ZeroDev constants are updated to conditionally configure public clients for mainnet, base, and linea chains. Balance handling and transaction flow logic are refactored across recovery and token processing components.

Changes

Cohort / File(s) Summary
Configuration & Environment
.env.example, src/constants/zerodev.consts.ts
Added NEXT_PUBLIC_ZERO_DEV_RECOVERY_BUNDLER_URL environment variable. Updated zerodev.consts.ts to conditionally populate PUBLIC_CLIENTS_BY_CHAIN with mainnet, base, and linea configurations when the recovery bundler URL is set.
Recover Funds Feature
src/app/(mobile-ui)/recover-funds/page.tsx
Introduced multi-chain balance handling with RECOVERABLE_CHAINS constant and Linea USDC retrieval. Replaced single-token state with selectedBalance (type IUserBalance | undefined). Updated balance filtering logic to handle multiple chains and exclude peanut token. Modified transaction flow to pass chainId for both native and ERC20 tokens. Added specific error messages for missing client and expired session scenarios. Updated UI logic to reference selectedBalance instead of token address and display chain names via getChainName().
Token & Balance Processing
src/app/actions/tokens.ts
Added type annotation for balances as IUserBalance[]. Introduced guard to skip processing when crossChainBalance is missing or zero. Added ETH placeholder address mapping and deduplication check for same address/chainId pairs. Retained existing balance object structure with updated field population.
Context & Error Handling
src/context/kernelClient.context.tsx
Replaced generic multi-chain comment with specific initialization behavior description. Enhanced error handling for missing chain clients by logging available chains and providing more descriptive error messages.
Form UI Updates
src/components/AddWithdraw/DynamicBankAccountForm.tsx
Removed inline information message "You can only withdraw to accounts under your name." from the form.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Balance state management refactor in recover-funds: Review the transition from selectedTokenAddress to selectedBalance and verify all state updates and UI references are consistent.
  • Multi-chain balance fetching logic: Verify parallel fetch execution for wallet and Linea USDC balances, data structure population, and filtering correctness across mainnet, base, and linea.
  • Deduplication logic in tokens.ts: Confirm the address/chainId deduplication check prevents duplicate balance entries without filtering legitimate data.
  • Conditional ZeroDev client configuration: Ensure the environment-driven initialization of recovery chains and their bundler/paymaster URL construction are correct.
  • Transaction flow updates: Verify chainId parameter is properly propagated in both native and ERC20 token transaction flows.
✨ 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

📜 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 bf29cc3 and a13d482.

📒 Files selected for processing (6)
  • .env.example (1 hunks)
  • src/app/(mobile-ui)/recover-funds/page.tsx (9 hunks)
  • src/app/actions/tokens.ts (2 hunks)
  • src/components/AddWithdraw/DynamicBankAccountForm.tsx (0 hunks)
  • src/constants/zerodev.consts.ts (4 hunks)
  • src/context/kernelClient.context.tsx (2 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@Hugo0 Hugo0 merged commit f3e8781 into peanut-wallet-dev Dec 1, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants