Class BalanceArray<T>

Type Parameters

Hierarchy

Implements

  • BalanceFunctions<T>

Constructors

  • Type Parameters

    Parameters

    • arrayLength: number

    Returns BalanceArray<T>

  • Type Parameters

    Parameters

    Returns BalanceArray<T>

Methods

  • Adds the balanceToAdd to the existing balances. Returns a new BalanceArray.

    Parameters

    Returns this

    Can also be used via the corresponding method with same name on BalanceArray

  • Adds multiple balances to the existing balances. Returns a new BalanceArray.

    Parameters

    Returns this

    Can also be used via the corresponding method with same name on BalanceArray

  • {@inheritDoc applyIncrementsToBalances}

    Parameters

    • incrementBadgeIdsBy: T
    • incrementOwnershipTimesBy: T
    • numIncrements: T

    Returns BalanceArray<T>

  • Checks if two balances are equal. Flag to check if the balances with zero amounts should be checked as well.

    Parameters

    Returns boolean

    Can also be used via the corresponding method with same name on BalanceArray

  • Determines whether all the members of an array satisfy the specified test.

    Parameters

    • predicate: ((value: Balance<T>, index: number, array: BalanceArray<T>) => unknown)

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

        • (value, index, array): unknown
        • Parameters

          Returns unknown

    • OptionalthisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns boolean

  • Filters out all balances with amount == 0. Returns a new BalanceArray.

    Returns this

    Can also be used via the corresponding method with same name on BalanceArray

  • {@inheritDoc getBalanceForIdAndTime}

    Parameters

    • badgeId: T
    • ownedTime: T

    Returns T

  • Returns all matching balances for a specific badge ID. Returns a new BalanceArray.

    Parameters

    • badgeId: T

    Returns BalanceArray<T>

    Can also be used via the corresponding method with same name on BalanceArray

  • Returns all matching balances for a specific time via a new BalanceArray.

    Parameters

    • ownedTime: T

    Returns BalanceArray<T>

    Can also be used via the corresponding method with same name on BalanceArray

  • Checks if the current balances are a subset of the threshold balances (i.e. doesn't exceed the threshold).

    Parameters

    Returns boolean

  • Subtracts the balanceToRemove from the existing balances. Returns a new BalanceArray.

    Throws an error if the balances underflow.

    Parameters

    • balanceToSubtract: iBalance<T>
    • allowUnderflow: boolean

    Returns BalanceArray<T>

    Can also be used via the corresponding method with same name on BalanceArray

  • Subtracts multiple balances from the existing balances. Returns a new BalanceArray.

    Throws an error if the balances underflow.

    Parameters

    Returns BalanceArray<T>

    Can also be used via the corresponding method with same name on BalanceArray

  • Updates the balance for what it currently is to newAmount.

    Parameters

    Returns this

    Returns a new BalanceArray. Does not modify the original.

    Can also be used via the corresponding method with same name on BalanceArray