Skip to content

algokit_utils._ensure_funded

Classes

EnsureBalanceParametersParameters for ensuring an account has a minimum number of µALGOs
EnsureFundedResponseResponse for ensuring an account has a minimum number of µALGOs

Functions

ensure_fundedFunds a given account using a funding source such that it has a certain amount of algos free to spend
(accounting for ALGOs locked in minimum balance requirement)
see https://developer.algorand.org/docs/get-details/accounts/#minimum-balance

API

class algokit_utils._ensure_funded.EnsureBalanceParameters

EnsureBalanceParameters

Parameters for ensuring an account has a minimum number of µALGOs

account_to_fund

account_to_fund : algokit_utils.models.Account | algosdk.atomic_transaction_composer.AccountTransactionSigner | str

None

The account address that will receive the µALGOs

fee_micro_algos

fee_micro_algos : int | None

None

(optional) The flat fee you want to pay, useful for covering extra fees in a transaction group or app call

funding_source

funding_source : algokit_utils.models.Account | algosdk.atomic_transaction_composer.AccountTransactionSigner | algokit_utils.dispenser_api.TestNetDispenserApiClient | None

None

The account (with private key) or signer that will send the µALGOs, will use get_dispenser_account by default. Alternatively you can pass an instance of TestNetDispenserApiClient which will allow you to interact with AlgoKit TestNet Dispenser API.

max_fee_micro_algos

max_fee_micro_algos : int | None

None

(optional)The maximum fee that you are happy to pay (default: unbounded) - if this is set it’s possible the transaction could get rejected during network congestion

min_funding_increment_micro_algos

min_funding_increment_micro_algos : int

0

When issuing a funding amount, the minimum amount to transfer (avoids many small transfers if this gets called often on an active account)

min_spending_balance_micro_algos

min_spending_balance_micro_algos : int

None

The minimum balance of ALGOs that the account should have available to spend (i.e. on top of minimum balance requirement)

note

note : str | bytes | None

None

The (optional) transaction note, default: “Funding account to meet minimum requirement

suggested_params

suggested_params : algosdk.transaction.SuggestedParams | None

None

(optional) transaction parameters

class algokit_utils._ensure_funded.EnsureFundedResponse

EnsureFundedResponse

Response for ensuring an account has a minimum number of µALGOs

transaction_id

transaction_id : str

None

The amount of µALGOs that were funded

algokit_utils._ensure_funded.ensure_funded

ensure_funded(client: algosdk.v2client.algod.AlgodClient, parameters: algokit_utils._ensure_funded.EnsureBalanceParameters) → algokit_utils._ensure_funded.EnsureFundedResponse | None

Funds a given account using a funding source such that it has a certain amount of algos free to spend (accounting for ALGOs locked in minimum balance requirement) see https://developer.algorand.org/docs/get-details/accounts/#minimum-balance

Args: client (AlgodClient): An instance of the AlgodClient class from the AlgoSDK library. parameters (EnsureBalanceParameters): An instance of the EnsureBalanceParameters class that specifies the account to fund and the minimum spending balance.

Returns: PaymentTxn | str | None: If funds are needed, the function returns a payment transaction or a string indicating that the dispenser API was used. If no funds are needed, the function returns None.