Transfer ERC-1155
This method allows you to transfer ERC-1155 tokens on a blockchain network. It supports both single and batch transfers.
Method Signature
async transferERC1155(config: TransferERC1155Config): Promise<TransactionReceipt>
Parameters
config
: TransferERC1155Config
- An object with the following properties:
network
:Network
(required) - The network used for transactions.to
:string
(required) - The address of the recipient.amount
:string | string[]
(required) - Token amount(s) to transfer. Use an array for batch transfer, or a single value for single transfer.tokenId
:string | string[]
(required) - Token ID(s) to transfer. Use an array for batch transfer, or a single value for single transfer.tokenAddress
:string
(required) - The address of the ERC-1155 token contract.walletToken
:string
(required) - The wallet token of the wallet to send the transaction for.refreshToken
:string
(optional) - The refresh token for authentication. Use this if you want to allow SDK automatically refresh the wallet token.
Returns
Promise<TransactionReceipt>
- An object containing the transaction receipt data.
Example Usage
const receipt = await sdk.wallet.transferERC1155({
network: Network.ETHEREUM,
to: '0x1234567890123456789012345678901234567890',
amount: ['2', '4'],
tokenId: ['2', '5'],
tokenAddress: '0xA468651e0b4F7504aC6390dB567AE937F782d055',
walletToken: 'your-wallet-token',
refreshToken: 'your-refresh-token' // Optional
});
console.log(receipt);
Response Example
{
"txReceipt": {
"_type": "TransactionReceipt",
"accessList": null,
"blockNumber": null,
"blockHash": null,
"chainId": "1",
"data": "0x2eb2c2d6000000000000000000000000b11858be587cab3d78c6ee6d1a66ed57819eb7130000000000000000000000009e79cdf3aba47f66451f175277b6fd732eb1a4c000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000",
"from": "0xB11858bE587cab3D78c6Ee6D1a66Ed57819Eb713",
"gasLimit": "88719",
"gasPrice": "10000000000",
"hash": "0xd0d370a1dc61b965eb1d74d0e7c5d7f75f6af785240dade8dafb8c73f37b492c",
"maxFeePerGas": null,
"maxPriorityFeePerGas": null,
"nonce": 3,
"signature": {
"_type": "signature",
"networkV": "229",
"r": "0x6275bcd431487444996f2abfc333e6c284a22d7749ac7a4b7ddd8fa916ccdb0a",
"s": "0x26c03c22a7a31da392c1b2114e19193978bb057c6d737515a9dc4f668d12117b",
"v": 27
},
"to": "0xeAAab07e113eE423FA1C01ac8dFCac2F6099A5C4",
"type": 0,
"value": "0"
},
"walletToken": "your-new-wallet-token",
"refreshToken": "your-new-refresh-token"
}
ℹ️
The SDK will automatically refresh the wallet token and return the new wallet token and refresh token if the refresh token is provided.
ℹ️
The response is an object containing the transaction receipt data, including details such as the transaction hash, gas used, and block information.
Additional Information
- This method requires a valid wallet token in the SDK configuration.
- For batch transfers, provide arrays for both
amount
andtokenId
parameters. - For single transfers, provide single values for both
amount
andtokenId
parameters. - The
tokenAddress
should be the contract address of the ERC-1155 token you want to transfer. - Gas fees and other transaction parameters are automatically calculated and applied.
For more information, see the Xellar Transfer ERC-1155 API Documentation (opens in a new tab).