Explorers
The StarknetConfig provider accepts an optional explorer property to
configure the block explorer used by the useExplorer hook.
Starknet Start ships with the following block explorers (in alphabetical order):
- Cartridge Explorer
- Viewblock
- Voyager
The Explorer interface
The Explorer interface is used to generate links to the block explorer.
It provides the following properties and methods.
name: string: human-friendly explorer name.block({ hash?: string, number?: number }): string: link to the specified block, either by hash or number.transaction(hash: string): string: link to the specified transaction.contract(address: string): string: link to the specified contract.class(hash: string): string: link to the specified class.
Explorer factory
StarknetConfig expects an explorer factory, that is a function with the
following signature:
type ExplorerFactory<T extends Explorer = Explorer> = (chain: Chain) => T | null;Starknet Start ships with the following explorer factories:
cartridgeviewblockvoyager
useExplorer hook
You can get an instance of the current explorer already initialized for the current chain
using the useExplorer hook. It returns null when the current chain does not
define an endpoint for the configured explorer (e.g. devnet).
import { } from "@starknetfoundation/starknet-start-react";
const = ();
const = ?.;
const = ?.({ : 123 });