Skip to main content
Example code snippets to query the indexer for insurance fund module related data.

Using gRPC

Fetch redemptions for an injective address

import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
import { IndexerGrpcInsuranceFundApi } from "@injectivelabs/sdk-ts/client/indexer";

const endpoints = getNetworkEndpoints(Network.Testnet);
const indexerGrpcInsuranceFundApi = new IndexerGrpcInsuranceFundApi(
  endpoints.indexer
);

const injectiveAddress = "inj...";

const redemptions = await indexerGrpcInsuranceFundApi.fetchRedemptions({
  injectiveAddress,
});

console.log(redemptions);

Fetch insurance funds

import { getNetworkEndpoints, Network } from "@injectivelabs/networks";
import { IndexerGrpcInsuranceFundApi } from "@injectivelabs/sdk-ts/client/indexer";

const endpoints = getNetworkEndpoints(Network.Testnet);
const indexerGrpcInsuranceFundApi = new IndexerGrpcInsuranceFundApi(
  endpoints.indexer
);

const insuranceFunds = await indexerGrpcInsuranceFundApi.fetchInsuranceFunds();

console.log(insuranceFunds);