Documentation Index
Fetch the complete documentation index at: https://injectivelabs-mintlify-jp-developers-first-half-1777019423.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Example code snippets to stream from the indexer for account module related data using StreamManagerV2.
Using gRPC Stream with StreamManagerV2
Stream subaccount balance
import { getNetworkEndpoints, Network } from '@injectivelabs/networks'
import {
StreamManagerV2,
IndexerGrpcAccountStreamV2
} from '@injectivelabs/sdk-ts/client/indexer'
const endpoints = getNetworkEndpoints(Network.Testnet)
const stream = new IndexerGrpcAccountStreamV2(endpoints.indexer)
const streamManager = new StreamManagerV2({
id: 'subaccount-balance',
streamFactory: () => stream.streamSubaccountBalance({
subaccountId: '0x...',
callback: (response) => {
streamManager.emit('data', response)
}
}),
onData: (balance) => {
console.log(balance)
},
retryConfig: { enabled: true }
})
streamManager.on('connect', () => console.log('Stream connected'))
streamManager.start()