Thirdweb is a platform offering tools and infrastructure for building decentralized applications on multiple blockchain networks. It simplifies blockchain integration with SDKs, APIs, and pre-built components.
In our case, thirdweb has several short code samples on their docs site, which we can use as an inspiration.
const { ThirdwebSDK } = require("@thirdweb-dev/sdk");
const axios = require("axios");
const sdk = new ThirdwebSDK("https://rpc.chiliz.com");
const walletAddress = "0xYourWalletAddress";
// ChilizScan API URL and your API key (required)
const CHILIZ_SCAN_API_URL = "https://api.chilizscan.com/api";
const API_KEY = "YourChilizScanAPIKey"; // Optional, if the API requires authentication
async function getTransactionHistory() {
try {
const response = await axios.get(`${CHILIZ_SCAN_API_URL}?module=account&action=txlist&address=${walletAddress}&apikey=${API_KEY}`);
const transactions = response.data.result;
console.log(`Transaction history of wallet ${walletAddress}:`, transactions);
} catch (error) {
console.error("Error fetching transaction history:", error);
}
}
getTransactionHistory();
Sadly, they don't seem to have transactions specific functions, so we're going to rely on the .