Conversation
Fix/file upload input
Add recognition for more QR codes: - Mercado Pago - Bitcoin On-Chain - Bitcoin Invoice - PIX - Tron - Solana - XRP
fix : remove unused code
[TASK-10158] feat: expand qr scanner
fix: use justaname batch api call for resolving to ens
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis pull request removes redundant asset export files and deprecates several legacy pages and components while introducing new configuration options and dependency updates. It refactors Next.js configuration (bundle analyzer, redirects, sourcemaps) and updates package dependencies. New features include fetching ENS primary names in wallet interfaces and enhanced QR code processing through a switch-case structure with Sentry logging and toast notifications. Additionally, various test files and utility functions have been added to validate QR code parsing and ENS name formats. Legacy components and exports in the assets, landing pages, and welcome sections have been removed or simplified. Changes
Sequence Diagram(s)sequenceDiagram
participant Home as HomePage Component
participant Memo as useMemo Hook
participant Batch as usePrimaryNameBatch Hook
participant Card as WalletCard Component
Home->>Memo: Derive walletAddresses from wallets state
Memo-->>Home: List of wallet addresses
Home->>Batch: Fetch ENS primary names with walletAddresses
Batch-->>Home: Return allPrimaryNames object
Home->>Card: Pass primaryName (or fallback address)
sequenceDiagram
participant QR as QR Scanner Component
participant Utils as recognizeQr & parseEip681 Functions
participant Switch as Switch-Case Logic
participant Toast as Toast Notification
participant Sentry as Sentry Logger
QR->>Utils: Pass scanned QR code data
Utils-->>QR: Return recognized QR type
QR->>Switch: Switch based on QR type
alt EIP-681 QR
Switch->>Utils: Attempt parsing with parseEip681
alt Parse fails
Switch->>Toast: Display error notification
Switch->>Sentry: Log error
end
else Other QR types
Switch->>Toast: Display respective informational toast
end
Possibly related PRs
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
src/hooks/useSetupFlow.ts (1)
54-54: Removing dispatch from dependency arraySimilar to the earlier change,
dispatchhas been removed from the dependency array while it's still used inside the callback. This creates consistency with the previous change but doesn't follow React's exhaustive dependencies rule.
🧹 Nitpick comments (11)
src/components/LandingPage/imageAssets.tsx (2)
73-81: Consider removing commented-out cloud animations.These commented-out
CloudAnimationcomponents aren't being used but are retained in the code. For better code maintenance and readability, consider removing them completely if they won't be needed in the future.Also applies to: 103-112
134-141: Remove commented-out HandToken code.The commented-out motion image for
HandTokenis no longer relevant as the asset has been removed from imports. This aligns with the PR objective of deprecating legacy components, but the code should be fully removed instead of commented out.- {/* <motion.img - initial={{ rotate: 5, opacity: 0, translateY: 28, translateX: -5, transformOrigin: 'top left' }} - whileInView={{ rotate: 0, opacity: 1, translateY: 0, translateX: 0, transformOrigin: 'top left' }} - whileHover={{ rotate: 5, transformOrigin: 'top left' }} - transition={{ type: 'spring', damping: 10 }} - src={HandToken.src} - className="absolute left-[7%] top-[63%] hidden w-36 md:left-[1%] md:top-[70%] lg:left-[7%] lg:top-[63%] lg:block xl:left-[11%]" - /> */}redirects.json (2)
43-43: Consider removing the trailing commaThe trailing comma at the end of your JSON array might cause issues with some JSON parsers. While many modern environments support trailing commas, it's safer to remove it for maximum compatibility.
- } -] + } +]
1-7: Inconsistent use of basePath propertyThe
basePath: falseproperty only appears in the first redirect rule. For consistency, consider either:
- Adding this property to all rules, or
- Removing it if it defaults to false anyway
This will make the configuration more uniform and easier to maintain.
src/components/Setup/Views/Welcome.tsx (1)
18-19: Simplified redirect logic.The redirect condition has been simplified to only check for the user's existence, making the code more maintainable.
However, the double negation (
!!user) is redundant in a boolean context.- if (!!user) push('/home') + if (user) push('/home')🧰 Tools
🪛 Biome (1.9.4)
[error] 18-18: Avoid redundant double-negation.
It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation(lint/complexity/noExtraBooleanCast)
src/components/Setup/Views/InstallPWA.tsx (1)
77-79: Simplify boolean condition.The double negation (
!!user) is redundant and makes the code less readable.- if (!!user) push('/home') + if (user) push('/home')🧰 Tools
🪛 Biome (1.9.4)
[error] 78-78: Avoid redundant double-negation.
It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation(lint/complexity/noExtraBooleanCast)
src/components/Global/DirectSendQR/index.tsx (3)
64-65: Remove redundant double negation.The double negation (
!!resolvedAddress) is unnecessary because theifstatement already checks truthiness.- if (!!resolvedAddress) { + if (resolvedAddress) {🧰 Tools
🪛 Biome (1.9.4)
[error] 65-65: Avoid redundant double-negation.
It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation(lint/complexity/noExtraBooleanCast)
114-117: Consider sanitizing or confirming redirects for external URLs.When the QR code is recognized as a generic URL, it’s directly assigned to
redirectUrl. This could allow malicious links. Consider warning users or validating/sanitizing the URL before redirecting.Do you want me to open a new issue with a proof-of-concept snippet for URL sanitization?
71-111: Maintain consistent “TODO” tracking.Multiple cases contain “TODO” placeholders (e.g., lines 44, 50, 66, 72, 78, 84, 90, 96, 102, 108). Some indicate partial or future handling for unsupported blockchain addresses. Consider opening detailed items in your issue tracker to ensure these cases are implemented or removed.
src/components/Global/DirectSendQR/utils.ts (1)
5-7: Track merchant address updates.
PINTA_MERCHANTSonly includes a single address mapping. If you plan to support additional merchants, ensure to maintain or automate this list to avoid stale references.src/assets/illustrations/index.ts (1)
1-1: Typo in the imported file pathThere appears to be a typo in the directory name "BACKGORUND" (should be "BACKGROUND") in the import path for PeanutGuyGIF.
-export { default as PeanutGuyGIF } from '@/animations/GIF_ALPHA_BACKGORUND/512X512_ALPHA_GIF_konradurban_01.gif' +export { default as PeanutGuyGIF } from '@/animations/GIF_ALPHA_BACKGROUND/512X512_ALPHA_GIF_konradurban_01.gif'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (99)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlsrc/assets/bg/bg.svgis excluded by!**/*.svgsrc/assets/chains/avalanche.svgis excluded by!**/*.svgsrc/assets/chains/base.svgis excluded by!**/*.svgsrc/assets/chains/bsc.svgis excluded by!**/*.svgsrc/assets/chains/gnosis.svgis excluded by!**/*.svgsrc/assets/chains/mainnet.svgis excluded by!**/*.svgsrc/assets/chains/manta-pacific.pngis excluded by!**/*.pngsrc/assets/chains/matic.svgis excluded by!**/*.svgsrc/assets/chains/milkomeda.svgis excluded by!**/*.svgsrc/assets/chains/optimism.svgis excluded by!**/*.svgsrc/assets/icons/checkbox.svgis excluded by!**/*.svgsrc/assets/icons/clipboard.svgis excluded by!**/*.svgsrc/assets/icons/eyes.pngis excluded by!**/*.pngsrc/assets/icons/fingerprint.pngis excluded by!**/*.pngsrc/assets/icons/gas.svgis excluded by!**/*.svgsrc/assets/icons/github-inverted.pngis excluded by!**/*.pngsrc/assets/icons/mail-icon.svgis excluded by!**/*.svgsrc/assets/icons/peanut-wallet.pngis excluded by!**/*.pngsrc/assets/icons/share.svgis excluded by!**/*.svgsrc/assets/icons/switch.svgis excluded by!**/*.svgsrc/assets/icons/telegram-icon.svgis excluded by!**/*.svgsrc/assets/icons/trapezoid.svgis excluded by!**/*.svgsrc/assets/icons/triangle.svgis excluded by!**/*.svgsrc/assets/icons/wallet.svgis excluded by!**/*.svgsrc/assets/icons/whatsapp-icon.svgis excluded by!**/*.svgsrc/assets/icons/x-icon.svgis excluded by!**/*.svgsrc/assets/illustrations/build_on_us_now.svgis excluded by!**/*.svgsrc/assets/illustrations/cashout_now.svgis excluded by!**/*.svgsrc/assets/illustrations/cloud_left.svgis excluded by!**/*.svgsrc/assets/illustrations/cloud_right.svgis excluded by!**/*.svgsrc/assets/illustrations/diagonal-lines.svgis excluded by!**/*.svgsrc/assets/illustrations/easy-tight.svgis excluded by!**/*.svgsrc/assets/illustrations/easy.svgis excluded by!**/*.svgsrc/assets/illustrations/good-idea.svgis excluded by!**/*.svgsrc/assets/illustrations/hand-bag.svgis excluded by!**/*.svgsrc/assets/illustrations/hand-peace.svgis excluded by!**/*.svgsrc/assets/illustrations/hand-rad.svgis excluded by!**/*.svgsrc/assets/illustrations/hand-snap.svgis excluded by!**/*.svgsrc/assets/illustrations/hand-thumbs-right.svgis excluded by!**/*.svgsrc/assets/illustrations/hand-thumbs.svgis excluded by!**/*.svgsrc/assets/illustrations/hey-dude.svgis excluded by!**/*.svgsrc/assets/illustrations/new.svgis excluded by!**/*.svgsrc/assets/illustrations/peace-fingers.svgis excluded by!**/*.svgsrc/assets/illustrations/smile-finder.svgis excluded by!**/*.svgsrc/assets/illustrations/smile-high.svgis excluded by!**/*.svgsrc/assets/illustrations/smile-pink.svgis excluded by!**/*.svgsrc/assets/illustrations/smile-side.svgis excluded by!**/*.svgsrc/assets/illustrations/smile-stars.svgis excluded by!**/*.svgsrc/assets/illustrations/star-blue.svgis excluded by!**/*.svgsrc/assets/illustrations/stop-sign.svgis excluded by!**/*.svgsrc/assets/illustrations/thumbs_up.svgis excluded by!**/*.svgsrc/assets/illustrations/vibes.svgis excluded by!**/*.svgsrc/assets/logos/integrators/beam-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/integrators/blockscout-logo.svgis excluded by!**/*.svgsrc/assets/logos/integrators/brume-logo.pngis excluded by!**/*.pngsrc/assets/logos/integrators/clave-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/integrators/eco-logo.pngis excluded by!**/*.pngsrc/assets/logos/integrators/kofime-logo.pngis excluded by!**/*.pngsrc/assets/logos/investors/hypersphere-logo-square.jpegis excluded by!**/*.jpegsrc/assets/logos/investors/hypersphere-logo.pngis excluded by!**/*.pngsrc/assets/logos/investors/longhash-logo-square.jpegis excluded by!**/*.jpegsrc/assets/logos/investors/longhash-logo.pngis excluded by!**/*.pngsrc/assets/logos/investors/nazare-logo-square.jpgis excluded by!**/*.jpgsrc/assets/logos/investors/nazare-logo.svgis excluded by!**/*.svgsrc/assets/logos/investors/zeeprime-logo-square.pngis excluded by!**/*.pngsrc/assets/logos/investors/zeeprime-logo.pngis excluded by!**/*.pngsrc/assets/logos/partners/0xsquid.jpgis excluded by!**/*.jpgsrc/assets/logos/partners/axelar.pngis excluded by!**/*.pngsrc/assets/logos/partners/bybit-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/partners/cleo-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/partners/izumi-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/partners/ktx-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/partners/lendle-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/partners/logx-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/partners/timeswap-logo.jpegis excluded by!**/*.jpegsrc/assets/logos/partners/wallet-connect-logo.pngis excluded by!**/*.pngsrc/assets/logos/partners/web3inbox-logo.svgis excluded by!**/*.svgsrc/assets/mockups/teal-wallet-1.pngis excluded by!**/*.pngsrc/assets/mockups/teal-wallet-2.pngis excluded by!**/*.pngsrc/assets/peanut/peanut-holding-mantle-logo.svgis excluded by!**/*.svgsrc/assets/peanut/peanutman-logo-dark.svgis excluded by!**/*.svgsrc/assets/peanut/peanutman-redpacket.svgis excluded by!**/*.svgsrc/assets/peanut/peanutman-thinking.svgis excluded by!**/*.svgsrc/assets/peanut/peanutman-wallets.svgis excluded by!**/*.svgsrc/assets/people/Steven.jpgis excluded by!**/*.jpgsrc/assets/people/derek.pngis excluded by!**/*.pngsrc/assets/people/hugo0-no-bg.pngis excluded by!**/*.pngsrc/assets/people/hugo0-with-bg.pngis excluded by!**/*.pngsrc/assets/people/kkonrad-no-bg.pngis excluded by!**/*.pngsrc/assets/people/kkonrad-with-bg.pngis excluded by!**/*.pngsrc/assets/people/kofime-icon.jpegis excluded by!**/*.jpegsrc/assets/people/konrad_cubism.jpgis excluded by!**/*.jpgsrc/assets/people/mydas.jpgis excluded by!**/*.jpgsrc/assets/people/orest.jpgis excluded by!**/*.jpgsrc/assets/people/sbf.jpegis excluded by!**/*.jpegsrc/assets/people/sharuk.pngis excluded by!**/*.pngsrc/assets/redpacket/red-packet-naked.svgis excluded by!**/*.svgsrc/assets/redpacket/red-packet.svgis excluded by!**/*.svg
📒 Files selected for processing (60)
index.ts(0 hunks)next.config.js(3 hunks)package.json(3 hunks)redirects.json(1 hunks)src/app/(mobile-ui)/home/page.tsx(3 hunks)src/app/(mobile-ui)/kyc/page.tsx(0 hunks)src/app/(mobile-ui)/wallet/page.tsx(3 hunks)src/app/[...recipient]/page.tsx(2 hunks)src/app/legacy/_about/page.tsx(0 hunks)src/app/legacy/_blog/page.tsx(0 hunks)src/app/legacy/_dashboard/page.tsx(0 hunks)src/app/legacy/_sdk/page.tsx(0 hunks)src/assets/bg/index.ts(1 hunks)src/assets/chains/index.ts(1 hunks)src/assets/icons/index.ts(1 hunks)src/assets/illustrations/index.ts(1 hunks)src/assets/index.ts(0 hunks)src/assets/logos/index.ts(1 hunks)src/assets/logos/integrators/index.ts(0 hunks)src/assets/logos/investors/index.ts(0 hunks)src/assets/logos/partners/index.ts(0 hunks)src/assets/lottie/hamburger-lottie.json(0 hunks)src/assets/lottie/index.ts(0 hunks)src/assets/mockups/index.ts(0 hunks)src/assets/peanut/index.ts(1 hunks)src/assets/people/index.ts(0 hunks)src/assets/redpacket/index.ts(0 hunks)src/components/About/index.tsx(0 hunks)src/components/Claim/useClaimLink.tsx(1 hunks)src/components/Global/DirectSendQR/__tests__/parseEip681.test.ts(1 hunks)src/components/Global/DirectSendQR/__tests__/recognizeQr.test.ts(1 hunks)src/components/Global/DirectSendQR/index.tsx(1 hunks)src/components/Global/DirectSendQR/utils.ts(1 hunks)src/components/Global/FileUploadInput/index.tsx(3 hunks)src/components/Global/FlowHeader/index.tsx(3 hunks)src/components/Global/Header/components/index.tsx(0 hunks)src/components/Global/Header/index.tsx(0 hunks)src/components/Global/ImageGeneration/LinkPreview.tsx(2 hunks)src/components/Global/QRScanner/index.tsx(0 hunks)src/components/Home/WalletCard.tsx(3 hunks)src/components/LandingPage/BuildOnUs/index.tsx(0 hunks)src/components/LandingPage/cashoutSection.tsx(0 hunks)src/components/LandingPage/features.tsx(0 hunks)src/components/LandingPage/imageAssets.tsx(1 hunks)src/components/LandingPage/index.ts(0 hunks)src/components/LandingPage/intro.tsx(0 hunks)src/components/LandingPage/mike.tsx(0 hunks)src/components/LandingPage/story.tsx(0 hunks)src/components/Setup/Views/InstallPWA.tsx(2 hunks)src/components/Setup/Views/SetupPasskey.tsx(2 hunks)src/components/Setup/Views/Welcome.tsx(1 hunks)src/components/Welcome/index.ts(0 hunks)src/components/Welcome/welcome.tsx(0 hunks)src/components/Welcome/welcomeSDK.tsx(0 hunks)src/components/index.ts(0 hunks)src/config/theme.config.tsx(1 hunks)src/config/wagmi.config.tsx(1 hunks)src/hooks/useSetupFlow.ts(2 hunks)src/utils/__tests__/general.utils.test.ts(1 hunks)src/utils/general.utils.ts(2 hunks)
💤 Files with no reviewable changes (30)
- src/assets/redpacket/index.ts
- src/components/index.ts
- src/app/legacy/_blog/page.tsx
- src/components/LandingPage/story.tsx
- src/components/LandingPage/mike.tsx
- src/app/(mobile-ui)/kyc/page.tsx
- src/components/LandingPage/cashoutSection.tsx
- src/app/legacy/_dashboard/page.tsx
- src/components/Welcome/index.ts
- src/components/LandingPage/intro.tsx
- src/components/Global/QRScanner/index.tsx
- src/components/Welcome/welcome.tsx
- src/components/LandingPage/BuildOnUs/index.tsx
- src/components/Welcome/welcomeSDK.tsx
- src/assets/lottie/index.ts
- src/assets/mockups/index.ts
- src/app/legacy/_sdk/page.tsx
- src/components/Global/Header/components/index.tsx
- src/assets/index.ts
- src/app/legacy/_about/page.tsx
- src/components/LandingPage/index.ts
- src/components/Global/Header/index.tsx
- src/assets/logos/integrators/index.ts
- src/assets/logos/investors/index.ts
- src/assets/lottie/hamburger-lottie.json
- src/components/About/index.tsx
- src/assets/people/index.ts
- src/components/LandingPage/features.tsx
- src/assets/logos/partners/index.ts
- index.ts
🧰 Additional context used
🧬 Code Definitions (10)
src/components/Setup/Views/Welcome.tsx (2)
src/hooks/useZeroDev.ts (1)
useZeroDev(30-160)src/context/authContext.tsx (1)
useAuth(317-323)
src/app/[...recipient]/page.tsx (1)
src/lib/url-parser/parser.ts (1)
parsePaymentURL(63-186)
src/components/Setup/Views/SetupPasskey.tsx (1)
src/hooks/useSetupFlow.ts (1)
useSetupFlow(6-68)
src/components/Global/DirectSendQR/__tests__/parseEip681.test.ts (1)
src/components/Global/DirectSendQR/utils.ts (1)
parseEip681(86-131)
src/components/Home/WalletCard.tsx (1)
src/interfaces/wallet.interfaces.ts (1)
IWallet(26-38)
src/components/Setup/Views/InstallPWA.tsx (1)
src/context/authContext.tsx (1)
useAuth(317-323)
src/components/Global/DirectSendQR/__tests__/recognizeQr.test.ts (1)
src/components/Global/DirectSendQR/utils.ts (1)
recognizeQr(62-79)
src/components/Global/FileUploadInput/index.tsx (1)
src/utils/general.utils.ts (1)
checkifImageType(737-741)
src/components/Global/DirectSendQR/index.tsx (3)
src/redux/hooks.ts (1)
useAppDispatch(4-4)src/components/Global/DirectSendQR/utils.ts (2)
recognizeQr(62-79)parseEip681(86-131)src/utils/general.utils.ts (1)
resolveFromEnsName(361-388)
src/components/Global/FlowHeader/index.tsx (1)
src/redux/hooks.ts (1)
useUserStore(12-12)
🪛 Biome (1.9.4)
src/components/Setup/Views/Welcome.tsx
[error] 18-18: Avoid redundant double-negation.
It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation
(lint/complexity/noExtraBooleanCast)
src/components/Setup/Views/InstallPWA.tsx
[error] 78-78: Avoid redundant double-negation.
It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation
(lint/complexity/noExtraBooleanCast)
src/components/Global/DirectSendQR/index.tsx
[error] 65-65: Avoid redundant double-negation.
It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation
(lint/complexity/noExtraBooleanCast)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (60)
src/components/LandingPage/imageAssets.tsx (1)
2-2: Simplified import statement aligns with usage.The import has been properly reduced to only include the
CloudandStarassets that are actively used in the remaining components, supporting the PR's objective of removing redundant assets.src/assets/bg/index.ts (1)
1-3:Details
✅ Verification successful
Clean-up of asset exports looks good
The removal of the
BG_SVGexport aligns with the PR's goal of cleaning up redundant assets. The single remaining export forBG_WALLET_CARD_SVGappears to be correct.However, I noticed a discrepancy between the summary and the actual code: the summary mentioned that
BG_WALLET_CARD_SVGis exported from './wallet-card.svg', but in the code it's from './wallet-card-bg.svg'. This is likely just a documentation error in the summary.
🏁 Script executed:
#!/bin/bash # Check if there are any remaining references to BG_SVG in the codebase echo "Checking for any references to BG_SVG in the codebase..." rg "BG_SVG" --type ts --type tsxLength of output: 183
🏁 Script executed:
#!/bin/bash echo "Re-checking for any references to BG_SVG in .ts and .tsx files using glob patterns..." rg BG_SVG -g '*.ts' -g '*.tsx'Length of output: 213
Asset export clean-up verified; please update documentation to match actual export paths.
- The removal of
BG_SVGand retention ofBG_WALLET_CARD_SVG(exported from./wallet-card-bg.svg) has been confirmed.- Verification via search scripts showed no lingering references to
BG_SVGin the codebase.- Note that the summary’s mention of
./wallet-card.svgappears to be a documentation error—please update the summary if necessary for consistency.redirects.json (1)
1-43: Well-structured redirect configurationThe redirects.json file provides a clean, maintainable way to configure application redirects. Each rule clearly defines source paths, destinations, and whether redirects are permanent.
I notice several paths are being redirected to legacy.peanut.to - this appears to be part of a migration strategy, which is good practice for maintaining backward compatibility.
src/hooks/useSetupFlow.ts (1)
39-39:Details
❓ Verification inconclusive
Removing dispatch from dependency array
You've removed
dispatchfrom the dependency array while it's still used inside the callback. While this won't likely cause issues (since Redux's dispatch function is stable), it doesn't follow React's exhaustive dependencies rule.
🏁 Script executed:
#!/bin/bash # Check if ESLint is configured to enforce exhaustive deps rule grep -r "react-hooks/exhaustive-deps" .eslintrc* --include="*.js" --include="*.json" || echo "Rule not explicitly configured" # Check for similar patterns elsewhere in the codebase rg "useCallback\([^,]+, \[[^\]]*steps[^\]]*\]\)" --type ts --type tsxLength of output: 301
Below is an updated review comment that highlights the need for manual verification of the hook’s dependency configuration. Note that our initial shell script output did not find an ESLint configuration enforcing the exhaustive deps rule (and the file‐search for similar patterns needed adjustment), so please verify that the use of
dispatchin the callback is intentional and correctly documented:React Hook Dependency Check – Verify Usage of
dispatch
- In
src/hooks/useSetupFlow.ts(around line 39), the callback still usesdispatchbut it has been removed from the dependency array.- While Redux’s
dispatchis stable in practice, omitting it violates React’s exhaustive-deps rule.- Action: Please verify that the omission is intentional. Consider either:
- Adding
dispatchinto the dependency array to align with the React hook rules, or- Adding a comment/documentation note explaining why it’s safe to omit it.
- Additionally, it was noted that no ESLint config was found enforcing the
react-hooks/exhaustive-depsrule (the rule may be set elsewhere, e.g. inpackage.json). Please double-check the project’s ESLint settings for consistency.src/config/wagmi.config.tsx (1)
31-31: Improved metadata with dynamic favicon URLGood improvement replacing the empty array with an actual favicon URL. This enhances the application's metadata.
However, consider adding a fallback URL in case
NEXT_PUBLIC_BASE_URLis undefined:- icons: [`${process.env.NEXT_PUBLIC_BASE_URL}/favicon.ico`], + icons: [`${process.env.NEXT_PUBLIC_BASE_URL || 'https://peanut.to'}/favicon.ico`],src/config/theme.config.tsx (2)
4-4: Reordered importsThe order of imports has been changed, which is a minor stylistic change that doesn't affect functionality.
7-14:Details
❓ Verification inconclusive
Removed default export
The default export of ThemeProvider has been removed, making it only available as a named export. This is generally a good practice but might require updates to import statements throughout the codebase.
🏁 Script executed:
#!/bin/bash # Check for potential broken imports of ThemeProvider rg "import\s+ThemeProvider\s+from\s+['\"]@/config/theme\.config['\"]" --type ts --type tsx # Check for any imports that might need to be updated rg "import.*ThemeProvider.*from\s+['\"]@/config/theme\.config['\"]" --type ts --type tsxLength of output: 247
#!/bin/bash # Re-check for potential broken imports of ThemeProvider using explicit globs for TS/TSX files. rg "import\s+ThemeProvider\s+from\s+['\"]@/config/theme\.config['\"]" -g "*.ts" -g "*.tsx" rg "import.*ThemeProvider.*from\s+['\"]@/config/theme\.config['\"]" -g "*.ts" -g "*.tsx"Attention:
The default export ofThemeProviderhas been removed in favor of a named export insrc/config/theme.config.tsx(Lines 7-14). While this is a good practice, it requires that all import statements across the codebase are updated accordingly.
- We attempted to verify imports using
rg, but the original search flagged an error due to unrecognized file types (tsx).- A revised search using explicit globs for
.tsand.tsxfiles is provided above. Please run this script to manually verify that no default imports forThemeProviderremain.If any outdated default imports are found, update them to use the named export. Otherwise, no further changes are required.
src/components/Setup/Views/SetupPasskey.tsx (2)
16-16: Dependency cleanup in useSetupFlow usage.The code now correctly removes
handleNextfrom the destructured values ofuseSetupFlow(), which is consistent with the dependency array change on line 49.
49-49: Simplified useEffect dependency array improves component behavior.Removing
handleNextfrom the dependency array is a good optimization since it's not used within the effect. This change prevents unnecessary effect re-runs whenhandleNextchanges and focuses the effect on its actual data dependencies (addressanduser).src/utils/__tests__/general.utils.test.ts (1)
211-238: Added robust test cases for token amount formatting in URLs.These test cases properly verify that the
getRequestLinkfunction correctly formats token amounts:
- The first case validates that trailing zeros are removed from '10.000000' to '10'
- The second case verifies that non-zero decimal parts are preserved ('10.110000' to '10.11')
These test cases ensure proper formatting of token amounts in payment request URLs and align with the recent changes to the
getRequestLinkfunction.src/app/[...recipient]/page.tsx (4)
33-33: Added component mount tracking for async operations.The new
isMountedflag will help prevent state updates on unmounted components.
37-38: Added lifecycle safety check before state updates.This check prevents updating state after component unmount, avoiding React warnings and potential memory leaks from processing data for components that are no longer in the DOM.
53-55: Added proper cleanup function to useEffect.The cleanup function correctly sets
isMountedto false when the component unmounts, ensuring that any pending async operations won't continue trying to update state.
56-56: Addeduserto dependency array for proper effect re-triggering.Including
userin the dependency array ensures the URL parsing logic re-runs when the user changes, which is important for proper error handling that depends on user state.src/components/Global/DirectSendQR/__tests__/recognizeQr.test.ts (1)
1-41: Well-structured test suite for QR code recognition functionality.This comprehensive test suite thoroughly validates the
recognizeQrfunction against various QR code formats:
- Peanut URLs
- EVM addresses
- ENS names
- EIP-681 formatted transactions
- Payment system codes (Mercado Pago, PIX)
- Blockchain addresses (Bitcoin, Tron, Solana, XRP)
- General URLs
- Invalid formats
The use of
it.eachpattern provides efficient test coverage with clear expectations for each input type.src/components/Global/FlowHeader/index.tsx (3)
2-2: Good enhancement adding Redux user state.Adding the
useUserStorehook enables proper user state management in this component.
24-25: Clean implementation of user state extraction.The destructuring of
userfrom the Redux store follows good practices for state management.
48-48: Enhanced conditional rendering with user authentication check.Good improvement by adding the user ID check (
!!user?.user.userId). This ensures theWalletHeaderis only rendered when a valid user is present, providing better control over the UI based on authentication status.src/assets/logos/index.ts (1)
1-2: Clean up of unused logo exports.Removing the unused exports for integrators, investors, and partners helps reduce bundle size and improves code maintainability. This aligns with the PR objective of cleaning up redundant assets.
src/components/Claim/useClaimLink.tsx (3)
3-3: Import reordering for better organization.Moving the
fetchWithSentryimport to the top of the import section improves code organization.
128-128: Default export added correctly.The implementation of the default export is correctly done.
15-15:Details
❓ Verification inconclusive
Changed from named export to default export.
The hook is now exported as a default export instead of a named export. Make sure all imports of this hook have been updated throughout the codebase from:
import { useClaimLink } from '@/components/Claim/useClaimLink'to:
import useClaimLink from '@/components/Claim/useClaimLink'
🏁 Script executed:
#!/bin/bash # Check for any remaining imports of the named useClaimLink export rg "import \{.*useClaimLink.*\} from ['\"]@/components/Claim/useClaimLink['\"]" --type ts --type tsxLength of output: 134
Below is a revised review comment. However, before finalizing, please run the following updated script to manually verify that no named imports of
useClaimLinkremain:#!/bin/bash # Re-run search for named import "useClaimLink" in TS and TSX files using updated file globs. rg "import\s+{\s*useClaimLink\s*}" -g "*.ts" -g "*.tsx"Once verified, you can confirm that all imports are now using the default syntax.
Action Required:
Ensure that the hook is now imported using the default export. Update all occurrences from:import { useClaimLink } from '@/components/Claim/useClaimLink'to:
import useClaimLink from '@/components/Claim/useClaimLink'src/components/Setup/Views/Welcome.tsx (1)
12-12: Simplified useZeroDev hook usage.Removing the
isKernelClientReadydependency simplifies the component and reduces unnecessary dependencies.src/app/(mobile-ui)/wallet/page.tsx (3)
21-21: Good addition of the ENS primary name hook.Adding this import for ENS primary name resolution will improve the user experience by showing more human-readable names.
43-46: Well-structured hook implementation with clear priority setting.The hook is properly configured to prioritize on-chain data for retrieving the ENS primary name, which ensures consistent display across the application.
150-150: Good use of fallback pattern.Using the nullish coalescing operator ensures a smooth fallback to the wallet address if no ENS name is found, preventing any display issues.
src/components/Global/ImageGeneration/LinkPreview.tsx (1)
2-2: Good addition of the ENS primary name hook.Adding this import enhances the address display capabilities.
src/assets/peanut/index.ts (1)
1-10: Clean removal of unused asset exports.Removing unnecessary exports helps reduce bundle size and maintenance overhead. The current exports appear to be well-organized.
src/components/Setup/Views/InstallPWA.tsx (2)
10-11: Good addition of authentication and routing imports.These imports enable important user redirection functionality.
70-71: Well-structured hook initialization.The hooks are correctly initialized at the component level.
src/utils/general.utils.ts (2)
69-78: Well-documented ENS name validator function.The JSDoc comment clearly explains the function's purpose, providing helpful examples for valid ENS names. The regex pattern is comprehensive and captures the required domain format with TLDs.
1056-1056: Good improvement for token amount formatting in links.Using
formatAmount()instead of directly adding the raw value ensures consistent formatting of token amounts in request links, which improves user experience.src/components/Global/DirectSendQR/__tests__/parseEip681.test.ts (1)
1-51: Great test coverage for the EIP-681 parser.The test suite comprehensively covers different scenarios:
- Simple ETH payment requests
- Requests with chain IDs
- ERC-20 token transfers
- Invalid URLs
- URLs with prefixes
This test file will ensure the parser correctly handles various EIP-681 formatted Ethereum URIs, which is essential for the QR code processing functionality.
package.json (3)
82-84: Good addition of bundle analysis tools.Adding
@next/bundle-analyzerand@size-limit/preset-appwill help monitor and optimize bundle sizes, which is important for performance.
109-109: Size-limit dependency added to support bundle size monitoring.This aligns with the size-limit configuration added below.
152-157: Bundle size constraints are a good practice.Setting a 500KB limit for JavaScript chunks will help prevent performance degradation from oversized bundles and encourage code splitting and optimization.
next.config.js (6)
2-4: Bundle analyzer configuration properly implemented.The analyzer is conditionally enabled based on the ANALYZE environment variable, which is a good practice for on-demand analysis.
6-6: Externalizing redirects configuration improves maintainability.Moving redirects to a separate JSON file makes them easier to manage and update without touching the main configuration file.
65-65: Optimization for development environment.Skipping redirects in development mode can improve reload times and simplify local testing.
153-155: Optimized sourcemap handling for production.Deleting sourcemaps after upload to Sentry is a good security practice that prevents exposing source code in production while still enabling error tracking.
161-169: Conditional service worker registration for production.Properly configured to only include the service worker in production builds, which avoids development mode complications.
171-171: Bundle analyzer properly applied to Next.js config.The export properly wraps the configuration with the bundle analyzer, enabling analysis when the ANALYZE flag is set.
src/app/(mobile-ui)/home/page.tsx (3)
19-19: New ENS integration dependency added.The import of
usePrimaryNameBatchfrom@justaname.id/reactintroduces ENS name support for wallet addresses, which will enhance the user experience by displaying human-readable names instead of raw Ethereum addresses.
48-53: Good implementation of ENS name fetching.The implementation correctly:
- Uses
useMemoto efficiently derive wallet addresses from the wallet objects- Leverages the
usePrimaryNameBatchhook with conditional enabling- Only performs the batch fetch when wallet addresses are available
This approach is efficient and follows React best practices.
206-206: Proper integration of ENS names in the UI.The component now correctly passes the ENS primary name to the
WalletCardcomponent with an appropriate fallback to the wallet address when no ENS name is available.src/components/Home/WalletCard.tsx (3)
35-35: Type definition updated for ENS support.The
WalletCardWallettype has been correctly updated to include the requiredprimaryNameproperty, ensuring type safety throughout the component.
77-77: Component parameter updated for ENS support.The
ExistingWalletCardcomponent has been modified to accept theprimaryNameprop, aligning with the type definition changes.
337-337: Function signature updated for ENS support.The
getWalletDisplayInfofunction signature has been updated to requireprimaryNameas a non-optional parameter, ensuring consistency with how the component is used in the application.src/components/Global/FileUploadInput/index.tsx (3)
23-25: Improved type safety for file handling.The
handleFileChangefunction now uses proper React event typing (React.ChangeEvent<HTMLInputElement>) and safely accesses files with optional chaining, which helps prevent potential runtime errors.
31-42: File deletion capability added.A new
handleFileDeletefunction has been implemented, which:
- Prevents event propagation
- Clears file data from the attachment options
- Resets the file input field
This provides a complete file management lifecycle and improves the user experience.
69-86: Enhanced UI for file management.The UI has been improved with:
- Group hover functionality to show/hide elements
- Visual feedback when hovering over uploaded files
- A delete button that appears on hover for better user experience
These changes make the file upload component more user-friendly and intuitive.
src/assets/icons/index.ts (1)
1-9: Icon exports simplified.Several unused icon exports have been removed, keeping only the necessary ones. This cleanup helps reduce bundle size and simplifies the codebase.
src/assets/chains/index.ts (1)
3-3:Details
❓ Verification inconclusive
Ensure no active references to removed icons remain.
Removing exports for unused chain icons is fine. Verify that no references to the removed icons remain in the codebase, to avoid potential import errors or broken images.
🏁 Script executed:
#!/bin/bash # Description: Search for any references to removed icons in the codebase rg 'BINANCE_ICON|MAINNET_ICON|POLYGON_ICON|GNOSIS_ICON|AVALANCHE_ICON|BASE_ICON|MILKOMEDA_ICON|OPTIMISM_ICON|MANTA_ICON'Length of output: 122
Manual Verification Required: Confirm No Residual Icon References
We ran a repository-wide search for the removed icon identifiers (BINANCE_ICON, MAINNET_ICON, POLYGON_ICON, GNOSIS_ICON, AVALANCHE_ICON, BASE_ICON, MILKOMEDA_ICON, OPTIMISM_ICON, MANTA_ICON) and did not locate any matches. This suggests that there are no active references remaining to these icons. However, please manually verify that no dynamic or non-standard references (such as computed properties or runtime imports) might have been missed. In particular, double-check that these icons aren’t indirectly used in file logic elsewhere in the codebase.
- Location:
src/assets/chains/index.ts(confirm removal of unused exports)- Action: Manually scrutinize other parts of the project for any potential dynamic references to the removed icons
src/components/Global/DirectSendQR/index.tsx (1)
25-25: Check the impact of forcing addresses to lowercase.Calling
data.toLowerCase()can invalidate EIP-55 checksummed addresses. Verify that your downstream logic and libraries do not require checksummed addresses, or consider preserving the original case for addresses.src/components/Global/DirectSendQR/utils.ts (4)
1-2: Imports appear correct.No issues found with the imports; they align with usage in this file.
47-58: Regex-based detection is maintained well.Using a map of regex patterns for each QR type is clean and straightforward. Just ensure updates to
EQrTypealways remain in sync withREGEXES_BY_TYPE.
62-79: Well-structured recognition logic.The function
recognizeQris logically clear, covering checks for base URL, addresses, ENS names, and regex-based matches before defaulting tonull.
86-131: Robust EIP-681 parsing.The
parseEip681function handles multiple scenarios (ETH transfer vs. ERC-20) effectively. The fallback returns a minimal object if parsing fails, preventing runtime errors.src/assets/illustrations/index.ts (2)
1-14: LGTM - Simplifying asset exportsThe changes appropriately add a new GIF export while maintaining the essential SVG exports. According to the PR summary, many exports were removed as part of deprecating legacy components, which aligns with the PR objectives to clean up assets for the production release.
1-1:Details
❓ Verification inconclusive
Verify usage of the new GIF asset
Since this is a newly added asset export, it's important to verify that it's properly used in the codebase.
🏁 Script executed:
#!/bin/bash # Check if the new GIF asset is being used in the codebase rg --type=tsx --type=ts "PeanutGuyGIF" --glob="!**/illustrations/index.ts"Length of output: 102
Action Required: Verify the Integration of the New GIF Asset
The export for
PeanutGuyGIFinsrc/assets/illustrations/index.tshas been added, but our initial verification command encountered an error (unrecognized file type: tsx). It appears the ripgrep configuration isn’t recognizing thetsxfile type, so we cannot confirm whether the asset is used elsewhere in the codebase.To gather the necessary information, please run the following revised shell script that explicitly targets TypeScript and TSX files:
#!/bin/bash rg -g "*.ts" -g "*.tsx" "PeanutGuyGIF" --glob="!**/illustrations/index.ts"Once you verify the usage (or confirm that it isn’t referenced), please update the review accordingly.
| const { primaryName } = usePrimaryName({ | ||
| address, | ||
| priority: 'onChain', | ||
| }) | ||
|
|
||
| if (primaryName) { | ||
| return primaryName | ||
| } |
There was a problem hiding this comment.
React hooks cannot be used in regular functions.
React hooks can only be called from React function components or custom hooks. Using usePrimaryName within the formatDisplayAddress function violates this rule and could cause runtime errors.
Consider refactoring to one of these approaches:
- function formatDisplayAddress(address: string): string {
- const { primaryName } = usePrimaryName({
- address,
- priority: 'onChain',
- })
-
- if (primaryName) {
- return primaryName
- }
-
- if (address.startsWith('0x')) {
- if (isAddress(address)) {
- return printableAddress(address)
- }
- return address
- }
- return address
- }
+ // Option 1: Create a hook component that uses the address formatting
+ function useFormattedAddress(address: string): string {
+ const { primaryName } = usePrimaryName({
+ address,
+ priority: 'onChain',
+ })
+
+ if (primaryName) {
+ return primaryName
+ }
+
+ if (address.startsWith('0x')) {
+ if (isAddress(address)) {
+ return printableAddress(address)
+ }
+ return address
+ }
+ return address
+ }
+ // Option 2: Move the hook to the parent component
+ function formatDisplayAddress(address: string, primaryName?: string): string {
+ if (primaryName) {
+ return primaryName
+ }
+
+ if (address.startsWith('0x')) {
+ if (isAddress(address)) {
+ return printableAddress(address)
+ }
+ return address
+ }
+ return address
+ }
+
+ export function LinkPreviewImg({
+ amount,
+ tokenSymbol,
+ address,
+ previewType,
+ }: {
+ amount: string
+ tokenSymbol?: string
+ address: string
+ previewType: PreviewType
+ }) {
+ const { primaryName } = usePrimaryName({
+ address,
+ priority: 'onChain',
+ })
+ // Then use formatDisplayAddress(address, primaryName) later in the component📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const { primaryName } = usePrimaryName({ | |
| address, | |
| priority: 'onChain', | |
| }) | |
| if (primaryName) { | |
| return primaryName | |
| } | |
| // Option 1: Create a custom hook that handles the address formatting logic | |
| function useFormattedAddress(address: string): string { | |
| const { primaryName } = usePrimaryName({ | |
| address, | |
| priority: 'onChain', | |
| }) | |
| if (primaryName) { | |
| return primaryName | |
| } | |
| if (address.startsWith('0x')) { | |
| if (isAddress(address)) { | |
| return printableAddress(address) | |
| } | |
| return address | |
| } | |
| return address | |
| } | |
| // Option 2: Keep a pure formatting function and move the hook call to a component | |
| function formatDisplayAddress(address: string, primaryName?: string): string { | |
| if (primaryName) { | |
| return primaryName | |
| } | |
| if (address.startsWith('0x')) { | |
| if (isAddress(address)) { | |
| return printableAddress(address) | |
| } | |
| return address | |
| } | |
| return address | |
| } | |
| export function LinkPreviewImg({ | |
| amount, | |
| tokenSymbol, | |
| address, | |
| previewType, | |
| }: { | |
| amount: string | |
| tokenSymbol?: string | |
| address: string | |
| previewType: PreviewType | |
| }) { | |
| const { primaryName } = usePrimaryName({ | |
| address, | |
| priority: 'onChain', | |
| }) | |
| // Later, you can use the primaryName with the pure formatting function: | |
| const displayAddress = formatDisplayAddress(address, primaryName) | |
| // Render the component using displayAddress, amount, tokenSymbol, previewType, etc. | |
| return ( | |
| <div> | |
| {/* Component markup that uses displayAddress */} | |
| <p>{displayAddress}</p> | |
| {/* ... */} | |
| </div> | |
| ) | |
| } |
| import { useToast } from '@/components/0_Bruddle/Toast' | ||
| import * as Sentry from '@sentry/nextjs' | ||
|
|
||
| const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL! |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Handle missing or undefined environment variables.
Using a non-null assertion (!) on process.env.NEXT_PUBLIC_BASE_URL can lead to runtime errors if the variable is actually undefined. Consider adding a fallback or error handling to prevent crashes.
- const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL!
+ const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL || ''
+ if (!BASE_URL) {
+ console.error('Error: NEXT_PUBLIC_BASE_URL is missing.')
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL! | |
| const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL || '' | |
| if (!BASE_URL) { | |
| console.error('Error: NEXT_PUBLIC_BASE_URL is missing.') | |
| } |
Summary by CodeRabbit
New Features
Refactors & Chores
Tests