# `Rujira.Coin`
[🔗](https://github.com/RujiraNetwork/rujira_ex/blob/v0.0.1/lib/rujira/coin.ex#L1)

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.

# `t`

```elixir
@type t() :: %Rujira.Coin{amount: Rujira.Amount.t(), asset: Rujira.Assets.Asset.t()}
```

# `denom`

```elixir
@spec denom(t()) :: {:ok, String.t()} | {:error, term()}
```

Returns the native denom string for this coin's asset.

# `new`

```elixir
@spec new(%{denom: String.t(), amount: String.t()}) :: {:ok, t()} | {:error, term()}
```

# `new`

```elixir
@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`

```elixir
@spec parse(String.t()) :: {:ok, [t()]} | {:error, :invalid_coin_format}
```

Parse a comma-separated coin string into a list of coins.
Supports both `"1000rune"` and `"1000 rune"` formats.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
