aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pending-tx
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/pending-tx')
-rw-r--r--ui/app/components/pending-tx/confirm-deploy-contract.js29
-rw-r--r--ui/app/components/pending-tx/confirm-send-ether.js22
-rw-r--r--ui/app/components/pending-tx/confirm-send-token.js42
-rw-r--r--ui/app/components/pending-tx/index.js2
4 files changed, 49 insertions, 46 deletions
diff --git a/ui/app/components/pending-tx/confirm-deploy-contract.js b/ui/app/components/pending-tx/confirm-deploy-contract.js
index 4810bb515..8e04fb84d 100644
--- a/ui/app/components/pending-tx/confirm-deploy-contract.js
+++ b/ui/app/components/pending-tx/confirm-deploy-contract.js
@@ -1,5 +1,5 @@
const { Component } = require('react')
-const { connect } = require('react-redux')
+const connect = require('../../metamask-connect')
const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const actions = require('../../actions')
@@ -8,7 +8,7 @@ const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
const hexToBn = require('../../../../app/scripts/lib/hex-to-bn')
const { conversionUtil } = require('../../conversion-util')
-const t = require('../../../i18n')
+const t = require('../../../i18n-helper').getMessage
const SenderToRecipient = require('../sender-to-recipient')
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
@@ -177,7 +177,7 @@ class ConfirmDeployContract extends Component {
return (
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'gasFee') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${fiatGas} ${currentCurrency.toUpperCase()}`),
@@ -216,8 +216,8 @@ class ConfirmDeployContract extends Component {
return (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ t('total') + ' ' ]),
- h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]),
+ h('span.confirm-screen-label', [ t(this.props.localeMessages, 'total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ t(this.props.localeMessages, 'amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -246,9 +246,9 @@ class ConfirmDeployContract extends Component {
h('.page-container__header', [
h('.page-container__back-button', {
onClick: () => backToAccountDetail(selectedAddress),
- }, t('back')),
- h('.page-container__title', t('confirmContract')),
- h('.page-container__subtitle', t('pleaseReviewTransaction')),
+ }, t(this.props.localeMessages, 'back')),
+ h('.page-container__title', t(this.props.localeMessages, 'confirmContract')),
+ h('.page-container__subtitle', t(this.props.localeMessages, 'pleaseReviewTransaction')),
]),
// Main Send token Card
h('.page-container__content', [
@@ -271,7 +271,7 @@ class ConfirmDeployContract extends Component {
h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('from') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'from') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@@ -279,9 +279,9 @@ class ConfirmDeployContract extends Component {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('to') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'to') ]),
h('div.confirm-screen-section-column', [
- h('div.confirm-screen-row-info', t('newContract')),
+ h('div.confirm-screen-row-info', t(this.props.localeMessages, 'newContract')),
]),
]),
@@ -299,12 +299,12 @@ class ConfirmDeployContract extends Component {
// Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', {
onClick: event => this.cancel(event, txMeta),
- }, t('cancel')),
+ }, t(this.props.localeMessages, 'cancel')),
// Accept Button
h('button.btn-confirm.page-container__footer-button.allcaps', {
onClick: event => this.onSubmit(event),
- }, t('confirm')),
+ }, t(this.props.localeMessages, 'confirm')),
]),
]),
])
@@ -321,6 +321,7 @@ ConfirmDeployContract.propTypes = {
conversionRate: PropTypes.number,
currentCurrency: PropTypes.string,
selectedAddress: PropTypes.string,
+ localeMessages: PropTypes.object,
}
const mapStateToProps = state => {
@@ -343,7 +344,7 @@ const mapDispatchToProps = dispatch => {
return {
backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)),
cancelTransaction: ({ id }) => dispatch(actions.cancelTx({ id })),
- displayWarning: warning => actions.displayWarning(t(warning)),
+ displayWarning: warning => actions.displayWarning(t(this.props.localeMessages, warning)),
}
}
diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js
index f36def9d5..253b69b7a 100644
--- a/ui/app/components/pending-tx/confirm-send-ether.js
+++ b/ui/app/components/pending-tx/confirm-send-ether.js
@@ -1,5 +1,5 @@
const Component = require('react').Component
-const { connect } = require('react-redux')
+const connect = require('../../metamask-connect')
const h = require('react-hyperscript')
const inherits = require('util').inherits
const actions = require('../../actions')
@@ -14,7 +14,7 @@ const {
multiplyCurrencies,
} = require('../../conversion-util')
const GasFeeDisplay = require('../send/gas-fee-display-v2')
-const t = require('../../../i18n')
+const t = require('../../../i18n-helper').getMessage
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
@@ -196,7 +196,7 @@ ConfirmSendEther.prototype.getData = function () {
},
to: {
address: txParams.to,
- name: identities[txParams.to] ? identities[txParams.to].name : t('newRecipient'),
+ name: identities[txParams.to] ? identities[txParams.to].name : t(this.props.localeMessages, 'newRecipient'),
},
memo: txParams.memo || '',
gasFeeInFIAT,
@@ -311,7 +311,7 @@ ConfirmSendEther.prototype.render = function () {
h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('from') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'from') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@@ -319,7 +319,7 @@ ConfirmSendEther.prototype.render = function () {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('to') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'to') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', toName),
h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`),
@@ -327,7 +327,7 @@ ConfirmSendEther.prototype.render = function () {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'gasFee') ]),
h('div.confirm-screen-section-column', [
h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex,
@@ -340,8 +340,8 @@ ConfirmSendEther.prototype.render = function () {
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ t('total') + ' ' ]),
- h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]),
+ h('span.confirm-screen-label', [ t(this.props.localeMessages, 'total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ t(this.props.localeMessages, 'amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -442,10 +442,10 @@ ConfirmSendEther.prototype.render = function () {
clearSend()
this.cancel(event, txMeta)
},
- }, t('cancel')),
+ }, t(this.props.localeMessages, 'cancel')),
// Accept Button
- h('button.btn-confirm.page-container__footer-button.allcaps', [t('confirm')]),
+ h('button.btn-confirm.page-container__footer-button.allcaps', [t(this.props.localeMessages, 'confirm')]),
]),
]),
]),
@@ -462,7 +462,7 @@ ConfirmSendEther.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event)
} else {
- this.props.dispatch(actions.displayWarning(t('invalidGasParams')))
+ this.props.dispatch(actions.displayWarning(t(this.props.localeMessages, 'invalidGasParams')))
this.setState({ submitting: false })
}
}
diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js
index ccd87c0a4..54963ae9a 100644
--- a/ui/app/components/pending-tx/confirm-send-token.js
+++ b/ui/app/components/pending-tx/confirm-send-token.js
@@ -1,12 +1,12 @@
const Component = require('react').Component
-const { connect } = require('react-redux')
+const connect = require('../../metamask-connect')
const h = require('react-hyperscript')
const inherits = require('util').inherits
const tokenAbi = require('human-standard-token-abi')
const abiDecoder = require('abi-decoder')
abiDecoder.addABI(tokenAbi)
const actions = require('../../actions')
-const t = require('../../../i18n')
+const t = require('../../../i18n-helper').getMessage
const clone = require('clone')
const Identicon = require('../identicon')
const GasFeeDisplay = require('../send/gas-fee-display-v2.js')
@@ -101,7 +101,7 @@ function mapDispatchToProps (dispatch, ownProps) {
fromNumericBase: 'dec',
toNumericBase: 'hex',
})
-
+
let forceGasMin
if (lastGasPrice) {
forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
@@ -168,7 +168,7 @@ ConfirmSendToken.prototype.getAmount = function () {
? +(sendTokenAmount * tokenExchangeRate * conversionRate).toFixed(2)
: null,
token: typeof value === 'undefined'
- ? t('unknown')
+ ? t(this.props.localeMessages, 'unknown')
: +sendTokenAmount.toFixed(decimals),
}
@@ -240,7 +240,7 @@ ConfirmSendToken.prototype.getData = function () {
},
to: {
address: value,
- name: identities[value] ? identities[value].name : t('newRecipient'),
+ name: identities[value] ? identities[value].name : t(this.props.localeMessages, 'newRecipient'),
},
memo: txParams.memo || '',
}
@@ -286,7 +286,7 @@ ConfirmSendToken.prototype.renderGasFee = function () {
return (
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'gasFee') ]),
h('div.confirm-screen-section-column', [
h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex,
@@ -308,8 +308,8 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
? (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ t('total') + ' ' ]),
- h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]),
+ h('span.confirm-screen-label', [ t(this.props.localeMessages, 'total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ t(this.props.localeMessages, 'amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -321,8 +321,8 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
: (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ t('total') + ' ' ]),
- h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]),
+ h('span.confirm-screen-label', [ t(this.props.localeMessages, 'total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ t(this.props.localeMessages, 'amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -349,10 +349,11 @@ ConfirmSendToken.prototype.render = function () {
this.inputs = []
- const title = txMeta.lastGasPrice ? 'Reprice Transaction' : t('confirm')
- const subtitle = txMeta.lastGasPrice
- ? 'Increase your gas fee to attempt to overwrite and speed up your transaction'
- : t('pleaseReviewTransaction')
+ const isTxReprice = Boolean(txMeta.lastGasPrice)
+ const title = isTxReprice ? t(this.props.localeMessages, 'reprice:title') : t(this.props.localeMessages, 'confirm')
+ const subtitle = isTxReprice
+ ? t(this.props.localeMessages, 'reprice:subtitle')
+ : t(this.props.localeMessages, 'pleaseReviewTransaction')
return (
h('div.confirm-screen-container.confirm-send-token', [
@@ -361,7 +362,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.page-container__header', [
!txMeta.lastGasPrice && h('button.confirm-screen-back-button', {
onClick: () => editTransaction(txMeta),
- }, t('edit')),
+ }, t(this.props.localeMessages, 'edit')),
h('div.page-container__title', title),
h('div.page-container__subtitle', subtitle),
]),
@@ -405,7 +406,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('from') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'from') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@@ -413,7 +414,7 @@ ConfirmSendToken.prototype.render = function () {
]),
toAddress && h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t('to') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'to') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', toName),
h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`),
@@ -427,6 +428,7 @@ ConfirmSendToken.prototype.render = function () {
]),
]),
+
h('form#pending-tx-form', {
onSubmit: this.onSubmit,
}, [
@@ -434,10 +436,10 @@ ConfirmSendToken.prototype.render = function () {
// Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', {
onClick: (event) => this.cancel(event, txMeta),
- }, t('cancel')),
+ }, t(this.props.localeMessages, 'cancel')),
// Accept Button
- h('button.btn-confirm.page-container__footer-button.allcaps', [t('confirm')]),
+ h('button.btn-confirm.page-container__footer-button.allcaps', [t(this.props.localeMessages, 'confirm')]),
]),
]),
]),
@@ -454,7 +456,7 @@ ConfirmSendToken.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event)
} else {
- this.props.dispatch(actions.displayWarning(t('invalidGasParams')))
+ this.props.dispatch(actions.displayWarning(t(this.props.localeMessages, 'invalidGasParams')))
this.setState({ submitting: false })
}
}
diff --git a/ui/app/components/pending-tx/index.js b/ui/app/components/pending-tx/index.js
index f4f6afb8f..e490a45f4 100644
--- a/ui/app/components/pending-tx/index.js
+++ b/ui/app/components/pending-tx/index.js
@@ -1,5 +1,5 @@
const Component = require('react').Component
-const { connect } = require('react-redux')
+const connect = require('../../metamask-connect')
const h = require('react-hyperscript')
const clone = require('clone')
const abi = require('human-standard-token-abi')