Network

The Network section provides a set of functions and interfaces for interacting with different blockchain networks. It includes the following:

  • The Network interface defines the properties of a blockchain network, such as its name, chain ID, RPC URL, native token, wrapped native token, and explorer URL.

interface Network {
  id: string;
  chainId: number;
  name: string;
  explorerUrl: string;
  rpcUrl: string;
  nativeToken: {
    chainId: number;
    address: string;
    decimals: number;
    symbol: string;
    name: string;
  };
  wrappedNativeToken: {
    chainId: number;
    address: string;
    decimals: number;
    symbol: string;
    name: string;
  };
  multicall2Address: string;
  multicall3Address: string;
}
  • The getNetwork() function returns the Network object for a given chain ID.

  • The getNetworkId() function returns the network ID (e.g. "mainnet", "polygon", etc.) for a given chain ID.

  • The ChainId enum defines constants for the chain IDs of the supported blockchain networks.

  • The NetworkId enum defines constants for the network IDs of the supported blockchain networks.

  • The isSupportedChainId() function returns a boolean indicating whether a given chain ID is supported.

  • The isSupportedNetworkId() function returns a boolean indicating whether a given network ID is supported.

  • The newExplorerUrl() function returns a formatted explorer URL for a given chain ID, explorer type, and data (e.g. transaction hash, address, token address).

These functions and interfaces provide a convenient and standardized way of interacting with different blockchain networks, and can be used across multiple libraries and applications.

Last updated