Example code snippets to query the indexer for portfolio module related data.
Fetch portfolio based on 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.Testnet)
const indexerGrpcAccountPortfolioApi = new IndexerGrpcAccountPortfolioApi(
endpoints.indexer,
)
const injectiveAddress = 'inj...'
const portfolio = await indexerGrpcAccountPortfolioApi.fetchAccountPortfolioBalances(
injectiveAddress,
)
console.log(portfolio)