-
Notifications
You must be signed in to change notification settings - Fork 199
02QueryingChainTendermint
Ivan Angelkoski edited this page Jun 12, 2023
·
4 revisions
Example code snippets to query for chain node related data.
- 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);
Powering the future of decentralized finance.