ao-js-sdk - v0.2.11
    Preparing search index...

    Interface ICurrencyAmount

    Interface for representing currency amounts with precise decimal handling. Provides methods for accessing the raw amount, decimal precision, and various formatting options.

    interface ICurrencyAmount {
        amount(): bigint;
        decimals(): number;
        toAbbreviated(decimalPlaces?: number): string;
        toFixed(decimalPlaces: number): string;
        toString(): string;
    }

    Implemented by

    Index

    Methods

    • Gets the raw amount as a bigint value. This represents the amount in the smallest unit (e.g., wei for ETH, satoshis for BTC).

      Returns bigint

      The raw amount as a bigint

    • Formats the currency amount using abbreviated notation (K, M, B, T). Examples: 1,500 -> "1.5K", 2,500,000 -> "2.5M", 1,000,000,000 -> "1B"

      Parameters

      • OptionaldecimalPlaces: number

        Optional number of decimal places for the abbreviated value (default: 1)

      Returns string

      Formatted string with K/M/B/T suffix

    • Formats the currency amount to a string with a specified number of decimal places.

      Parameters

      • decimalPlaces: number

        The number of decimal places to display

      Returns string

      Formatted string with the specified decimal places