Options
All
  • Public
  • Public/Protected
  • All
Menu

Interpreter parses and executes a TEAL code. Each transaction is using a new instance of interpreter and doesn't share the interpreter state. When executing the transaction we create a Context (ctx) and pass it to the interpreter. It encapsulates runtime state and the transaction group state (eg shared scratch space). Interpreter must not modify the runtime - the latter will be updated during the context commit phase once all transactions in the groups succeed.

Hierarchy

  • Interpreter

Index

Constructors

Properties

bytecblock: Uint8Array[]
callStack: Stack<number>
gas: number
innerTxns: EncTx[]
instructionIndex: number
instructions: Operator[]
intcblock: BigInt[]
labelMap: Map<string, number>
length: number
lineToCost: {}

Type declaration

  • [key: number]: number
runtime: Runtime
scratch: StackElem[]
stack: TEALStack
subTxn: undefined | EncTx
tealVersion: number

Methods

  • assertValidTxArray(): void
  • This function executes TEAL code after parsing and returns the result of the program.

    Parameters

    • program: string
    • mode: ExecutionMode

      : execution mode of TEAL code (smart signature or contract)

    • runtime: Runtime

      : runtime object

    • Optional debugStack: number

    Returns undefined | StackElem

    The final result on the stack or undefined if nothing was on the stack. NOTE: program should fail if there is no result (stack is empty after the execution) or the result is zero.

  • Queries account by accountIndex or ctx.tx.snd (if accountIndex==0). If account address is passed, then queries account by address. Throws exception if account is not found.

    Parameters

    • accountRef: StackElem

      index of account to fetch from account list

    • line: number

      line number NOTE: index 0 represents txn sender account

    Returns AccountStoreI

  • getAppIDByReference(appRef: number, foreign: boolean, line: number, op: Op): number
  • getAssetDef(assetId: number): undefined | AssetParams
  • getAssetIDByReference(assetRef: number, foreign: boolean, line: number, op: Op): number
  • getGlobalState(appID: number, key: string | Uint8Array, line: number): undefined | StackElem
  • jumpForward(label: string, line: number): void
  • jumpToLabel(label: string, line: number): void
  • mapLabelWithIndexes(): void
  • printStack(instruction: Operator, debugStack?: number): void
  • setGlobalState(appID: number, key: string | Uint8Array, value: StackElem, line: number): void

Generated using TypeDoc