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 | Chain | ChainOptions | LegacyChain,
): Readonly;

Parameters

The options for the chain.

Type

let options: number | Chain | ChainOptions | LegacyChain;

Returns

let returnType: Readonly;

The defined chain.