Crates.io | ceres-browser |
lib.rs | ceres-browser |
version | 0.2.0 |
source | src |
created_at | 2021-08-02 09:51:12.227169 |
updated_at | 2021-08-02 09:51:12.227169 |
description | Run ink! contract in browser! |
homepage | |
repository | https://github.com/patractlabs/ceres |
max_upload_size | |
id | 430361 |
size | 191,829 |
Run ink! contract anywhere
A browser implementation of 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