Contracts
The call
if (provider.capabilities.contractInfo && provider.getContractInfo) {
const contract = await provider.getContractInfo(address, "ethereum");
}
Etherscan and Blockscout serve it, on every EVM chain they cover. No other provider does, and getContractInfo is absent on them rather than present and useless.
The shape
interface ContractInfo {
address: string;
isVerified: boolean; // source available on the explorer
isProxy?: boolean;
implementationAddress?: string; // when isProxy
name?: string;
compilerVersion?: string;
abi?: string; // JSON string, as the explorer sends it
sourceCode?: string;
isToken?: boolean;
tokenStandard?: "ERC-20" | "ERC-721" | "ERC-1155";
creator?: string;
creationTxHash?: string;
}
isVerified means the explorer holds source that compiles to the deployed bytecode. It says nothing about whether the code is sound, and nothing about the implementation behind a proxy, which is its own address with its own verification. When isProxy is true, read implementationAddress next; the ABI you want is usually there.
abi stays a string so nothing here parses somebody else's JSON on your behalf. JSON.parse it when you need the entries.
CLI
explorers contract 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984
explorers contract 0x… -c base -p blockscout
In the explorer
The Explorer shows the metadata, the number of ABI entries and the length of the source, not the source itself. A verified contract's source can run to hundreds of kilobytes and a demo page is not where to read it.