Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Variables

MAX_GAS: BN = ...
ONE_TGAS: BN = ...
ZERO: BN = ...

Functions

  • bnToApproximateDecimal(v: BN, decimals: number, precision?: number): number
  • Parameters

    • v: BN
    • decimals: number
    • Optional precision: number

    Returns number

  • bnToFixed(num: BN, decimals: number, precision?: number): string
  • Analogous to Number.toFixed() for BN values. Example

    example

    bnToFixed(new BN(123), 2, 5) === '1.23000'; // true

    Parameters

    • num: BN

      on-chain integer representation

    • decimals: number

      number of decimals

    • Optional precision: number

      optional precision, same as in Number.toFixed()

    Returns string

  • decimalToBn(price: number, decimals: number): BN
  • denomination(decimals: number): BN
  • floorToBn(v: BN, closest: BN): BN
  • floorToDecimals(v: BN, decimals: number): BN
  • functionCallWithOutcome<T>(account: Account, params: FunctionCallOptions): Promise<{ executionOutcome: FinalExecutionOutcome; response: T }>
  • roundDownTo(v: BN, nearest: BN): BN
  • tgasAmount(tgas: number): BN
  • toDecimalPaddedString(val: string, decimals?: number): string
  • Turn a decimal number into its on-chain integer representation.

    example

    toDecimalPaddedString('1.23', 2) === '123'

    Parameters

    • val: string

      A number as a string

    • Optional decimals: number

      Number of decimals

    Returns string

    BN of the number

Generated using TypeDoc