Skip to content

02QueryingIndexerLeaderboard

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-leaderboard ⚠️

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

Using HTTP REST

  • get the leaderboard
import { IndexerRestLeaderboardChronosApi } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";

const endpoints = getNetworkEndpoints(Network.TestnetK8s);
const indexerGrpcExplorerApi = new IndexerRestLeaderboardChronosApi(
  `${endpoints.chronos}/api/chronos/v1/leaderboard`
);

const SelectList = {
  Day: "1d",
  Week: "7d",
};

const resolution = SelectList.Day;

const leaderboard = await indexerGrpcExplorerApi.fetchLeaderboard(resolution);

console.log(leaderboard);

⚠️ DOCUMENTATION ⚠️

Clone this wiki locally