build
build.tolk standard library file
Module for building contract code cells.
build() is a host-assisted helper for tests, scripts, and emulation
scenarios. It returns a code cell; it does not deploy the contract by
itself.
Build a contract with a specified name and optional path.
name is the contract name in Acton.toml (the key in [contracts.<name>]), not
the display name stored in [contracts.<name>].display-name.
build() has three practical resolution modes:
build("JettonWallet"): resolve the contract by name fromActon.tomlbuild("JettonWallet", "contracts/non-standard-filename.tolk"): skip manifest lookup and compile the explicit.tolkfilebuild("JettonWallet", "build/JettonWallet.boc"): skip compilation and decode the explicit.bocfile directly
If path is omitted (empty string), Acton looks up the contract name in
Acton.toml. If no contract with that name is found, execution fails.
If the resolved manifest source already points to a .boc file, the name
lookup still succeeds, but the code is loaded directly from that BoC instead
of being compiled from Tolk source.
Example:
val cell = build("JettonWallet");If path is non-empty, Acton.toml lookup is skipped and that path is used directly.
The path can point to:
- a
.tolkfile - a
.bocfile
Example:
val cell = build("JettonWallet", "contracts/non-standard-filename.tolk");Example with prebuilt code:
val cell = build("JettonWallet", "build/JettonWallet.boc");Path rules and cache behavior:
- Relative paths are resolved from the project root (the directory with
Acton.toml). .tolkpaths go through the runtime build pipeline: Acton can reuse an in-memory cache for the current run and the shared file cache underbuild/cacheacross runs..bocpaths bypass compilation entirely. Acton just reads the file, decodes the code cell, and returns it.- Because
.bocmode does not compile anything, it does not populate or consult the compilation cache. - Missing or invalid
.bocfiles fail at runtime with file-read or BoC decode errors.
Definitions
build
fun build(name: string, path: string = ""): cellLast updated on