Get Account Balances

Returns the Account Balance.

import 'dotenv/config';
import { DataService } from '@kanalabs/mirai';

(async () => {
   
   // Define the accountAddress and chainId
   const accountAddress = '0xD783e00389a7d25E5e7c00f4Ea1F90800636d423';
   const chainId = 80001;
   const dataApiKey = process.env.DATASERVICE_API_KEY || '' as string; 
   
   // initializating DataService...
   const dataService = new DataService();
   
   // Retrieve account balances using the specified accountAddress and chainId with your api key
   const response = await dataService.getAccountBalances(accountAddress, chainId, dataApiKey);
   
   // Log the account balances response
   console.log('response', response);
})()

Last updated