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

    Remarks

    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

    Remarks

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

  • Applys increments to balances. Returns a new BalanceArray with the incremented balances.

    Parameters

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

    Returns BalanceArray<T>

    Remarks

    Can also be used via the applyIncrements method on BalanceArray

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

    Parameters

    Returns boolean

    Remarks

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

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

    Returns this

    Remarks

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

  • Find the balance amount for a specific badge ID at a specific time within a set of balances. Returns x0 if not found.

    Parameters

    • badgeId: T

      The Badge ID to search for.

    • ownedTime: T

      The time to search for.

    Returns T

    Remarks

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

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

    Parameters

    • badgeId: T

    Returns BalanceArray<T>

    Remarks

    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>

    Remarks

    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>

    Remarks

    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>

    Remarks

    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

    Remarks

    Returns a new BalanceArray. Does not modify the original.

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