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 from Acton.toml to generate the wrapper for. Required unless
--all is given.
--all
Generate wrappers for every contract defined in Acton.toml.
--output, --test-output, contract-name
Write the generated wrapper to an exact path.
--output-dir, --all
Write the generated wrapper to a directory and let Acton choose the file name.
--output
Test Stub Options
Generate a stub test file together with the wrapper.
--ts
Write the generated test file to an exact path.
--test.
--all, --test-output-dir, --ts
Write the generated test file to a directory and let Acton choose the file name.
--test.
--test-output, --ts
TypeScript Options
Generate a TypeScript wrapper through @ton/tolk-abi-to-typescript@0.5.0.
--test, --test-output, --test-output-dir
Display Options
Control when to use colored output.
auto, always, never
auto
Project Options
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.
--project-root
Path to the project root to use for configuration discovery and relative defaults.
--manifest-path
ABI Requirements
Wrapper generation depends on the contract ABI exposed by the Tolk compiler.
storage: ...enables typed storage helpers such asfromStorageincomingMessages: ...enablessend{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
npxmust be available inPATH - existing wrapper files at the target path are overwritten
--tscannot be combined with--test,--test-output, or--test-output-dir
Configuration
Project-wide defaults can be configured in 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:
[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
-
Generate the default Tolk wrapper:
acton wrapper Counter -
Generate a wrapper and stub test:
acton wrapper Counter --test -
Generate a TypeScript wrapper:
acton wrapper Counter --ts -
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 -
Generate a frontend-oriented TypeScript wrapper layout:
acton wrapper Counter --ts --output-dir app/src/wrappers-ts -
Generate wrappers for every contract in
Acton.toml:acton wrapper --all acton wrapper --all --ts acton wrapper --all --output-dir wrappers/generated
See Also
acton help buildacton help test- Generating wrappers guide
Last updated on