Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ton-compiler

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ton-compiler

TON compiler binaries

  • 2.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

TON COMPILER

Packaged Func compiler for TON smart contracts.

Version npm

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 compiler
  • v2022.10
  • v2022.12
  • v2023.01
  • 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

# 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-fift ./wallet.fif

# Compile to fift and fift
ton-compiler --input ./wallet.fc --output ./wallet.cell --output-fift ./wallet.fif

# Disable stdlib
ton-compiler --no-stdlib --input ./wallet.fc --output ./wallet.cell --output-fift ./wallet.fif

# Pick version
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); // Compiled Fift assembler
  console.log(result.cell); // Compiled cell Buffer
} else {
  console.warn(result.logs); // Output logs
}

License

MIT

FAQs

Package last updated on 21 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc