Skip to content

tonwhales/ton-contract-executor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TON Contract Executor

Runs TVM locally and provides primitives for TON smart contracts local development.

Install

yarn add ton-contract-executor

How it works

This package internally uses vm-execute cli tool compiled to WASM. vm-execute fetches vm code, initial stack and data cell from json config, executes TVM and returns resulting vm stack as json.

How to use

import { SmartContract } from "ton-contract-executor";
import { Cell } from "ton";

const source = `
    () main() {
        ;; noop
    }

    int test() method_id {
        return 777;
    }
`

let contract = await SmartContract.fromFuncSource(source, new Cell())
let res = await contract.invokeGetMethod('test', [])    // returns stack with int 777 as first and only entry

License

MIT

About

TON Contracts local executor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published