Skip to content

algorand

AlgorandClientA client that brokers easy access to Algorand functionality.

A client that brokers easy access to Algorand functionality.

set_default_validity_window(validity_window: int) → typing_extensions.Self

Section titled “set_default_validity_window(validity_window: int) → typing_extensions.Self”

Sets the default validity window for transactions.

  • Parameters: validity_window – The number of rounds between the first and last valid rounds
  • Returns: The AlgorandClient so method calls can be chained
  • Example:
    algorand = AlgorandClient.mainnet().set_default_validity_window(1000);

Sets the default signer to use if no other signer is specified.

  • Parameters: signer – The signer to use, either a TransactionSigner or a TransactionSignerAccountProtocol
  • Returns: The AlgorandClient so method calls can be chained
  • Example:
    signer = SigningAccount(private_key=..., address=...)
    algorand = AlgorandClient.mainnet().set_default_signer(signer)

set_signer(sender: str, signer: algosdk.atomic_transaction_composer.TransactionSigner) → typing_extensions.Self

Section titled “set_signer(sender: str, signer: algosdk.atomic_transaction_composer.TransactionSigner) → typing_extensions.Self”

Tracks the given account for later signing.

  • Parameters:
    • sender – The sender address to use this signer for
    • signer – The signer to sign transactions with for the given sender
  • Returns: The AlgorandClient so method calls can be chained
  • Example:
    signer = SigningAccount(private_key=..., address=...)
    algorand = AlgorandClient.mainnet().set_signer(signer.addr, signer.signer)

Sets the default signer to use if no other signer is specified.

  • Parameters: signer – The signer to use, either a TransactionSigner or a TransactionSignerAccountProtocol
  • Returns: The AlgorandClient so method calls can be chained
  • Example:
    accountManager = AlgorandClient.mainnet()
    accountManager.set_signer_from_account(TransactionSignerAccount(address=..., signer=...))
    accountManager.set_signer_from_account(algosdk.LogicSigAccount(program, args))
    accountManager.set_signer_from_account(SigningAccount(private_key=..., address=...))
    accountManager.set_signer_from_account(MultisigAccount(metadata, signing_accounts))
    accountManager.set_signer_from_account(account)

set_suggested_params_cache(suggested_params: algosdk.transaction.SuggestedParams, until: float | None = None) → typing_extensions.Self

Section titled “set_suggested_params_cache(suggested_params: algosdk.transaction.SuggestedParams, until: float | None = None) → typing_extensions.Self”

Sets a cache value to use for suggested params.

  • Parameters:
    • suggested_params – The suggested params to use
    • until – A timestamp until which to cache, or if not specified then the timeout is used
  • Returns: The AlgorandClient so method calls can be chained
  • Example:
    algorand = AlgorandClient.mainnet().set_suggested_params_cache(suggested_params, time.time() + 3.6e6)

set_suggested_params_cache_timeout(timeout: int) → typing_extensions.Self

Section titled “set_suggested_params_cache_timeout(timeout: int) → typing_extensions.Self”

Sets the timeout for caching suggested params.

  • Parameters: timeout – The timeout in milliseconds
  • Returns: The AlgorandClient so method calls can be chained
  • Example:
    algorand = AlgorandClient.mainnet().set_suggested_params_cache_timeout(10_000)

get_suggested_params() → algosdk.transaction.SuggestedParams

Section titled “get_suggested_params() → algosdk.transaction.SuggestedParams”

Get suggested params for a transaction (either cached or from algod if the cache is stale or empty)

  • Example:
    algorand = AlgorandClient.mainnet().get_suggested_params()

register_error_transformer(transformer: algokit_utils.transactions.transaction_composer.ErrorTransformer) → typing_extensions.Self

Section titled “register_error_transformer(transformer: algokit_utils.transactions.transaction_composer.ErrorTransformer) → typing_extensions.Self”

Register a function that will be used to transform an error caught when simulating or executing composed transaction groups made from new_group

  • Parameters: transformer – The error transformer function
  • Returns: The AlgorandClient so you can chain method calls

unregister_error_transformer(transformer: algokit_utils.transactions.transaction_composer.ErrorTransformer) → typing_extensions.Self

Section titled “unregister_error_transformer(transformer: algokit_utils.transactions.transaction_composer.ErrorTransformer) → typing_extensions.Self”

Unregister an error transformer function

  • Parameters: transformer – The error transformer function to remove
  • Returns: The AlgorandClient so you can chain method calls

Start a new TransactionComposer transaction group

  • Example:
    composer = AlgorandClient.mainnet().new_group()
    result = await composer.add_transaction(payment).send()

Get clients, including algosdk clients and app clients.

  • Example:
    clientManager = AlgorandClient.mainnet().client

Get or create accounts that can sign transactions.

  • Example:
    accountManager = AlgorandClient.mainnet().account

Get or create assets.

  • Example:
    assetManager = AlgorandClient.mainnet().asset

Get or create applications.

  • Example:
    appManager = AlgorandClient.mainnet().app

Get or create applications.

  • Example:
    appDeployer = AlgorandClient.mainnet().app_deployer

Methods for sending a transaction and waiting for confirmation

  • Example:
    result = await AlgorandClient.mainnet().send.payment(
    PaymentParams(
    sender="SENDERADDRESS",
    receiver="RECEIVERADDRESS",
    amount=AlgoAmount(algo-1)
    ))

Methods for building transactions

  • Example:
    transaction = AlgorandClient.mainnet().create_transaction.payment(
    PaymentParams(
    sender="SENDERADDRESS",
    receiver="RECEIVERADDRESS",
    amount=AlgoAmount(algo=1)
    ))

Returns an AlgorandClient pointing at default LocalNet ports and API token.

  • Returns: The AlgorandClient
  • Example:
    algorand = AlgorandClient.default_localnet()

Returns an AlgorandClient pointing at TestNet using AlgoNode.

  • Returns: The AlgorandClient
  • Example:
    algorand = AlgorandClient.testnet()

Returns an AlgorandClient pointing at MainNet using AlgoNode.

  • Returns: The AlgorandClient
  • Example:
    algorand = AlgorandClient.mainnet()

static from_clients(algod: algosdk.v2client.algod.AlgodClient, indexer: algosdk.v2client.indexer.IndexerClient | None = None, kmd: algosdk.kmd.KMDClient | None = None) → AlgorandClient

Section titled “static from_clients(algod: algosdk.v2client.algod.AlgodClient, indexer: algosdk.v2client.indexer.IndexerClient | None = None, kmd: algosdk.kmd.KMDClient | None = None) → AlgorandClient”

Returns an AlgorandClient pointing to the given client(s).

  • Parameters:
    • algod – The algod client to use
    • indexer – The indexer client to use
    • kmd – The kmd client to use
  • Returns: The AlgorandClient
  • Example:
    algorand = AlgorandClient.from_clients(algod, indexer, kmd)

Returns an AlgorandClient loading the configuration from environment variables.

Retrieve configurations from environment variables when defined or get defaults.

Expects to be called from a Python environment.

  • Returns: The AlgorandClient
  • Example:
    algorand = AlgorandClient.from_environment()

Returns an AlgorandClient from the given config.

  • Parameters:
    • algod_config – The config to use for the algod client
    • indexer_config – The config to use for the indexer client
    • kmd_config – The config to use for the kmd client
  • Returns: The AlgorandClient
  • Example:
    algorand = AlgorandClient.from_config(algod_config, indexer_config, kmd_config)