How to get chain state?

  • getChainState

This function is used to retrieve the current state of the blockchain.

import { L1XProvider } from "@l1x/l1x-wallet-sdk";

let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
  endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});

l1xProvider.core
  .getChainState()
  .then((response) => console.log(response))    // log response
  .catch((err) => console.error(err));          // log error

Returns:

A promise that resolves with the blockchain's current state.

{
    "cluster_address": "0101010101010101010101010101010101010101",
    "head_block_hash": "63bea1e7671c013823403dd877c3bea20ee21cfd7fe84cf62eaedee15d855ff2",
    "head_block_number": "456558"
}

Last updated