PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/esm/utils
Просмотр файла: helpers.d.mts
import { MoveStructId } from '../types/types.mjs';
import '../types/indexer.mjs';
import '../types/generated/operations.mjs';
import '../types/generated/types.mjs';
import './apiEndpoints.mjs';
/**
* Sleep for the specified amount of time in milliseconds.
* This function can be used to introduce delays in asynchronous operations.
*
* @param timeMs - The time in milliseconds to sleep.
*/
declare function sleep(timeMs: number): Promise<null>;
/**
* Get the error message from an unknown error.
*
* @param error The error to get the message from
* @returns The error message
*/
declare function getErrorMessage(error: unknown): string;
declare const nowInSeconds: () => number;
/**
* Floors the given timestamp to the nearest whole hour.
* This function is useful for normalizing timestamps to hourly intervals.
*
* @param timestampInSeconds - The timestamp in seconds to be floored.
*/
declare function floorToWholeHour(timestampInSeconds: number): number;
/**
* Decodes a base64 URL-encoded string into its original form.
* This function is useful for converting base64 URL-encoded data back to a readable format.
*
* @param base64Url - The base64 URL-encoded string to decode.
* @returns The decoded string.
*/
declare function base64UrlDecode(base64Url: string): string;
/**
* Amount is represented in the smallest unit format on chain, this function converts
* a human-readable amount format to the smallest unit format
* @example
* human-readable amount format: 500
* on chain amount format when decimal is 8: 50000000000
*
* @param value The value in human-readable format
* @param decimal The token decimal
* @returns The value in the smallest units
*/
declare const convertAmountFromHumanReadableToOnChain: (value: number, decimal: number) => number;
/**
* Amount is represented in the smallest unit format on chain, this function converts
* the smallest unit format to a human-readable amount format
* @example
* human-readable amount format: 500
* on chain amount format when decimal is 8: 50000000000
*
* @param value The value in human-readable format
* @param decimal The token decimal
* @returns The value in the smallest units
*/
declare const convertAmountFromOnChainToHumanReadable: (value: number, decimal: number) => number;
/**
* Convert an encoded struct to a MoveStructId.
*
* @example
* const structObj = {
* account_address: "0x1",
* module_name: "0x6170746f735f636f696e",
* struct_name: "0x4170746f73436f696e",
* };
* // structId is "0x1::aptos_coin::AptosCoin"
* const structId = parseEncodedStruct(structObj);
*
* @param structObj The struct with account_address, module_name, and struct_name properties
* @returns The MoveStructId
*/
declare const parseEncodedStruct: (structObj: {
account_address: string;
module_name: string;
struct_name: string;
}) => MoveStructId;
/**
* Determines whether the given object is an encoded struct type with the following properties:
* - account_address: string
* - module_name: string
* - struct_name: string
*
* @param structObj The object to check
* @returns Whether the object is an encoded struct type
*/
declare const isEncodedStruct: (structObj: any) => structObj is {
account_address: string;
module_name: string;
struct_name: string;
};
export { base64UrlDecode, convertAmountFromHumanReadableToOnChain, convertAmountFromOnChainToHumanReadable, floorToWholeHour, getErrorMessage, isEncodedStruct, nowInSeconds, parseEncodedStruct, sleep };
Выполнить команду
Для локальной разработки. Не используйте в интернете!