Skip to content

Peanut.me prod release#792

Merged
jjramirezn merged 28 commits intopeanut-walletfrom
peanut-wallet-dev
Apr 7, 2025
Merged

Peanut.me prod release#792
jjramirezn merged 28 commits intopeanut-walletfrom
peanut-wallet-dev

Conversation

@Hugo0
Copy link
Copy Markdown
Contributor

@Hugo0 Hugo0 commented Apr 7, 2025

Summary by CodeRabbit

  • New Features

    • Wallet displays now show user-friendly names instead of raw addresses.
    • Enhanced QR code processing with expanded recognition and improved error feedback.
    • File upload interface now supports file deletion.
    • PWA installation flow automatically redirects logged-in users to the home page.
  • Refactors & Chores

    • Streamlined routing and asset management for a leaner, more optimized experience.
    • Legacy and unused components have been removed to simplify the UI.
    • Build configurations and dependency updates improve overall performance.
  • Tests

    • New tests ensure accurate QR code parsing and token amount formatting.

kushagrasarathe and others added 28 commits March 31, 2025 16:36
Add recognition for more QR codes:
- Mercado Pago
- Bitcoin On-Chain
- Bitcoin Invoice
- PIX
- Tron
- Solana
- XRP
fix: use justaname batch api call for resolving to ens
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
peanut-ui (peanut-wallet-staging) ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2025 1:27pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2025

Walkthrough

This 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

File(s) Change Summary
index.ts, src/assets/bg/index.ts, src/assets/chains/index.ts, src/assets/icons/index.ts, src/assets/illustrations/index.ts, src/assets/index.ts, src/assets/logos/..., src/assets/lottie/..., src/assets/mockups/index.ts, src/assets/peanut/index.ts, src/assets/people/index.ts, src/assets/redpacket/index.ts Removed or modified asset export statements and entire files to deprecate unused SVG/PNG assets and logos; added a new export (PeanutGuyGIF) in illustrations with minor formatting adjustments.
next.config.js, package.json, redirects.json, src/config/theme.config.tsx, src/config/wagmi.config.tsx Updated Next.js configuration by adding bundle analyzer support, refactoring redirects, and adding sourcemap settings; modified dependencies and added size-limit configuration; adjusted theme and metadata settings.
src/app/(mobile-ui)/home/page.tsx, src/app/(mobile-ui)/wallet/page.tsx, src/app/(mobile-ui)/kyc/page.tsx, src/app/[...recipient]/page.tsx, src/app/legacy/_about/page.tsx, src/app/legacy/_blog/page.tsx, src/app/legacy/_dashboard/page.tsx, src/app/legacy/_sdk/page.tsx Introduced ENS name fetching in home and wallet pages, added lifecycle cleanup for URL fetching, and removed several legacy pages including KYC, about, blog, dashboard, and SDK pages.
Components Group I:
src/components/About/index.tsx, src/components/Claim/useClaimLink.tsx, src/components/Global/DirectSendQR/index.tsx, src/components/Global/DirectSendQR/utils.ts, src/components/Global/FileUploadInput/index.tsx, src/components/Global/FlowHeader/index.tsx, src/components/Global/Header/components/index.tsx, src/components/Global/Header/index.tsx, src/components/Global/ImageGeneration/LinkPreview.tsx, src/components/Global/QRScanner/index.tsx, src/components/Home/WalletCard.tsx
Refactored components by localizing the useClaimLink function, enhancing QR code processing with a new switch-case logic, adding file deletion functionality, updating wallet card to require a primaryName, and incorporating a new user store hook to conditionally render wallet headers; removed header sub-components.
Components Group II:
src/components/LandingPage/..., src/components/Setup/Views/InstallPWA.tsx, src/components/Setup/Views/SetupPasskey.tsx, src/components/Setup/Views/Welcome.tsx, src/components/Welcome/index.ts, src/components/Welcome/welcome.tsx, src/components/Welcome/welcomeSDK.tsx, src/components/index.ts
Removed several landing page components (BuildOnUs, CashoutSection, Features, Intro, Mike, Story) and welcome UI files; added authentication checking and redirection in InstallPWA; simplified hook dependencies in SetupPasskey and Welcome; removed public exports for welcome components.
src/hooks/useSetupFlow.ts, src/utils/__tests__/general.utils.test.ts, src/utils/general.utils.ts Updated dependency arrays in the useSetupFlow hook; added a new function validateEnsName and improved token amount formatting in getRequestLink; new test cases added to cover token formatting variations.
src/components/Global/DirectSendQR/__tests__/parseEip681.test.ts, src/components/Global/DirectSendQR/__tests__/recognizeQr.test.ts Introduced new test suites validating the parsing of EIP-681 URIs and recognition of various QR code formats using the recognizeQr utility.

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)
Loading
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
Loading

Possibly related PRs

  • fix : remove unused code  #789: Removes an index.ts file with similar asset exports, closely related to the current removal of asset-export files.
  • feat: justaname integration #664: Integrates the @justaname.id/react package to improve primary name handling in wallet components, aligning with the new ENS features.
  • release: Club lp #481: Focuses on asset export removals (e.g., ClaimChainsBadge, Cloud, HR, EasySign), which directly corresponds with several removals in the current PR.

Poem

I'm a little rabbit with a hop so light,
Dancing through changes in code tonight.
Assets vanish and configs gleam,
ENS names now steal the scene.
QR codes twirl in a swift new beat,
With happy bytes making the project sweet!
🐇💻✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/hooks/useSetupFlow.ts (1)

54-54: Removing dispatch from dependency array

Similar to the earlier change, dispatch has 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 CloudAnimation components 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 HandToken is 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 comma

The 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 property

The basePath: false property only appears in the first redirect rule. For consistency, consider either:

  1. Adding this property to all rules, or
  2. 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 the if statement 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_MERCHANTS only 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 path

There 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

📥 Commits

Reviewing files that changed from the base of the PR and between a79e825 and 30e277f.

⛔ Files ignored due to path filters (99)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • src/assets/bg/bg.svg is excluded by !**/*.svg
  • src/assets/chains/avalanche.svg is excluded by !**/*.svg
  • src/assets/chains/base.svg is excluded by !**/*.svg
  • src/assets/chains/bsc.svg is excluded by !**/*.svg
  • src/assets/chains/gnosis.svg is excluded by !**/*.svg
  • src/assets/chains/mainnet.svg is excluded by !**/*.svg
  • src/assets/chains/manta-pacific.png is excluded by !**/*.png
  • src/assets/chains/matic.svg is excluded by !**/*.svg
  • src/assets/chains/milkomeda.svg is excluded by !**/*.svg
  • src/assets/chains/optimism.svg is excluded by !**/*.svg
  • src/assets/icons/checkbox.svg is excluded by !**/*.svg
  • src/assets/icons/clipboard.svg is excluded by !**/*.svg
  • src/assets/icons/eyes.png is excluded by !**/*.png
  • src/assets/icons/fingerprint.png is excluded by !**/*.png
  • src/assets/icons/gas.svg is excluded by !**/*.svg
  • src/assets/icons/github-inverted.png is excluded by !**/*.png
  • src/assets/icons/mail-icon.svg is excluded by !**/*.svg
  • src/assets/icons/peanut-wallet.png is excluded by !**/*.png
  • src/assets/icons/share.svg is excluded by !**/*.svg
  • src/assets/icons/switch.svg is excluded by !**/*.svg
  • src/assets/icons/telegram-icon.svg is excluded by !**/*.svg
  • src/assets/icons/trapezoid.svg is excluded by !**/*.svg
  • src/assets/icons/triangle.svg is excluded by !**/*.svg
  • src/assets/icons/wallet.svg is excluded by !**/*.svg
  • src/assets/icons/whatsapp-icon.svg is excluded by !**/*.svg
  • src/assets/icons/x-icon.svg is excluded by !**/*.svg
  • src/assets/illustrations/build_on_us_now.svg is excluded by !**/*.svg
  • src/assets/illustrations/cashout_now.svg is excluded by !**/*.svg
  • src/assets/illustrations/cloud_left.svg is excluded by !**/*.svg
  • src/assets/illustrations/cloud_right.svg is excluded by !**/*.svg
  • src/assets/illustrations/diagonal-lines.svg is excluded by !**/*.svg
  • src/assets/illustrations/easy-tight.svg is excluded by !**/*.svg
  • src/assets/illustrations/easy.svg is excluded by !**/*.svg
  • src/assets/illustrations/good-idea.svg is excluded by !**/*.svg
  • src/assets/illustrations/hand-bag.svg is excluded by !**/*.svg
  • src/assets/illustrations/hand-peace.svg is excluded by !**/*.svg
  • src/assets/illustrations/hand-rad.svg is excluded by !**/*.svg
  • src/assets/illustrations/hand-snap.svg is excluded by !**/*.svg
  • src/assets/illustrations/hand-thumbs-right.svg is excluded by !**/*.svg
  • src/assets/illustrations/hand-thumbs.svg is excluded by !**/*.svg
  • src/assets/illustrations/hey-dude.svg is excluded by !**/*.svg
  • src/assets/illustrations/new.svg is excluded by !**/*.svg
  • src/assets/illustrations/peace-fingers.svg is excluded by !**/*.svg
  • src/assets/illustrations/smile-finder.svg is excluded by !**/*.svg
  • src/assets/illustrations/smile-high.svg is excluded by !**/*.svg
  • src/assets/illustrations/smile-pink.svg is excluded by !**/*.svg
  • src/assets/illustrations/smile-side.svg is excluded by !**/*.svg
  • src/assets/illustrations/smile-stars.svg is excluded by !**/*.svg
  • src/assets/illustrations/star-blue.svg is excluded by !**/*.svg
  • src/assets/illustrations/stop-sign.svg is excluded by !**/*.svg
  • src/assets/illustrations/thumbs_up.svg is excluded by !**/*.svg
  • src/assets/illustrations/vibes.svg is excluded by !**/*.svg
  • src/assets/logos/integrators/beam-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/integrators/blockscout-logo.svg is excluded by !**/*.svg
  • src/assets/logos/integrators/brume-logo.png is excluded by !**/*.png
  • src/assets/logos/integrators/clave-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/integrators/eco-logo.png is excluded by !**/*.png
  • src/assets/logos/integrators/kofime-logo.png is excluded by !**/*.png
  • src/assets/logos/investors/hypersphere-logo-square.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/investors/hypersphere-logo.png is excluded by !**/*.png
  • src/assets/logos/investors/longhash-logo-square.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/investors/longhash-logo.png is excluded by !**/*.png
  • src/assets/logos/investors/nazare-logo-square.jpg is excluded by !**/*.jpg
  • src/assets/logos/investors/nazare-logo.svg is excluded by !**/*.svg
  • src/assets/logos/investors/zeeprime-logo-square.png is excluded by !**/*.png
  • src/assets/logos/investors/zeeprime-logo.png is excluded by !**/*.png
  • src/assets/logos/partners/0xsquid.jpg is excluded by !**/*.jpg
  • src/assets/logos/partners/axelar.png is excluded by !**/*.png
  • src/assets/logos/partners/bybit-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/partners/cleo-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/partners/izumi-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/partners/ktx-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/partners/lendle-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/partners/logx-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/partners/timeswap-logo.jpeg is excluded by !**/*.jpeg
  • src/assets/logos/partners/wallet-connect-logo.png is excluded by !**/*.png
  • src/assets/logos/partners/web3inbox-logo.svg is excluded by !**/*.svg
  • src/assets/mockups/teal-wallet-1.png is excluded by !**/*.png
  • src/assets/mockups/teal-wallet-2.png is excluded by !**/*.png
  • src/assets/peanut/peanut-holding-mantle-logo.svg is excluded by !**/*.svg
  • src/assets/peanut/peanutman-logo-dark.svg is excluded by !**/*.svg
  • src/assets/peanut/peanutman-redpacket.svg is excluded by !**/*.svg
  • src/assets/peanut/peanutman-thinking.svg is excluded by !**/*.svg
  • src/assets/peanut/peanutman-wallets.svg is excluded by !**/*.svg
  • src/assets/people/Steven.jpg is excluded by !**/*.jpg
  • src/assets/people/derek.png is excluded by !**/*.png
  • src/assets/people/hugo0-no-bg.png is excluded by !**/*.png
  • src/assets/people/hugo0-with-bg.png is excluded by !**/*.png
  • src/assets/people/kkonrad-no-bg.png is excluded by !**/*.png
  • src/assets/people/kkonrad-with-bg.png is excluded by !**/*.png
  • src/assets/people/kofime-icon.jpeg is excluded by !**/*.jpeg
  • src/assets/people/konrad_cubism.jpg is excluded by !**/*.jpg
  • src/assets/people/mydas.jpg is excluded by !**/*.jpg
  • src/assets/people/orest.jpg is excluded by !**/*.jpg
  • src/assets/people/sbf.jpeg is excluded by !**/*.jpeg
  • src/assets/people/sharuk.png is excluded by !**/*.png
  • src/assets/redpacket/red-packet-naked.svg is excluded by !**/*.svg
  • src/assets/redpacket/red-packet.svg is 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 Cloud and Star assets 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_SVG export aligns with the PR's goal of cleaning up redundant assets. The single remaining export for BG_WALLET_CARD_SVG appears to be correct.

However, I noticed a discrepancy between the summary and the actual code: the summary mentioned that BG_WALLET_CARD_SVG is 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 tsx

Length 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_SVG and retention of BG_WALLET_CARD_SVG (exported from ./wallet-card-bg.svg) has been confirmed.
  • Verification via search scripts showed no lingering references to BG_SVG in the codebase.
  • Note that the summary’s mention of ./wallet-card.svg appears to be a documentation error—please update the summary if necessary for consistency.
redirects.json (1)

1-43: Well-structured redirect configuration

The 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 dispatch from 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 tsx

Length 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 dispatch in 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 uses dispatch but it has been removed from the dependency array.
  • While Redux’s dispatch is stable in practice, omitting it violates React’s exhaustive-deps rule.
  • Action: Please verify that the omission is intentional. Consider either:
    • Adding dispatch into 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-deps rule (the rule may be set elsewhere, e.g. in package.json). Please double-check the project’s ESLint settings for consistency.
src/config/wagmi.config.tsx (1)

31-31: Improved metadata with dynamic favicon URL

Good 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_URL is 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 imports

The 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 tsx

Length 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 of ThemeProvider has been removed in favor of a named export in src/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 .ts and .tsx files is provided above. Please run this script to manually verify that no default imports for ThemeProvider remain.

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 handleNext from the destructured values of useSetupFlow(), which is consistent with the dependency array change on line 49.


49-49: Simplified useEffect dependency array improves component behavior.

Removing handleNext from the dependency array is a good optimization since it's not used within the effect. This change prevents unnecessary effect re-runs when handleNext changes and focuses the effect on its actual data dependencies (address and user).

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 getRequestLink function correctly formats token amounts:

  1. The first case validates that trailing zeros are removed from '10.000000' to '10'
  2. 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 getRequestLink function.

src/app/[...recipient]/page.tsx (4)

33-33: Added component mount tracking for async operations.

The new isMounted flag 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 isMounted to false when the component unmounts, ensuring that any pending async operations won't continue trying to update state.


56-56: Added user to dependency array for proper effect re-triggering.

Including user in 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 recognizeQr function 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.each pattern 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 useUserStore hook enables proper user state management in this component.


24-25: Clean implementation of user state extraction.

The destructuring of user from 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 the WalletHeader is 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 fetchWithSentry import 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 tsx

Length 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 useClaimLink remain:

#!/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 isKernelClientReady dependency 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-analyzer and @size-limit/preset-app will 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 usePrimaryNameBatch from @justaname.id/react introduces 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:

  1. Uses useMemo to efficiently derive wallet addresses from the wallet objects
  2. Leverages the usePrimaryNameBatch hook with conditional enabling
  3. 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 WalletCard component 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 WalletCardWallet type has been correctly updated to include the required primaryName property, ensuring type safety throughout the component.


77-77: Component parameter updated for ENS support.

The ExistingWalletCard component has been modified to accept the primaryName prop, aligning with the type definition changes.


337-337: Function signature updated for ENS support.

The getWalletDisplayInfo function signature has been updated to require primaryName as 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 handleFileChange function 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 handleFileDelete function has been implemented, which:

  1. Prevents event propagation
  2. Clears file data from the attachment options
  3. 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:

  1. Group hover functionality to show/hide elements
  2. Visual feedback when hovering over uploaded files
  3. 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 EQrType always remain in sync with REGEXES_BY_TYPE.


62-79: Well-structured recognition logic.

The function recognizeQr is logically clear, covering checks for base URL, addresses, ENS names, and regex-based matches before defaulting to null.


86-131: Robust EIP-681 parsing.

The parseEip681 function 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 exports

The 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 PeanutGuyGIF in src/assets/illustrations/index.ts has been added, but our initial verification command encountered an error (unrecognized file type: tsx). It appears the ripgrep configuration isn’t recognizing the tsx file 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.

Comment on lines +21 to +28
const { primaryName } = usePrimaryName({
address,
priority: 'onChain',
})

if (primaryName) {
return primaryName
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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.

Suggested change
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!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ 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.

Suggested change
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.')
}

@jjramirezn jjramirezn merged commit b810fe4 into peanut-wallet Apr 7, 2025
5 checks passed
This was referenced Jul 15, 2025
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.

3 participants