ERCs

ERC-165 — Standard Interface Detection

eips.ethereum.org/EIPS/eip-165

A contract declares which interfaces it supports via supportsInterface(bytes4) — returning true for interface IDs it implements. The interface ID is the XOR of the function selectors.

import { supports_interface } from "@ethernauta/erc/165";

const ok = await supports_interface({ interface_id: "0x80ac58cd" })(
  contract({ chain_id: eip155_1.chain_id, contract: nft_address }),
);
// true → contract implements ERC-721

Surface

MethodShapePurpose
supports_interface({ interface_id })Callable<boolean>Per-interface detection.

Common interface IDs

IDStandard
0x80ac58cdERC-721
0x5b5e139fERC-721 Metadata
0x780e9d63ERC-721 Enumerable
0xd9b67a26ERC-1155
0x0e89341cERC-1155 Metadata URI
0x2a55205aERC-2981 (royalties)

See also