Skip to content

Commit 0003d80

Browse files
committed
feat: 🎸 Added wallet generation hardhat task
1 parent 1f6a49b commit 0003d80

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tasks/index.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
22
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
33
import { task } from 'hardhat/config';
4+
import { utils, Wallet } from 'ethers';
45

56
task('debug', 'Transaction debug')
67
.addParam('tx', 'Transaction hash')
@@ -17,5 +18,15 @@ task('debug', 'Transaction debug')
1718
// },
1819
],
1920
);
20-
console.log('@@@', JSON.stringify(trace, null, 2));
21+
console.log(JSON.stringify(trace, null, 2));
22+
});
23+
24+
task('wallet', 'Generate random wallet')
25+
// eslint-disable-next-line @typescript-eslint/require-await
26+
.setAction(async () => {
27+
const mnemonic = utils.entropyToMnemonic(utils.randomBytes(32));
28+
console.log(`Mnemonic: ${mnemonic}`);
29+
const wallet = Wallet.fromMnemonic(mnemonic);
30+
console.log('Account address:', wallet.address);
31+
console.log('PK:', wallet.privateKey);
2132
});

0 commit comments

Comments
 (0)