Skip to content

Chains (Chain)

A chain as plain data that an application writes: what a wallet or a page needs to know about it. There is no registry of chains. A Chain is what Connection.switchChain offers to a wallet that does not know the chain.

import type { Chain } from "@ethect/core";
const base: Chain.Chain = {
id: 8453,
name: "Base",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: ["https://mainnet.base.org"],
explorer: "https://basescan.org",
};
Export Kind Description
Chain.Chain type A chain: the fields below.
Field Type Holds
id number the chain id
name string what a wallet shows
nativeCurrency { name, symbol, decimals } the currency that pays for gas
rpcUrls ReadonlyArray<string> public endpoints a wallet can use
explorer (optional) string the URL of a block explorer