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_managerpackage from web3.js to viem, replacing all Web3 dependencies with viem's modern TypeScript-first API. The migration includes:EvmChainclass to use viem'screatePublicClientandcreateWalletClientgetContractwith typed read/write methodsweb3,web3-eth-contract, and@types/web3; retainedviem ^2.23.5Rationale
This migration provides:
price_pusherapplicationHow 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
estiamteAndSendTransactionmethod signature changes don't break calling codedeploymethod works correctly with gas estimation and contract creation🟡 Important - Type Safety
eslint-disable-next-linecomments withas anycasts in contract methods🟡 Important - Script Compatibility
event.returnValuestoevent.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])