import { decodeAddress, GearApi, GearKeyring, } from "https://gear-js.deno.dev/api/index.ts"; export async function postMetadata( params: { genesis: string; codeHash: string; metaHex: string; }, ) { let { genesis, metaHex, codeHash, } = params; let body = { "id": Math.floor(Math.random() * 100), "jsonrpc": "2.0", "method": "meta.add", "params": { genesis, hex: metaHex, codeHash, }, }; // https requires passing `--unsafely-ignore-certificate-errors` to deno // so revert to http as a workaround let resp = await fetch("http://idea.gear-tech.io/api", { "headers": { "Accept": "application/json", "content-type": "application/json;charset=utf-8", }, body: JSON.stringify(body), "method": "POST", }); return await resp.json(); }