-
Notifications
You must be signed in to change notification settings - Fork 2
zerodev api v3 support #15
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
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thank you so much to taking care of it! |
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 adds support for the Zerodev API v3 by fetching supported chains dynamically, updating RPC endpoints and verification flows, and introducing a new chainOption filter in CLI commands.
- Replaced static chain definitions with an async
getSupportedChainsfetch from the Zerodev API v3. - Updated
processAndValidateChainsto be async, acceptchainOption, and returnZerodevChainobjects. - Adjusted client RPC URLs (bundler and paymaster) to v3 paths and updated deploy/verify actions to use the new chain model.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/deployContract.test.ts | Updated tests for async processAndValidateChains and added a basic getSupportedChains test. |
| src/utils/validate.ts | Made processAndValidateChains async, added chainOption, and changed return type to ZerodevChain[]. |
| src/constant.ts | Removed hard-coded chain list; implemented dynamic fetching of chains and project-specific filtering. |
| src/command/index.ts | Made CLI commands async, updated chain display coloring, and wired chainOption into processAndValidateChains. |
| src/clients/index.ts | Updated getZeroDevBundlerRPC and getZeroDevPaymasterRPC to use v3 endpoints. |
| src/clients/createKernelClient.ts | Updated RPC and paymaster URLs to v3 and adapted createPublicClient for the new ZerodevChain. |
| src/action/verifyContracts.ts | Switched to explorerAPI, removed old Etherscan key logic, and added error-exit on any failed verification. |
| src/action/findDeployment.ts | Migrated to ZerodevChain, but updated createPublicClient transport call. |
| src/action/deployContracts.ts | Updated to v3 RPC, added receipt awaits, and fail-fast logic on deployment errors. |
| package.json, README.md, CHANGELOG.md, .env.example | Bumped version/deps, updated docs for ZERODEV_API_KEY/ZERODEV_PROJECT_ID. |
Comments suppressed due to low confidence (2)
test/deployContract.test.ts:45
- [nitpick] Test for getSupportedChains only checks that the return value is defined; consider asserting that
chainshas expected entries (e.g., non-empty array or contains specific chain names) to improve test coverage.
expect(chains).toBeDefined();
src/clients/index.ts:15
- getZeroDevPaymasterRPC constructs the same endpoint as getZeroDevBundlerRPC, but the paymaster path should likely be
/api/v3/{projectId}/paymaster/{chainId}or similar. Please verify and correct the paymaster endpoint.
let rpc = `https://rpc.zerodev.app/api/v3/${process.env.ZERODEV_PROJECT_ID}/chain/${chainId}`
| createPublicClient({ | ||
| transport: http(getZeroDevBundlerRPC(chain.projectId)) | ||
| chain: chain, | ||
| transport: http() |
Copilot
AI
Jun 4, 2025
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.
In createPublicClient call inside findDeployment, http() is invoked without providing the RPC URL. It should use the chain's RPC URL, for example: transport: http(chain.rpcUrls.default.http[0]).
| transport: http() | |
| transport: http(chain.rpcUrls.default.http[0]) |
| chain: chain.viemChainObject, | ||
| transport: http(getZeroDevBundlerRPC(chain.projectId)) | ||
| chain: chain, | ||
| transport: http() |
Copilot
AI
Jun 4, 2025
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.
createPublicClient is configured with http() without a URL; it should be provided with the chain's RPC URL, e.g., transport: http(chain.rpcUrls.default.http[0]).
| transport: http() | |
| transport: http(chain.rpcUrls.default.http[0]) |
| chains = chainNames | ||
| .map((chainName) => | ||
| supportedChains.find( | ||
| (chain) => | ||
| chain.name.toLowerCase() === chainName.toLowerCase() | ||
| ) | ||
| ) | ||
| .filter((chain) => chain !== undefined) |
Copilot
AI
Jun 4, 2025
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.
[nitpick] Specified chain names that don't match any supported chains are silently dropped. It may be better to report an error or warning if a chainOption entry is not found to avoid silent misconfiguration.
| chains = chainNames | |
| .map((chainName) => | |
| supportedChains.find( | |
| (chain) => | |
| chain.name.toLowerCase() === chainName.toLowerCase() | |
| ) | |
| ) | |
| .filter((chain) => chain !== undefined) | |
| const matchedChains = chainNames | |
| .map((chainName) => { | |
| const matchedChain = supportedChains.find( | |
| (chain) => | |
| chain.name.toLowerCase() === chainName.toLowerCase() | |
| ) | |
| if (!matchedChain) { | |
| console.warn(`Warning: Chain name "${chainName}" is not supported and will be ignored.`) | |
| } | |
| return matchedChain | |
| }) | |
| chains = matchedChains.filter((chain) => chain !== undefined) |
now uses
ZERODEV_API_KEYandZERODEV_PROJECT_IDto cover all supported networks