How to get native token balance?
getAccountState:
Retrieves the account state information from the L1X Core blockchain.
import { L1XProvider, GetAccountStateArg } from "@l1x/l1x-wallet-sdk";
let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
    endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
let params: GetAccountStateArg = {
  address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
};
l1xProvider.core
  .getAccountState(params)
  .then((response) => console.log(response)) // log response
  .catch((err) => console.error(err)); // log errorParameters:
The account state request parameters.
{
    "address": "346fb07c43e88b58c058e8d6c4bf2f5080a01999"
}Returns:
A promise that resolves with the account state response.
{
   "account_state":{
      "balance": "53648",
      "balance_formatted": "0",
      "nonce": 54,
      "account_type": 1
   }
}Last updated