https://weavechain.com: Layer-0 For Data
- @weavechain/weave-js-api: Javascript API
- @weavechain/weave-react-api: React Native API
npm install @weavechain/weave-js-api --save
or
yarn add @weavechain/weave-js-api
import { WeaveAPI, WeaveHelper } from "@weavechain/weave-js-api"
const [ pub, pvk ] = WeaveHelper.generateKeys();
console.log("Public key: ", pub);
console.log("Private key: ", pvk);
const node = "https://public.weavechain.com:443/92f30f0b6be2732cb817c19839b0940c";
const organization = "weavedemo";
const scope = "shared";
const table = "directory";
const encrypted = node.startsWith("http://");
const cfg = WeaveHelper.getConfig(node, pub, pvk, encrypted)
const nodeApi = new WeaveAPI().create(cfg);
await nodeApi.init();
const session = await nodeApi.login(organization, pub, scope || "*");
nodeApi.read(session, scope, table, null, WeaveHelper.Options.READ_DEFAULT_NO_CHAIN).then((r, ex) => {
if (ex) {
console.log("Failed", ex);
} else {
console.log(r);
}
});