ERCs
ERC-1155 — Multi-Token Standard
One contract, many token IDs. Each ID can be fungible (supply > 1) or non-fungible (supply = 1). The interesting primitives are the batch operations — atomic transfers and balance reads across many IDs in one call.
import {
balance_of,
balance_of_batch,
safe_transfer_from,
safe_batch_transfer_from,
set_approval_for_all,
is_approved_for_all,
} from "@ethernauta/erc/1155"; Core methods
| Method | Shape | Purpose |
|---|---|---|
balance_of({ owner, id }) | Callable<Uint256> | Balance for one ID. |
balance_of_batch({ owners, ids }) | Callable<Uint256[]> | Batched balance read. |
safe_transfer_from({ from, to, id, amount, data? }) | Signable<Hash32> | Single-ID transfer. |
safe_batch_transfer_from({ from, to, ids, amounts, data? }) | Signable<Hash32> | Atomic multi-ID transfer. |
set_approval_for_all({ operator, approved }) | Signable<Hash32> | Operator approval. |
is_approved_for_all({ owner, operator }) | Callable<boolean> | Read operator approval. |
Extensions
| Subpath | Methods |
|---|---|
@ethernauta/erc/1155/metadata_uri | uri({ id }) |
Batch reads
const balances = await balance_of_batch({
owners: [me, me, me],
ids: [1n, 2n, 3n],
})(contract({ chain_id: eip155_1.chain_id, contract: collection }));
// → [Uint256, Uint256, Uint256] One eth_call, one decoded array. No need for client-side multicall.