Add support for Wallet private keys without 0x prefix (#3768).
This commit is contained in:
parent
b1bb69356a
commit
4665fb4c68
@ -39,6 +39,10 @@ export class Wallet extends BaseWallet {
|
||||
* to %%provider%%.
|
||||
*/
|
||||
constructor(key: string | SigningKey, provider?: null | Provider) {
|
||||
if (typeof(key) === "string" && !key.startsWith("0x")) {
|
||||
key = "0x" + key;
|
||||
}
|
||||
|
||||
let signingKey = (typeof(key) === "string") ? new SigningKey(key): key;
|
||||
super(signingKey, provider);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user