-
Notifications
You must be signed in to change notification settings - Fork 195
02StreamingIndexerPortfolio
Ivan Angelkoski edited this page Jun 12, 2023
·
4 revisions
Example code snippets to stream from the indexer for portfolio module related data.
- stream an account's portfolio
import { IndexerGrpcAccountPortfolioStream } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
const endpoints = getNetworkEndpoints(Network.TestnetK8s);
const indexerGrpcAccountPortfolioStream = new IndexerGrpcAccountPortfolioStream(
endpoints.indexer
);
const accountAddress = "inj...";
const streamFn = indexerGrpcAccountPortfolioStream.streamAccountPortfolio.bind(
indexerGrpcAccountPortfolioStream
);
const callback = (portfolioResults) => {
console.log(portfolioResults);
};
const streamFnArgs = {
accountAddress,
callback,
};
streamFn(streamFnArgs);
Powering the future of decentralized finance.