Skip to content

Conversation

@0x402ai
Copy link

@0x402ai 0x402ai commented Oct 31, 2025

Refactor X402Config to use network-keyed configuration for both EVM and SVM

  • Replace flat SvmConfig with network-mapped types SvmConfig and EvmConfig (Partial<Record<Network, ...>>).
  • Extend X402Config to expose svmConfig?: SvmConfig and evmConfig?: EvmConfig.
  • Update all usages and tests to the new nested structure.
  • API surface changes (applies to createSvmConnectedClient and other similar functions):
    • network: stringnetwork: Network for stronger parameter constraints and improved IDE hints.
    • rename parameter configx402Config (type unchanged).
  • Commented out iotexTestnet in typescript/packages/x402/src/types/shared/evm/wallet.ts since it doesn’t exist in the supported networks.

Migration note: read RPC URLs from x402Config?.svmConfig?.[network]?.rpcUrl or x402Config?.evmConfig?.[network]?.rpcUrl.

Example:

const x402Config: X402Config = {
  svmConfig: { solana: { rpcUrl: "https://api.mainnet-beta.solana.com" } },
  evmConfig:  { base:   { rpcUrl: "https://mainnet.base.org" } },
};

Description

Tests

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits

…nd SVM.

* Replace flat `SvmConfig` with network-mapped types `SvmConfig` and `EvmConfig` (`Partial<Record<Network, ...>>`).
* Extend `X402Config` to expose `svmConfig?: SvmConfig` and `evmConfig?: EvmConfig`.
* Update all usages and tests to the new nested structure.
* API surface changes (applies to `createSvmConnectedClient` and other similar functions):
  * `network: string` → `network: Network` for stronger parameter constraints and improved IDE hints.
  * rename parameter `config` → `x402Config` (type unchanged).
* Commented out iotexTestnet in typescript/packages/x402/src/types/shared/evm/wallet.ts since it doesn’t exist in the supported networks.

Migration note: read RPC URLs from `x402Config?.svmConfig?.[network]?.rpcUrl` or `x402Config?.evmConfig?.[network]?.rpcUrl`.

Example:

```ts
const x402Config: X402Config = {
  svmConfig: { solana: { rpcUrl: "https://api.mainnet-beta.solana.com" } },
  evmConfig:  { base:   { rpcUrl: "https://mainnet.base.org" } },
};
```

Signed-off-by: 0x402ai <[email protected]>
@cb-heimdall
Copy link

cb-heimdall commented Oct 31, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@vercel
Copy link

vercel bot commented Oct 31, 2025

Someone is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@0x402ai
Copy link
Author

0x402ai commented Nov 4, 2025

Some files that I didn’t modify are reported by the formatter due to line ending (CRLF/LF) inconsistencies.
All modified files have passed the format check , lint check and the tests.
It might be better to address the cross-platform line ending differences in a separate commit and establish a consistent rule in the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants