kleros-v2 icon indicating copy to clipboard operation
kleros-v2 copied to clipboard

Feat(web): Migrate to wagmi V2

Open alcercu opened this issue 1 year ago • 6 comments

Creating the PR as draft since I get a building error: @parcel/core: Failed to resolve '@wagmi/core/codegen' from ./node_modules/wagmi/dist/esm/exports/codegen.js @parcel/resolver-default: Cannot load file './codegen' from module '@wagmi/core'


PR-Codex overview

This PR updates dependencies, refactors contract-related hooks, and improves query handling for better integration with external services.

Detailed summary

  • Updated dependencies for @wagmi/cli to version 2.0.3
  • Refactored contract-related hooks for better functionality
  • Improved query handling for enhanced integration with external services

The following files were skipped due to too many changes: web/src/components/Popup/Description/StakeWithdraw.tsx, web/src/consts/chains.ts, web/package.json, web/src/hooks/useIsCrossChainDispute.ts, web/src/components/Verdict/FinalDecision.tsx, web/src/hooks/queries/usePopulatedDisputeData.ts, web/src/components/ConnectWallet/AccountDisplay.tsx, web/src/pages/Resolver/Parameters/Jurors.tsx, web/src/pages/Cases/CaseDetails/Voting/Classic/Vote.tsx, web/src/hooks/useVotingContext.tsx, web/src/pages/Resolver/Parameters/NotablePersons/PersonFields.tsx, web/src/pages/Courts/CourtDetails/StakePanel/InputDisplay.tsx, web/src/pages/Cases/CaseDetails/Voting/Classic/Commit.tsx, web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx, web/src/components/ConnectWallet/index.tsx, web/src/pages/Resolver/NavigationButtons/SubmitDisputeButton.tsx, web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx, web/src/components/ClaimPnkButton.tsx, web/src/pages/Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx, web/src/context/Web3Provider.tsx, web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx, yarn.lock

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

alcercu avatar Jan 16 '24 12:01 alcercu

Deploy Preview for kleros-v2 ready!

Name Link
Latest commit e542b4a8654b9bf5c4f40460acaf64f0e5cdbe6d
Latest deploy log https://app.netlify.com/sites/kleros-v2/deploys/666854252b0fae0008e73522
Deploy Preview https://deploy-preview-1417--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.

netlify[bot] avatar Jan 16 '24 12:01 netlify[bot]

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

18 New issues
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jan 18 '24 15:01 sonarqubecloud[bot]

Deploy Preview for kleros-v2-neo ready!

Name Link
Latest commit e542b4a8654b9bf5c4f40460acaf64f0e5cdbe6d
Latest deploy log https://app.netlify.com/sites/kleros-v2-neo/deploys/66685425443cbd00089136b1
Deploy Preview https://deploy-preview-1417--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.

netlify[bot] avatar Apr 12 '24 09:04 netlify[bot]

Deploy Preview for kleros-v2-university ready!

Name Link
Latest commit e542b4a8654b9bf5c4f40460acaf64f0e5cdbe6d
Latest deploy log https://app.netlify.com/sites/kleros-v2-university/deploys/666854252199ba0008215897
Deploy Preview https://deploy-preview-1417--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.

netlify[bot] avatar Apr 12 '24 09:04 netlify[bot]

Update from @alcercu: We need check the proper way to implement a replacement of the (now deprecated) watch: true option for queries. Basically triggering query revalidation every X blocks on the queries with values that change often (balances, stakes, etc.)

jaybuidl avatar May 15 '24 14:05 jaybuidl

[!IMPORTANT]

Review skipped

Auto reviews are limited to specific labels.

Labels to auto review (1)
  • dependencies

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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


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.

coderabbitai[bot] avatar May 28 '24 14:05 coderabbitai[bot]

let's delete all references to parcel

image

the @tractors/lifi-sdk-parcel is something we need for now, will test if vite works with the original lifi-sdk and we can change that then

Harman-singh-waraich avatar May 30 '24 14:05 Harman-singh-waraich

related to the SDK, the data Mappings in the Dev section does not seem to work correctly, I compared the same input with the "dev" branch (renders in dev branch)

image

template and mappings I used:

template:

{
  "$schema": "../NewDisputeTemplate.schema.json",
  "title": "{{title}}", 
  "description": "{{description}}", 
  "question": "Which party abided by the terms of the contract?",
  "answers": [
    {
      "title": "Refund the Buyer",
      "description": "Select this to return the funds to the Buyer."
    },
    {
      "title": "Pay the Seller",
      "description": "Select this to release the funds to the Seller."
    }
  ],
  "policyURI": "/ipfs/XxxxxXXX/escrow-general-policy.pdf", 
  "attachment": { 
    "label": "Transaction Terms",
    "uri": "{{extraDescriptionUri}}"
  },
  "frontendUrl": "https://escrow-v2.kleros.builders/#/myTransactions/%s/overview", 
  "arbitrableChainID": "421614",
  "arbitrableAddress": "0x??", 
  "arbitratorChainID": "421614",
  "arbitratorAddress": "0x??", 
  "metadata": {
    "buyer": "{{buyer}}",
    "seller": "{{seller}}",
    "amount": "{{amount}}",
    "currency": "{{currency}}",
    "deadline": "{{deadline}}",
    "transactionUri": "{{transactionUri}}" 
  },
  "category": "Escrow",
  "specification": "KIPXXX",
  "aliases": {
    "Buyer": "{{buyer}}",
    "Seller": "{{seller}}"
  },
  "version": "1.0"
}

mappings:

[
  {
    "type": "graphql",
    "endpoint": "https://api.studio.thegraph.com/query/61738/escrow-v2-devnet/version/latest",
    "query": "query GetTransaction($transactionId: ID!) { escrow(id: $transactionId) { transactionUri buyer seller amount token deadline } }",
    "variables": {
      "transactionId": "{{externalDisputeID}}"
    },
    "seek": ["escrow.transactionUri", "escrow.buyer", "escrow.seller", "escrow.amount", "escrow.token", "escrow.deadline"],
    "populate": ["transactionUri", "address", "sendingRecipientAddress", "amount", "token", "deadline"]
  },
  {
    "type": "fetch/ipfs/json",
    "ipfsUri": "{{transactionUri}}",
    "seek": ["title", "description", "extraDescriptionUri"],
    "populate": ["escrowTitle", "deliverableText", "extraDescriptionUri"]
  }
]

and externalDisputeID being 23

kemuru avatar May 30 '24 17:05 kemuru

Wallet logos are not loading in lifi sdk, load perfectly on dev branch

Functionality is fine, swapping works perfectly.

Screenshot 2024-05-31 at 12 02 34 PM

Harman-singh-waraich avatar May 31 '24 06:05 Harman-singh-waraich

ENS names not loading in case overview

Screenshot 2024-05-31 at 12 13 57 PM

Harman-singh-waraich avatar May 31 '24 06:05 Harman-singh-waraich

Missing Dapp guide icon Screenshot 2024-05-31 at 12 28 37 PM

Harman-singh-waraich avatar May 31 '24 09:05 Harman-singh-waraich

Code Climate has analyzed commit e542b4a8 and detected 22 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 5
Style 17

View more on Code Climate.

codeclimate[bot] avatar Jun 11 '24 13:06 codeclimate[bot]