Repository navigation
Feat/migrate wallet library - #300
Merged
Merged
Conversation
…der a codegen script.
…sts from ethers to viem.
…p the ethers provider.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Coverage Report for CI Build 39409688171Coverage increased (+2.2%) to 68.596%Details
Uncovered Changes
Coverage Regressions7 previously-covered lines in 6 files lost coverage.
Coverage Stats
💛 - Coveralls |
tuler
approved these changes
Oct 20, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@web3-onboard/*has had no release since Dec 2024 and nobody ships fixes for it. Also,ethersv5 is a legacy branch that carries the unpatchableellipticadvisory;eth-chainsserves 2023 chain data;eth-rpc-errorswas renamed upstream.One migration closes all four audit findings. No user-facing changes beyond the connect modal, which is now RainbowKit's.
Changes:
Wallet layer —
src/components/wallet/is the only place that imports RainbowKit and wagmi; the rest of the app keeps consuminguseWallet(), which now exposes viem clients instead of an ethers provider.connect button → RainbowKit modal → wagmi connector →
useWallet()→ services (viem)Wallets: MetaMask, WalletConnect (Ledger Live, Rainbow, Trust), Base and Safe, which connects automatically when the explorer is opened as a Safe App.
Contracts on viem — ABIs and deployment addresses are generated from the
@cartesicontract packages by@wagmi/cliinto a gitignored file:pnpm codegen=run-p chakra-types gen:abi→src/services/contracts/generated.ts→useContract()→read.*/write.*dev,buildand both CI workflows runcodegenfirst. Writes are simulated before signing, so a revert surfaces with the contract's reason before the wallet opens, as the previous gas estimation did.ethersand@cartesi/*become devDependencies used only by the generator. I added an ESLint rules rejects importing them fromsrc/.Numbers —
BigNumber→bigint;FixedNumberdivisions (rates, shares, percentages) →ratio()insrc/utils/bigint.ts. Characterization tests captured from the ethers implementation pin the reward and pool-balance maths.Server ENS — avatar lookups go through viem's universal resolver (one
eth_call); benchmarked at ~70 ms vs ~320 ms for the ethers path on the same RPC, identical results.@rainbow-me/rainbowkit,wagmi,viem,@tanstack/react-query,@wagmi/cli@web3-onboard/*(7),eth-chains,eth-rpc-errors,@ethersproject/*, direct@safe-global/*ethers,@cartesi/*Notable finding
RainbowKit 2 pins wagmi to the 2.x line, which froze when wagmi 3 shipped (Nov 2025), so the bundled WalletConnect and MetaMask SDK versions move only when RainbowKit adds wagmi 3 support. Accepted trade-off;
overridesinpnpm-workspace.yamlpin the patched minors of the transitive advisories that tree brings (ws,h3,picomatch,preact,defu,bn.js,uuid,form-data,decode-uri-component) andqrto~0.5.5, whichcuer@0.0.3(pinned by RainbowKit) needs until RainbowKit shipscuer@0.0.4.Notes
next.config.jsexternalises@coinbase/cdp-sdkon the server: it imports optional@x402/*peers that Turbopack otherwise tries to resolve.Contract<T>insrc/services/contracts/index.tsspells out the ABI-typedread/writesurface because viem'sGetContractReturnTypeonly resolves understrictNullChecks, which this project does not enable.src/services/contracts/localhost.jsonstays: it is the only source of the chain-31337 addresses for the generator.