Last active
November 30, 2022 17:28
-
-
Save btwiuse/49feb02adf56cf40c9659de1ec97bc12 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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