01QueryingChain - InjectiveLabs/injective-ts Wiki

Querying the Chain

Using gRPC

Querying the Bank Module

Example code snippets to query the bank module on the chain using the gRPC protocol.

  • Fetching accounts balances
import { ChainGrpcBankApi } from '@injectivelabs/sdk-ts'
import { getEndpointsForNetwork, Network } from "@injectivelabs/networks";

const endpoints = getEndpointsForNetwork(Network.TestnetK8s);
const injectiveAddress = 'inj14au322k9munkmx5wrchz9q30juf5wjgz2cfqku'
const chainGrpcBankApi = new ChainGrpcBankApi(endpoints.sentryGrpcApi)

const balances = await chainGrpcBankApi.fetchBalances(injectiveAddress)

console.log(balances)

Using HTTP REST