funcexec
v1.2.0
Published
FunC executor for main() function
Downloads
6
Readme
funcexec
FunC executor for main() function
Installation
For CLI usage:
npm i -g funcexec
For script usage:
npm i funcexec
Usage
From CLI
fce filename [--no-stdlib]
Example:
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:
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{}
]
]
}