Docs
Command reference

acton wrapper

Reference manual for the acton wrapper command

Synopsis

acton wrapper [options] contract-name

acton wrapper [options] --all

Description

Generate a wrapper for the contract identified by _contract-name_ from Acton.toml.

Use --all to generate wrappers for every contract defined in Acton.toml without picking a single one.

Wrapper generation uses ABI emitted by the Tolk compiler from the contract source or from a configured types interface file. In practice, the contract header is the source of truth for typed storage accessors, incoming message helpers, and generated get-method bindings.

The command can also generate a stub test file or emit a TypeScript wrapper for frontend and tooling integrations.

For .tolk contracts, acton wrapper compiles the selected source directly. For precompiled .boc contracts, it reads code from the BoC and compiles the configured types interface file. A prior acton build run is not required.

Options

Wrapper Options

<contract-name>

Contract name from Acton.toml to generate the wrapper for. Required unless --all is given.

Conflicts with:

--all

--all

Generate wrappers for every contract defined in Acton.toml.

Conflicts with:

--output, --test-output, contract-name

-o,--output<path>

Write the generated wrapper to an exact path.

Conflicts with:

--output-dir, --all

--output-dir<dir>

Write the generated wrapper to a directory and let Acton choose the file name.

Conflicts with:

--output

Test Stub Options

-t,--test

Generate a stub test file together with the wrapper.

Conflicts with:

--ts

--test-output<path>

Write the generated test file to an exact path.

Requires:

--test.

Conflicts with:

--all, --test-output-dir, --ts

--test-output-dir<dir>

Write the generated test file to a directory and let Acton choose the file name.

Requires:

--test.

Conflicts with:

--test-output, --ts

TypeScript Options

--ts

Generate a TypeScript wrapper through @ton/tolk-abi-to-typescript@0.5.0.

Conflicts with:

--test, --test-output, --test-output-dir

Display Options

--color<when>

Control when to use colored output.

Possible values:

auto, always, never

Default:

auto

Project Options

--manifest-path<path>

Path to the Acton.toml file to use for this invocation.

Use this when running the command outside the project directory or when the manifest lives at a non-default location.

Conflicts with:

--project-root

--project-root<path>

Path to the project root to use for configuration discovery and relative defaults.

Conflicts with:

--manifest-path

ABI Requirements

Wrapper generation depends on the contract ABI exposed by the Tolk compiler.

  • storage: ... enables typed storage helpers such as fromStorage
  • incomingMessages: ... enables send{Message} helpers
  • declared get methods are emitted as wrapper methods

If incomingMessages is missing, message-sending helpers are not generated. If storage is missing, storage helpers fall back to an untyped initializer.

TypeScript Generation

acton wrapper --ts shells out to npx @ton/tolk-abi-to-typescript@0.5.0.

  • Node.js, npm, and npx must be available in PATH
  • existing wrapper files at the target path are overwritten
  • --ts cannot be combined with --test, --test-output, or --test-output-dir

Configuration

Project-wide defaults can be configured in Acton.toml:

Acton.toml
[wrappers.tolk]
output-dir = "wrappers"
generate-test = true
test-output-dir = "tests"

[wrappers.typescript]
output-dir = "wrappers-ts"

CLI flags override config values for the current invocation.

For a precompiled .boc contract, configure types next to src so wrapper generation can read ABI from the Tolk interface file:

Acton.toml
[contracts.Precompiled]
src = "contracts/Precompiled.boc"
types = "contracts/Precompiled.types.tolk"

Do not put dependencies on the BoC contract itself: it is already compiled. Instead, put depends = ["Precompiled"] on the .tolk contract that needs the BoC code.

Exit Status

  • 0: Wrapper generation completed successfully.
  • 1: The contract could not be found or compiled, ABI data was missing, the TypeScript generator could not run, or an output file could not be written.

Examples

  1. Generate the default Tolk wrapper:

    acton wrapper Counter
  2. Generate a wrapper and stub test:

    acton wrapper Counter --test
  3. Generate a TypeScript wrapper:

    acton wrapper Counter --ts
  4. Generate into custom locations:

    acton wrapper Counter --output-dir tests/generated
    acton wrapper Counter --test --test-output-dir tests/generated
    acton wrapper Counter --ts --output-dir wrappers-ts
  5. Generate a frontend-oriented TypeScript wrapper layout:

    acton wrapper Counter --ts --output-dir app/src/wrappers-ts
  6. Generate wrappers for every contract in Acton.toml:

    acton wrapper --all
    acton wrapper --all --ts
    acton wrapper --all --output-dir wrappers/generated

See Also

Last updated on

On this page