From 31089778ba3c97443e25bd3a7a901f45757894d9 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Mon, 27 Aug 2018 20:58:40 -0700 Subject: Add raised type buttons to Button component. Refactor all buttons within app to Button components --- ui/app/components/signature-request.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ui/app/components/signature-request.js') diff --git a/ui/app/components/signature-request.js b/ui/app/components/signature-request.js index 2e0102d1a..2bfa350d3 100644 --- a/ui/app/components/signature-request.js +++ b/ui/app/components/signature-request.js @@ -23,6 +23,7 @@ const { } = require('../selectors.js') import { clearConfirmTransaction } from '../ducks/confirm-transaction.duck' +import Button from './button' const { DEFAULT_ROUTE } = require('../routes') @@ -248,7 +249,10 @@ SignatureRequest.prototype.renderFooter = function () { } return h('div.request-signature__footer', [ - h('button.btn-default.btn--large.request-signature__footer__cancel-button', { + h(Button, { + type: 'default', + large: true, + className: 'request-signature__footer__cancel-button', onClick: event => { cancel(event).then(() => { this.props.clearConfirmTransaction() @@ -256,7 +260,9 @@ SignatureRequest.prototype.renderFooter = function () { }) }, }, this.context.t('cancel')), - h('button.btn-primary.btn--large', { + h(Button, { + type: 'primary', + large: true, onClick: event => { sign(event).then(() => { this.props.clearConfirmTransaction() -- cgit v1.2.3 From 36dd0354e777e6786ae0d2284ffcb1adbc6d85f7 Mon Sep 17 00:00:00 2001 From: bitpshr Date: Mon, 10 Sep 2018 17:11:57 -0400 Subject: Implement latest EIP-712 protocol --- ui/app/components/signature-request.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'ui/app/components/signature-request.js') diff --git a/ui/app/components/signature-request.js b/ui/app/components/signature-request.js index 2bfa350d3..4d078d23c 100644 --- a/ui/app/components/signature-request.js +++ b/ui/app/components/signature-request.js @@ -8,6 +8,7 @@ const ethUtil = require('ethereumjs-util') const classnames = require('classnames') const { compose } = require('recompose') const { withRouter } = require('react-router-dom') +const { ObjectInspector } = require('react-inspector') const AccountDropdownMini = require('./dropdowns/account-dropdown-mini') @@ -169,12 +170,29 @@ SignatureRequest.prototype.msgHexToText = function (hex) { } } +// eslint-disable-next-line react/display-name +SignatureRequest.prototype.renderTypedDataV2 = function (data) { + const { domain, message } = JSON.parse(data) + return [ + h('div.request-signature__typed-container', [ + domain ? h('div', [ + h('h1', 'Domain'), + h(ObjectInspector, { data: domain, expandLevel: 1, name: 'domain' }), + ]) : '', + message ? h('div', [ + h('h1', 'Message'), + h(ObjectInspector, { data: message, expandLevel: 1, name: 'message' }), + ]) : '', + ]), + ] +} + SignatureRequest.prototype.renderBody = function () { let rows let notice = this.context.t('youSign') + ':' const { txData } = this.props - const { type, msgParams: { data } } = txData + const { type, msgParams: { data, version } } = txData if (type === 'personal_sign') { rows = [{ name: this.context.t('message'), value: this.msgHexToText(data) }] @@ -205,9 +223,9 @@ SignatureRequest.prototype.renderBody = function () { }), }, [notice]), - h('div.request-signature__rows', [ - - ...rows.map(({ name, value }) => { + h('div.request-signature__rows', type === 'eth_signTypedData' && version === 'V2' ? + this.renderTypedDataV2(data) : + rows.map(({ name, value }) => { if (typeof value === 'boolean') { value = value.toString() } @@ -216,9 +234,7 @@ SignatureRequest.prototype.renderBody = function () { h('div.request-signature__row-value', value), ]) }), - - ]), - + ), ]) } -- cgit v1.2.3 From 42fdcf6239fc9278cfa85b6ae6cc025cef0e35ae Mon Sep 17 00:00:00 2001 From: bitpshr Date: Thu, 13 Sep 2018 15:12:08 -0400 Subject: Update new method namespace from v2 to v3 --- ui/app/components/signature-request.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ui/app/components/signature-request.js') diff --git a/ui/app/components/signature-request.js b/ui/app/components/signature-request.js index 4d078d23c..5b0c7684a 100644 --- a/ui/app/components/signature-request.js +++ b/ui/app/components/signature-request.js @@ -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() -- cgit v1.2.3 From 5cde74fe88cd473b6a6979686687c1b1d967d6ca Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Thu, 11 Oct 2018 13:36:24 -0230 Subject: Update Zendesk links for new subdomain --- ui/app/components/signature-request.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app/components/signature-request.js') diff --git a/ui/app/components/signature-request.js b/ui/app/components/signature-request.js index 5b0c7684a..d76eb5ef8 100644 --- a/ui/app/components/signature-request.js +++ b/ui/app/components/signature-request.js @@ -204,7 +204,7 @@ SignatureRequest.prototype.renderBody = function () { h('span.request-signature__help-link', { onClick: () => { global.platform.openWindow({ - url: 'https://consensys.zendesk.com/hc/en-us/articles/360004427792', + url: 'https://metamask.zendesk.com/hc/en-us/articles/360015488751', }) }, }, this.context.t('learnMore'))] -- cgit v1.2.3