-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (27 loc) · 1009 Bytes
/
index.js
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
31
32
import {ethers} from "ethers";
import { LedgerSigner } from "@ethers-ext/signer-ledger";
import HIDTransport from "@ledgerhq/hw-transport-node-hid";
const RPC = process.argv[2];
const paths = [
{name: "Default", path: `m/44'/60'/i'/0/0`},
{name: "Ledger", path: `m/44'/60'/0'/i`},
{name: "Ledger Live", path: `m/44'/60'/0'/i/0/0`},
];
const getPaths = async (path, depth) => {
}
(async() => {
const provider = new ethers.JsonRpcProvider(RPC)
const signer = new LedgerSigner(HIDTransport, provider);
for (let j = 0; j < paths.length; j++) {
console.log("\n")
console.log(`${paths[j].name}: ${paths[j].path}`);
console.log("---------------------");
for (let i = 0; i < 10; i++) {
const path = paths[j].path.replace("i", i);
const account = signer.getSigner(path);
const address = await account.getAddress();
const balance = ethers.formatEther(await provider.getBalance(address));
console.log(`${i}: ${address} (${balance} ether)`);
}
}
})();