Evolution SDK

Coin.ts

Coin overview


Table of contents


constants

MAX_COIN_VALUE

Maximum value for a coin amount (maxWord64).

Signature

export declare const MAX_COIN_VALUE: 18446744073709551615n

Added in v2.0.0

generators

arbitrary

Generate a random Coin value.

Signature

export declare const arbitrary: FastCheck.Arbitrary<bigint>

Added in v2.0.0

model

Coin (type alias)

Type alias for Coin representing ADA amounts in lovelace. 1 ADA = 1,000,000 lovelace

Signature

export type Coin = typeof Coin.Type

Added in v2.0.0

ordering

compare

Compare two coin amounts.

Signature

export declare const compare: (a: Coin, b: Coin) => -1 | 0 | 1

Added in v2.0.0

predicates

is

Check if a value is a valid Coin.

Signature

export declare const is: (u: unknown, overrideOptions?: ParseOptions | number) => u is bigint

Added in v2.0.0

schemas

Coin

Schema for validating coin amounts as unsigned 64-bit integers. coin = uint

Signature

export declare const Coin: Schema.refine<bigint, typeof Schema.BigInt>

Added in v2.0.0

transformation

add

Add two coin amounts safely.

Signature

export declare const add: (a: Coin, b: Coin) => Coin

Added in v2.0.0

subtract

Subtract two coin amounts safely.

Signature

export declare const subtract: (a: Coin, b: Coin) => Coin

Added in v2.0.0