ton-compiler

TON compiler binaries

Usage no npm install needed!

<script type="module">
  import tonCompiler from 'https://cdn.skypack.dev/ton-compiler';
</script>

README

TON COMPILER

Version npm

Packaged Func compiler for TON smart contracts.

BETA: right now works only on MacOS

Features

  • 🚀 Doesn't need to install and compile TON
  • 🍰 Programmatic and CLI interfaces
  • 💸 Ready to use in unit-testing

Install

yarn add ton-compiler

How to use

This packages adds multiple binaries: func, fift and ton-compiler.

  • Fift compiler already have stdlib included
  • Func compiler need stdlib to be provided, you can use bundled-in: ./node_modules/ton-compioler/funclib/stdblib.fc
  • Ton Compiler is a wrapper around them to be able to compile everything in one go

Console Use

# Compile to binary form (for contract creation)
ton-compiler --input ./wallet.fc --output ./wallet.cell

# Compile to fift (useful for debuging)
ton-compiler --input ./wallet.fc --output ./wallet.fif --fift

Programmatic use

import { compileFunc } from "ton-compiler";
let compiled = await compileFunc("source code");
console.log(compiled.fift); // Compiled Fift assembler
console.log(compiled.cell.toString('hex')); // Compiled cell

License

MIT