ic-wasm

A library for transforming Wasm canisters running on the Internet Computer

Executable

To install the ic-wasm executable, run

$ cargo install ic-wasm

Metadata

Manage metadata in the Wasm module.

Usage: ic-wasm <input.wasm> [-o <output.wasm>] metadata [name] [-d <text content> | -f <file content>] [-v <public|private>]

Info

Print information about the Wasm canister

Usage: ic-wasm <input.wasm> info

Shrink

Remove unused functions and debug info

Usage: ic-wasm <input.wasm> -o <output.wasm> shrink

Resource

Limit resource usage, mainly used by Motoko Playground

Usage: ic-wasm <input.wasm> -o <output.wasm> resource --remove_cycles_transfer --limit_stable_memory_page 1024

Instrument (experimental)

Instrument canister method to emit execution trace to stable memory.

Usage: ic-wasm <input.wasm> -o <output.wasm> instrument --trace-only func1 --trace-only func2

Instrumented canister has the following additional endpoints:

When --trace-only flag is provided, the counter and trace logging will only happen during the execution of that function, instead of tracing the whole update call. Note that the function itself has to be non-recursive.

Current limitations:

Library

To use ic-wasm as a library, add this to your Cargo.toml:

toml [dependencies.ic-wasm] default-features = false

Contribution

See our CONTRIBUTING to get started.