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

  • 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

amount: Numeric.Output
denom: string

Methods

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

    Returns boolean

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

    Returns boolean

  • mod(other: Value): Coin
  • mul(other: Value): Coin
  • toAminoJSON(isClassic?: boolean): string
  • Parameters

    • Optional isClassic: boolean

    Returns string

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

    Returns Coin

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

    • Optional isClassic: boolean

    Returns string

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

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

    Returns string

  • fromProto(proto: Coin): Coin
  • fromString(str: string): Coin