Skip to content

Conversation

@tractorss
Copy link
Contributor

@tractorss tractorss commented Feb 7, 2025

PR-Codex overview

This PR introduces updates to the dependencies and modifies the wallet connection logic, replacing the @web3modal/wagmi library with @reown/appkit and related packages. It also updates the handling of supported chains and configuration for the wagmi library.

Detailed summary

  • Added @reown/appkit and @reown/appkit-adapter-wagmi dependencies.
  • Replaced useWeb3Modal with useAppKit in ConnectWallet component.
  • Updated SUPPORTED_CHAINS and QUERY_CHAINS to use AppKitNetwork.
  • Modified Web3Provider to utilize WagmiAdapter.
  • Updated viem and wagmi dependencies to newer versions.
  • Removed references to @web3modal/wagmi.
  • Updated various packages in yarn.lock to their latest versions.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features
    • Upgraded wallet connection flow offers a smoother, more responsive experience when accessing chain switching and modal activation.
  • Refactor
    • Streamlined network configuration and chain mapping for improved reliability.
  • Chore
    • Updated several underlying dependencies and removed deprecated integrations to enhance overall performance and stability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request migrates wallet connection and chain configuration to a new library. In package.json, new dependencies are added while some old ones are removed or updated. The ConnectWallet component now imports hooks from the new library, and chain types have shifted from Chain to AppKitNetwork. The Web3Provider has been reconfigured to use the new adapter and initialization method, with adjustments in functions handling chain IDs and transports.

Changes

Files Change Summary
web/package.json Added dependencies: "@reown/appkit" and "@reown/appkit-adapter-wagmi" (v^1.6.6). Removed "@web3modal/wagmi". Updated versions of "@tanstack/react-query", "viem", and "wagmi".
web/src/components/ConnectWallet/index.tsx Updated wallet connection imports and usage: switched from "useWeb3Modal" and "useWeb3ModalState" to "useAppKit" and "useAppKitState" from "@reown/appkit/react".
web/src/consts/chains.ts Changed type imports: Using AppKitNetwork from "@reown/appkit/networks", updated SUPPORTED_CHAINS and QUERY_CHAINS mapping.
web/src/context/Web3Provider.tsx Replaced @web3modal/wagmi integration with @reown/appkit; updated function parameter types, adjusted chains array to use AppKitNetwork; replaced createWeb3Modal with createAppKit and wagmiConfig with a new WagmiAdapter instance; expanded themeVariables and updated provider configuration.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant CW as ConnectWallet Component
    participant AK as AppKit (useAppKit)
    participant WP as Web3Provider (WagmiProvider)

    U->>CW: Clicks connect button
    CW->>AK: Calls open() to initiate wallet connection
    AK->>WP: Provides wallet configuration via WagmiAdapter
    WP-->>U: Updates UI with wallet connection status
Loading

Possibly related PRs

Suggested reviewers

  • kemuru
  • alcercu

Poem

I'm a rabbit, hopping near and far,
Updating dependencies like a shining star.
From old connections to fresh AppKit light,
I celebrate the changes with pure delight!
🐇 Keep on coding, day and night!
(^_^) Hop along, everything's all right!


🪧 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. (Beta)
  • @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 or @coderabbitai title 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.

@netlify
Copy link

netlify bot commented Feb 7, 2025

Deploy Preview for kleros-escrow-v2 ready!

Name Link
🔨 Latest commit 6a0d286
🔍 Latest deploy log https://app.netlify.com/sites/kleros-escrow-v2/deploys/67aa684d6039630008514d5e
😎 Deploy Preview https://deploy-preview-103--kleros-escrow-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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: 0

🧹 Nitpick comments (3)
web/src/context/Web3Provider.tsx (2)

18-18: Guard against invalid string chain IDs.

By allowing the chainId parameter to be a string, there's a risk that an unexpected string key might lead to undefined values in the alchemyToViemChain mapping. Consider adding a fallback or validation to avoid potential runtime issues.


52-53: High overlay z-index comment.

Comenting that the overlay is at 9999 is helpful context. Setting it to 10000 ensures it’s displayed above other modals. Just keep in mind potential stacking conflicts.

web/src/components/ConnectWallet/index.tsx (1)

33-34: Renamed destructured properties for clarity.

Destructuring { open } and the isOpen alias is straightforward. If you anticipate more modal states, consider clearer naming to avoid confusion.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f138274 and fe8a0b9.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • web/package.json (2 hunks)
  • web/src/components/ConnectWallet/index.tsx (2 hunks)
  • web/src/consts/chains.ts (1 hunks)
  • web/src/context/Web3Provider.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Redirect rules - kleros-escrow-v2
  • GitHub Check: Redirect rules - kleros-escrow-v2
  • GitHub Check: Header rules - kleros-escrow-v2
  • GitHub Check: Header rules - kleros-escrow-v2
  • GitHub Check: Pages changed - kleros-escrow-v2
  • GitHub Check: Pages changed - kleros-escrow-v2
🔇 Additional comments (15)
web/src/context/Web3Provider.tsx (6)

3-6: Smooth integration of new imports.

The newly introduced imports from "@reown/appkit" and the continued usage of "wagmi" appear consistent with the rest of the file. Nice job keeping them well-organized!


22-22: Fallback usage looks good.

Using fallback for HTTP and WebSocket transports is a robust way to ensure connectivity. Keep an eye on handling errors if any of the endpoints fail.


34-34: Typed chain array is clear.

Asserting the array type to “[AppKitNetwork, ...AppKitNetwork[]]” clarifies the chain definitions. This is a neat approach to ensure there's at least one network in the list.


38-40: Consider validating projectId.

When instantiating WagmiAdapter, ensure projectId is valid to avoid potential misconfigurations or UI issues if the environment variable is missing.


44-47: createAppKit initialization is well-structured.

The usage of adapters, networks, and a defaultNetwork nicely aligns with your new architecture. Great job organizing the code for scalability!


57-57: Switched to WagmiProvider with the new config.

Replacing the old config reference with “wagmiAdapter.wagmiConfig” aligns with your updated approach. Looks great!

web/src/consts/chains.ts (3)

1-2: Consistent type imports.

Importing both “Chain” from “viem” and “AppKitNetwork” from “@reown/appkit/networks” maintains compatibility. The approach is clear for bridging services that still rely on “Chain.”


9-11: Correct usage of AppKitNetwork in SUPPORTED_CHAINS.

Switching the record type to AppKitNetwork matches the new architecture. This ensures uniform configuration throughout the codebase.


14-17: QUERY_CHAINS successfully migrated.

Similarly, updating QUERY_CHAINS to use AppKitNetwork is consistent with the rest of the changes.

web/src/components/ConnectWallet/index.tsx (1)

3-3: Hooks swapped seamlessly.

Using “useAppKit” and “useAppKitState” from “@reown/appkit/react” replaces the previous web3modal approach nicely. Great job adopting the new library consistently!

web/package.json (5)

71-71: New Dependency Addition: @reown/appkit
The addition of "@reown/appkit": "^1.6.6" aligns with the migration to the new wallet connection library. Please ensure that its usage is consistently integrated across the codebase.


72-72: New Dependency Addition: @reown/appkit-adapter-wagmi
Including "@reown/appkit-adapter-wagmi": "^1.6.6" supports the new adapter setup for wallet connection functionality. Verify that provider configurations are updated accordingly.


75-75: Dependency Version Upgrade: @tanstack/react-query
The update to "@tanstack/react-query": "^5.66.0" ensures you benefit from recent bug fixes and performance improvements. Confirm that all components depending on this library work as expected with the upgrade.


102-102: Dependency Version Upgrade: viem
Upgrading "viem" to "^2.22.22" is in line with the migration effort and ensures compatibility with other updated dependencies. Validate that no breaking changes affect the chain configuration.


103-103: Dependency Version Upgrade: wagmi
The revision of "wagmi" to "^2.14.10" is essential for supporting the new wallet connection mechanisms provided by @Reown. Please double-check that integration with "@reown/appkit-adapter-wagmi" is seamless.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 7, 2025
@jaybuidl jaybuidl linked an issue Feb 10, 2025 that may be closed by this pull request
@jaybuidl jaybuidl merged commit 548a87b into master Feb 10, 2025
5 of 7 checks passed
@jaybuidl jaybuidl deleted the chore/migrate-to-reown branch February 10, 2025 21:02
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.

Migration from WalletConnect to Reown

3 participants