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

Fix for the Alchemy URL and SIWE verification for ERC-1271 #1638

Merged
merged 2 commits into from
Jul 4, 2024

Conversation

jaybuidl
Copy link
Member

@jaybuidl jaybuidl commented Jul 1, 2024

Superseds #1642


PR-Codex overview

The focus of this PR is to update chain configurations and Alchemy API integration in various files.

Detailed summary

  • Added gnosis chain in chains.ts
  • Updated Alchemy API integration in authUser.ts
  • Added gnosis and sepolia chains in Web3Provider.tsx
  • Refactored chain URL generation functions in Web3Provider.tsx

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

Summary by CodeRabbit

  • New Features

    • Improved error messages when signer is invalid by including detailed error information.
    • Enhanced environment variable handling and provider initialization.
  • Refactor

    • Updated chain support to include Gnosis in query constants.
    • Refactored Web3 provider configuration to handle different chains based on deployment status.

Copy link
Contributor

coderabbitai bot commented Jul 1, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The recent update enhances error handling and provider initialization in the authUser function by incorporating additional error information, environment variable management, and new imports. Chain support improvements were made in chains.ts and Web3Provider.tsx by including additional chains and refining transport handling based on environment status.

Changes

File Change Summary
web/netlify/functions/authUser.ts Improved error message with additional error details, added imports for ethers and getDefaultChainRpcUrl
web/src/consts/chains.ts Included gnosis in imported chains and added to QUERY_CHAINS constant
web/src/context/Web3Provider.tsx Added chain imports, refined alchemyApiKey, introduced isProduction, and updated chain handling logic

Sequence Diagram

sequenceDiagram
    participant User
    participant authUser
    participant ethers
    participant Web3Provider

    User->>+authUser: Call authUser
    authUser->>+ethers: Import
    authUser->>+Web3Provider: getDefaultChainRpcUrl
    authUser->>-User: Return Response
Loading

Poem

In code, we've made some changes bright,
With ethers' help and RPC light,
Gnosis joins the chain delight,
Error details now in sight,
Production or not, our code's just right.
🌟🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

netlify bot commented Jul 1, 2024

Deploy Preview for kleros-v2 ready!

Name Link
🔨 Latest commit 11f5ace
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2/deploys/6686d20b56030e00096d35ec
😎 Deploy Preview https://deploy-preview-1638--kleros-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

netlify bot commented Jul 1, 2024

Deploy Preview for kleros-v2-university ready!

Name Link
🔨 Latest commit 11f5ace
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-university/deploys/6686d20b430b8a000848b2e8
😎 Deploy Preview https://deploy-preview-1638--kleros-v2-university.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

netlify bot commented Jul 1, 2024

Deploy Preview for kleros-v2-neo ready!

Name Link
🔨 Latest commit 11f5ace
🔍 Latest deploy log https://app.netlify.com/sites/kleros-v2-neo/deploys/6686d20b21664a00082132b4
😎 Deploy Preview https://deploy-preview-1638--kleros-v2-neo.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

Outside diff range and nitpick comments (1)
web/netlify/functions/authUser.ts (1)

Line range hint 98-99: Consider adding detailed logging in the catch block.

Adding detailed logging can help with debugging and monitoring.

-  return { statusCode: 500, body: JSON.stringify({ message: `${err}` }) };
+  console.error("Error in authUser function:", err);
+  return { statusCode: 500, body: JSON.stringify({ message: `${err.message}`, error: err }) };
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 288a281 and 8db03dd.

Files selected for processing (1)
  • web/netlify/functions/authUser.ts (1 hunks)
Additional comments not posted (1)
web/netlify/functions/authUser.ts (1)

78-78: Enhanced error handling is a good practice.

The addition of JSON.stringify(err) to the error message provides more context for debugging.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 1, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8db03dd and bfac925.

Files selected for processing (3)
  • web/netlify/functions/authUser.ts (2 hunks)
  • web/src/consts/chains.ts (1 hunks)
  • web/src/context/Web3Provider.tsx (1 hunks)
Additional comments not posted (10)
web/src/consts/chains.ts (2)

16-16: LGTM!

The addition of gnosis to the QUERY_CHAINS constant is correct.


2-2: Verify the correctness of the gnosis import.

Ensure that the gnosis chain is correctly imported from viem/chains.

web/src/context/Web3Provider.tsx (6)

14-14: LGTM!

The change in the scope of the alchemyApiKey variable to local is correct.


15-15: LGTM!

The introduction of the isProduction variable is correct.


19-23: LGTM!

The update to the alchemyToViemChain mapping object is correct.


26-27: LGTM!

The change to the alchemyURL function signature is correct.


33-47: LGTM!

The modifications to the getTransports function are correct.


6-6: Verify the correctness of the gnosis and sepolia imports.

Ensure that the gnosis and sepolia chains are correctly imported from wagmi/chains.

web/netlify/functions/authUser.ts (2)

4-4: LGTM!

The addition of the ethers import is correct.


78-82: LGTM!

The enhancement to the error message for an invalid signer is correct.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 3, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bfac925 and 2c27441.

Files selected for processing (2)
  • web/netlify/functions/authUser.ts (2 hunks)
  • web/src/context/Web3Provider.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • web/netlify/functions/authUser.ts
  • web/src/context/Web3Provider.tsx

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 4, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2c27441 and f50156e.

Files selected for processing (1)
  • web/netlify/functions/authUser.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/netlify/functions/authUser.ts

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 4, 2024
@jaybuidl jaybuidl added Type: Bug 🐛 Package: Web Court web frontend labels Jul 4, 2024
@jaybuidl jaybuidl changed the title ERC1271 debugging Fix for the Alchemy URL and SIWE verification for ERC-1271 Jul 4, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f50156e and 0c7c5d0.

Files selected for processing (3)
  • web/netlify/functions/authUser.ts (2 hunks)
  • web/src/consts/chains.ts (1 hunks)
  • web/src/context/Web3Provider.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • web/netlify/functions/authUser.ts
  • web/src/consts/chains.ts
  • web/src/context/Web3Provider.tsx

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 4, 2024
Copy link

codeclimate bot commented Jul 4, 2024

Code Climate has analyzed commit 11f5ace and detected 0 issues on this pull request.

View more on Code Climate.

Copy link

sonarqubecloud bot commented Jul 4, 2024

@jaybuidl jaybuidl marked this pull request as ready for review July 4, 2024 16:59
@jaybuidl jaybuidl merged commit b5d6c95 into dev Jul 4, 2024
21 of 22 checks passed
@jaybuidl jaybuidl deleted the fix/siwe-debug branch July 4, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Smart Contract Accounts support via ERC-1271
1 participant