import { decodeAddress, GearApi, GearKeyring, } from "https://gear-js.deno.dev/api/index.ts"; export async function setProgramName( params: { genesis: string; programId: string; name: string; }, ) { let { genesis, programId, name, } = params; let body = { "id": Math.floor(Math.random() * 100), "jsonrpc": "2.0", "method": "program.name.add", "params": { genesis, id: programId, name, }, }; // 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(); } export async function setCodeName( params: { genesis: string; codeId: string; name: string; }, ) { let { genesis, codeId, name, } = params; let body = { "id": Math.floor(Math.random() * 100), "jsonrpc": "2.0", "method": "code.name.add", "params": { genesis, id: codeId, name, }, }; // 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(); }