From b14cb0fa2c31c09bfc4c668e5b9dbbc52e9b5dce Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 13 Sep 2022 21:24:31 -0400 Subject: [PATCH] Fixed message signing errors that clobbered critical Error properties (#3356). --- packages/providers/src.ts/json-rpc-provider.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/providers/src.ts/json-rpc-provider.ts b/packages/providers/src.ts/json-rpc-provider.ts index 94e37e588..ac6f928ba 100644 --- a/packages/providers/src.ts/json-rpc-provider.ts +++ b/packages/providers/src.ts/json-rpc-provider.ts @@ -298,8 +298,6 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner { async signMessage(message: Bytes | string): Promise { const data = ((typeof(message) === "string") ? toUtf8Bytes(message): message); const address = await this.getAddress(); - - try { return await this.provider.send("personal_sign", [ hexlify(data), address.toLowerCase() ]); } catch (error) { @@ -307,7 +305,7 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner { logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { action: "signMessage", from: address, - message: data + messageData: message }); } throw error; @@ -326,7 +324,7 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner { logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { action: "_legacySignMessage", from: address, - message: data + messageData: message }); } throw error; @@ -351,7 +349,7 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner { logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { action: "_signTypedData", from: address, - message: { domain: populated.domain, types, value: populated.value } + messageData: { domain: populated.domain, types, value: populated.value } }); } throw error;