Crates.io | inkpad-browser |
lib.rs | inkpad-browser |
version | 0.1.0 |
source | src |
created_at | 2022-01-29 09:45:42.530516 |
updated_at | 2022-01-29 09:45:42.530516 |
description | Run ink! contract in browser! |
homepage | |
repository | https://github.com/clearloop/inkpad |
max_upload_size | |
id | 523524 |
size | 191,750 |
Run ink! contract anywhere
A browser implementation of inkpad
import Flipper from "./flipper.json";
(async () => {
const wasm = await import("@patract/inkpad-browser").catch(console.error);
const { Runtime } = wasm && (await wasm.default);
// create monitor
console.log("hello, this is a template of inkpad");
// load contract
const contract = new Runtime(JSON.stringify(Flipper));
console.log("...init contract");
// deploy contract
(contract as any).deploy("default", "[]");
console.log("...deploy contract");
// call contract
const res = contract.call("get", "[]");
console.log(`...call contract...${res}`);
// flip
contract.call("flip", "[]");
const flip = contract.call("get", "[]");
console.log(`...call contract...${flip}`);
})();
Apache-2.0