Skip to content

Create Publication

We are looking for publications that demonstrate building dApps or smart contracts!
See the full list of Gitcoin bounties that are eligible for rewards.

types amount.AlgoAmount

@algorandfoundation/algokit-utils / types/amount / AlgoAmount

Class: AlgoAmount

types/amount.AlgoAmount

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

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new AlgoAmount(amount): AlgoAmount

Parameters
Name Type
amount { algos: number } | { microAlgos: number }
Returns

AlgoAmount

Defined in

src/types/amount.ts:17

Properties

amountInMicroAlgos

Private amountInMicroAlgos: number

Defined in

src/types/amount.ts:5

Accessors

algos

get algos(): number

Return the amount as a number in Algos

Returns

number

Defined in

src/types/amount.ts:13


microAlgos

get microAlgos(): number

Return the amount as a number in µAlgos

Returns

number

Defined in

src/types/amount.ts:8

Methods

toString

toString(): string

Returns

string

Defined in

src/types/amount.ts:21


valueOf

valueOf(): number

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

Returns

number

Defined in

src/types/amount.ts:29


Algos

Algos(amount): AlgoAmount

Create a AlgoAmount object representing the given number of Algos

Parameters
Name Type
amount number
Returns

AlgoAmount

Defined in

src/types/amount.ts:34


MicroAlgos

MicroAlgos(amount): AlgoAmount

Create a AlgoAmount object representing the given number of µAlgos

Parameters
Name Type
amount number
Returns

AlgoAmount

Defined in

src/types/amount.ts:39