Skip to content

02QueryingChainTendermint

Ivan Angelkoski edited this page Jun 12, 2023 · 4 revisions

⚠️ The Docs have been moved to https://docs.ts.injective.network/querying/querying-chain/querying-chain-tendermint ⚠️

Example code snippets to query for chain node related data.

Using HTTP REST

  • get latest block info
import { ChainRestTendermintApi } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";

const endpoints = getNetworkEndpoints(Network.TestnetK8s);
const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest);

const latestBlock = await chainRestTendermintApi.fetchLatestBlock();

console.log(latestBlock);
  • get chain node info
import { ChainRestTendermintApi } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";

const endpoints = getNetworkEndpoints(Network.TestnetK8s);
const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest);

const nodeInfo = await chainRestTendermintApi.fetchNodeInfo();

console.log(nodeInfo);

⚠️ DOCUMENTATION ⚠️

Clone this wiki locally