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 b76c1e60f..41415411e 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')
@@ -37,8 +38,13 @@ function mapDispatchToProps (dispatch) {
}
}
+SignatureRequest.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = connect(mapStateToProps, mapDispatchToProps)(SignatureRequest)
+
inherits(SignatureRequest, Component)
function SignatureRequest (props) {
Component.call(this)
@@ -54,7 +60,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'),
@@ -75,7 +81,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,
@@ -102,7 +108,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`),
@@ -136,7 +142,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'),
]),
])
@@ -154,18 +160,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', {}, [
@@ -224,10 +230,10 @@ SignatureRequest.prototype.renderFooter = function () {
return h('div.request-signature__footer', [
h('button.btn-secondary--lg.request-signature__footer__cancel-button', {
onClick: cancel,
- }, this.props.t('cancel')),
+ }, this.context.t('cancel')),
h('button.btn-primary--lg', {
onClick: sign,
- }, this.props.t('sign')),
+ }, this.context.t('sign')),
])
}