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