Repository navigation
Switch to viem - #584
Open
sirpy wants to merge 18 commits into
Open
Switch to viem#584sirpy wants to merge 18 commits into
sirpy wants to merge 18 commits into
Conversation
Contributor
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unbounded retries on insufficient funds can stall staking operations, while unsafe post-broadcast lock release can corrupt nonce reservations and allow duplicate-nonce submissions.
7 open issues
Avoid resetting nonce queue after releasing the lock · New Stop retrying unchanged insufficient-funds transactions · New Honor configured WebSocket providers when creating clients · New Recognize viem receipt timeouts in staking recovery · New Normalize bigint fields in returned receipts · New Convert decoded event count before slicing · New Treat missing transaction receipts as retryable · New
What changed in this PR
Migrates the server’s blockchain wallet infrastructure from Web3.js to viem, using GoodWidget’s fallback clients while retaining KMS signing and queued transaction workflows.
Changes:
- Adds configurable HTTP RPC fallbacks and Chainlist discovery.
- Migrates wallet, contract, staking, and event operations to viem APIs.
- Updates transaction handling, tests, documentation, dependencies, and lint rules.
| File | Description |
|---|---|
src/server/verification/verificationAPI.js |
Uses viem contract addresses and expands request logging. |
src/server/utils/helpers.js |
Applies formatting-only changes. |
src/server/storage/cron/CleanupAbandonedSignups.js |
Reformats the cleanup query without changing behavior. |
src/server/goodid/veramo.js |
Retrieves signing accounts from the migrated wallet model. |
src/server/blockchain/Web3Wallet.js |
Implements viem clients, contract operations, and transaction submission. |
src/server/blockchain/stakingModelTasksV2.js |
Migrates staking and fishing operations to viem. |
src/server/blockchain/stakingModelTasksOld.js |
Migrates legacy staking and fishing operations to viem. |
src/server/blockchain/MultiWallet.js |
Uses viem contract addresses for chain filtering. |
src/server/blockchain/BaseAdminWallet.js |
Migrates faucet setup and reads to viem. |
src/server/blockchain/AdminWallet.js |
Migrates mainnet clients and transaction handling. |
src/server/blockchain/__tests__/viemWallet.test.js |
Adds fallback, signing, receipt, and nonce tests. |
src/server/blockchain/__tests__/stakingModelManager.test.js |
Updates staking tests for viem interfaces. |
src/server/blockchain/__tests__/fishManager.test.js |
Updates fishing tests for viem interfaces. |
src/server/blockchain/__tests__/baseWallet.test.js |
Updates contract-address assertions. |
src/server/blockchain/__tests__/adminWalletKMS.test.js |
Migrates KMS transaction checks and removes the custom WETH test. |
src/server/blockchain/__tests__/adminWallet.test.js |
Updates wallet reads and bigint assertions. |
README.md |
Documents viem usage, RPC behavior, and wallet testing. |
package.json |
Adds viem and GoodWidget dependencies. |
.eslintrc |
Adjusts import validation for the new dependencies. |
Review effort: Balanced
Convert bigint values to strings in transaction receipt. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
This branch has not been 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.


Description
Switch wallet to viem with fallback rpcs from chainlist use @goodwidget/core createviemfallbackclient
Summary by Sourcery
Migrate blockchain wallet operations from Web3 to viem with resilient RPC fallbacks while preserving local and KMS transaction workflows.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests: