Application

This is the class that should be initialized for all Beaker Applications.

class beaker.application.Application[source]
__init__(name: str, *, descr: str | None = None, build_options: beaker.build_options.BuildOptions | None = None)[source]
__init__(name: str, *, state: TState, descr: str | None = None, build_options: beaker.build_options.BuildOptions | None = None)

<TODO>

build(client: AlgodClient | None = None) ApplicationSpecification[source]

Build the application specification, including transpiling the application to TEAL, and fully compiling any nested (i.e. precompiled) apps/lsigs to byte code.

Note: .

Parameters

client (optional) – An Algod client that is required if there are any precompiled so they can be fully compiled.

external(fn: Callable[[...], Expr], /) ABIReturnSubroutine[source]
external(*, method_config: pyteal.MethodConfig | dict[Literal['no_op', 'opt_in', 'close_out', 'update_application', 'delete_application'], pyteal.CallConfig] | None = None, name: str | None = None, authorize: collections.abc.Callable[[pyteal.Expr], pyteal.Expr] | pyteal.SubroutineFnWrapper | None = None, read_only: bool = False, override: bool | None = False) Callable[[Callable[[...], Expr]], ABIReturnSubroutine]
external(*, method_config: pyteal.MethodConfig | dict[Literal['no_op', 'opt_in', 'close_out', 'update_application', 'delete_application'], pyteal.CallConfig] | None = None, name: str | None = None, authorize: collections.abc.Callable[[pyteal.Expr], pyteal.Expr] | pyteal.SubroutineFnWrapper | None = None, bare: Literal[False], read_only: bool = False, override: bool | None = False) Callable[[Callable[[...], Expr]], ABIReturnSubroutine]
external(*, method_config: pyteal.MethodConfig | dict[Literal['no_op', 'opt_in', 'close_out', 'update_application', 'delete_application'], pyteal.CallConfig], name: str | None = None, authorize: collections.abc.Callable[[pyteal.Expr], pyteal.Expr] | pyteal.SubroutineFnWrapper | None = None, bare: Literal[True], override: bool | None = False) Callable[[Callable[[], Expr]], SubroutineFnWrapper]
external(*, method_config: pyteal.MethodConfig | dict[Literal['no_op', 'opt_in', 'close_out', 'update_application', 'delete_application'], pyteal.CallConfig] | None = None, name: str | None = None, authorize: collections.abc.Callable[[pyteal.Expr], pyteal.Expr] | pyteal.SubroutineFnWrapper | None = None, bare: bool, read_only: bool = False, override: bool | None = False) collections.abc.Callable[[collections.abc.Callable[[...], pyteal.Expr]], pyteal.ABIReturnSubroutine] | collections.abc.Callable[[collections.abc.Callable[[], pyteal.Expr]], pyteal.SubroutineFnWrapper]

Add the method decorated to be handled as an ABI method for the Application

Parameters
  • fn – The function being wrapped.

  • method_config – <TODO>

  • name – Name of ABI method. If not set, name of the python method will be used. Useful for method overriding.

  • authorize – a subroutine with input of Txn.sender() and output uint64 interpreted as allowed if the output>0.

  • bare

  • read_only – Mark a method as callable with no fee using dryrun or simulate

  • override

Returns

An ABIReturnSubroutine or SubroutineFnWrapper

initialize_global_state() Expr[source]

Initialize any global state variables declared

Returns

The Expr to initialize the application state.

Return type

pyteal.Expr

initialize_local_state(addr: Optional[Expr] = None) Expr[source]

Initialize any local state variables declared

Parameters

addr – Optional, address of account to initialize state for (defaults to Txn.sender()).

Returns

The Expr to initialize the account state.

Return type

pyteal.Expr