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

Type aliases

Static Data

Data: Data[]

Static DataDict

DataDict: {}

Type declaration

Static Input

Input: DataDict | Coin[] | Coins | string

Static ReprDict

ReprDict: {}

Type declaration

  • [denom: string]: Coin

Constructors

constructor

Methods

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

div

filter

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

    Parameters

    • fn: (c: Coin) => boolean

      predicate

        • (c: Coin): boolean
        • Parameters

          Returns boolean

    Returns Coins

get

  • Gets the Coin for denomination if it exists in the collection.

    Parameters

    • denom: Denom

      denomination to lookup

    Returns Coin | undefined

map

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

    Type parameters

    • T

    Parameters

    • fn: (c: Coin) => T
        • Parameters

          Returns T

    Returns T[]

mod

mul

set

sub

toArray

toData

toDecCoins

toIntCoins

toJSON

  • toJSON(): string

toString

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

    Eg: 15000ukrw,12000uluna

    Returns string

Static fromData

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