Skip to content

Commit

Permalink
accept privkey with 0x prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Oct 19, 2023
1 parent 34d9260 commit 24bddf3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/eth/EthWalletManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export class EthWalletManager {
if(typeof faucetConfig.ethChainId === "number")
this.initChainCommon(faucetConfig.ethChainId);

this.walletKey = Buffer.from(faucetConfig.ethWalletKey, "hex");
let privkey = faucetConfig.ethWalletKey;
if(privkey.match(/^0x/))
privkey = privkey.substring(2);
this.walletKey = Buffer.from(privkey, "hex");
this.walletAddr = EthUtil.toChecksumAddress("0x"+EthUtil.privateToAddress(this.walletKey).toString("hex"));

await this.loadWalletState();
Expand Down

0 comments on commit 24bddf3

Please sign in to comment.