How to get transaction signatures from time to time
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 transaction signatures from time to time
In order to get transaction signatures from time to time, Blocklens provides you a getTransactionSignaturesFromTimeToTime endpoint to do so.
Here you'll need parameters: from_time
, to_time
.
Once you've obtained all the from_time
, to_time
, 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.APTOS_MAINNET.getTransactionSignaturesFromTimeToTime({"from_time":"1696048259","to_time":"1696048260"});
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.eyJpZCI6Mjc5OTgyMjYyLCJwYWdlIjoxLCJmcm9tX3RpbWUiOiIxNjk2MDQ4MjU5IiwidG9fdGltZSI6IjE2OTYwNDgyNTkiLCJpYXQiOjE2OTcwNjExMjh9.EuFD10jrGGgvJBYwSaX3dZMvY9-kph5a4xrGuzMlVMM",
"page": 1,
"limit": 20,
"total_items": 1,
"data": [
{
"block_height": 97922847,
"transaction_version": 279982271,
"transaction_hash": "0xee852ea50aaaa3a05faa59544cf132ce9537cb107e7212748eb3a8bd003ac60b",
"transaction_type": "user_transaction",
"type": "ed25519_signature",
"public_key": "null",
"signature": "0x7639a44e5263f477e04f426696786e0bf294d0b4468b3e1ff7b66cc00577d54ebf7bb83b0e2ef85299075c321b6218b314d21542fecb8a4343012e9d0da7b50d",
"timestamp": 1696048259
}
]
}
Congratulations 🥳 you just found the get transaction signatures from time to time 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.