Type alias Amount<I, D>

Amount<I, D>: {
    basisPoints: bigint;
    decimals: D;
    identifier: I;
}

Describes an amount of any type or currency using the lowest possible unit. It uses a BigInt to represent the basis points of the amount, a decimal number to know how to interpret the basis points, and an identifier to know what type of amount we are dealing with.

Custom type parameters can be used to represent specific types of amounts. For example:

  • Amount<'SOL', 9> represents an amount of SOL in lamports.
  • Amount<'USD', 2> represents an amount of USD in cents.
  • Amount<'%', 2> represents a percentage with 2 decimals.

Type Parameters

Type declaration

  • basisPoints: bigint

    The amount in its lower possible unit such that it does not contain decimals.

  • decimals: D

    The number of decimals in the amount.

  • identifier: I

    The identifier of the amount.

Generated using TypeDoc