-
Notifications
You must be signed in to change notification settings - Fork 196
02QueryingIndexerInsuranceFund
Ivan Angelkoski edited this page Jun 12, 2023
·
4 revisions
Example code snippets to query the indexer for insurance fund module related data.
- 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);
Powering the future of decentralized finance.