Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Coin

Captures sdk.Coin and sdk.DecCoin from Cosmos SDK. A composite value that combines a denomination with an amount value. Coins are immutable once created, and operations that return Coin will return a new Coin. See Coins for a collection of Coin objects.

Hierarchy

Implements

Index

Constructors

constructor

  • new Coin(denom: string, amount: Value): Coin
  • Creates a new coin. Depending on the type of amount, it will be converted to an integer coin or decimal coin.

    Parameters

    • denom: string

      denomination

    • amount: Value

      coin's amount

    Returns Coin

Properties

Readonly amount

amount: Numeric.Output

Readonly denom

denom: string

Methods

add

div

  • div(other: Value): Coin

isDecCoin

  • isDecCoin(): boolean
  • Checks whether the Coin is a Decimal coin.

    Returns boolean

isIntCoin

  • isIntCoin(): boolean
  • Checks whether the Coin is an Integer coin.

    Returns boolean

mod

  • mod(other: Value): Coin

mul

  • mul(other: Value): Coin

sub

toAmino

toAminoJSON

  • toAminoJSON(): string
  • Returns string

toData

toDecCoin

toIntCeilCoin

  • toIntCeilCoin(): Coin
  • Turns the Coin into an Integer coin with ceiling the amount.

    Returns Coin

toIntCoin

toJSON

  • toJSON(): string
  • Returns string

toProto

  • toProto(): Coin

toString

  • toString(): string
  • Outputs <amount><denom>.

    Eg: Coin('uluna', 1500) -> 1500uluna

    Returns string

Static fromAmino

Static fromData

Static fromProto

  • fromProto(proto: Coin): Coin

Static fromString

  • fromString(str: string): Coin