transactions.transaction_composer
Attributes
Section titled “Attributes”ErrorTransformer | |
|---|---|
MethodCallParams | |
AppMethodCallTransactionArgument | |
TxnParams |
Classes
Section titled “Classes”PaymentParams | Parameters for a payment transaction. |
|---|---|
AssetCreateParams | Parameters for creating a new asset. |
AssetConfigParams | Parameters for configuring an existing asset. |
AssetFreezeParams | Parameters for freezing an asset. |
AssetDestroyParams | Parameters for destroying an asset. |
OnlineKeyRegistrationParams | Parameters for online key registration. |
OfflineKeyRegistrationParams | Parameters for offline key registration. |
AssetTransferParams | Parameters for transferring an asset. |
AssetOptInParams | Parameters for opting into an asset. |
AssetOptOutParams | Parameters for opting out of an asset. |
AppCallParams | Parameters for calling an application. |
AppCreateSchema | dict() -> new empty dictionary |
AppCreateParams | Parameters for creating an application. |
AppUpdateParams | Parameters for updating an application. |
AppDeleteParams | Parameters for deleting an application. |
AppCallMethodCallParams | Parameters for a regular ABI method call. |
AppCreateMethodCallParams | Parameters for an ABI method call that creates an application. |
AppUpdateMethodCallParams | Parameters for an ABI method call that updates an application. |
AppDeleteMethodCallParams | Parameters for an ABI method call that deletes an application. |
BuiltTransactions | Set of transactions built by TransactionComposer. |
TransactionComposerBuildResult | Result of building transactions with TransactionComposer. |
SendAtomicTransactionComposerResults | Results from sending an AtomicTransactionComposer transaction group. |
TransactionComposer | A class for composing and managing Algorand transactions. |
Functions
Section titled “Functions”calculate_extra_program_pages(→ int) | Calculate minimum number of extra_pages required for provided approval and clear programs |
|---|---|
populate_app_call_resources(…) | Populate application call resources based on simulation results. |
prepare_group_for_sending(…) | Take an existing Atomic Transaction Composer and return a new one with changes applied to the transactions |
send_atomic_transaction_composer(…) | Send an AtomicTransactionComposer transaction group. |
Module Contents
Section titled “Module Contents”algokit_utils.transactions.transaction_composer.ErrorTransformer
Section titled “algokit_utils.transactions.transaction_composer.ErrorTransformer”class algokit_utils.transactions.transaction_composer.PaymentParams
Section titled “class algokit_utils.transactions.transaction_composer.PaymentParams”Bases: _CommonTxnParams
Parameters for a payment transaction.
receiver : str
Section titled “receiver : str”The account that will receive the ALGO
amount : algokit_utils.models.amount.AlgoAmount
Section titled “amount : algokit_utils.models.amount.AlgoAmount”Amount to send
close*remainder_to *: str | None_ = None
Section titled “close*remainder_to *: str | None_ = None”If given, close the sender account and send the remaining balance to this address, defaults to None
class algokit_utils.transactions.transaction_composer.AssetCreateParams
Section titled “class algokit_utils.transactions.transaction_composer.AssetCreateParams”Bases: _CommonTxnParams
Parameters for creating a new asset.
total : int
Section titled “total : int”The total amount of the smallest divisible unit to create
asset*name *: str | None_ = None
Section titled “asset*name *: str | None_ = None”The full name of the asset
unit*name *: str | None_ = None
Section titled “unit*name *: str | None_ = None”The short ticker name for the asset
url : str | None = None
Section titled “url : str | None = None”The metadata URL for the asset
decimals : int | None = None
Section titled “decimals : int | None = None”The amount of decimal places the asset should have
default*frozen *: bool | None_ = None
Section titled “default*frozen *: bool | None_ = None”Whether the asset is frozen by default in the creator address
manager : str | None = None
Section titled “manager : str | None = None”The address that can change the manager, reserve, clawback, and freeze addresses
reserve : str | None = None
Section titled “reserve : str | None = None”The address that holds the uncirculated supply
freeze : str | None = None
Section titled “freeze : str | None = None”The address that can freeze the asset in any account
clawback : str | None = None
Section titled “clawback : str | None = None”The address that can clawback the asset from any account
metadata*hash *: bytes | None_ = None
Section titled “metadata*hash *: bytes | None_ = None”Hash of the metadata contained in the metadata URL
class algokit_utils.transactions.transaction_composer.AssetConfigParams
Section titled “class algokit_utils.transactions.transaction_composer.AssetConfigParams”Bases: _CommonTxnParams
Parameters for configuring an existing asset.
asset*id *: int_
Section titled “asset*id *: int_”The ID of the asset
manager : str | None = None
Section titled “manager : str | None = None”The address that can change the manager, reserve, clawback, and freeze addresses, defaults to None
reserve : str | None = None
Section titled “reserve : str | None = None”The address that holds the uncirculated supply, defaults to None
freeze : str | None = None
Section titled “freeze : str | None = None”The address that can freeze the asset in any account, defaults to None
clawback : str | None = None
Section titled “clawback : str | None = None”The address that can clawback the asset from any account, defaults to None
class algokit_utils.transactions.transaction_composer.AssetFreezeParams
Section titled “class algokit_utils.transactions.transaction_composer.AssetFreezeParams”Bases: _CommonTxnParams
Parameters for freezing an asset.
asset*id *: int_
Section titled “asset*id *: int_”The ID of the asset
account : str
Section titled “account : str”The account to freeze or unfreeze
frozen : bool
Section titled “frozen : bool”Whether the assets in the account should be frozen
class algokit_utils.transactions.transaction_composer.AssetDestroyParams
Section titled “class algokit_utils.transactions.transaction_composer.AssetDestroyParams”Bases: _CommonTxnParams
Parameters for destroying an asset.
asset*id *: int_
Section titled “asset*id *: int_”The ID of the asset
class algokit_utils.transactions.transaction_composer.OnlineKeyRegistrationParams
Section titled “class algokit_utils.transactions.transaction_composer.OnlineKeyRegistrationParams”Bases: _CommonTxnParams
Parameters for online key registration.
vote*key *: str_
Section titled “vote*key *: str_”The root participation public key
selection*key *: str_
Section titled “selection*key *: str_”The VRF public key
vote*first *: int_
Section titled “vote*first *: int_”The first round that the participation key is valid
vote*last *: int_
Section titled “vote*last *: int_”The last round that the participation key is valid
vote*key_dilution *: int_
Section titled “vote*key_dilution *: int_”The dilution for the 2-level participation key
state*proof_key *: bytes | None_ = None
Section titled “state*proof_key *: bytes | None_ = None”The 64 byte state proof public key commitment, defaults to None
class algokit_utils.transactions.transaction_composer.OfflineKeyRegistrationParams
Section titled “class algokit_utils.transactions.transaction_composer.OfflineKeyRegistrationParams”Bases: _CommonTxnParams
Parameters for offline key registration.
prevent*account_from_ever_participating_again *: bool_
Section titled “prevent*account_from_ever_participating_again *: bool_”Whether to prevent the account from ever participating again
class algokit_utils.transactions.transaction_composer.AssetTransferParams
Section titled “class algokit_utils.transactions.transaction_composer.AssetTransferParams”Bases: _CommonTxnParams
Parameters for transferring an asset.
asset*id *: int_
Section titled “asset*id *: int_”The ID of the asset
amount : int
Section titled “amount : int”The amount of the asset to transfer (smallest divisible unit)
receiver : str
Section titled “receiver : str”The account to send the asset to
clawback*target *: str | None_ = None
Section titled “clawback*target *: str | None_ = None”The account to take the asset from, defaults to None
close*asset_to *: str | None_ = None
Section titled “close*asset_to *: str | None_ = None”The account to close the asset to, defaults to None
class algokit_utils.transactions.transaction_composer.AssetOptInParams
Section titled “class algokit_utils.transactions.transaction_composer.AssetOptInParams”Bases: _CommonTxnParams
Parameters for opting into an asset.
asset*id *: int_
Section titled “asset*id *: int_”The ID of the asset
class algokit_utils.transactions.transaction_composer.AssetOptOutParams
Section titled “class algokit_utils.transactions.transaction_composer.AssetOptOutParams”Bases: _CommonTxnParams
Parameters for opting out of an asset.
asset*id *: int_
Section titled “asset*id *: int_”The ID of the asset
creator : str
Section titled “creator : str”The creator address of the asset
class algokit_utils.transactions.transaction_composer.AppCallParams
Section titled “class algokit_utils.transactions.transaction_composer.AppCallParams”Bases: _CommonTxnParams
Parameters for calling an application.
on*complete *: algosdk.transaction.OnComplete_
Section titled “on*complete *: algosdk.transaction.OnComplete_”The OnComplete action, defaults to None
app*id *: int | None_ = None
Section titled “app*id *: int | None_ = None”The ID of the application, defaults to None
approval*program *: str | bytes | None_ = None
Section titled “approval*program *: str | bytes | None_ = None”The program to execute for all OnCompletes other than ClearState, defaults to None
clear*state_program *: str | bytes | None_ = None
Section titled “clear*state_program *: str | bytes | None_ = None”The program to execute for ClearState OnComplete, defaults to None
schema : dict[str, int] | None = None
Section titled “schema : dict[str, int] | None = None”The state schema for the app, defaults to None
args : list[bytes] | None = None
Section titled “args : list[bytes] | None = None”Application arguments, defaults to None
account*references *: list[str] | None_ = None
Section titled “account*references *: list[str] | None_ = None”Account references, defaults to None
app*references *: list[int] | None_ = None
Section titled “app*references *: list[int] | None_ = None”App references, defaults to None
asset*references *: list[int] | None_ = None
Section titled “asset*references *: list[int] | None_ = None”Asset references, defaults to None
extra*pages *: int | None_ = None
Section titled “extra*pages *: int | None_ = None”Number of extra pages required for the programs, defaults to None
boxreferences : list[algokit_utils.models.state.BoxReference | algokitutils.models.state.BoxIdentifier] | None = None
Section titled “boxreferences : list[algokit_utils.models.state.BoxReference | algokitutils.models.state.BoxIdentifier] | None = None”Box references, defaults to None
class algokit_utils.transactions.transaction_composer.AppCreateSchema
Section titled “class algokit_utils.transactions.transaction_composer.AppCreateSchema”Bases: TypedDict
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
dict(iterable) -> new dictionary initialized as if via: : d = {} for k, v in iterable:
{’ ’}
> d[k] = v
dict(
**kwargs) -> new dictionary initialized with the name=value pairs : in the keyword argument list. For example: dict(one=1, two=2)
global*ints *: int_
Section titled “global*ints *: int_”The number of global ints in the schema
global*byte_slices *: int_
Section titled “global*byte_slices *: int_”The number of global byte slices in the schema
local*ints *: int_
Section titled “local*ints *: int_”The number of local ints in the schema
local*byte_slices *: int_
Section titled “local*byte_slices *: int_”The number of local byte slices in the schema
class algokit_utils.transactions.transaction_composer.AppCreateParams
Section titled “class algokit_utils.transactions.transaction_composer.AppCreateParams”Bases: _CommonTxnParams
Parameters for creating an application.
approval*program *: str | bytes_
Section titled “approval*program *: str | bytes_”The program to execute for all OnCompletes other than ClearState
clear*state_program *: str | bytes_
Section titled “clear*state_program *: str | bytes_”The program to execute for ClearState OnComplete
schema : AppCreateSchema | None = None
Section titled “schema : AppCreateSchema | None = None”The state schema for the app, defaults to None
on*complete *: algosdk.transaction.OnComplete | None_ = None
Section titled “on*complete *: algosdk.transaction.OnComplete | None_ = None”The OnComplete action, defaults to None
args : list[bytes] | None = None
Section titled “args : list[bytes] | None = None”Application arguments, defaults to None
account*references *: list[str] | None_ = None
Section titled “account*references *: list[str] | None_ = None”Account references, defaults to None
app*references *: list[int] | None_ = None
Section titled “app*references *: list[int] | None_ = None”App references, defaults to None
asset*references *: list[int] | None_ = None
Section titled “asset*references *: list[int] | None_ = None”Asset references, defaults to None
boxreferences : list[algokit_utils.models.state.BoxReference | algokitutils.models.state.BoxIdentifier] | None = None
Section titled “boxreferences : list[algokit_utils.models.state.BoxReference | algokitutils.models.state.BoxIdentifier] | None = None”Box references, defaults to None
extra*program_pages *: int | None_ = None
Section titled “extra*program_pages *: int | None_ = None”Number of extra pages required for the programs, defaults to None
class algokit_utils.transactions.transaction_composer.AppUpdateParams
Section titled “class algokit_utils.transactions.transaction_composer.AppUpdateParams”Bases: _CommonTxnParams
Parameters for updating an application.
app*id *: int_
Section titled “app*id *: int_”The ID of the application
approval*program *: str | bytes_
Section titled “approval*program *: str | bytes_”The program to execute for all OnCompletes other than ClearState
clear*state_program *: str | bytes_
Section titled “clear*state_program *: str | bytes_”The program to execute for ClearState OnComplete
args : list[bytes] | None = None
Section titled “args : list[bytes] | None = None”Application arguments, defaults to None
account*references *: list[str] | None_ = None
Section titled “account*references *: list[str] | None_ = None”Account references, defaults to None
app*references *: list[int] | None_ = None
Section titled “app*references *: list[int] | None_ = None”App references, defaults to None
asset*references *: list[int] | None_ = None
Section titled “asset*references *: list[int] | None_ = None”Asset references, defaults to None
boxreferences : list[algokit_utils.models.state.BoxReference | algokitutils.models.state.BoxIdentifier] | None = None
Section titled “boxreferences : list[algokit_utils.models.state.BoxReference | algokitutils.models.state.BoxIdentifier] | None = None”Box references, defaults to None
on*complete *: algosdk.transaction.OnComplete | None_ = None
Section titled “on*complete *: algosdk.transaction.OnComplete | None_ = None”The OnComplete action, defaults to None
class algokit_utils.transactions.transaction_composer.AppDeleteParams
Section titled “class algokit_utils.transactions.transaction_composer.AppDeleteParams”Bases: _CommonTxnParams
Parameters for deleting an application.
app*id *: int_
Section titled “app*id *: int_”The ID of the application
args : list[bytes] | None = None
Section titled “args : list[bytes] | None = None”Application arguments, defaults to None
account*references *: list[str] | None_ = None
Section titled “account*references *: list[str] | None_ = None”Account references, defaults to None
app*references *: list[int] | None_ = None
Section titled “app*references *: list[int] | None_ = None”App references, defaults to None
asset*references *: list[int] | None_ = None
Section titled “asset*references *: list[int] | None_ = None”Asset references, defaults to None
boxreferences : list[algokit_utils.models.state.BoxReference | algokitutils.models.state.BoxIdentifier] | None = None
Section titled “boxreferences : list[algokit_utils.models.state.BoxReference | algokitutils.models.state.BoxIdentifier] | None = None”Box references, defaults to None
on*complete *: algosdk.transaction.OnComplete_
Section titled “on*complete *: algosdk.transaction.OnComplete_”The OnComplete action, defaults to DeleteApplicationOC
class algokit_utils.transactions.transaction_composer.AppCallMethodCallParams
Section titled “class algokit_utils.transactions.transaction_composer.AppCallMethodCallParams”Bases: _BaseAppMethodCall
Parameters for a regular ABI method call.
app*id *: int_
Section titled “app*id *: int_”The ID of the application
on*complete *: algosdk.transaction.OnComplete | None_ = None
Section titled “on*complete *: algosdk.transaction.OnComplete | None_ = None”The OnComplete action, defaults to None
class algokit_utils.transactions.transaction_composer.AppCreateMethodCallParams
Section titled “class algokit_utils.transactions.transaction_composer.AppCreateMethodCallParams”Bases: _BaseAppMethodCall
Parameters for an ABI method call that creates an application.
approval*program *: str | bytes_
Section titled “approval*program *: str | bytes_”The program to execute for all OnCompletes other than ClearState
clear*state_program *: str | bytes_
Section titled “clear*state_program *: str | bytes_”The program to execute for ClearState OnComplete
schema : AppCreateSchema | None = None
Section titled “schema : AppCreateSchema | None = None”The state schema for the app, defaults to None
on*complete *: algosdk.transaction.OnComplete | None_ = None
Section titled “on*complete *: algosdk.transaction.OnComplete | None_ = None”The OnComplete action (cannot be ClearState), defaults to None
extra*program_pages *: int | None_ = None
Section titled “extra*program_pages *: int | None_ = None”Number of extra pages required for the programs, defaults to None
class algokit_utils.transactions.transaction_composer.AppUpdateMethodCallParams
Section titled “class algokit_utils.transactions.transaction_composer.AppUpdateMethodCallParams”Bases: _BaseAppMethodCall
Parameters for an ABI method call that updates an application.
app*id *: int_
Section titled “app*id *: int_”The ID of the application
approval*program *: str | bytes_
Section titled “approval*program *: str | bytes_”The program to execute for all OnCompletes other than ClearState
clear*state_program *: str | bytes_
Section titled “clear*state_program *: str | bytes_”The program to execute for ClearState OnComplete
on*complete *: algosdk.transaction.OnComplete_
Section titled “on*complete *: algosdk.transaction.OnComplete_”The OnComplete action
class algokit_utils.transactions.transaction_composer.AppDeleteMethodCallParams
Section titled “class algokit_utils.transactions.transaction_composer.AppDeleteMethodCallParams”Bases: _BaseAppMethodCall
Parameters for an ABI method call that deletes an application.
app*id *: int_
Section titled “app*id *: int_”The ID of the application
on*complete *: algosdk.transaction.OnComplete_
Section titled “on*complete *: algosdk.transaction.OnComplete_”The OnComplete action
algokit_utils.transactions.transaction_composer.MethodCallParams
Section titled “algokit_utils.transactions.transaction_composer.MethodCallParams”algokit_utils.transactions.transaction_composer.AppMethodCallTransactionArgument
Section titled “algokit_utils.transactions.transaction_composer.AppMethodCallTransactionArgument”algokit_utils.transactions.transaction_composer.TxnParams
Section titled “algokit_utils.transactions.transaction_composer.TxnParams”class algokit_utils.transactions.transaction_composer.BuiltTransactions
Section titled “class algokit_utils.transactions.transaction_composer.BuiltTransactions”Set of transactions built by TransactionComposer.
transactions : list[algosdk.transaction.Transaction]
Section titled “transactions : list[algosdk.transaction.Transaction]”The built transactions
method*calls *: dict[int, algosdk.abi.Method]_
Section titled “method*calls *: dict[int, algosdk.abi.Method]_”Map of transaction index to ABI method
signers : dict[int, algosdk.atomic_transaction_composer.TransactionSigner]
Section titled “signers : dict[int, algosdk.atomic_transaction_composer.TransactionSigner]”Map of transaction index to TransactionSigner
class algokit_utils.transactions.transaction_composer.TransactionComposerBuildResult
Section titled “class algokit_utils.transactions.transaction_composer.TransactionComposerBuildResult”Result of building transactions with TransactionComposer.
atc : algosdk.atomic_transaction_composer.AtomicTransactionComposer
Section titled “atc : algosdk.atomic_transaction_composer.AtomicTransactionComposer”The AtomicTransactionComposer instance
transactions : list[algosdk.atomic_transaction_composer.TransactionWithSigner]
Section titled “transactions : list[algosdk.atomic_transaction_composer.TransactionWithSigner]”The list of transactions with signers
method*calls *: dict[int, algosdk.abi.Method]_
Section titled “method*calls *: dict[int, algosdk.abi.Method]_”Map of transaction index to ABI method
class algokit_utils.transactions.transaction_composer.SendAtomicTransactionComposerResults
Section titled “class algokit_utils.transactions.transaction_composer.SendAtomicTransactionComposerResults”Results from sending an AtomicTransactionComposer transaction group.
group*id *: str_
Section titled “group*id *: str_”The group ID if this was a transaction group
confirmations : list[algosdk.v2client.algod.AlgodResponseType]
Section titled “confirmations : list[algosdk.v2client.algod.AlgodResponseType]”The confirmation info for each transaction
tx*ids *: list[str]_
Section titled “tx*ids *: list[str]_”The transaction IDs that were sent
transactions : list[algokit_utils.models.transaction.TransactionWrapper]
Section titled “transactions : list[algokit_utils.models.transaction.TransactionWrapper]”The transactions that were sent
returns : list[algokit_utils.applications.abi.ABIReturn]
Section titled “returns : list[algokit_utils.applications.abi.ABIReturn]”The ABI return values from any ABI method calls
simulate*response *: dict[str, Any] | None_ = None
Section titled “simulate*response *: dict[str, Any] | None_ = None”The simulation response if simulation was performed, defaults to None
algokit_utils.transactions.transaction_composer.calculate_extra_program_pages(approval: bytes | None, clear: bytes | None) → int
Section titled “algokit_utils.transactions.transaction_composer.calculate_extra_program_pages(approval: bytes | None, clear: bytes | None) → int”Calculate minimum number of extra_pages required for provided approval and clear programs
algokit_utils.transactions.transaction_composer.populate_app_call_resources(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient) → algosdk.atomic_transaction_composer.AtomicTransactionComposer
Section titled “algokit_utils.transactions.transaction_composer.populate_app_call_resources(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient) → algosdk.atomic_transaction_composer.AtomicTransactionComposer”Populate application call resources based on simulation results.
- Parameters:
- atc – The AtomicTransactionComposer containing transactions
- algod – Algod client for simulation
- Returns: Modified AtomicTransactionComposer with populated resources
algokit_utils.transactions.transaction_composer.prepare_group_for_sending(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient, populate_app_call_resources: bool | None = None, cover_app_call_inner_transaction_fees: bool | None = None, additional_atc_context: AdditionalAtcContext | None = None) → algosdk.atomic_transaction_composer.AtomicTransactionComposer
Section titled “algokit_utils.transactions.transaction_composer.prepare_group_for_sending(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient, populate_app_call_resources: bool | None = None, cover_app_call_inner_transaction_fees: bool | None = None, additional_atc_context: AdditionalAtcContext | None = None) → algosdk.atomic_transaction_composer.AtomicTransactionComposer”Take an existing Atomic Transaction Composer and return a new one with changes applied to the transactions based on the supplied parameters to prepare it for sending. Please note, that before calling .execute() on the returned ATC, you must call .build_group().
- Parameters:
- atc – The AtomicTransactionComposer containing transactions
- algod – Algod client for simulation
- populate_app_call_resources – Whether to populate app call resources
- cover_app_call_inner_transaction_fees – Whether to cover inner txn fees
- additional_atc_context – Additional context for the AtomicTransactionComposer
- Returns: Modified AtomicTransactionComposer ready for sending
algokit_utils.transactions.transaction_composer.send_atomic_transaction_composer(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient, *, max_rounds_to_wait: int | None = 5, skip_waiting: bool = False, suppress_log: bool | None = None, populate_app_call_resources: bool | None = None, cover_app_call_inner_transaction_fees: bool | None = None, additional_atc_context: AdditionalAtcContext | None = None) → SendAtomicTransactionComposerResults
Section titled “algokit_utils.transactions.transaction_composer.send_atomic_transaction_composer(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient, *, max_rounds_to_wait: int | None = 5, skip_waiting: bool = False, suppress_log: bool | None = None, populate_app_call_resources: bool | None = None, cover_app_call_inner_transaction_fees: bool | None = None, additional_atc_context: AdditionalAtcContext | None = None) → SendAtomicTransactionComposerResults”Send an AtomicTransactionComposer transaction group.
Executes a group of transactions atomically using the AtomicTransactionComposer.
- Parameters:
- atc – The AtomicTransactionComposer instance containing the transaction group to send
- algod – The Algod client to use for sending the transactions
- max_rounds_to_wait – Maximum number of rounds to wait for confirmation, defaults to 5
- skip_waiting – If True, don’t wait for transaction confirmation, defaults to False
- suppress_log – If True, suppress logging, defaults to None
- populate_app_call_resources – If True, populate app call resources, defaults to None
- cover_app_call_inner_transaction_fees – If True, cover app call inner transaction fees, defaults to None
- additional_atc_context – Additional context for the AtomicTransactionComposer
- Returns: Results from sending the transaction group
- Raises:
- Exception – If there is an error sending the transactions
- error – If there is an error from the Algorand node
class algokit_utils.transactions.transaction_composer.TransactionComposer(algod: algosdk.v2client.algod.AlgodClient, get_signer: collections.abc.Callable[[str], algosdk.atomic_transaction_composer.TransactionSigner], get_suggested_params: collections.abc.Callable[[], algosdk.transaction.SuggestedParams] | None = None, default_validity_window: int | None = None, app_manager: algokit_utils.applications.app_manager.AppManager | None = None, error_transformers: list[ErrorTransformer] | None = None)
Section titled “class algokit_utils.transactions.transaction_composer.TransactionComposer(algod: algosdk.v2client.algod.AlgodClient, get_signer: collections.abc.Callable[[str], algosdk.atomic_transaction_composer.TransactionSigner], get_suggested_params: collections.abc.Callable[[], algosdk.transaction.SuggestedParams] | None = None, default_validity_window: int | None = None, app_manager: algokit_utils.applications.app_manager.AppManager | None = None, error_transformers: list[ErrorTransformer] | None = None)”A class for composing and managing Algorand transactions.
Provides a high-level interface for building and executing transaction groups using the Algosdk library. Supports various transaction types including payments, asset operations, application calls, and key registrations.
- Parameters:
- algod – An instance of AlgodClient used to get suggested params and send transactions
- get_signer – A function that takes an address and returns a TransactionSigner for that address
- get_suggested_params – Optional function to get suggested transaction parameters, defaults to using algod.suggested_params()
- default_validity_window – Optional default validity window for transactions in rounds, defaults to 10
- app_manager – Optional AppManager instance for compiling TEAL programs, defaults to None
- error_transformers – Optional list of error transformers to use when an error is caught in simulate or send
register_error_transformer(transformer: ErrorTransformer) → TransactionComposer
Section titled “register_error_transformer(transformer: ErrorTransformer) → TransactionComposer”Register a function that will be used to transform an error caught when simulating or sending.
- Parameters: transformer – The error transformer function
- Returns: The composer so you can chain method calls
add_transaction(transaction: algosdk.transaction.Transaction, signer: algosdk.atomic_transaction_composer.TransactionSigner | None = None) → TransactionComposer
Section titled “add_transaction(transaction: algosdk.transaction.Transaction, signer: algosdk.atomic_transaction_composer.TransactionSigner | None = None) → TransactionComposer”Add a raw transaction to the composer.
- Parameters:
- transaction – The transaction to add
- signer – Optional transaction signer, defaults to getting signer from transaction sender
- Returns: The transaction composer instance for chaining
- Example:
composer.add_transaction(transaction)
add_payment(params: PaymentParams) → TransactionComposer
Section titled “add_payment(params: PaymentParams) → TransactionComposer”Add a payment transaction.
- Example:
params = PaymentParams(sender="SENDER_ADDRESS",receiver="RECEIVER_ADDRESS",amount=AlgoAmount.from_algo(1),close_remainder_to="CLOSE_ADDRESS"... (see PaymentParams for more options))composer.add_payment(params)
- Parameters: params – The payment transaction parameters
- Returns: The transaction composer instance for chaining
add_asset_create(params: AssetCreateParams) → TransactionComposer
Section titled “add_asset_create(params: AssetCreateParams) → TransactionComposer”Add an asset creation transaction.
- Example:
params = AssetCreateParams(sender="SENDER_ADDRESS",total=1000,asset_name="MyAsset",unit_name="MA",url="https://example.com",decimals=0,default_frozen=False,manager="MANAGER_ADDRESS",reserve="RESERVE_ADDRESS",freeze="FREEZE_ADDRESS",clawback="CLAWBACK_ADDRESS"... (see AssetCreateParams for more options)composer.add_asset_create(params)
- Parameters: params – The asset creation parameters
- Returns: The transaction composer instance for chaining
add_asset_config(params: AssetConfigParams) → TransactionComposer
Section titled “add_asset_config(params: AssetConfigParams) → TransactionComposer”Add an asset configuration transaction.
- Example:
params = AssetConfigParams(sender="SENDER_ADDRESS",asset_id=123456,manager="NEW_MANAGER_ADDRESS",reserve="NEW_RESERVE_ADDRESS",freeze="NEW_FREEZE_ADDRESS",clawback="NEW_CLAWBACK_ADDRESS"... (see AssetConfigParams for more options))composer.add_asset_config(params)
- Parameters: params – The asset configuration parameters
- Returns: The transaction composer instance for chaining
add_asset_freeze(params: AssetFreezeParams) → TransactionComposer
Section titled “add_asset_freeze(params: AssetFreezeParams) → TransactionComposer”Add an asset freeze transaction.
- Example:
params = AssetFreezeParams(sender="SENDER_ADDRESS",asset_id=123456,account="ACCOUNT_TO_FREEZE",frozen=True... (see AssetFreezeParams for more options))composer.add_asset_freeze(params)
- Parameters: params – The asset freeze parameters
- Returns: The transaction composer instance for chaining
add_asset_destroy(params: AssetDestroyParams) → TransactionComposer
Section titled “add_asset_destroy(params: AssetDestroyParams) → TransactionComposer”Add an asset destruction transaction.
- Example:
params = AssetDestroyParams(sender="SENDER_ADDRESS",asset_id=123456... (see AssetDestroyParams for more options)composer.add_asset_destroy(params)
- Parameters: params – The asset destruction parameters
- Returns: The transaction composer instance for chaining
add_asset_transfer(params: AssetTransferParams) → TransactionComposer
Section titled “add_asset_transfer(params: AssetTransferParams) → TransactionComposer”Add an asset transfer transaction.
- Example:
params = AssetTransferParams(sender="SENDER_ADDRESS",asset_id=123456,amount=10,receiver="RECEIVER_ADDRESS",clawback_target="CLAWBACK_TARGET_ADDRESS",close_asset_to="CLOSE_ADDRESS"... (see AssetTransferParams for more options)composer.add_asset_transfer(params)
- Parameters: params – The asset transfer parameters
- Returns: The transaction composer instance for chaining
add_asset_opt_in(params: AssetOptInParams) → TransactionComposer
Section titled “add_asset_opt_in(params: AssetOptInParams) → TransactionComposer”Add an asset opt-in transaction.
- Example:
params = AssetOptInParams(sender="SENDER_ADDRESS",asset_id=123456... (see AssetOptInParams for more options))composer.add_asset_opt_in(params)
- Parameters: params – The asset opt-in parameters
- Returns: The transaction composer instance for chaining
add_asset_opt_out(params: AssetOptOutParams) → TransactionComposer
Section titled “add_asset_opt_out(params: AssetOptOutParams) → TransactionComposer”Add an asset opt-out transaction.
- Example:
params = AssetOptOutParams(sender="SENDER_ADDRESS",asset_id=123456,creator="CREATOR_ADDRESS"... (see AssetOptOutParams for more options)composer.add_asset_opt_out(params)
- Parameters: params – The asset opt-out parameters
- Returns: The transaction composer instance for chaining
add_app_create(params: AppCreateParams) → TransactionComposer
Section titled “add_app_create(params: AppCreateParams) → TransactionComposer”Add an application creation transaction.
- Example:
params = AppCreateParams(sender="SENDER_ADDRESS",approval_program="TEAL_APPROVAL_CODE",clear_state_program="TEAL_CLEAR_CODE",schema={'global_ints': 1, 'global_byte_slices': 1, 'local_ints': 1, 'local_byte_slices': 1},on_complete=OnComplete.NoOpOC,args=[b'arg1'],account_references=["ACCOUNT1"],app_references=[789],asset_references=[123],box_references=[],extra_program_pages=0... (see AppCreateParams for more options))composer.add_app_create(params)
- Parameters: params – The application creation parameters
- Returns: The transaction composer instance for chaining
add_app_update(params: AppUpdateParams) → TransactionComposer
Section titled “add_app_update(params: AppUpdateParams) → TransactionComposer”Add an application update transaction.
- Example:
params = AppUpdateParams(sender="SENDER_ADDRESS",app_id=789,approval_program="TEAL_NEW_APPROVAL_CODE",clear_state_program="TEAL_NEW_CLEAR_CODE",args=[b'new_arg1'],account_references=["ACCOUNT1"],app_references=[789],asset_references=[123],box_references=[],on_complete=OnComplete.UpdateApplicationOC... (see AppUpdateParams for more options)composer.add_app_update(params)
- Parameters: params – The application update parameters
- Returns: The transaction composer instance for chaining
add_app_delete(params: AppDeleteParams) → TransactionComposer
Section titled “add_app_delete(params: AppDeleteParams) → TransactionComposer”Add an application deletion transaction.
- Example:
params = AppDeleteParams(sender="SENDER_ADDRESS",app_id=789,args=[b'delete_arg'],account_references=["ACCOUNT1"],app_references=[789],asset_references=[123],box_references=[],on_complete=OnComplete.DeleteApplicationOC... (see AppDeleteParams for more options)composer.add_app_delete(params)
- Parameters: params – The application deletion parameters
- Returns: The transaction composer instance for chaining
add_app_call(params: AppCallParams) → TransactionComposer
Section titled “add_app_call(params: AppCallParams) → TransactionComposer”Add an application call transaction.
- Example:
params = AppCallParams(sender="SENDER_ADDRESS",on_complete=OnComplete.NoOpOC,app_id=789,approval_program="TEAL_APPROVAL_CODE",clear_state_program="TEAL_CLEAR_CODE",schema={'global_ints': 1, 'global_byte_slices': 1, 'local_ints': 1, 'local_byte_slices': 1},... (see AppCallParams for more options))composer.add_app_call(params)
- Parameters: params – The application call parameters
- Returns: The transaction composer instance for chaining
add_app_create_method_call(params: AppCreateMethodCallParams) → TransactionComposer
Section titled “add_app_create_method_call(params: AppCreateMethodCallParams) → TransactionComposer”Add an application creation method call transaction.
-
Parameters: params – The application creation method call parameters
-
Returns: The transaction composer instance for chaining
-
Example:
# Basic examplemethod = algosdk.abi.Method(name="method",args=[...],returns="string")composer.add_app_create_method_call(AppCreateMethodCallParams(sender="CREATORADDRESS",approval_program="TEALCODE",clear_state_program="TEALCODE",method=method,args=["arg1_value"]))# Advanced examplemethod = ABIMethod(name="method",args=[{"name": "arg1", "type": "string"}],returns={"type": "string"})composer.add_app_create_method_call(AppCreateMethodCallParams(sender="CREATORADDRESS",method=method,args=["arg1_value"],approval_program="TEALCODE",clear_state_program="TEALCODE",schema={"global_ints": 1,"global_byte_slices": 2,"local_ints": 3,"local_byte_slices": 4},extra_pages=1,on_complete=OnComplete.OptInOC,args=[bytes([1, 2, 3, 4])],account_references=["ACCOUNT_1"],app_references=[123, 1234],asset_references=[12345],box_references=["box1", {"app_id": 1234, "name": "box2"}],lease="lease",note="note",first_valid_round=1000,validity_window=10,extra_fee=AlgoAmount.from_micro_algos(1000),static_fee=AlgoAmount.from_micro_algos(1000),max_fee=AlgoAmount.from_micro_algos(3000)))
add_app_update_method_call(params: AppUpdateMethodCallParams) → TransactionComposer
Section titled “add_app_update_method_call(params: AppUpdateMethodCallParams) → TransactionComposer”Add an application update method call transaction.
- Parameters: params – The application update method call parameters
- Returns: The transaction composer instance for chaining
add_app_delete_method_call(params: AppDeleteMethodCallParams) → TransactionComposer
Section titled “add_app_delete_method_call(params: AppDeleteMethodCallParams) → TransactionComposer”Add an application deletion method call transaction.
- Parameters: params – The application deletion method call parameters
- Returns: The transaction composer instance for chaining
add_app_call_method_call(params: AppCallMethodCallParams) → TransactionComposer
Section titled “add_app_call_method_call(params: AppCallMethodCallParams) → TransactionComposer”Add an application call method call transaction.
- Parameters: params – The application call method call parameters
- Returns: The transaction composer instance for chaining
add_online_key_registration(params: OnlineKeyRegistrationParams) → TransactionComposer
Section titled “add_online_key_registration(params: OnlineKeyRegistrationParams) → TransactionComposer”Add an online key registration transaction.
- Parameters: params – The online key registration parameters
- Returns: The transaction composer instance for chaining
add_offline_key_registration(params: OfflineKeyRegistrationParams) → TransactionComposer
Section titled “add_offline_key_registration(params: OfflineKeyRegistrationParams) → TransactionComposer”Add an offline key registration transaction.
- Parameters: params – The offline key registration parameters
- Returns: The transaction composer instance for chaining
add_atc(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer) → TransactionComposer
Section titled “add_atc(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer) → TransactionComposer”Add an existing AtomicTransactionComposer’s transactions.
- Parameters: atc – The AtomicTransactionComposer to add
- Returns: The transaction composer instance for chaining
- Example:
atc = AtomicTransactionComposer()atc.add_transaction(TransactionWithSigner(transaction, signer))composer.add_atc(atc)
count() → int
Section titled “count() → int”Get the total number of transactions.
- Returns: The number of transactions
Build the transaction group.
- Returns: The built transaction group result
rebuild() → TransactionComposerBuildResult
Section titled “rebuild() → TransactionComposerBuildResult”Rebuild the transaction group from scratch.
- Returns: The rebuilt transaction group result
build_transactions() → BuiltTransactions
Section titled “build_transactions() → BuiltTransactions”Build and return the transactions without executing them.
- Returns: The built transactions result
execute(*, max_rounds_to_wait: int | None = None) → SendAtomicTransactionComposerResults
Section titled “execute(*, max_rounds_to_wait: int | None = None) → SendAtomicTransactionComposerResults”send(params: algokit_utils.models.transaction.SendParams | None = None) → SendAtomicTransactionComposerResults
Section titled “send(params: algokit_utils.models.transaction.SendParams | None = None) → SendAtomicTransactionComposerResults”Send the transaction group to the network.
- Parameters: params – Parameters for the send operation
- Returns: The transaction send results
- Raises: self._transform_error – If the transaction fails (may be transformed by error transformers)
simulate(allow_more_logs: bool | None = None, allow_empty_signatures: bool | None = None, allow_unnamed_resources: bool | None = None, extra_opcode_budget: int | None = None, exec_trace_config: algosdk.v2client.models.SimulateTraceConfig | None = None, simulation_round: int | None = None, skip_signatures: bool | None = None) → SendAtomicTransactionComposerResults
Section titled “simulate(allow_more_logs: bool | None = None, allow_empty_signatures: bool | None = None, allow_unnamed_resources: bool | None = None, extra_opcode_budget: int | None = None, exec_trace_config: algosdk.v2client.models.SimulateTraceConfig | None = None, simulation_round: int | None = None, skip_signatures: bool | None = None) → SendAtomicTransactionComposerResults”Simulate transaction group execution with configurable validation rules.
- Parameters:
- allow_more_logs – Whether to allow more logs than the standard limit
- allow_empty_signatures – Whether to allow transactions with empty signatures
- allow_unnamed_resources – Whether to allow unnamed resources.
- extra_opcode_budget – Additional opcode budget to allocate
- exec_trace_config – Configuration for execution tracing
- simulation_round – Round number to simulate at
- skip_signatures – Whether to skip signature validation
- Returns: The simulation results
- Example:
result = composer.simulate(extra_opcode_budget=1000, skip_signatures=True, ...)
static arc2_note(note: algokit_utils.models.transaction.Arc2TransactionNote) → bytes
Section titled “static arc2_note(note: algokit_utils.models.transaction.Arc2TransactionNote) → bytes”Create an encoded transaction note that follows the ARC-2 spec.
https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md
- Parameters: note – The ARC-2 note to encode
- Returns: The encoded note bytes
- Raises: ValueError – If the dapp_name is invalid