Module
NFT ERC-1155 — 2–10 credits
Interact with ERC-1155 multi-token contracts. ERC-1155 allows a single contract to manage multiple token types (both fungible and non-fungible). Query balances, metadata URIs, and transfer tokens.
API Key
balance()
GET
2 credits
API Key
Get the balance of a single ERC-1155 token ID for a specific address.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
$contract | string | Yes | ERC-1155 contract address |
$address | string | Yes | Wallet address to check |
$tokenId | int | Yes | Token ID to query |
$network | ?string | No | Network name. Defaults to WEB3_DEFAULT_NETWORK |
Example
$result = Web3Api::nft1155()->balance(
contract: '0xd07dc4262BCDbf85190C01c996b4C06a461d2430',
address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
tokenId: 1,
network: 'polygon',
);
Response
[
'contract' => '0xd07dc4262BCDbf85190C01c996b4C06a461d2430',
'address' => '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
'token_id' => 1,
'balance' => 10, // holds 10 copies of token ID 1
]
balanceBatch()
POST
2 credits
API Key
Get balances for multiple ERC-1155 token IDs for a single address in one call.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
$contract | string | Yes | ERC-1155 contract address |
$address | string | Yes | Wallet address to check |
$tokenIds | int[] | Yes | Array of token IDs to query |
$network | ?string | No | Network name. Defaults to WEB3_DEFAULT_NETWORK |
Example
$balances = Web3Api::nft1155()->balanceBatch(
contract: '0xd07dc4262BCDbf85190C01c996b4C06a461d2430',
address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
tokenIds: [1, 2, 3, 5, 10],
network: 'polygon',
);
// $balances['1'] => 10
// $balances['2'] => 5
// $balances['3'] => 0
// $balances['5'] => 1
// $balances['10'] => 0
Response
{ "1": 10, "2": 5, "3": 0, "5": 1, "10": 0 }
uri()
GET
2 credits
API Key
Retrieve the metadata URI for a specific ERC-1155 token ID. The URI may contain {id} as a placeholder per the ERC-1155 spec.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
$contract | string | Yes | ERC-1155 contract address |
$tokenId | int | Yes | Token ID |
$network | ?string | No | Network name. Defaults to WEB3_DEFAULT_NETWORK |
Example
$result = Web3Api::nft1155()->uri(
contract: '0xd07dc4262BCDbf85190C01c996b4C06a461d2430',
tokenId: 1,
network: 'polygon',
);
Response
[
'contract' => '0xd07dc4262BCDbf85190C01c996b4C06a461d2430',
'token_id' => 1,
'uri' => 'https://metadata.example.com/{id}.json',
]
transfer()
POST
10 credits
API Key
Transfer a quantity of an ERC-1155 token from one address to another using safeTransferFrom.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
$contractAddress | string | Yes | ERC-1155 contract address |
$fromAddress | string | Yes | Sender's wallet address |
$privateKey | ?string | No | Sender's private key. Pass null to use the stored managed wallet |
$toAddress | string | Yes | Recipient's wallet address |
$tokenId | int | Yes | Token ID to transfer |
$amount | int | Yes | Quantity to transfer |
$network | ?string | No | Network name. Defaults to WEB3_DEFAULT_NETWORK |
$data | string | No | Additional data bytes to pass to recipient (default: "0x") |
Example
$tx = Web3Api::nft1155()->transfer(
contractAddress: '0xd07dc4262BCDbf85190C01c996b4C06a461d2430',
fromAddress: '0xSENDER_ADDRESS',
privateKey: '0xSENDER_PRIVATE_KEY',
toAddress: '0xRECEIVER_ADDRESS',
tokenId: 1,
amount: 5, // send 5 copies of token ID 1
network: 'polygon',
data: '0x', // optional extra data
);
Response
[
'tx_hash' => '0xabcdef1234567890...',
'status' => 'pending',
]