Skip to content

AlgoAmount

class algokit_utils.models.amount.AlgoAmount(*, micro_algo: int)

Section titled “class algokit_utils.models.amount.AlgoAmount(*, micro_algo: int)”

class AlgoAmount(*, algo: int | decimal.Decimal)

Section titled “class AlgoAmount(*, algo: int | decimal.Decimal)”

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

  • Example:
    >>> amount = AlgoAmount(algo=1)
    >>> amount = AlgoAmount.from_algo(1)
    >>> amount = AlgoAmount(micro_algo=1_000_000)
    >>> amount = AlgoAmount.from_micro_algo(1_000_000)

Return the amount as a number in µAlgo.

  • Returns: The amount in µAlgo.

Return the amount as a number in Algo.

  • Returns: The amount in Algo.

Create an AlgoAmount object representing the given number of Algo.

  • Parameters: amount – The amount in Algo.
  • Returns: An AlgoAmount instance.
  • Example:
    >>> amount = AlgoAmount.from_algo(1)

Create an AlgoAmount object representing the given number of µAlgo.

  • Parameters: amount – The amount in µAlgo.
  • Returns: An AlgoAmount instance.
  • Example:
    >>> amount = AlgoAmount.from_micro_algo(1_000_000)