Burn an NFT

How to burn an NFT?

🚧

This guide assumes that the NFT that is going to be burned was created by our NFT API and therefore uses functions that are available in our contracts.

In order to burn an NFT, we will need to execute a function on the NFT contract. In the example below we are calling the contract 0xe80f3baa739c18fd4ebf97716529a4b85be464dd and more specifically the function burn.

As input parameters we have

  • Token id (Token ID that will get burned)
  • Contract account(address) (Address of the contract that is managing the token)
  • amount (Number of tokens to be burned, in case of an ERC1155 token)
Burn an NFT

Burn an NFT

Request Endpoint: reference

POST https://api-wallet.venly.io/api/transactions/execute

Request Body:

{
    "pincode": "1234",
    "transactionRequest": {
        "type": "CONTRACT_EXECUTION",
        "walletId": "7a9a754e-6331-46a7-a5ac-e74b04df18d0",
        "to": "0xe80f3baa739c18fd4ebf97716529a4b85be464dd",
        "secretType": "MATIC",
        "functionName": "burn",
        "inputs": [
            {
                "type": "uint256",
                "value": "402"
            },
            {
                "type": "address",
                "value": "0xe80f3baa739c18fd4ebf97716529a4b85be464dd"
            },
            {
                "type": "uint256",
                "value": "1"
            }
        ]
    }
}

Burning multiple tokens

Our contract also allows you to burn multiple tokens with one transaction. We use the burnBatch function instead of the burn function. The burnBatch function used Arrays as an input parameter for id and amount.

Burning Multiple Tokens

Burning Multiple Tokens