Tired of trying to find TON binaries compiled for your system, we've got you covered.
This is a heavy rewrite of ton-compiler package, so kudos to its authors. All commits were erased, because there were heavy binaries in git and we don't want them to stuck in history.
- 🚀 Binaries (fift and func) are compiled to WASM, runs anywhere without any hustle
- 🍰 Programmatic and CLI interfaces
- 💸 Ready to use in unit testing
npm install tonc
This packages adds multiple binaries: func, fift and tonc.
- Fift compiler already has stdlib included
- Func compiler needs stdlib to be provided, you can use bundled version:
./node_modules/tonc/funclib/stdblib.fc
- Ton Compiler is a wrapper to compile everything in one go
# Compile to binary form (for contract creation)
tonc --input ./wallet.fc --output ./wallet.cell
# Compile to fift (useful for debuging)
tonc --input ./wallet.fc --output ./wallet.fif --fift
import { compileFunc } from "tonc";
let compiled = await compileFunc("source code");
console.log(compiled.fift); // Compiled Fift assembler
console.log(compiled.cell.toString("hex")); // Compiled cell
Currently building WASM works only on Linux, though it should be possible on OS X too.
- Install emscripten as explained in https://emscripten.org/docs/getting_started/downloads.html
- Make sure you have installed git, curl, and build-tools (clang, cmake, etc)
- Run
make compile
, this will bootstrap all needed file in./build/
directory, compile binaries to WASM initially and copy those WASM files to./bin/exec
It takes some time, so be patient - After that you can run
compile-only-ton
, which will only recompile TON to wasm
MIT