@nktkas/hyperliquid
Version:
Hyperliquid API SDK for all major JS runtimes, written in TypeScript.
71 lines • 3.35 kB
JavaScript
import * as v from "valibot";
// ============================================================
// API Schemas
// ============================================================
import { UnsignedDecimal, UnsignedInteger } from "../../_schemas.js";
/**
* Request supply, rate, and pending payment information for an aligned quote token.
*/
export const AlignedQuoteTokenInfoRequest = /* @__PURE__ */ (() => {
return v.pipe(v.object({
/** Type of request. */
type: v.pipe(v.literal("alignedQuoteTokenInfo"), v.description("Type of request.")),
/** Token index. */
token: v.pipe(UnsignedInteger, v.description("Token index.")),
}), v.description("Request supply, rate, and pending payment information for an aligned quote token."));
})();
/**
* Supply, rate, and pending payment information for an aligned quote token.
*/
export const AlignedQuoteTokenInfoResponse = /* @__PURE__ */ (() => {
return v.pipe(v.object({
/** Whether the token is aligned. */
isAligned: v.pipe(v.boolean(), v.description("Whether the token is aligned.")),
/** Timestamp (in ms since epoch) when the token was first aligned. */
firstAlignedTime: v.pipe(UnsignedInteger, v.description("Timestamp (in ms since epoch) when the token was first aligned.")),
/** Total EVM minted supply. */
evmMintedSupply: v.pipe(UnsignedDecimal, v.description("Total EVM minted supply.")),
/** Daily amount owed as an array of [date, amount] tuples. */
dailyAmountOwed: v.pipe(v.array(v.pipe(v.tuple([
/** Date in YYYY-MM-DD format. */
v.pipe(v.string(), v.description("Date in YYYY-MM-DD format.")),
/** Amount owed. */
v.pipe(UnsignedDecimal, v.description("Amount owed.")),
]), v.description("[date, amount] tuple."))), v.description("Daily amount owed as an array of [date, amount] tuples.")),
/** Predicted rate. */
predictedRate: v.pipe(UnsignedDecimal, v.description("Predicted rate.")),
}), v.description("Supply, rate, and pending payment information for an aligned quote token."));
})();
/**
* Request supply, rate, and pending payment information for an aligned quote token.
*
* @param config - General configuration for Info API requests.
* @param params - Parameters specific to the API request.
* @param signal - [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to cancel the request.
*
* @returns Supply, rate, and pending payment information for an aligned quote token.
*
* @throws {ValiError} When the request parameters fail validation (before sending).
* @throws {TransportError} When the transport layer throws an error.
*
* @example
* ```ts
* import { HttpTransport } from "@nktkas/hyperliquid";
* import { alignedQuoteTokenInfo } from "@nktkas/hyperliquid/api/info";
*
* const transport = new HttpTransport(); // or `WebSocketTransport`
*
* const data = await alignedQuoteTokenInfo(
* { transport },
* { token: 1328 },
* );
* ```
*/
export function alignedQuoteTokenInfo(config, params, signal) {
const request = v.parse(AlignedQuoteTokenInfoRequest, {
type: "alignedQuoteTokenInfo",
...params,
});
return config.transport.request("info", request, signal);
}
//# sourceMappingURL=alignedQuoteTokenInfo.js.map