Options
All
  • Public
  • Public/Protected
  • All
Menu

Module compiler/Compiler

Index

Variables

Const DEFAULT_TEAL_MODE

DEFAULT_TEAL_MODE: Mode = ...

Const DEFAULT_TEAL_VERSION

DEFAULT_TEAL_VERSION: 2 = ...

Const MAX_TEAL_VERSION

MAX_TEAL_VERSION: 3 = 3

Const MIN_TEAL_VERSION

MIN_TEAL_VERSION: 2 = 2

Functions

compileTeal

  • compileTeal(ast: Expr, mode: Mode, version?: number, assembleConstants?: boolean): string
  • Compile a PyTeal expression into TEAL assembly.

    throws

    TealInputError if an operation in ast is not supported by the supplied mode and version.

    throws

    TealInternalError if an internal error is encounter during compilation.

    Parameters

    • ast: Expr

      The PyTeal expression to assemble.

    • mode: Mode

      The mode of the program to assemble. Must be Signature or Application.

    • Optional version: number

      When true, the compiler will produce a program with fully assembled constants, rather than using the pseudo-ops int, byte, and addr. These constants will be assembled in the most space-efficient way, so enabling this may reduce the compiled program's size. Enabling this option requires a minimum TEAL version of 3. Defaults to false.

    • Optional assembleConstants: boolean

      The TEAL version used to assemble the program. This will determine which expressions and fields are able to be used in the program and how expressions compile to TEAL opcodes. Defaults to 2 if not included.

    Returns string

    A TEAL assembly program compiled from the input expression.

Generated using TypeDoc