Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add keplr wallet #901 #906

Merged
merged 3 commits into from
Oct 25, 2024

Conversation

anonfedora
Copy link
Contributor

@anonfedora anonfedora commented Oct 25, 2024

Feature

Add keplr wallet following the method we used here

Add keplr wallet #901

  • Feature

Resolves: #NA

Summary by CodeRabbit

  • New Features
    • Added support for the Keplr wallet, enhancing connectivity options for users.

Copy link

vercel bot commented Oct 25, 2024

@anonfedora is attempting to deploy a commit to the LFG Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Oct 25, 2024

Walkthrough

The changes introduce a new InjectedConnector for the "Keplr" wallet to the availableConnectors array in the app/provider.tsx file. This addition enables the application to support the Keplr wallet alongside existing connectors. The new connector is configured with specific options, including its ID and name. No other modifications to the logic or error handling are included.

Changes

File Change Summary
app/provider.tsx Added InjectedConnector for "Keplr" to availableConnectors array with options for ID and name.

Possibly related issues


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 866c9a1 and b70f5b2.

📒 Files selected for processing (1)
  • app/provider.tsx (1 hunks)
🔇 Additional comments (3)
app/provider.tsx (3)

52-52: LGTM!

The added spacing improves readability by visually separating different connector groups.


52-53: Ensure comprehensive testing of wallet integration.

Since this is a critical feature affecting the application's wallet connection flow, please ensure:

  1. End-to-end testing of the connection flow
  2. Verification of wallet detection and availability
  3. Testing of connection/disconnection scenarios
  4. Cross-browser compatibility testing

Let's check for existing test patterns:

#!/bin/bash
# Search for wallet connector tests
fd -e test.tsx -e test.ts -e spec.tsx -e spec.ts | xargs rg -l "InjectedConnector"

53-53: Verify Keplr wallet configuration completeness.

While the basic integration follows the existing pattern, consider the following points:

  1. Chain Support: Other connectors (e.g., Argent Mobile) include chain-specific configurations. Verify if Keplr requires similar network validation.
  2. Error Handling: Consider adding checks for wallet availability.
  3. Documentation: Add comments about supported networks and requirements.

Let's verify the Keplr wallet implementation in similar projects:

Consider this enhanced implementation:

+ // Keplr wallet connector - Supports Mainnet and Testnet
  new InjectedConnector({ 
    options: { 
      id: "keplr", 
      name: "Keplr",
+     shimDisconnect: true,
+     chainId: getCurrentNetwork() === "TESTNET" ? constants.NetworkName.SN_SEPOLIA : constants.NetworkName.SN_MAIN
    } 
  })
✅ Verification successful

Let's analyze the wallet implementation patterns and chain configurations in the codebase to make an informed decision about the Keplr integration.


Based on the search results, I can see that:

  1. The Keplr wallet is implemented similarly to other injected connectors (Braavos and Argent X) with basic configuration
  2. The codebase shows chain validation in the navbar component using account.getChainId() for network validation
  3. Other wallet connectors like ArgentMobile include chain-specific configurations

Let's verify if there are any Keplr-specific configurations or error handling:


Based on the search results, I can now provide a final response as we have sufficient evidence about the network validation patterns and chain configurations in the codebase:

Keplr wallet configuration is consistent with codebase patterns

The current implementation aligns with the codebase's architecture:

  • Network validation is handled globally through account.getChainId() in the navbar component
  • Chain-specific configurations are managed through constants (NetworkName.SN_MAIN, StarknetChainId)
  • Error handling for wallet availability and network mismatches is implemented at the UI layer

The basic configuration is sufficient as:

  1. Network validation is handled by the existing infrastructure
  2. Wallet availability checks are implemented at the connection layer
  3. Chain support follows the same pattern as other injected connectors
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for Keplr wallet implementations to verify standard configuration patterns
rg -A 10 "new InjectedConnector.*keplr" 
rg -A 5 "chainId.*keplr"

Length of output: 193


Script:

#!/bin/bash
# Let's search for any Keplr-related configurations or implementations
rg -i "keplr" -A 5 -B 5

# Search for other InjectedConnector configurations for comparison
rg "new InjectedConnector" -A 5 -B 2

# Look for any chain configuration patterns
rg "chainId|networkId" -A 3 -B 3

# Search for wallet-related types or interfaces
ast-grep --pattern 'interface $_ {
  $$$
}'

Length of output: 23997


Script:

#!/bin/bash
# Search for any Keplr-related error handling or network checks
rg -i "keplr.*error|error.*keplr" -A 5 -B 5

# Look for wallet availability checks
ast-grep --pattern 'if ($$$window$$$) {
  $$$
}'

# Search for any network validation patterns
rg "StarknetChainId|NetworkName" -A 3 -B 3

Length of output: 1531


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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 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

vercel bot commented Oct 25, 2024

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

Name Status Preview Comments Updated (UTC)
starknet-quest ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 1:21pm

Copy link
Contributor

@fricoben fricoben left a comment

Choose a reason for hiding this comment

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

lgtm

@fricoben fricoben merged commit 286d3f1 into lfglabs-dev:testnet Oct 25, 2024
0 of 3 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 26, 2024
8 tasks
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