Skip to content

02QueryingIndexerInsuranceFund

Ivan Angelkoski edited this page Jun 12, 2023 · 4 revisions

⚠️ The Docs have been moved to https://docs.ts.injective.network/querying/querying-api/querying-indexer-insurance-funds ⚠️

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

Using gRPC

  • Get redemptions for an injective address
import { IndexerGrpcInsuranceFundApi } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";

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

const injectiveAddress = "inj...";

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

console.log(redemptions);
  • Get insurance funds
import { IndexerGrpcInsuranceFundApi } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";

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

const insuranceFunds = await indexerGrpcInsuranceFundApi.fetchInsuranceFunds();

console.log(insuranceFunds);

⚠️ DOCUMENTATION ⚠️

Clone this wiki locally