Skip to content

Add Viem v2 & Wagmi v2 packages, and remove Ethers dependency#303

Merged
aefhm merged 60 commits intomainfrom
CedarMist/client-refactor
Jul 30, 2024
Merged

Add Viem v2 & Wagmi v2 packages, and remove Ethers dependency#303
aefhm merged 60 commits intomainfrom
CedarMist/client-refactor

Conversation

@CedarMist
Copy link
Contributor

@CedarMist CedarMist commented Apr 24, 2024

Description

Add support for Viem v2 and Wagmi v2. Remove Ethers dependency.

Replaces #164

Details

  • Simplified sapphire-paratime dependencies

    • Removed ethers, this reduces bundled size significantly when used standalone or with Viem
    • Removed tweetnacl.js, extracted necessary functions into munacl.ts
    • Removed generic sapphire.wrap function, it now exposes wrapEthereumProvider which only wraps EIP-1193 compatible providers
  • Tests:

    • Removed many mock based tests, instead relying more heavily on integration tests to verify actual functionality
    • All CI tests run through a local RPC proxy (clients/js/scripts/proxy.ts) which will die if any unencrypted transactions, calls or gas estimates are made.
      • This ensures that the clients & integrations apply encryption consistently, and will prevent any regressions where encryption is accidentally broken.
  • Integrations:

    • Each SDK has its own integration package + tests
      • @oasisprotocol/sapphire-ethers-v6
      • @oasisprotocol/wagmi-v2
      • @oasisprotocol/viem-v2
  • Removed duplicate example projects (e.g. where two projects use the exact same underlying libraries)

    • Each example project also serves as an integration test
      • hardhat-viem (Hardhat + Viem)
      • onchain-signer (Hardhat + Ignition + Ethers v6)
      • hardhat-boilerplate (Hardhat + Ethers v5 + frontend & bundling)
      • wagmi-v2 (Wagmi + frontend & bundling)
      • wagmi-v1

@netlify
Copy link

netlify bot commented Apr 24, 2024

Deploy Preview for oasisprotocol-sapphire-paratime canceled.

Name Link
🔨 Latest commit d956ad7
🔍 Latest deploy log https://app.netlify.com/sites/oasisprotocol-sapphire-paratime/deploys/66a86876ff5f210008cbaece

@CedarMist CedarMist self-assigned this Apr 30, 2024
@CedarMist CedarMist added p:1 Priority: high dependencies Pull requests that update a dependency file js client docs Documentation javascript Pull requests that update JavaScript code labels Apr 30, 2024
@CedarMist CedarMist marked this pull request as ready for review April 30, 2024 09:41
@aefhm aefhm self-requested a review April 30, 2024 19:19
@CedarMist
Copy link
Contributor Author

CedarMist commented May 10, 2024

Feedback from Matevz

  • use @noble/curves rather than munacl.ts
  • need to double check that multiple signers in hardhat with ethers work
  • does walletconnect & rainbowkit etc, work on mobile?
  • wagmi v2 example encrypts the deployment transaction
    • we want unencrypted deployments, always?
  • pure viem-v2 example in integrations
  • tag current branch as 1.x / stable
  • new stuff goes as 2.x / beta?

@CedarMist CedarMist changed the title Cedar mist/client refactor Remove Ethers dependency from sapphire-paratime package, add viem v2 & wagmi v2 packages May 10, 2024
Copy link
Contributor

@aefhm aefhm left a comment

Choose a reason for hiding this comment

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

Comments cover client code. Will send notes on integrations next. Still need to QA as well.

@matevz
Copy link
Member

matevz commented May 13, 2024

* tag current branch as 1.x / stable
* new stuff goes as 2.x / beta?

Sleeping over this, I would name the stable branch as clients/js/1.3.x and keep the new refactored codebase inside the main branch. If we find anything worth fixing in the stable branch as well, then we backport the fix from main to clients/js/1.3.x. If the fix is solely for 1.3.x, then we just fix the issue on the branch directly.

Copy link
Contributor

@aefhm aefhm left a comment

Choose a reason for hiding this comment

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

I took a QA pass around examples and the Hardhat fork which worked great :)

Copy link
Contributor

@aefhm aefhm left a comment

Choose a reason for hiding this comment

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

I vote to merge, and we can iterate from there.

@aefhm aefhm mentioned this pull request Jun 25, 2024
4 tasks
@aefhm aefhm force-pushed the CedarMist/client-refactor branch from 5125cf5 to 1555cc0 Compare July 15, 2024 04:57
@aefhm aefhm changed the title Remove Ethers dependency from sapphire-paratime package, add viem v2 & wagmi v2 packages Add Viem v2 & Wagmi v2 packages, and remove Ethers dependency Jul 17, 2024
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

I tried the SIWE mechanism as an alternative to the signed queries that were removed in this PR. I can confirm the alternative is viable, so feel free to merge this.

@aefhm aefhm force-pushed the CedarMist/client-refactor branch from 1555cc0 to c1c060c Compare July 29, 2024 04:29
@aefhm aefhm enabled auto-merge July 29, 2024 04:32
@aefhm aefhm force-pushed the CedarMist/client-refactor branch 2 times, most recently from 153f1f9 to 4273653 Compare July 30, 2024 03:17
@aefhm aefhm force-pushed the CedarMist/client-refactor branch from 4273653 to 2a77f25 Compare July 30, 2024 03:32
@aefhm aefhm force-pushed the CedarMist/client-refactor branch from fa86469 to d956ad7 Compare July 30, 2024 04:13
@aefhm aefhm merged commit 2f4ce26 into main Jul 30, 2024
@aefhm aefhm deleted the CedarMist/client-refactor branch July 30, 2024 04:16
github-actions bot added a commit that referenced this pull request Jul 30, 2024
…darMist/client-refactor

Add Viem v2 & Wagmi v2 packages, and remove Ethers dependency 2f4ce26
github-actions bot added a commit that referenced this pull request Jul 30, 2024
…edarMist/client-refactor

Add Viem v2 & Wagmi v2 packages, and remove Ethers dependency 2f4ce26
@rube-de rube-de mentioned this pull request Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client dependencies Pull requests that update a dependency file docs Documentation javascript Pull requests that update JavaScript code p:1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants