getChainMetadata

Retrieves chain data for a given chain.

Example

const chain = defineChain({ id: 1 });
const chainData = await getChainMetadata(chain);
console.log(chainData);
function getChainMetadata(
chain: Readonly<ChainOptions & { rpc: string }>,
): Promise<ChainMetadata>;

Parameters

The chain object containing the chain ID.

Type

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

Returns

let returnType: { chain: string; chainId: number; ens?: { registry: string }; explorers?: Readonly<Array<ChainExplorer>>; faucets?: readonly Array<string>; features?: Readonly<Array<{ name: string }>>; icon?: Icon; infoURL?: string; name: string; nativeCurrency: { decimals: number; name: string; symbol: string }; networkId?: number; parent?: { bridges?: Readonly<Array<{ url: string }>>; chain: string; type: string }; redFlags?: readonly Array<string>; rpc: readonly Array<string>; shortName: string; slip44?: number; slug: string; stackType: string; status?: string; testnet: boolean; title?: string }

A Promise that resolves to the chain data.