Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Coins

Analagous to sdk.Coins and sdk.DecCoins from Cosmos-SDK, and represents a collection of Coin objects.

Hierarchy

Implements

Index

Constructors

  • Parameters

    Returns Coins

Methods

  • [iterator](): { next: (() => { done: true; value: Coin }) }
  • Returns { next: (() => { done: true; value: Coin }) }

    • next: (() => { done: true; value: Coin })
        • (): { done: true; value: Coin }
        • Returns { done: true; value: Coin }

          • done: true
          • value: Coin
  • Adds a value from the elements of the collection. Coins of a similar denomination will be clobbered into one value containing their sum.

    Parameters

    Returns Coins

  • denoms(): string[]
  • Filters out the Coin objects that don't match the predicate

    Parameters

    • fn: ((c: Coin) => boolean)

      predicate

        • Parameters

          Returns boolean

    Returns Coins

  • find(fn: ((c: Coin) => boolean)): undefined | Coin
  • Find out the Coin objects that match the predicate

    Parameters

    • fn: ((c: Coin) => boolean)

      predicate

        • Parameters

          Returns boolean

    Returns undefined | Coin

  • get(denom: string): undefined | Coin
  • Gets the Coin for denomination if it exists in the collection.

    Parameters

    • denom: string

      denomination to lookup

    Returns undefined | Coin

  • map<T>(fn: ((c: Coin) => T)): T[]
  • Map a value onto the elements of the Coin collection.

    Type Parameters

    • T

    Parameters

    Returns T[]

  • set(denom: string, value: Value | Coin): void
  • Sets the Coin value for a denomination.

    Parameters

    • denom: string

      denomination to set

    • value: Value | Coin

      value to set

    Returns void

  • toAminoJSON(isClassic?: boolean): string
  • Parameters

    • Optional isClassic: boolean

    Returns string

  • Creates a new Coins object with all Integer coins with ceiling the amount

    Returns Coins

  • toJSON(isClassic?: boolean): string
  • Parameters

    • Optional isClassic: boolean

    Returns string

  • toString(): string
  • Converts the Coins information to a comma-separated list.

    Eg: 15000ukrw,12000uluna

    Returns string

  • fromString(str: string): Coins
  • Converts a comma-separated list of coins to a Coins object

    Eg. 1500ukrw,12302uluna

    Parameters

    • str: string

      comma-separated list of coins

    Returns Coins