From 0820cc720408dda184af857f2df98ac213c2f819 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Sat, 18 Feb 2023 13:36:23 -0500 Subject: [PATCH] Add support for Wallet private keys without 0x prefix (#3768). --- src.ts/wallet/wallet.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src.ts/wallet/wallet.ts b/src.ts/wallet/wallet.ts index 355f51e9d9..23a932ea6c 100644 --- a/src.ts/wallet/wallet.ts +++ b/src.ts/wallet/wallet.ts @@ -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); }