burn
The burn
functionality, often implemented in certain ERC-721 token variants, facilitates the permanent removal of a non-fungible token (NFT) from circulation. Once a token undergoes burning, it becomes ineligible for transfer, effectively deleting its data. This operation is irreversible and typically signifies a deliberate action by the token owner. The burn
method is an integral part of the ERC721Instance
object, accessible through client libraries like ZkyugaClient
.
Method Signature
async burn(tokenId: string, signer: WalletSigner): Promise<TransactionResponse>
Parameters
tokenId
string
The unique identifier of the ERC-721 token you wish to burn.
signer
WalletSigner
The wallet signer instance used for signing the burn transaction. Typically associated with the token's owner.
Returns
A
Promise
resolving to aTransactionResponse
object, furnishing comprehensive details regarding the burn transaction, including its status and transaction hash.
Usage Example
Begin by initializing the desired ERC-721 token contract:
const erc721 = zkyugaClient.getERC721Instance("your ERC-721 contract address here");
Then, employ the burn
method to obliterate a specific token:
const tokenId = "1009"; // Example token ID
const signer = zkyugaClient.createWalletSigner("your private key");
const transactionResponse = await erc721.burn(tokenId, signer);
console.log(`Burn Transaction Hash: ${transactionResponse.hash}`);
Notes
Burning a token entails an irreversible action. Exercise caution and ensure the intent to permanently remove the token from circulation.
Only the token owner or an approved address can execute the
burn
operation. Unauthorized attempts will result in transaction failures.Considering Ethereum's gas mechanism, sufficient
ZKYUGA
coin balance is necessary in the account associated with the signer to cover transaction fees incurred during theburn
process.
Last updated