mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
Update new method namespace from v2 to v3
This commit is contained in:
parent
68c2554296
commit
42fdcf6239
@ -140,7 +140,7 @@ module.exports = class TypedMessageManager extends EventEmitter {
|
||||
sigUtil.typedSignatureHash(params.data)
|
||||
}, 'Expected EIP712 typed data')
|
||||
break
|
||||
case 'V2':
|
||||
case 'V3':
|
||||
let data
|
||||
assert.equal(typeof params, 'object', 'Params should be an object.')
|
||||
assert.ok('data' in params, 'Params must include a data field.')
|
||||
|
@ -991,7 +991,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
case 'V1':
|
||||
signature = sigUtil.signTypedDataLegacy(privKey, { data: cleanMsgParams.data })
|
||||
break
|
||||
case 'V2':
|
||||
case 'V3':
|
||||
signature = sigUtil.signTypedData(privKey, { data: JSON.parse(cleanMsgParams.data) })
|
||||
break
|
||||
}
|
||||
@ -1253,7 +1253,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_v2', 'V2').bind(this))
|
||||
engine.push(this.createTypedDataMiddleware('eth_signTypedData_v3', 'V3').bind(this))
|
||||
engine.push(createProviderMiddleware({ provider: this.provider }))
|
||||
|
||||
// setup connection
|
||||
|
@ -19,8 +19,8 @@ TypedMessageRenderer.prototype.render = function () {
|
||||
case 'V1':
|
||||
text = renderTypedData(value)
|
||||
break
|
||||
case 'V2':
|
||||
text = renderTypedDataV2(value)
|
||||
case 'V3':
|
||||
text = renderTypedDataV3(value)
|
||||
break
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ function renderTypedData (values) {
|
||||
})
|
||||
}
|
||||
|
||||
function renderTypedDataV2 (values) {
|
||||
function renderTypedDataV3 (values) {
|
||||
const { domain, message } = JSON.parse(values)
|
||||
return [
|
||||
domain ? h('div', [
|
||||
|
@ -171,7 +171,7 @@ SignatureRequest.prototype.msgHexToText = function (hex) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/display-name
|
||||
SignatureRequest.prototype.renderTypedDataV2 = function (data) {
|
||||
SignatureRequest.prototype.renderTypedDataV3 = function (data) {
|
||||
const { domain, message } = JSON.parse(data)
|
||||
return [
|
||||
h('div.request-signature__typed-container', [
|
||||
@ -223,8 +223,8 @@ SignatureRequest.prototype.renderBody = function () {
|
||||
}),
|
||||
}, [notice]),
|
||||
|
||||
h('div.request-signature__rows', type === 'eth_signTypedData' && version === 'V2' ?
|
||||
this.renderTypedDataV2(data) :
|
||||
h('div.request-signature__rows', type === 'eth_signTypedData' && version === 'V3' ?
|
||||
this.renderTypedDataV3(data) :
|
||||
rows.map(({ name, value }) => {
|
||||
if (typeof value === 'boolean') {
|
||||
value = value.toString()
|
||||
|
Loading…
Reference in New Issue
Block a user