How to get nft burns of collection from block to block
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 of collection from block to block
In order to get nft burns of collection from block to block, Blocklens provides you a getNftBurnsOfCollectionFromBlockToBlock endpoint to do so.
Here you'll need parameters: address
, from_block
, to_block
.
Once you've obtained all the address
, from_block
, to_block
, 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.getNftBurnsOfCollectionFromBlockToBlock("0x6339e5E072086621540D0362C4e3Cea0d643E114", {"from_block":18246150,"to_block":18246151});
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": "0x928eCD2e55E7042B5b920B352A84f156AdeDB037",
"contract_type": "ERC1155",
"token_id": "38049157011561114448189451032040",
"block_hash": "0x7385abaea36047d2451ef613347ea33ddf29c83378f0437f7e8557fcb4c5d45a",
"block_number": 4809155,
"transaction_hash": "0xdada043282313a78525d0d2e1dbf809f33fcaf6aaa0ee4d1a33980010279efcf",
"log_index": 11,
"from": "0x9Dc7990136EB33339522b57260E07090EB540232",
"to": "0x0000000000000000000000000000000000000000",
"amount": null,
"operator": "0x9Dc7990136EB33339522b57260E07090EB540232",
"timestamp": 1701537252,
"block_time": "2023-12-02 17:14:12.0"
}
]
Congratulations 🥳 you just found the get nft burns of collection from block to block 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.