Skip to content

algopy_testing.context_helpers.txn_context

DeferredAppCall
TransactionContextContext for managing transaction groups and active transactions.
TransactionGroup
TReturn
TParamSpec

Bases: Generic[TReturn]

Context for managing transaction groups and active transactions.

defer_app_call(method: Callable[TParamSpec, TReturn], *args: TParamSpec, **kwargs: TParamSpec) → DeferredAppCall[TReturn]

Section titled “defer_app_call(method: Callable[TParamSpec, TReturn], *args: TParamSpec, **kwargs: TParamSpec) → DeferredAppCall[TReturn]”

Prepare an application call transaction group for a contract method without executing it.

create_group(gtxns: Sequence[algopy.gtxn.TransactionBase | DeferredAppCall[Any]] | None = None, active_txn_index: int | None = None, active_txn_overrides: ActiveTransactionFields | None = None) → Iterator[None]

Section titled “create_group(gtxns: Sequence[algopy.gtxn.TransactionBase | DeferredAppCall[Any]] | None = None, active_txn_index: int | None = None, active_txn_overrides: ActiveTransactionFields | None = None) → Iterator[None]”

Adds a new transaction group using a list of transactions and an optional index to indicate the active transaction within the group.

  • Parameters:
    • gtxns – List of transactions
    • active_txn_index – Index of the active transaction
    • active_txn_overrides – Overrides for active txn
  • Returns: None

property last_active : algopy.gtxn.Transaction

Section titled “property last_active : algopy.gtxn.Transaction”

property active_txn : algopy.gtxn.Transaction

Section titled “property active_txn : algopy.gtxn.Transaction”

property itxn_groups : Sequence[collections.abc.Sequence[InnerTransactionResultType]]

Section titled “property itxn_groups : Sequence[collections.abc.Sequence[InnerTransactionResultType]]”

get_txn(index: int | algopy.UInt64) → algopy.gtxn.Transaction

Section titled “get_txn(index: int | algopy.UInt64) → algopy.gtxn.Transaction”

get_scratch_slot(index: algopy.UInt64 | int) → algopy.UInt64 | algopy.Bytes

Section titled “get_scratch_slot(index: algopy.UInt64 | int) → algopy.UInt64 | algopy.Bytes”

Retrieves the scratch values for a specific slot in the active transaction.

  • Parameters: index – Which scratch slot to query
  • Returns: Scratch slot value for the active transaction

get_scratch_space() → Sequence[algopy.Bytes | algopy.UInt64]

Section titled “get_scratch_space() → Sequence[algopy.Bytes | algopy.UInt64]”

Retrieves scratch space for the active transaction.

  • Returns: List of scratch space values for the active transaction
  • Return type: Sequence[algopy.Bytes | algopy.UInt64]