1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge pull request #5368 from MetaMask/bugfix-sign-typed-data

bugfix: update eth_signTypedData_v3 parameter order
This commit is contained in:
kumavis 2018-09-26 10:46:19 -04:00 committed by GitHub
commit 13348961e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 164 additions and 178 deletions

View File

@ -1255,7 +1255,7 @@ module.exports = class MetamaskController extends EventEmitter {
engine.push(this.preferencesController.requestWatchAsset.bind(this.preferencesController))
engine.push(this.createTypedDataMiddleware('eth_signTypedData', 'V1').bind(this))
engine.push(this.createTypedDataMiddleware('eth_signTypedData_v1', 'V1').bind(this))
engine.push(this.createTypedDataMiddleware('eth_signTypedData_v3', 'V3').bind(this))
engine.push(this.createTypedDataMiddleware('eth_signTypedData_v3', 'V3', true).bind(this))
engine.push(createProviderMiddleware({ provider: this.provider }))
// setup connection
@ -1511,13 +1511,13 @@ module.exports = class MetamaskController extends EventEmitter {
* @param {Function} - next
* @param {Function} - end
*/
createTypedDataMiddleware (methodName, version) {
createTypedDataMiddleware (methodName, version, reverse) {
return async (req, res, next, end) => {
const { method, params } = req
if (method === methodName) {
const promise = this.typedMessageManager.addUnapprovedMessageAsync({
data: params.length >= 1 && params[0],
from: params.length >= 2 && params[1],
data: reverse ? params[1] : params[0],
from: reverse ? params[0] : params[1],
}, req, version)
this.sendUpdate()
this.opts.showUnconfirmedMessage()

334
package-lock.json generated

File diff suppressed because it is too large Load Diff