# funcexec

> FunC executor for main() function

Latest version **1.2.0** (published 2023-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install funcexec
pnpm add funcexec
yarn add funcexec
bun add funcexec
```

Provides the command `fce`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2023-06-12 |
| First published | 2022-11-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 79 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gusarich |
| Maintainers | gusarich |
| Keywords | func, executor, ton |

## Links

- npm: https://www.npmjs.com/package/funcexec
- npm.io page: https://npm.io/package/funcexec

## Dependencies (6)

- [ton](https://npm.io/package/ton.md) ^13.4.1
- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [ton-core](https://npm.io/package/ton-core.md) ^0.49.0
- [ton-crypto](https://npm.io/package/ton-crypto.md) ^3.2.0
- [ton-contract-executor](https://npm.io/package/ton-contract-executor.md) ^0.7.0
- [@ton-community/func-js](https://npm.io/package/@ton-community/func-js.md) ^0.6.1

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.2.0 (latest) — 2023-06-12
- 1.1.3 — 2023-05-24
- 1.1.2 — 2023-05-07
- 1.1.1 — 2023-05-07
- 1.1.0 — 2023-05-07
- 1.0.6 — 2023-02-05
- 1.0.5 — 2022-11-20
- 1.0.4 — 2022-11-20
- 1.0.3 — 2022-11-20
- 1.0.2 — 2022-11-20
- 1.0.1 — 2022-11-20
- 1.0.0 — 2022-11-20

## README

# funcexec

FunC executor for main() function

## Installation

For CLI usage:

```bash
npm i -g funcexec
```

For script usage:

```bash
npm i funcexec
```

## Usage

### From CLI

```bash
fce filename [--no-stdlib]
```

Example:

```bash
fce contract.fc
```

Example output:

```
Result: success 0
Gas consumed: 399
Logs:

s0 = CS{Cell{0024d371738b33132338fe203001fe2030fe2030} bits: 36..60; refs: 0..0}
s0 = 1
s0 = 3
```

### From JavaScript / TypeScript

Example:

```typescript
import { execute } from 'funcexec';

async function main() {
    const code = `() main () {
        int a = 1;
        int b = 2;
        int c = a + b;
        ~dump("123");
        ~dump(a);
        ~dump(c);
    }`;

    const result = await execute(code);

    console.log(result);
}

main();
```

Example output:

```
{
  type: 'success',
  exit_code: 0,
  gas_consumed: 399,
  result: [
    1000000000000000000n,
    1000000000000000000n,
    x{480000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000203782DACE9D900000000000000000000000000000004_},
    x{}
  ],
  action_list_cell: x{},
  logs: '',
  actionList: [],
  debugLogs: [
    '#DEBUG#: s0 = CS{Cell{0024d371738b33132338fe203001fe2030fe2030} bits: 36..60; refs: 0..0}',
    '#DEBUG#: s0 = 1',
    '#DEBUG#: s0 = 3'
  ],
  c7: [
    [
      124711402n,
      0n,
      0n,
      1683456514n,
      1683456514n,
      1683456514n,
      47875142786658879052646382433116183532529609479486613149337769638019042486462n,
      [Array],
      x{8000000000000000000000000000000000000000000000000000000000000000001_},
      x{}
    ]
  ]
}
```

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