Skip to content

AlgoAmount

Defined in: algokit-utils-ts/src/types/amount.ts:4

Wrapper class to ensure safe, explicit conversion between µAlgo, Algo and numbers

new AlgoAmount(amount): AlgoAmount

Defined in: algokit-utils-ts/src/types/amount.ts:37

Create a new AlgoAmount instance.

{ algos: number | bigint; } | { algo: number | bigint; } | { microAlgos: number | bigint; } | { microAlgo: number | bigint; }

An object specifying the amount in Algo or µALGO. Use the key ‘algo’ for Algo amounts and ‘microAlgo’ for µALGO.

AlgoAmount

A new instance of AlgoAmount representing the specified amount.

const amount = new AlgoAmount({ algo: 5 });

get algo(): number

Defined in: algokit-utils-ts/src/types/amount.ts:23

Return the amount as a number in Algo

number


get algos(): number

Defined in: algokit-utils-ts/src/types/amount.ts:18

Return the amount as a number in Algo

number


get microAlgo(): bigint

Defined in: algokit-utils-ts/src/types/amount.ts:13

Return the amount as a number in µAlgo

bigint


get microAlgos(): bigint

Defined in: algokit-utils-ts/src/types/amount.ts:8

Return the amount as a number in µAlgo

bigint

toString(): string

Defined in: algokit-utils-ts/src/types/amount.ts:50

string


valueOf(): number

Defined in: algokit-utils-ts/src/types/amount.ts:58

valueOf allows you to use AlgoAmount in comparison operations such as < and >= etc., but it’s not recommended to use this to convert to a number, it’s much safer to explicitly call the algos or microAlgos properties

number


static Algo(amount): AlgoAmount

Defined in: algokit-utils-ts/src/types/amount.ts:68

Create a AlgoAmount object representing the given number of Algo

number | bigint

AlgoAmount


static Algos(amount): AlgoAmount

Defined in: algokit-utils-ts/src/types/amount.ts:63

Create a AlgoAmount object representing the given number of Algo

number | bigint

AlgoAmount


static MicroAlgo(amount): AlgoAmount

Defined in: algokit-utils-ts/src/types/amount.ts:78

Create a AlgoAmount object representing the given number of µAlgo

number | bigint

AlgoAmount


static MicroAlgos(amount): AlgoAmount

Defined in: algokit-utils-ts/src/types/amount.ts:73

Create a AlgoAmount object representing the given number of µAlgo

number | bigint

AlgoAmount