import * as Numbers from "./numbers.js"; /** * Represents an amount of LGNT. The smallest possible amount of LGNT * is equal to `10 ^ Lgnt.SMALLEST_UNIT_PREFIX.tenExponent`. An amount * of LGNT has at most `Lgnt.DECIMALS` * (equal to `-Lgnt.SMALLEST_UNIT_PREFIX.tenExponent`) decimals. * * The canonical form of an amount of LGNT is its expression as a * factor of `10 ^ Lgnt.SMALLEST_UNIT_PREFIX.tenExponent`. For example, * the canonical form of 1 LGNT is equal to `10 ^ Lgnt.DECIMALS`. */ export declare class Lgnt { static readonly CODE = "LGNT"; static readonly SMALLEST_UNIT_PREFIX: Numbers.UnitPrefix; static readonly DECIMALS: number; /** * Builds an LGNT amount from its canonical form. * * @param canonical The canonical form of an amount of LGNT * @returns An LGNT amount */ static fromCanonical(canonical: bigint): Lgnt; /** * Builds an LGNT amount from its canonical form * given as a `PrefixedNumber` instance. * * @param canonical The canonical form of an amount of LGNT * @returns An LGNT amount */ static fromCanonicalPrefixedNumber(prefixed: Numbers.PrefixedNumber): Lgnt; /** * Builds an LGNT amount. * * @param amount The amount * @returns An LGNT amount */ static from(amount: bigint | number | string): Lgnt; /** * Builds an LGNT amount * given as a `PrefixedNumber` instance. * * @param amount The amount * @returns An LGNT amount */ static fromPrefixedNumber(amount: Numbers.PrefixedNumber): Lgnt; /** * @returns An amount of 0 LGNT */ static zero(): Lgnt; /** * Constructs an LGNT amount given its canonical form. * Developers should prefer the use of the static factory * methods provided by this class to make the code more * self-explanatory. * * @param canonical The canonical form of an amount of LGNT */ constructor(canonical: bigint); /** * The canonical form of this amount. */ readonly canonical: bigint; /** * @returns The canonical form of this amount as a `PrefixedNumber`. */ toCanonicalPrefixedNumber(): Numbers.PrefixedNumber; /** * @param unit The unit to express this amount into. * If not provided, `Numbers.NONE` is used by default. * @returns This amount as a `PrefixedNumber`. */ toPrefixedNumber(unit?: Numbers.UnitPrefix): Numbers.PrefixedNumber; /** * Adds this amount to another. * * @param amount Another amount * @returns The addition of this amount with another */ add(amount: Lgnt): Lgnt; /** * Substracts another amount from this one. * * @param amount Another amount * @returns This amount minus the other */ substract(amount: Lgnt): Lgnt; /** * Multiplies this amount by a given factor. * * @param factor The factor * @returns The multiplication of this amount with given factor. */ multiply(factor: bigint): Lgnt; /** * Divides this amount by a given divider. * Given the fixed precision of an amount of LGNT, this * operation may result in a loss of value. * * @param divider The divider * @returns The division of this amount by given divider. */ divide(divider: bigint): Lgnt; /** * Negate this amount. * @returns the negated amount/ */ negate(): Lgnt; /** * Check if this amount is strictly negative (i.e. less than zero). * @returns true if amount is strictly negative, false otherwise. */ isNegative(): boolean; /** * The integer part of this amount expressed in given unit. * * @param unit The unit in which to express this amount * @returns The integer part of this amount */ integerPart(unit?: Numbers.UnitPrefix): bigint; /** * The decimal part of this amount expressed in given unit. * The returned string has always a length equal to the * expected number of decimals. It might be zero-padded * on the left. * * @param decimals The number of decimals * @param unit The unit in which to express this amount * @returns The decimal part of this amount */ decimalPartString(decimals: number, unit?: Numbers.UnitPrefix): string; /** * The decimal part of this amount expressed in given unit. * * @param decimals The maximum number of decimals * @param unit The unit in which to express this amount * @returns The decimal part of this amount */ decimalPart(decimals: number, unit?: Numbers.UnitPrefix): bigint; /** * Converts this amount into a fiat amount given a rate LGNT/FIAT. * For example, if 20 LGNTs = 1 FIAT, then the rate is 20. * * @param rate The rate to apply * @returns The fiat equivalent of this LGNT amount */ convertToFiat(rate: number): number; /** * Builds an LGNT amount given a fiat amount and a rate LGNT/FIAT. * For example, if 20 LGNTs = 1 FIAT, then the rate is 20. * * @param amount a fiat amount * @param rate The rate to apply * @returns The LGNT equivalent of given fiat amount */ static fromFiat(amount: number, rate: number): Lgnt; /** * Checks equality of this amount with another. * * @param another Another LGNT amount * @returns True if both amounts are equal, false otherwise */ equalTo(another: Lgnt): boolean; /** * Compares this amount to another. * * @param another Another LGNT amount * @returns Zero if both amounts are equal, * a negative value if this amount is lower than the other, * a positive value if this amount is greater than the other */ compareTo(another: Lgnt): number; /** * @returns The canonical form of this amount as a string. */ toString(): string; } /** * A formatter for LGNT amounts. It is parametrized with the * number of decimals to display and the unit in which to * display the amounts. */ export declare class LgntFormatter { constructor(decimals: number, unit: Numbers.UnitPrefix); private decimals; private unit; format(lgnt: Lgnt): string; } /** * @deprecated use Lgnt.SMALLEST_UNIT_PREFIX */ export declare const LGNT_SMALLEST_UNIT: Numbers.UnitPrefix; /** * @deprecated use Lgnt.from(1).canonical */ export declare const LGNT: bigint; /** * @deprecated use Lgnt.CODE */ export declare const SYMBOL = "LGNT"; /** * @deprecated use Lgnt.fromPrefixedNumber(amount).canonical */ export declare function toCanonicalAmount(amount: Numbers.PrefixedNumber): bigint; /** * @deprecated use Lgnt.fromCanonical(canonicalAmount).toCanonicalPrefixedNumber() */ export declare function toPrefixedNumberAmount(canonicalAmount: bigint): Numbers.PrefixedNumber; /** * @deprecated use Lgnt.from(lgntAmount).toPrefixedNumber() */ export declare function nLgnt(lgntAmount: bigint): Numbers.PrefixedNumber;