TON COMPILER
Packaged Func compiler for TON smart contracts.
Features
- ⭐️ Multiple func compiler versions
- 🚀 Doesn't need to install and compile TON
- 🍰 Programmatic and CLI interfaces
- 💸 Ready to use in unit-testing
Supported Versions
latest
(default) - by default library and cli use latest available compilerv2022.10
legacy
- Legacy compiler
Install
yarn add ton-compiler
How to use
This packages adds ton-compiler
binary to a project. FunC compilation is a multi-stage process. One is compiling Func to Fift code that then compiled to a binary representation. Fift compiler already have Asm.fif
bundled. Func stdlib is bundled, but could be disabled at runtime.
Console Use
ton-compiler --input ./wallet.fc --output ./wallet.cell
ton-compiler --input ./wallet.fc --output-fift ./wallet.fif
ton-compiler --input ./wallet.fc --output ./wallet.cell --output-fift ./wallet.fif
ton-compiler --no-stdlib --input ./wallet.fc --output ./wallet.cell --output-fift ./wallet.fif
ton-compiler --version "legacy" --input ./wallet.fc --output ./wallet.cell --output-fift ./wallet.fif
Programmatic use
import { compileContract } from "ton-compiler";
let result = await compileContract({ code: 'source code', stdlib: true, version: 'latest' });
if (result.ok) {
console.log(result.fift);
console.log(result.cell);
} else {
console.warn(result.logs);
}
License
MIT