Fixed message signing errors that clobbered critical Error properties (#3356).

This commit is contained in:
Richard Moore 2022-09-13 21:24:31 -04:00
parent 4c86dc9ed4
commit b14cb0fa2c

@ -298,8 +298,6 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner {
async signMessage(message: Bytes | string): Promise<string> { async signMessage(message: Bytes | string): Promise<string> {
const data = ((typeof(message) === "string") ? toUtf8Bytes(message): message); const data = ((typeof(message) === "string") ? toUtf8Bytes(message): message);
const address = await this.getAddress(); const address = await this.getAddress();
try { try {
return await this.provider.send("personal_sign", [ hexlify(data), address.toLowerCase() ]); return await this.provider.send("personal_sign", [ hexlify(data), address.toLowerCase() ]);
} catch (error) { } catch (error) {
@ -307,7 +305,7 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner {
logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, {
action: "signMessage", action: "signMessage",
from: address, from: address,
message: data messageData: message
}); });
} }
throw error; throw error;
@ -326,7 +324,7 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner {
logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, {
action: "_legacySignMessage", action: "_legacySignMessage",
from: address, from: address,
message: data messageData: message
}); });
} }
throw error; throw error;
@ -351,7 +349,7 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner {
logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { logger.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, {
action: "_signTypedData", action: "_signTypedData",
from: address, from: address,
message: { domain: populated.domain, types, value: populated.value } messageData: { domain: populated.domain, types, value: populated.value }
}); });
} }
throw error; throw error;