aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/signature-request.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/signature-request.js')
-rw-r--r--ui/app/components/signature-request.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/ui/app/components/signature-request.js b/ui/app/components/signature-request.js
index 92feb70ba..b958a2d2d 100644
--- a/ui/app/components/signature-request.js
+++ b/ui/app/components/signature-request.js
@@ -1,8 +1,9 @@
const Component = require('react').Component
+const PropTypes = require('prop-types')
const h = require('react-hyperscript')
const inherits = require('util').inherits
const Identicon = require('./identicon')
-const connect = require('../metamask-connect')
+const connect = require('react-redux').connect
const ethUtil = require('ethereumjs-util')
const classnames = require('classnames')
const { compose } = require('recompose')
@@ -41,11 +42,16 @@ function mapDispatchToProps (dispatch) {
}
}
+SignatureRequest.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
)(SignatureRequest)
+
inherits(SignatureRequest, Component)
function SignatureRequest (props) {
Component.call(this)
@@ -61,7 +67,7 @@ SignatureRequest.prototype.renderHeader = function () {
h('div.request-signature__header-background'),
- h('div.request-signature__header__text', this.props.t('sigRequest')),
+ h('div.request-signature__header__text', this.context.t('sigRequest')),
h('div.request-signature__header__tip-container', [
h('div.request-signature__header__tip'),
@@ -82,7 +88,7 @@ SignatureRequest.prototype.renderAccountDropdown = function () {
return h('div.request-signature__account', [
- h('div.request-signature__account-text', [this.props.t('account') + ':']),
+ h('div.request-signature__account-text', [this.context.t('account') + ':']),
h(AccountDropdownMini, {
selectedAccount,
@@ -109,7 +115,7 @@ SignatureRequest.prototype.renderBalance = function () {
return h('div.request-signature__balance', [
- h('div.request-signature__balance-text', [this.props.t('balance')]),
+ h('div.request-signature__balance-text', [this.context.t('balance')]),
h('div.request-signature__balance-value', `${balanceInEther} ETH`),
@@ -143,7 +149,7 @@ SignatureRequest.prototype.renderRequestInfo = function () {
return h('div.request-signature__request-info', [
h('div.request-signature__headline', [
- this.props.t('yourSigRequested'),
+ this.context.t('yourSigRequested'),
]),
])
@@ -161,18 +167,18 @@ SignatureRequest.prototype.msgHexToText = function (hex) {
SignatureRequest.prototype.renderBody = function () {
let rows
- let notice = this.props.t('youSign') + ':'
+ let notice = this.context.t('youSign') + ':'
const { txData } = this.props
const { type, msgParams: { data } } = txData
if (type === 'personal_sign') {
- rows = [{ name: this.props.t('message'), value: this.msgHexToText(data) }]
+ rows = [{ name: this.context.t('message'), value: this.msgHexToText(data) }]
} else if (type === 'eth_signTypedData') {
rows = data
} else if (type === 'eth_sign') {
- rows = [{ name: this.props.t('message'), value: data }]
- notice = this.props.t('signNotice')
+ rows = [{ name: this.context.t('message'), value: data }]
+ notice = this.context.t('signNotice')
}
return h('div.request-signature__body', {}, [
@@ -233,12 +239,12 @@ SignatureRequest.prototype.renderFooter = function () {
onClick: event => {
cancel(event).then(() => this.props.history.push(DEFAULT_ROUTE))
},
- }, this.props.t('cancel')),
+ }, this.context.t('cancel')),
h('button.btn-primary--lg', {
onClick: event => {
sign(event).then(() => this.props.history.push(DEFAULT_ROUTE))
},
- }, this.props.t('sign')),
+ }, this.context.t('sign')),
])
}