diff --git a/ecosystem/typescript/sdk_v2/src/client/get.ts b/ecosystem/typescript/sdk_v2/src/client/get.ts index 6fdc354abc3f3e..bfbcd71ebaba23 100644 --- a/ecosystem/typescript/sdk_v2/src/client/get.ts +++ b/ecosystem/typescript/sdk_v2/src/client/get.ts @@ -39,7 +39,7 @@ export type GetRequestOptions = { overrides?: ClientConfig; }; -export type GetAptosFullNodeRequestOptions = Omit; +export type GetAptosRequestOptions = Omit; /** * Main function to do a Get request @@ -72,14 +72,14 @@ export async function get(options: GetRequestOptions): Promise( - options: GetAptosFullNodeRequestOptions, + options: GetAptosRequestOptions, ): Promise> { return get({ ...options, type: AptosApiType.FULLNODE }); } /// This function is a helper for paginating using a function wrapping an API export async function paginateWithCursor, Res extends any[]>( - options: GetAptosFullNodeRequestOptions, + options: GetAptosRequestOptions, ): Promise { const out = []; let cursor: string | undefined; diff --git a/ecosystem/typescript/sdk_v2/src/client/post.ts b/ecosystem/typescript/sdk_v2/src/client/post.ts index 55030696abed35..96814c73c8018f 100644 --- a/ecosystem/typescript/sdk_v2/src/client/post.ts +++ b/ecosystem/typescript/sdk_v2/src/client/post.ts @@ -43,7 +43,7 @@ export type PostRequestOptions = { overrides?: ClientConfig; }; -export type PostAptosFullNodeRequestOptions = Omit; +export type PostAptosRequestOptions = Omit; /** * Main function to do a Post request @@ -76,7 +76,19 @@ export async function post(options: PostRequestOptions): Promise( - options: PostAptosFullNodeRequestOptions, + options: PostAptosRequestOptions, ): Promise> { return post({ ...options, type: AptosApiType.FULLNODE }); } + +export async function postAptosIndexer( + options: PostAptosRequestOptions, +): Promise> { + return post({ ...options, type: AptosApiType.INDEXER }); +} + +export async function postAptosFaucet( + options: PostAptosRequestOptions, +): Promise> { + return post({ ...options, type: AptosApiType.FAUCET }); +} diff --git a/ecosystem/typescript/sdk_v2/src/internal/general.ts b/ecosystem/typescript/sdk_v2/src/internal/general.ts index 421f3ac599ae4a..2b9c7aa6af570d 100644 --- a/ecosystem/typescript/sdk_v2/src/internal/general.ts +++ b/ecosystem/typescript/sdk_v2/src/internal/general.ts @@ -6,9 +6,8 @@ */ import { AptosConfig } from "../api/aptos_config"; -import { getAptosFullNode, post, postAptosFullNode } from "../client"; +import { getAptosFullNode, postAptosFullNode, postAptosIndexer } from "../client"; import { Block, GraphqlQuery, LedgerInfo, LedgerVersion, MoveValue, TableItemRequest, ViewRequest } from "../types"; -import { AptosApiType } from "../utils/const"; export async function getLedgerInfo(args: { aptosConfig: AptosConfig }): Promise { const { aptosConfig } = args; @@ -89,9 +88,8 @@ export async function queryIndexer(args: { originMethod?: string; }): Promise { const { aptosConfig, query, originMethod } = args; - const { data } = await post({ + const { data } = await postAptosIndexer({ aptosConfig, - type: AptosApiType.INDEXER, originMethod: originMethod ?? "queryIndexer", path: "", body: query,