@aptos-labs/aptos-client
Version:
Client package for accessing the Aptos network API.
43 lines • 1.65 kB
TypeScript
import type { AptosClientRequest, AptosClientResponse } from "./types.js";
export type { Cookie } from "./cookieJar.js";
export { CookieJar } from "./cookieJar.js";
export type { AptosClientRequest, AptosClientResponse, CookieJarLike } from "./types.js";
/**
* Send a JSON request to an Aptos API endpoint.
*
* This is the default export and the primary entry point for most callers.
*
* @typeParam Res - Expected shape of the JSON response body.
* @param requestOptions - Request configuration.
* @returns Parsed response with status, headers, and deserialized body.
*
* @example
* ```ts
* import aptosClient from "@aptos-labs/aptos-client";
*
* const { data } = await aptosClient<{ chain_id: number }>({
* url: "https://fullnode.mainnet.aptoslabs.com/v1",
* method: "GET",
* });
* ```
*/
export default function aptosClient<Res>(requestOptions: AptosClientRequest): Promise<AptosClientResponse<Res>>;
/**
* Send a request and parse the response as JSON.
*
* Identical to the default export; useful when a named import is preferred.
*
* @typeParam Res - Expected shape of the JSON response body.
* @param requestOptions - Request configuration.
*/
export declare function jsonRequest<Res>(requestOptions: AptosClientRequest): Promise<AptosClientResponse<Res>>;
/**
* Send a request and return the response as an `ArrayBuffer`.
*
* Intended for BCS-encoded responses from the Aptos API.
*
* @experimental
* @param requestOptions - Request configuration.
*/
export declare function bcsRequest(requestOptions: AptosClientRequest): Promise<AptosClientResponse<ArrayBuffer>>;
//# sourceMappingURL=index.node.d.ts.map