2017-05-30 15:06:46 +04:00
# wasm-utils
2017-04-12 20:52:01 +04:00
2017-11-20 16:54:31 +03:00
[](https://travis-ci.org/paritytech/wasm-utils)
2019-07-17 17:02:55 +03:00
Collection of WASM utilities used in pwasm-ethereum and substrate contract development
2017-04-12 20:52:01 +04:00
2017-08-09 14:00:09 +03:00
## Build tools for cargo
Easiest way to use is to install via `cargo install` :
```
2018-05-16 17:39:34 +04:00
cargo install pwasm-utils-cli --bin wasm-build
2017-08-09 14:00:09 +03:00
```
2017-09-15 22:03:43 +03:00
## Symbols pruning (wasm-prune)
2017-04-12 20:52:01 +04:00
```
2018-05-16 17:39:34 +04:00
cargo install pwasm-utils-cli --bin wasm-prune
2018-03-13 16:16:52 +03:00
wasm-prune < input_wasm_binary.wasm > < output_wasm_binary.wasm >
2017-04-12 20:52:01 +04:00
```
2018-05-18 16:29:35 +04:00
This will optimize WASM symbols tree to leave only those elements that are used by contract `call` function entry.
2017-04-12 20:52:01 +04:00
2017-05-30 15:06:46 +04:00
## Gas counter (wasm-gas)
2017-04-12 20:53:31 +04:00
2019-07-17 17:02:55 +03:00
For development puposes, raw WASM contract can be injected with gas counters (the same way as it done by pwasm-ethereum/substrate runtime when running contracts)
2017-04-12 20:52:01 +04:00
2017-05-30 15:06:46 +04:00
```
2018-05-16 17:39:34 +04:00
cargo install pwasm-utils-cli --bin wasm-gas
2018-03-13 16:16:52 +03:00
wasm-gas < input_wasm_binary.wasm > < output_wasm_binary.wasm >
2017-05-30 15:06:46 +04:00
```
2017-05-30 15:08:19 +04:00
## API
2017-05-30 15:08:42 +04:00
All executables use corresponding api methods of the root crate and can be combined in other build tools.
2017-11-03 02:11:41 +03:00
# License
`wasm-utils` is primarily distributed under the terms of both the MIT
license and the Apache License (Version 2.0), at your choice.
See LICENSE-APACHE, and LICENSE-MIT for details.
2018-05-16 20:52:54 +04:00
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in `wasm-utils` by you, as defined in the Apache-2.0 license, shall be
2019-07-17 17:02:55 +03:00
dual licensed as above, without any additional terms or conditions.