From d26a8e7f82938e59b7d6b1668d3b480246e3da49 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 22 Oct 2019 14:53:25 -0700 Subject: [PATCH] Allow non strigified typed data params --- app/scripts/metamask-controller.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 16d879f34..e9683580c 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -1168,9 +1168,12 @@ module.exports = class MetamaskController extends EventEmitter { try { const cleanMsgParams = await this.typedMessageManager.approveMessage(msgParams) - // For some reason every version after V1 has stringified params. + // For some reason every version after V1 used stringified params. if (version !== 'V1') { - cleanMsgParams.data = JSON.parse(cleanMsgParams.data) + // But we don't have to require that. We can stop suggesting it now: + if (typeof cleanMsgParams.data === 'string') { + cleanMsgParams.data = JSON.parse(cleanMsgParams.data) + } } const address = sigUtil.normalize(cleanMsgParams.from)