Skip to content

Commit

Permalink
Update new method namespace from v2 to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpshr committed Sep 13, 2018
1 parent 68c2554 commit 42fdcf6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/scripts/lib/typed-message-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions old-ui/app/components/typed-message-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -54,7 +54,7 @@ function renderTypedData (values) {
})
}

function renderTypedDataV2 (values) {
function renderTypedDataV3 (values) {
const { domain, message } = JSON.parse(values)
return [
domain ? h('div', [
Expand Down
6 changes: 3 additions & 3 deletions ui/app/components/signature-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', [
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 42fdcf6

Please sign in to comment.