Function formatAssetAmountCurrency

  • Formats an asset amount using its currency symbol

    If decimal is not set, amount.decimal is used If asset is not set, $ will be used as currency symbol by default trimZeros is false by default Note: trimZeros wins over decimal

    Parameters

    • params: {
          amount: {
              amount: (() => BigNumber);
              decimal: number;
              div: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
              eq: ((value) => boolean);
              gt: ((value) => boolean);
              gte: ((value) => boolean);
              lt: ((value) => boolean);
              lte: ((value) => boolean);
              minus: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
              plus: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
              times: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
              type: Asset;
          };
          asset?: Asset;
          decimal?: number;
          trimZeros?: boolean;
      }

      The asset amount currency format options.

      • amount: {
            amount: (() => BigNumber);
            decimal: number;
            div: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
            eq: ((value) => boolean);
            gt: ((value) => boolean);
            gte: ((value) => boolean);
            lt: ((value) => boolean);
            lte: ((value) => boolean);
            minus: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
            plus: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
            times: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; });
            type: Asset;
        }
        • amount: (() => BigNumber)
            • (): BigNumber
            • Returns BigNumber

        • decimal: number
        • div: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
            • (value, decimal?): { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
              • Optional decimal: number

              Returns { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

        • eq: ((value) => boolean)
            • (value): boolean
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })

              Returns boolean

        • gt: ((value) => boolean)
            • (value): boolean
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })

              Returns boolean

        • gte: ((value) => boolean)
            • (value): boolean
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })

              Returns boolean

        • lt: ((value) => boolean)
            • (value): boolean
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })

              Returns boolean

        • lte: ((value) => boolean)
            • (value): boolean
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })

              Returns boolean

        • minus: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
            • (value, decimal?): { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
              • Optional decimal: number

              Returns { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

        • plus: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
            • (value, decimal?): { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
              • Optional decimal: number

              Returns { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

        • times: ((value, decimal?) => { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
            • (value, decimal?): { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }
            • Parameters

              • value: Value | ({ type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; })
              • Optional decimal: number

              Returns { type: Denomination.Asset; amount: () => BigNumber; plus: (value: Value | ..., decimal?: number | undefined) => ...; minus: (value: Value | ..., decimal?: number | undefined) => ...; ... 7 more ...; decimal: number; }

        • type: Asset
      • Optional asset?: Asset
      • Optional decimal?: number
      • Optional trimZeros?: boolean

    Returns string

    The formatted asset amount string using its currency format.

Generated using TypeDoc