useChainMetadata

Example

import { useChainMetadata } from "thirdweb/react";
const { data: chainMetadata } = useChainMetadata(
defineChain(11155111),
);
console.log("Name:", chainMetadata.name); // Sepolia
console.log("Faucets:", chainMetadata.faucets); // ["https://thirdweb.com/sepolia/faucet"]
console.log("Explorers:", chainMetadata.explorers); // ["https://sepolia.etherscan.io/"]
function useChainMetadata(
chain?: Readonly<ChainOptions & { rpc: string }>,
): UseQueryResult<ChainMetadata>;

Parameters

Chain to retrieve metadata for, see defineChain for how to create a chain from a chain ID.

Type

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

Returns

let returnType: UseQueryResult<ChainMetadata>;

A React Query result containing the chain metadata,