Skip to content

02QueryingIndexerPortfolio

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

⚠️ The Docs have been moved to https://docs.ts.injective.network/querying/querying-api/querying-indexer-portfolio ⚠️

Example code snippets to query the indexer for portfolio module related data.

Using gRPC

  • Get a portfolio based off injective address, such as bank balances and subaccount balances
import { IndexerGrpcAccountPortfolioApi } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";

const endpoints = getNetworkEndpoints(Network.TestnetK8s);
const indexerGrpcAccountPortfolioApi = new IndexerGrpcAccountPortfolioApi(
  endpoints.indexer
);

const injectiveAddress = "inj...";

const portfolio = await indexerGrpcAccountPortfolioApi.fetchAccountPortfolio(
  injectiveAddress
);

console.log(portfolio);

⚠️ DOCUMENTATION ⚠️

Clone this wiki locally