Skip to main content

How to get nft burns by transaction hash

Prerequisites

Before getting started, make sure you have the following ready:

  • Node v.14+
  • NPM

Step 1: Setup Blocklens

First register your Blocklens account and get your Blocklens API Key.

Once you have your Blocklens API Key, install the Blocklens SDK in your project.

npm i blocklens-sdk

Step 2: Get NFT burns by transaction hash

In order to get nft burns by transaction hash, Blocklens provides you a getNftBurnsByTransaction endpoint to do so.

Here you'll need a parameter: transaction_hash.

Once you've obtained the transaction_hash, you can copy the following code:

import Blocklens from "blocklens-sdk";

const blocklens = new Blocklens();
blocklens.init({ apiKey: "YOUR_API_KEY" });

const runApis = async () => {
const response = await blocklens.ETH_MAINNET.getNftBurnsByTransaction("0x12259c8b5a0f51320bb1b64dfb2b1b61e24aaa127318b0cf92d209525f0d5447");
console.log(response);
};

runApis();

Step 3: Run the script

ts-node index.ts

In your terminal, you should see the following JSON response with the data: In your terminal, you should see the following JSON response with the data blocks:

[
{
"token_address": "0x0E1396Bef94ce317E41cB45F0397039A29845E30",
"contract_type": "ERC1155",
"token_id": "1",
"block_hash": "0x45593b20ae7a484d4137d713925345d903a40d512e214c9f7d9348396c68c03e",
"block_number": 4803952,
"transaction_hash": "0xd9deb1249d96932faa568852a9fc0004817b476b749dbce7253ac2b44bb870dd",
"log_index": 33,
"from": "0x38a735F4651Ace4e350A7DC1331442368E798b91",
"to": "0x0000000000000000000000000000000000000000",
"amount": null,
"operator": "0x0BE578E8B80b60700bAED31D0AE65D9856B2B6Fc",
"timestamp": 1701465888,
"block_time": "2023-12-01 21:24:48.0"
}
]

Congratulations 🥳 you just found the get nft burns by transaction hash on multiple chains with only a few lines of code using the Blocklens Wallet API!

API Reference

If you want to know more details on the endpoint and optional parameters, check out:

Support

If you face any trouble following the tutorial, feel free to reach out to our community engineers in our Discord or Forum to get 24/7 developer support.