// Copyright © Endless // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 /** * This file contains the underlying implementations for exposed API surface in * the {@link api/general}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * general namespace and without having a dependency cycle error. */ import { EndlessConfig } from "../api/endlessConfig"; import { getEndlessFullNode, getEndlessIndexer } from "../client"; import { LedgerInfo, SearchResponse, Status } from "../types"; export async function getLedgerInfo(args: { endlessConfig: EndlessConfig }): Promise { const { endlessConfig } = args; const { data } = await getEndlessFullNode<{}, LedgerInfo>({ endlessConfig, originMethod: "getLedgerInfo", path: "", }); return data; } export async function getIndexerStatus(args: { endlessConfig: EndlessConfig; durationSecs?: number; }): Promise { const { endlessConfig, durationSecs } = args; const { data } = await getEndlessIndexer<{}, Status>({ endlessConfig, originMethod: "getIndexerStatus", path: "", params: { duration_secs: durationSecs, }, }); return data; } export async function search(args: { endlessConfig: EndlessConfig; query: string; }): Promise { const { endlessConfig, query } = args; const { data } = await getEndlessIndexer<{}, SearchResponse[]>({ endlessConfig, originMethod: "search", path: "search", params: { query }, }); return data; }