1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Allow non strigified typed data params

This commit is contained in:
Dan Finlay 2019-10-22 14:53:25 -07:00
parent a8aca0a326
commit d26a8e7f82

View File

@ -1168,9 +1168,12 @@ module.exports = class MetamaskController extends EventEmitter {
try { try {
const cleanMsgParams = await this.typedMessageManager.approveMessage(msgParams) 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') { 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) const address = sigUtil.normalize(cleanMsgParams.from)