# ton-compiler

> TON compiler binaries

Latest version **2.3.0** (published 2023-02-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install ton-compiler
pnpm add ton-compiler
yarn add ton-compiler
bun add ton-compiler
```

Provides the commands `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.0 |
| Published | 2023-02-21 |
| First published | 2021-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 49.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Steve Korshakov <steve@korshakov.com> |
| Maintainers | mrmld, tonwhales |

## Links

- npm: https://www.npmjs.com/package/ton-compiler
- Repository: https://github.com/ton-core/ton-compiler.git
- npm.io page: https://npm.io/package/ton-compiler

## Dependencies (2)

- [arg](https://npm.io/package/arg.md) ^5.0.1
- [tmp](https://npm.io/package/tmp.md) ^0.2.1

## Recent versions

- 2.3.0 (latest) — 2023-02-21
- 2.2.0 — 2023-02-01
- 2.1.2 — 2023-01-26
- 2.1.1 — 2023-01-09
- 2.1.0 — 2023-01-09
- 2.0.0 — 2022-10-13
- 1.0.0 — 2022-02-18
- 0.9.0 — 2021-11-28
- 0.8.0 — 2021-11-28
- 0.7.0 — 2021-11-04
- 0.4.0 — 2021-11-04
- 0.6.1 — 2021-10-01
- 0.6.0 — 2021-10-01

## README

# TON COMPILER

Packaged Func compiler for TON smart contracts.

[![Version npm](https://img.shields.io/npm/v/ton-compiler.svg?logo=npm)](https://www.npmjs.com/package/ton-compiler)

## 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

```bash
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

```bash
# 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

```typescript
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

---
_Source: https://npm.io/package/ton-compiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
