Skip to content

Tealscript Example

← Back to Examples

Example source from examples/tealscript/example.algo.ts.

LocalNet running (algokit localnet start)

From the repository’s examples directory:

cd examples
npx tsx tealscript/example.algo.ts

View source on GitHub

import type { bytes } from '@algorandfoundation/algorand-typescript'
import { abimethod, Bytes, log, Uint64 } from '@algorandfoundation/algorand-typescript'
import { TealScriptBase } from './teal-script-base.algo'

export default class ExampleTealScript extends TealScriptBase {
  public createApplication() {
    log('Application created')

    super.createApplication()

    return Uint64(4)
  }

  @abimethod({ allowActions: ['NoOp', 'OptIn'], name: 'Overridden name', onCreate: 'allow', readonly: false })
  public customMethod(): bytes {
    return Bytes('')
  }
}