Module algoappdev.dryruns

Utilities for building and parsing dryruns.

Functions

def build_account(address: str, local_states: List[algosdk.v2client.models.application_local_state.ApplicationLocalState] = None, assets: List[algosdk.v2client.models.asset_holding.AssetHolding] = None, microalgos: int = None, status: str = 'Offline') ‑> algosdk.v2client.models.account.Account

Build an account with the given address.

With just the address specified, the account cannot be used in a transaction.

Use local_states to provide key-value pairs for various apps this account has opted into. The actual state can be empty to indicate the account has opted in, but has nothing set in its local storage.

Use assets to provide information about assets owned by the account.

Use mircoalgos to provide a balance of Algo owned by the account.

def build_application(app_idx: int, approval_program: bytes = None, clear_state_program: bytes = None, global_schema: algosdk.v2client.models.application_state_schema.ApplicationStateSchema = None, local_schema: algosdk.v2client.models.application_state_schema.ApplicationStateSchema = None, state: List[algosdk.v2client.models.teal_key_value.TealKeyValue] = None, creator: str = None) ‑> algosdk.v2client.models.application.Application

Build an Application with a given app_idx.

With just the app_idx specified, the app cannot be used in a transaction.

The programs can be set to allow the app logic to be called. Note that the approval_program is the one called for all on_complete code other than the ClearState code. Those transcations will call clear_state_program.

If the schemas are None, default to the most permissive schema (64 byte slices and 64 ints).

Use state to provide key-value pairs for the app's global state.

def check_err(result: Dict[~KT, ~VT])

Raise an error if the result contains an execution error.

def get_global_deltas(result: Dict[~KT, ~VT], txn_idx: int = 0) ‑> List[KeyDelta]

Get the list of global key deltas for transaction txn_idx.

def get_local_deltas(result: Dict[~KT, ~VT], txn_idx: int = 0) ‑> Dict[str, List[KeyDelta]]

Get the list of local key deltas for transaction txn_idx.

def get_messages(result: Dict[~KT, ~VT], txn_idx: int = 0) ‑> List[str]

Get the list of execution messages for transaction txn_idx.

def get_trace(result: Dict[~KT, ~VT], txn_idx: int = 0) ‑> List[TraceItem]

Get the list of trace lines for transaction txn_idx.

Classes

class AppCallCtx

Build up the full context (arguments) which are accessible by app calls generated by a group of transactions (or a single transaction).

Methods

def build_request(self) ‑> algosdk.v2client.models.dryrun_request.DryrunRequest

Build the dry run request.

def suggested_params(self) ‑> algosdk.future.transaction.SuggestedParams

Build minimal transaction parameters which will work with dry run.

Defaults to using the minimal network fee, and allowing the maximum transaction lifetime for execution, from the current round or from the first round.

def with_account(self, account: algosdk.v2client.models.account.Account) ‑> AppCallCtx

Add an account with some local state.

def with_account_opted_in(self, app_idx: int = None, address: str = None, local_state: List[algosdk.v2client.models.teal_key_value.TealKeyValue] = None) ‑> AppCallCtx

Add an account which is opted into to an app.

If app_idx is omitted, defaults to the index of the last added app.

If address is omitted, defaults to the next available address not in the accounts.

If local_state isn't provided, then the account is seen to be opted into the app, but with no local storage set.

def with_app(self, app: algosdk.v2client.models.application.Application) ‑> AppCallCtx

Add an application. If this application is being called, its source program(s) must be supplied.

def with_app_program(self, program: bytes = None, app_idx: int = None, state: List[algosdk.v2client.models.teal_key_value.TealKeyValue] = None) ‑> AppCallCtx

Add an application with defaults and possibly an approval program.

If app_idx is omitted, defaults to the next available app idx not in the apps.

def with_latest_timestamp(self, latest_timestamp: int) ‑> AppCallCtx

Set the latest timestamp (Global.latest_timestamp)

def with_round(self, round: int) ‑> AppCallCtx

Set the last round (Global.round)

def with_txn(self, txn: algosdk.future.transaction.Transaction) ‑> AppCallCtx

Add a transaction.

NOTE: for an ApplicationCreateTxn, the transaction sender must match the application creator. The zero address can be used for both.

def with_txn_call(self, on_complete: algosdk.future.transaction.OnComplete = OnComplete.NoOpOC, sender: str = None, params: algosdk.future.transaction.SuggestedParams = None, app_idx: int = None, args: List[bytes] = None) ‑> AppCallCtx

Add a transaction which calls an app.

If sender is omitted, defaults to the address of the last added account.

If params is omitted, defaults to the result of suggested_params.

If app_idx is omitted, defaults to the index of the last added app.

class KeyDelta (key: bytes, value: int)

Information about a key value which changed.

Ancestors

  • builtins.tuple

Static methods

def from_result(result: Dict[~KT, ~VT]) ‑> KeyDelta

Instance variables

var key : bytes

Alias for field number 0

var value : int

Alias for field number 1

class TraceItem (source: str, stack: List[Union[int, bytes]], program_counter: int)

Information about a call trace line item.

Ancestors

  • builtins.tuple

Instance variables

var program_counter : int

Alias for field number 2

var source : str

Alias for field number 0

var stack : List[Union[int, bytes]]

Alias for field number 1