init
This commit is contained in:
25
scripts/generate-wallet.mjs
Normal file
25
scripts/generate-wallet.mjs
Normal file
@@ -0,0 +1,25 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import Arweave from "arweave";
|
||||
|
||||
const root = process.cwd();
|
||||
const walletPath = path.join(root, "wallet.json");
|
||||
|
||||
async function main() {
|
||||
const arweave = Arweave.init({
|
||||
host: "arweave.net",
|
||||
port: 443,
|
||||
protocol: "https",
|
||||
timeout: 30_000,
|
||||
logging: false
|
||||
});
|
||||
|
||||
const jwk = await arweave.wallets.generate();
|
||||
await fs.writeFile(walletPath, `${JSON.stringify(jwk, null, 2)}\n`, "utf8");
|
||||
console.log(`Generated wallet: ${walletPath}`);
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error?.message || String(error));
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user