acton wrapper
Reference manual for the acton wrapper command
Synopsis
acton wrapper [options] contract-name
Description
Generate a wrapper for the contract identified by _contract-name_ from
Acton.toml.
Wrapper generation uses the ABI emitted by the Tolk compiler. 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.
acton wrapper compiles the selected contract directly. A prior acton build
run is not required.
Options
Wrapper Options
Contract name from Acton.toml to generate the wrapper for.
Write the generated wrapper to an exact path.
--output-dir.
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.
Write the generated test file to an exact path.
Requires --test.
Write the generated test file to a directory and let Acton choose the file name.
Requires --test and conflicts with --test-output.
TypeScript Options
Generate a TypeScript wrapper through gen-typescript-from-tolk.
test stub generation.
Display Options
Control when to use colored output.
auto, always, never
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.
Path to the project root to use for configuration discovery and relative defaults.
This conflicts with --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 gen-typescript-from-tolk-dev.
- 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.
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
See Also
acton help buildacton help test- Generating wrappers guide
Last updated on