From 09225ddbdd44d827ee0bf5b940bac7b91a9de0a8 Mon Sep 17 00:00:00 2001 From: wasm-forge <122647775+wasm-forge@users.noreply.github.com> Date: Tue, 29 Aug 2023 22:19:11 +0200 Subject: [PATCH] Update README.md Update the explanation on the usage --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a5ac4fa..0b8aaff 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This will read the old Wasm file and create a new Wasm file with the WASI depend **NOTE** -The tool requires that you the polyfill implementation is present in your Wasm binary, to do that in your Rust project, you can add the dependency: +The tool requires that the polyfill implementation is present in your Wasm binary, to include the polyfill implementation into your canister project you need to add the dependency: ```bash cargo add --git https://github.com/wasm-forge/ic-wasi-polyfill @@ -40,6 +40,19 @@ cargo add --git https://github.com/wasm-forge/ic-wasi-polyfill This will create the polyfill methods in your `.wasm` file, which are needed for `wasi2ic`. +Also add the call to the init of the polyfill, example: + +```rust +#[ic_cdk::init] +fn init() { + unsafe { + ic_wasi_polyfill::init(&[0u8; 32], &[]); + } +} +``` + + + **NOTE2** The polyfill library is still in early development, and not all methods are implemented. Feel free to review its current state before use.