ton icon indicating copy to clipboard operation
ton copied to clipboard

New github action. Emscripten WebAssembly. fift.js and func.js

Open neodix42 opened this issue 2 years ago • 0 comments

WASM versions of fift and func utilities. Compiled with Emscripten.

Due to security reasons wasm restricts access to a file system, however Emscripten has a feature, where one can pack any files into wasm assembly. These both assemblies include crypto/lib and crypto/smartcont folders, that allows to run standard scripts out of the box. Thanks to interactive mode that is supported by fift and func, one can also supply any external script or contract via argument.

Usage examples: // create standard new-wallet located in wasm's virtual file system node --experimental-wasm-threads fift.js -Ilib -s smartcont/new-wallet.fif 0 new-wallet

// execute custom Fift script located outside wasm's virtual file system node --experimental-wasm-threads fift.js -Ilib -i < ~/new-wallet-test.fif 0 new-wallet

Notice: Fift in interactive mode does not support arguments, please adjust your script accordingly.

// convert FunC code into Fift assemler taking file from wasm's virtual file system node --experimental-wasm-threads func.js -SPA smartcont/stdlib.fc smartcont/simple-wallet-code.fc

// convert FunC code into Fift assemler taking file from external location node --experimental-wasm-threads func.js -I -SPA smartcont/stdlib.fc < ~/simple-wallet-code.fc

neodix42 avatar Jul 22 '22 19:07 neodix42