Skip to content

x402NetworkToChainId

x402NetworkToChainId(network): 1 | 137 | 1001 | 8217 | 43113 | 43114 | 80002 | 11155111

Defined in: src/x402/types.ts:367

Extracts the SupportedChainId from an X402Network.

Total over the X402Network type: if the input is eip155:80002 the result is 80002. Use isX402Network first to narrow an arbitrary string.

Parameters

network

"eip155:1" | "eip155:43114" | "eip155:43113" | "eip155:11155111" | "eip155:8217" | "eip155:1001" | "eip155:137" | "eip155:80002"

Returns

1 | 137 | 1001 | 8217 | 43113 | 43114 | 80002 | 11155111

Example

import { x402NetworkToChainId } from "kawasekit";
const chainId = x402NetworkToChainId("eip155:80002"); // 80002