Skip to content

Commit 734ec5c

Browse files
committed
wallet from mnemonic
1 parent e541232 commit 734ec5c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/cli.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Command } from 'commander';
22
import { Commands } from './commands.js';
3-
import { JsonRpcProvider, Wallet, ethers } from 'ethers';
3+
import { JsonRpcProvider, Signer, ethers } from 'ethers';
44
import chalk from 'chalk';
55
import { stdin as input, stdout as output } from 'node:process';
66
import { createInterface } from 'readline/promises';
@@ -10,17 +10,16 @@ import { toBoolean } from './helpers.js';
1010
async function initializeSigner() {
1111

1212
const provider = new JsonRpcProvider(process.env.RPC);
13-
let signer;
13+
let signer: Signer;
1414

1515
if (process.env.PRIVATE_KEY) {
1616
signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
1717
} else {
18-
signer = Wallet.fromPhrase(process.env.MNEMONIC);
19-
signer = await signer.connect(provider);
18+
signer = ethers.Wallet.fromPhrase(process.env.MNEMONIC, provider);
2019
}
2120

2221
const { chainId } = await signer.provider.getNetwork();
23-
return { signer, chainId };
22+
return { signer, chainId: Number(chainId) };
2423
}
2524

2625
export async function createCLI() {

0 commit comments

Comments
 (0)