-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
Issue Type: Bug / Code Correctness
Title: Fix missing error handling for unsupported network parameter in CdpClient.evm.sendTransaction
Description:
In the TypeScript CDP SDK (@coinbase/cdp-sdk), calling cdp.evm.sendTransaction({ …, network }) with an unsupported or mistyped network string (e.g., "ethereum" instead of "base-sepolia" or "base") currently results in a generic error or failed RPC call without a clear SDK-level validation. This can lead to cryptic errors during runtime and make it hard for developers to diagnose issues related to network configuration. :contentReference[oaicite:0]{index=0}
Expected behavior:
- If an unsupported or invalid network string is passed into
cdp.evm.sendTransaction(or related EVM methods), the SDK should validate the network parameter early. - The method should throw a clear and descriptive error (e.g.,
Unsupported network: ${network}) before attempting any RPC or API call. - The error message should list valid supported networks for quick reference.
Proposed solution:
- Add validation logic in the core EVM client wrapper before making API or RPC calls.
- Use a centralized list of supported networks (e.g., from the SDK’s configuration or a const enum).
- Update types so that
networkideally accepts only a union of valid network identifiers where possible. - Add unit tests verifying that invalid network values throw with clear messages.
Acceptance criteria:
- Passing an invalid network to
sendTransaction,requestFaucet,createAccount, etc., throws a descriptive SDK error. - Tests are added to cover incorrect network parameter usage.
- No breaking behavior for existing valid network calls.
Metadata
Metadata
Assignees
Labels
No labels