Add support for Wallet private keys without 0x prefix (#3768).

This commit is contained in:
Richard Moore 2023-02-18 13:36:23 -05:00
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);
}