Docs
chromia.com

Function

createAmount

  • createAmount(num: SupportedNumber, decimals?: number): Amount

    Returns a new asset amount.

    Parameters

    • num: SupportedNumber

      The desired value for the amount.

    • Optionaldecimals: number

      The desired number of decimal digits.

    Returns Amount

    An asset amount with the specified value, and decimal digits added to it if needed. Be careful with blockchain return values! They are generally represented as big integers, removing the decimal point. If you want to use (num: 1000, decimals: 3) to represent 1.000, you should use createAmountFromBalance(1000, 3) instead.

    Example

    TypeScript
    createAmount(1, 2) // returns 1.00
    createAmount("1", 2) // returns 1.00