Files
hyperzine/scripts/generate-wallet.mjs
2026-03-27 12:05:15 +00:00

26 lines
623 B
JavaScript

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);
});