Skip to content

Instantly share code, notes, and snippets.

@btwiuse
Last active November 30, 2022 17:28
Show Gist options
  • Save btwiuse/49feb02adf56cf40c9659de1ec97bc12 to your computer and use it in GitHub Desktop.
Save btwiuse/49feb02adf56cf40c9659de1ec97bc12 to your computer and use it in GitHub Desktop.
#!/usr/bin/env -S deno run -A
const RPC_NODE = "http://127.0.0.1:9933"
async function request(method: string, params: any) {
const response = await fetch(RPC_NODE, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: Math.floor(Math.random() * 100),
method,
params,
}),
});
const responseData: any = await response.json();
return responseData;
}
console.log(JSON.stringify(await request('author_rotateKeys', [])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment