/** * Amount utilities for NEAR tokens. * * All amounts must specify units explicitly: * - `Amount.NEAR(10)` → `"10 NEAR"` * - `Amount.yocto(1000n)` → `"1000 yocto"` * - `"10 NEAR"` (string literal) * - `"1000 yocto"` (string literal) * - `1000n` (bigint literal, treated as yoctoNEAR) * * No bare numbers are accepted in order to prevent accidental unit confusion. */ /** * String amount in NEAR units. * * Examples: * - "10 NEAR" * - "1.5 NEAR" */ export type NearAmountString = `${number} NEAR`; /** * String amount in yoctoNEAR units. * * Examples: * - "1000000 yocto" * - "1 yocto" */ export type YoctoAmountString = `${bigint} yocto`; /** * Amount input type - must be a string with unit specification or bigint. * * Accepts: * - Literal strings: "10 NEAR", "1.5 NEAR", "1000 yocto" * - Constructor output: Amount.NEAR(10), Amount.yocto(1000n) * - Raw bigint: 1000000n (interpreted as yoctoNEAR) */ export type AmountInput = NearAmountString | YoctoAmountString | bigint; /** * Amount namespace - explicit constructors for NEAR values. * * @example * Amount.NEAR(10) // "10 NEAR" * Amount.NEAR(10.5) // "10.5 NEAR" * Amount.NEAR("10.5") // "10.5 NEAR" * Amount.yocto(1000000n) // "1000000 yocto" * Amount.yocto("1000000") // "1000000 yocto" */ export declare const Amount: { /** * Create a NEAR amount. * @param value - Amount in NEAR. * @returns Formatted string `"X NEAR"`. */ NEAR(value: number | `${number}`): NearAmountString; /** * Create a yoctoNEAR amount (10^-24 NEAR). * @param value - Amount in yoctoNEAR. * @returns Formatted string `"X yocto"`. */ yocto(value: bigint | `${bigint}`): YoctoAmountString; /** * Common amount constants. */ ZERO: YoctoAmountString; ONE_NEAR: NearAmountString; ONE_YOCTO: YoctoAmountString; }; /** * Parse amount to yoctoNEAR. * * @param amount - Amount with unit (e.g., `"10 NEAR"`, `"1000 yocto"`) or bigint (treated as yoctoNEAR). * @returns Amount in yoctoNEAR as a string. * @throws Error If the format is invalid or ambiguous (e.g. bare numbers). */ export declare function parseAmount(amount: AmountInput): string; /** * Format yoctoNEAR to human-readable NEAR * @param yocto - Amount in yoctoNEAR * @param options - Formatting options * @returns Formatted string (e.g., "10.50 NEAR") */ export declare function formatAmount(yocto: string | bigint, options?: { precision?: number; includeSuffix?: boolean; trimZeros?: boolean; }): string; //# sourceMappingURL=amount.d.ts.map