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

constructor

  • Parameters

    Returns Coins

Methods

[iterator]

  • [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

add

  • 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

  • denoms(): string[]

div

filter

  • Filters out the Coin objects that don't match the predicate

    Parameters

    • fn: (c: Coin) => boolean

      predicate

        • Parameters

          Returns boolean

    Returns Coins

get

  • 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

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

    Type parameters

    • T

    Parameters

    Returns T[]

mod

mul

set

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

    Parameters

    • denom: string

      denomination to set

    • value: Coin | Value

      value to set

    Returns void

sub

toAmino

toAminoJSON

  • toAminoJSON(): string
  • Returns string

toArray

toData

toDecCoins

toIntCeilCoins

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

    Returns Coins

toIntCoins

toJSON

  • toJSON(): string
  • Returns string

toProto

toString

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

    Eg: 15000ukrw,12000uluna

    Returns string

Static fromAmino

Static fromData

Static fromProto

Static fromString

  • 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