0.0.22 • Published 2 years ago

ewasm-jsvm v0.0.22

Weekly downloads
2
License
GPL-3.0-or-later
Repository
github
Last release
2 years ago

ewasm-jsvm

ewasm virtual machine for javascript

Specs: https://github.com/ewasm/design/blob/master/eth_interface.md.

! Use it only for testing. Not production ready.

Use

Needs peer dependencies: npm install ethers --save.

npm install ewasm-jsvm --save

Node

For i64 support, use a Node.js version which supports the --experimental-wasm-bigint flag. E.g. v13.10.1

Browser

A limited (Ethereum interface methods with args of type i64 are not supported by browsers), but easier to use version of the ewasm-jsvm can be found at https://observablehq.com/@loredanacirstea/ewasmjsvm.

Development

cd ewasm-jsvm
yarn

Run Tests

npm run test

To test a contract:

For contracts that only need to execute the constructor, check out the c1 contract, abi & test:

const ewmodule = ewasmjsvm.runtimeSim(contracts.c1.bin, c1Abi);
const answ = await ewmodule.main(DEFAULT_TX_INFO);

For contracts where the constructor returns a runtime wasm to be deployed (that only has a fallback/default function), check out c2 contract, abi & test:

const runtime = await ewasmjsvm.deploy(contracts.c2.bin, c2Abi)(DEFAULT_TX_INFO);
const answ = await runtime.main(DEFAULT_TX_INFO);

For contracts with functions, check out the c10 contract, abi & test:

const runtime = await ewasmjsvm.deploy(contracts.c10.bin, c10Abi)(DEFAULT_TX_INFO);
let answ = await runtime.sum(8, 2, DEFAULT_TX_INFO);
0.0.21

2 years ago

0.0.22

2 years ago

0.0.20

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago