/** * Gas utilities for NEAR transactions. * * Gas amounts should specify units explicitly: * - `Gas.Tgas(30)` → `"30 Tgas"` * - `"30 Tgas"` (string literal) * * Raw gas units (e.g. `"30000000000000"`) are also supported for advanced use cases. */ /** * Gas input type - string with unit specification. * * Accepts: * - Literal strings: "30 Tgas", "30.5 Tgas" * - Raw gas strings: "30000000000000" * - Constructor output: Gas.Tgas(30) * * For variables, use 'as const' to preserve literal type: * @example * const gas = "30 Tgas" as const */ export type GasInput = `${number} Tgas` | `${number}.${number} Tgas` | `${number}`; /** * Gas namespace - explicit constructors. * * @example * Gas.Tgas(30) // "30 Tgas" * Gas.Tgas(300) // "300 Tgas" */ export declare const Gas: { /** * Create gas amount in TGas (teragas). * @param value - Amount in TGas. */ readonly Tgas: (value: number | `${number}`) => `${number} Tgas`; /** * Common gas amounts. */ readonly DEFAULT: `${number} Tgas`; readonly MAX: `${number} Tgas`; }; /** * Parse gas string to raw gas units. * * @param gas - Gas with unit (e.g., `"30 Tgas"`) or raw gas number. * @returns Gas in raw units as a string. */ export declare function parseGas(gas: GasInput | number): string; /** * Format gas to TGas using string-based BigInt division. * * @param gas - Gas in raw units. * @param precision - Decimal places (default: 2). * @returns Formatted gas with `' Tgas'` suffix. */ export declare function formatGas(gas: string | bigint, precision?: number): string; /** * Convert TGas to raw gas units using string manipulation. * Avoids floating point precision errors. * * @param tgas - Amount in TGas. * @returns Gas amount as string. */ export declare function toGas(tgas: number): string; /** * Convert raw gas to TGas. * Uses string-based BigInt division to avoid floating point division errors. * * Note: The final conversion to number may lose precision either when the result * exceeds Number.MAX_SAFE_INTEGER (~9007 TGas) or when it has more than * approximately 15–17 significant digits (for example, many fractional digits), * even if the whole part is within the safe integer range. For typical NEAR gas * limits (~1000 Tgas, i.e. 1 PGas max) without excessive decimal precision, this * is not a concern. This API still expects gas amounts to be expressed in Tgas units. * For applications requiring arbitrary precision, use formatGas(), which returns * a formatted string. * * @param gas - Gas amount in raw units. * @returns Amount in TGas as a number. */ export declare function toTGas(gas: string | bigint): number; //# sourceMappingURL=gas.d.ts.map