Canonical coin type for Rujira.
Represents an asset + amount pair. Amount is always an integer in smallest units. Asset is always resolved at construction time.
Summary
Functions
Returns the native denom string for this coin's asset.
Parse a comma-separated coin string into a list of coins.
Supports both "1000rune" and "1000 rune" formats.
Types
@type t() :: %Rujira.Coin{amount: Rujira.Amount.t(), asset: Rujira.Assets.Asset.t()}
Functions
Returns the native denom string for this coin's asset.
@spec new(Rujira.Assets.Asset.t(), non_neg_integer()) :: t()
@spec new(String.t(), non_neg_integer()) :: {:ok, t()} | {:error, term()}
@spec new(String.t(), String.t()) :: {:ok, t()} | {:error, term()}
Parse a comma-separated coin string into a list of coins.
Supports both "1000rune" and "1000 rune" formats.