forked from mashharuki/erc-4337-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.ts
More file actions
30 lines (27 loc) · 830 Bytes
/
init.ts
File metadata and controls
30 lines (27 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import fs from "fs/promises";
import path from "path";
import prettier from "prettier";
import { ethers } from "ethers";
import { Presets } from "userop";
const INIT_CONFIG = {
rpcUrl: "https://api.stackup.sh/v1/node/API_KEY",
signingKey: new ethers.Wallet(ethers.utils.randomBytes(32)).privateKey,
secp256r1Key: Presets.Signers.BarzSecp256r1.generatePrivateKey(),
paymaster: {
rpcUrl: "https://api.stackup.sh/v1/paymaster/API_KEY",
context: {},
},
};
const CONFIG_PATH = path.resolve(__dirname, "../config.json");
async function main() {
return fs.writeFile(
CONFIG_PATH,
prettier.format(JSON.stringify(INIT_CONFIG, null, 2), { parser: "json" })
);
}
main()
.then(() => console.log(`Config written to ${CONFIG_PATH}`))
.catch((error) => {
console.error(error);
process.exit(1);
});