defineChain

Defines a chain with the given options.

Example

Just pass the chain ID to connect to:

const chain = defineChain(1);

Or pass your own RPC or custom values:

const chain = defineChain({
id: 1,
rpc: "https://my-rpc.com",
nativeCurrency: {
name: "Ether",
symbol: "ETH",
decimals: 18,
},
});
function defineChain(
options: number | ChainOptions | LegacyChain | Chain,
): Chain;

Parameters

The options for the chain.

Type

let options: number | ChainOptions | LegacyChain | Chain;

Returns

let returnType: Readonly<ChainOptions & { rpc: string }>;

The defined chain.