-
Notifications
You must be signed in to change notification settings - Fork 48
feat(rln)!: generate contract types, migrate from ethers to viem #2705
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
Conversation
1fcf108 to
a88dd8c
Compare
size-limit report 📦
|
264f2c0 to
5ea574e
Compare
70922e5 to
7e5680f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the RLN package from ethers.js to viem for Ethereum interactions and introduces automated contract type generation using wagmi CLI. The changes enable type-safe contract interactions by generating TypeScript bindings directly from the smart contract ABIs.
Key changes:
- Replaced ethers.js with viem for all blockchain interactions
- Automated ABI generation via wagmi CLI from waku-rlnv2-contract repository
- Updated all contract interaction code to use viem's type-safe APIs
- Added new methods for querying merkle root and merkle proof directly from contracts
Reviewed Changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rln/wagmi.config.ts | Configures wagmi CLI to generate TypeScript bindings from Foundry contracts |
| packages/rln/src/contract/wagmi/generated.ts | Auto-generated type-safe contract ABIs (977 lines) |
| packages/rln/src/contract/rln_base_contract.ts | Migrated from ethers Contract to viem getContract with type-safe reads/writes |
| packages/rln/src/utils/walletClient.ts | New utility to create viem client from window.ethereum |
| packages/rln/src/types.ts | Updated to use viem WalletClient instead of ethers.Signer |
| packages/rln/generate_contract_abi.sh | Shell script to clone, build, and generate contract types |
| packages/rln/package.json | Removed ethers dependency, added viem and wagmi tooling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 21 out of 23 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
weboko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good first iteration
left comments in addition to Copilot's
and make sure you properly integrate it with release CI
93c152a to
e0c6a09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 21 out of 23 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
44ad556 to
8221064
Compare
0b90116 to
12d56f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 23 out of 25 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2b36cb2 to
4eb4978
Compare
4eb4978 to
354dc65
Compare
807439a to
f7c6831
Compare
55e2e02 to
d1e0074
Compare
Problem / Description
Previous to this, the ABIs for the contracts were manually added to the rln package (not clear how).
Additionally, code related to calling the contracts was not typed, so any breaking changes to the ABI would not be detected at compile time.
Solution
https://github.com/waku-org/waku-rlnv2-contractThe rest of the code has been updated to use viem, which provides clean and typesafe ways to interact with the smart contracts.
Also adds new methods that were introduced in latest contract changes, specifically the ability to query for merkle root and merkle proof for a commitment directly from the smart contract.
Notes
Checklist