-
Notifications
You must be signed in to change notification settings - Fork 196
02StreamingIndexerAccount
Ivan Angelkoski edited this page Jun 12, 2023
·
4 revisions
Example code snippets to stream from the indexer for subaccount related data.
- Stream a subaccount balance
import { IndexerGrpcAccountStream } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
const endpoints = getNetworkEndpoints(Network.TestnetK8s);
const indexerGrpcAccountStream = new IndexerGrpcAccountStream(
endpoints.indexer
);
const subaccountId = "0x...";
const streamFn = indexerGrpcAccountStream.streamSubaccountBalance.bind(
indexerGrpcAccountStream
);
const callback = (subaccountBalance) => {
console.log(subaccountBalance);
};
const streamFnArgs = {
subaccountId,
callback,
};
streamFn(streamFnArgs);
Powering the future of decentralized finance.