显示软件包…
1 个不稳定版本
0.2.0 | 2021年8月2日 |
---|
#561 in #substrate
165KB
2.5K SLoC
Ceres
在任何地方运行 ink! 合同
Ceres 的浏览器实现
示例
import Flipper from "./flipper.json";
(async () => {
const wasm = await import("@patract/ceres-browser").catch(console.error);
const { Runtime } = wasm && (await wasm.default);
// create monitor
console.log("hello, this is a template of ceres");
// 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
依赖项
~15MB
~299K SLoC