inkpad-runtime

Crates.ioinkpad-runtime
lib.rsinkpad-runtime
version0.1.0
sourcesrc
created_at2022-01-29 09:26:09.520009
updated_at2022-01-29 09:26:09.520009
descriptionRuntime ink! contract anywhere!
homepage
repositoryhttps://github.com/clearloop/inkpad
max_upload_size
id523516
size25,498
(clearloop)

documentation

README

Inkpad Runtime

crate doc downloads LICENSE

The wasm executor of ink! contract

This repo provides:

  • Parsing *.contract to ABI and wasm source
  • A wasm runtime for executing ink! contract
    • Few interfaces

Design


- - - - - - - - -      - - - - -      - - - - - - -
| ink! contract | ---> | inkpad | ---> |  anywhere |
- - - - - - - - -      - - - - -      - - - - - - -

Example

use inkpad_runtime::Runtime;

#[test]
fn test_flipper() {
    let mut rt = Runtime::from_contract(include_bytes!("../flipper.contract"))
        .expect("Create runtime failed");

    rt.deploy("default", &[]).expect("Deploy failed");
    assert_eq!(&rt.call("get", &[]).expect("Call contract failed"), &[0]);

    rt.deploy("new", &["true"]).expect("Deploy failed");
    assert_eq!(&rt.call("get", &[]).expect("Call contract failed"), &[1]);

    rt.call("flip", &[]).expect("Call contract failed");
    assert_eq!(&rt.call("get", &[]).expect("Call contract failed"), &[0]);
}

LICENSE

MIT

Commit count: 86

cargo fmt