显示软件包…
1 个不稳定版本
0.1.0 | 2022 年 1 月 29 日 |
---|
#116 在 #runtime
100KB
1K SLoC
Inkpad
在任何地方运行 ink! 合同
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
依赖项
~16MB
~315K SLoC