compile_tolk
Compile Tolk smart contract source into Fift assembly, base64 BoC, and code hash. Provide source files as a map with entrypoint; standard library imports auto-resolved.
Instructions
Compiles Tolk smart contract source code using @ton/tolk-js. Provide source files as a map of filename→content. The entrypoint file must be included. Standard library imports (@stdlib/*) are resolved automatically. Returns compiled Fift code, BoC (Bag of Cells) in base64, and the code hash.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sources | No | Object mapping filename → source code content. Must include the entrypoint file. Example: {"main.tolk": "fun main(): int { return 0; }"} | |
| optimizationLevel | No | Optimization level 0-2 (default: 2). 0 = no optimization, 2 = full optimization | |
| withStackComments | No | Include stack layout comments in Fift output (default: false). Useful for debugging | |
| entrypointFileName | Yes | The main .tolk file to compile (e.g., "main.tolk") | |
| experimentalOptions | No | Space-separated experimental compiler flags (advanced usage) |