How to get erc20 token mint
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 ERC20 token mint
In order to get erc20 token mint, Blocklens provides you a getErc20Mints endpoint to do so.
import Blocklens from "blocklens-sdk";
const blocklens = new Blocklens();
blocklens.init({ apiKey: "YOUR_API_KEY" });
const runApis = async () => {
const response = await blocklens.ETH_MAINNET.getErc20Mints();
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:
{
"cursor": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTgyODMyODMwMTk5MDAwNzcwLCJwYWdlIjoxLCJpYXQiOjE2OTcwNjM1ODh9.7ayUwwJdMIBKepLYStPXadXZITGL-C5ViPiOMg1HvaM",
"page": 1,
"limit": 20,
"total_items": 1,
"data": [
{
"token_name": "Monerium EUR emoney",
"token_symbol": "EURe",
"token_decimals": 18,
"contract_address": "0x3231Cb76718CDeF2155FC47b5286d82e6eDA273f",
"transaction_hash": "0xa744d4f95c89c1838e401719f11e2d1bc8f39b1fa0b036396c0100e1ab4f2b03",
"transaction_index": 137,
"log_index": 378,
"block_hash": "0x9dce9c505115b31b6afcae07d5b3ddc2bdf4ca89469682cc79cbc64fe12bce7b",
"block_number": 18283286,
"to_wallet": "0x4F90e39B8E5A1A7dC11F90e06474d3807f00309E",
"value": "376303220000000000000000",
"value_decimal": "376303.22",
"timestamp": 1696496531
}
]
}
Congratulations 🥳 you just found the get erc20 token mint 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.