Skip to content

Conversation

jjramirezn
Copy link
Contributor

Also deleted AddressInput because it was not used anywhere

contributes to TASK-9432

Copy link

vercel bot commented May 23, 2025

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

Name Status Preview Comments Updated (UTC)
peanut-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 3:57pm

Copy link
Contributor

coderabbitai bot commented May 23, 2025

Caution

Review failed

The pull request is closed.

"""

Walkthrough

This change expands recipient input functionality by adding support for usernames alongside addresses, ENS, IBAN, and US identifiers. It updates type definitions, input validation logic, and placeholder texts to explicitly include usernames. The AddressInput component is removed, and recipient validation is consolidated in GeneralRecipientInput.

Changes

Files/Paths Change Summary
src/components/Claim/Link/Initial.view.tsx
src/components/Request/direct-request/views/Initial.direct.request.view.tsx
src/components/Withdraw/views/Initial.withdraw.view.tsx
Updated the placeholder text in GeneralRecipientInput from "Enter an address or ENS" to "Enter a username, an address or ENS". Removed related recipient type and validity state tracking in direct request view.
src/components/Global/AddressInput/index.tsx Deleted the AddressInput component, which provided debounced Ethereum/ENS input validation.
src/components/Global/GeneralRecipientInput/index.tsx Refactored recipient validation logic to use validateAndResolveRecipient, removed direct ENS validation, and expanded support for usernames. Enhanced error handling and updated recipient type logic. Trimmed input of base URL prefix before validation.
src/hooks/useRecentRecipients.ts Extended the RecentRecipient type union to include 'username' as a valid recipient type.
src/interfaces/interfaces.ts Added 'username' to the RecipientType type alias.
src/components/Global/GeneralRecipientInput/tests/GeneralRecipientInput.test.tsx
src/lib/validation/recipient.test.ts
src/lib/validation/recipient.ts
Updated tests to reflect new error messages and recipient type expectations related to username handling and ENS resolution error messages.
src/components/TransactionDetails/TransactionCard.tsx Reordered Tailwind CSS classes for the pending status pulsating dot element in the transaction card JSX.

Possibly related PRs

Suggested reviewers

  • jjramirezn
    """

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f23b398 and f1105b0.

📒 Files selected for processing (4)
  • src/components/Claim/Link/Initial.view.tsx (1 hunks)
  • src/components/Global/GeneralRecipientInput/index.tsx (4 hunks)
  • src/components/TransactionDetails/TransactionCard.tsx (1 hunks)
  • src/components/Withdraw/views/Initial.withdraw.view.tsx (1 hunks)
✨ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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 link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/components/Global/GeneralRecipientInput/index.tsx (1)

59-68: Consider providing more specific error messages.

The unified validation approach is clean, but the generic error message "Invalid address" on line 65 might be misleading when username validation fails. Consider using the error message from the caught exception or mapping error types to user-friendly messages.

-                } catch (error) {
-                    errorMessage.current = 'Invalid address'
-                    console.error('Error while validating recipient input field:', error)
-                    return false
+                } catch (error) {
+                    if (error instanceof Error) {
+                        errorMessage.current = error.message || 'Invalid recipient'
+                    } else {
+                        errorMessage.current = 'Invalid recipient'
+                    }
+                    console.error('Error while validating recipient input field:', error)
+                    return false
🧰 Tools
🪛 GitHub Actions: Tests

[error] 66-66: Error while validating recipient input field: RecipientValidationError: Invalid Peanut username


[error] 66-66: Error while validating recipient input field: RecipientValidationError: Invalid Ethereum address


[error] 66-66: Error while validating recipient input field: RecipientValidationError: Error resolving ENS name

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c037d09 and 595d3d7.

📒 Files selected for processing (7)
  • src/components/Claim/Link/Initial.view.tsx (1 hunks)
  • src/components/Global/AddressInput/index.tsx (0 hunks)
  • src/components/Global/GeneralRecipientInput/index.tsx (4 hunks)
  • src/components/Request/direct-request/views/Initial.direct.request.view.tsx (1 hunks)
  • src/components/Withdraw/views/Initial.withdraw.view.tsx (1 hunks)
  • src/hooks/useRecentRecipients.ts (1 hunks)
  • src/interfaces/interfaces.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • src/components/Global/AddressInput/index.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/components/Global/GeneralRecipientInput/index.tsx (2)
src/lib/validation/recipient.ts (1)
  • validateAndResolveRecipient (12-56)
src/interfaces/interfaces.ts (1)
  • RecipientType (4-4)
🪛 GitHub Actions: Tests
src/components/Global/GeneralRecipientInput/index.tsx

[error] 66-66: Error while validating recipient input field: RecipientValidationError: Invalid Peanut username


[error] 66-66: Error while validating recipient input field: RecipientValidationError: Invalid Ethereum address


[error] 66-66: Error while validating recipient input field: RecipientValidationError: Error resolving ENS name

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (5)
src/components/Claim/Link/Initial.view.tsx (1)

556-556: Consistent placeholder text update.

The placeholder text update is consistent with other components and clearly indicates username support.

src/components/Request/direct-request/views/Initial.direct.request.view.tsx (1)

155-155: Consistent placeholder text update with proper type integration.

The placeholder text update is consistent with other components and the component properly imports the updated RecipientType interface.

src/hooks/useRecentRecipients.ts (1)

8-8: LGTM! Type extension is clean and consistent.

The addition of 'username' to the RecentRecipient type union aligns with the PR objective and is consistent with the RecipientType definition in interfaces.ts.

src/components/Global/GeneralRecipientInput/index.tsx (2)

48-48: Good UX improvement for handling pasted URLs.

The addition of .replace(\${BASE_URL}/`, '')` handles cases where users paste full Peanut URLs instead of just the username/address, improving the user experience.


91-93: Correctly extended to handle username type.

The condition now properly includes both ENS and username types, ensuring that human-readable names are displayed while resolved addresses are used internally.

Copy link
Contributor

@kushagrasarathe kushagrasarathe left a comment

Choose a reason for hiding this comment

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

LFGGG 🚀

@kushagrasarathe
Copy link
Contributor

@jjramirezn resolve conflict before merging 🫡

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.

2 participants