feat(contract_manager): migrate from web3.js to viem #3109
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
This PR migrates the
contract_manager
package from web3.js to viem, replacing all Web3 dependencies with viem's modern TypeScript-first API. The migration includes:EvmChain
class to use viem'screatePublicClient
andcreateWalletClient
getContract
with typed read/write methodsweb3
,web3-eth-contract
, and@types/web3
; retainedviem ^2.23.5
Rationale
This migration provides:
price_pusher
applicationHow has this been tested?
Build verification:
pnpm turbo build
- All 21 tasks successful including contract_manager compilationpnpm run fix:lint
- All linting errors resolvedpre-commit run --all-files
- Core TypeScript checks passedReview Focus Areas
🔴 Critical - Transaction Logic
estiamteAndSendTransaction
method signature changes don't break calling codedeploy
method works correctly with gas estimation and contract creation🟡 Important - Type Safety
eslint-disable-next-line
comments withas any
casts in contract methods🟡 Important - Script Compatibility
event.returnValues
toevent.args
- confirm this works across all contract typesencodeABI()
toencodeFunctionData()
- verify ABI compatibilityLink to Devin run: https://app.devin.ai/sessions/0ca65ffd62684f73ab3603e2d8fa75af
Requested by: Jayant ([email protected])