Transfer ERC-721
This method allows you to transfer an ERC-721 token (NFT) on a blockchain network.
Method Signature
async transferERC721(config: TransferERC721Config): Promise<TransactionReceipt>
Parameters
config
: TransferERC721Config
- An object with the following properties:
network
:Network
(required) - The network used for transactions.to
:string
(required) - The address of the recipient.tokenId
:string
(required) - The ID of the ERC721 token to transfer.tokenAddress
:string
(required) - The address of the ERC721 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.transferERC721({
network: Network.ETHEREUM,
to: '0x1234567890123456789012345678901234567890',
tokenId: '1',
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": "0x42842e0e000000000000000000000000b11858be587cab3d78c6ee6d1a66ed57819eb7130000000000000000000000009e79cdf3aba47f66451f175277b6fd732eb1a4c00000000000000000000000000000000000000000000000000000000000000000",
"from": "0xBfE64B4b628E0998A03e2522B051Cf1B4661c964",
"gasLimit": "62878",
"gasPrice": "10000000000",
"hash": "0xc6ec8d635b85d01d3c55b4c28e50833e89248998db7f25a5be5cc49fee460979",
"maxFeePerGas": null,
"maxPriorityFeePerGas": null,
"nonce": 2,
"signature": {
"_type": "signature",
"networkV": "230",
"r": "0x48db5e659eb14e9f7116f65aaaa77931a0c66deb394adc41d581da0f6188d592",
"s": "0x24defbadb35bcf0be14dac14c6053ad8f7f25ddd89b669bfba772316bfa446f7",
"v": 28
},
"to": "0x9B9ef330B204bf33316FAf24E3Ed4FfCf57F02C3",
"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.
- The
tokenId
parameter should be provided as a string. - The
tokenAddress
should be the contract address of the ERC-721 token you want to transfer. - Gas fees and other transaction parameters are automatically calculated and applied.
For more information, see the Xellar Transfer ERC-721 API Documentation (opens in a new tab).