Skip to main content

ERC-1155 interaction

ERC-1155 is the multi-token standard. A single contract can hold both fungible tokens (like gold coins in a game) and non-fungible tokens (like unique items). The standard also has efficient batch operations built in. Standard ERC-1155 contracts work on Sei without modification.

Try it: deploy an ERC-1155

Compile and deploy a real ERC-1155 to Sei Testnet from the browser. The Remix sandbox preloads an OpenZeppelin-based DemoMultiToken with a public mint(id, amount) function. Then use the read and write patterns below with your deployed address. First, add Sei Testnet to your wallet: In Remix, compile the contract on the Solidity Compiler tab. Then deploy it from the Deploy & Run tab with Environment set to Injected Provider - MetaMask.

Setup

Reading a single balance

Batch balance query

balanceOfBatch fetches the balances for multiple owner and ID pairs in one call. This is the most efficient way to load a user’s inventory:

Reading token metadata URI

viem

Transferring a single token

Batch transfer

Send multiple token IDs in a single transaction:

Operator approval

Watching transfer events

Watch new events over the WebSocket endpoint. Watchers that poll the public HTTP endpoint can miss events or report them twice. For details, see Listen to events.