aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/tx-list-item.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/tx-list-item.js')
-rw-r--r--ui/app/components/tx-list-item.js44
1 files changed, 28 insertions, 16 deletions
diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js
index d104eda88..42c008798 100644
--- a/ui/app/components/tx-list-item.js
+++ b/ui/app/components/tx-list-item.js
@@ -1,4 +1,5 @@
const Component = require('react').Component
+const PropTypes = require('prop-types')
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const inherits = require('util').inherits
@@ -14,10 +15,14 @@ const { conversionUtil, multiplyCurrencies } = require('../conversion-util')
const { calcTokenAmount } = require('../token-util')
const { getCurrentCurrency } = require('../selectors')
-const t = require('../../i18n')
+
+TxListItem.contextTypes = {
+ t: PropTypes.func,
+}
module.exports = connect(mapStateToProps, mapDispatchToProps)(TxListItem)
+
function mapStateToProps (state) {
return {
tokens: state.metamask.tokens,
@@ -63,20 +68,24 @@ TxListItem.prototype.getAddressText = function () {
const {
address,
txParams = {},
+ isMsg,
} = this.props
const decodedData = txParams.data && abiDecoder.decodeMethod(txParams.data)
const { name: txDataName, params = [] } = decodedData || {}
const { value } = params[0] || {}
- switch (txDataName) {
- case 'transfer':
- return `${value.slice(0, 10)}...${value.slice(-4)}`
- default:
- return address
- ? `${address.slice(0, 10)}...${address.slice(-4)}`
- : t('contractDeployment')
+ let addressText
+ if (txDataName === 'transfer' || address) {
+ const addressToRender = txDataName === 'transfer' ? value : address
+ addressText = `${addressToRender.slice(0, 10)}...${addressToRender.slice(-4)}`
+ } else if (isMsg) {
+ addressText = this.context.t('sigRequest')
+ } else {
+ addressText = this.context.t('contractDeployment')
}
+
+ return addressText
}
TxListItem.prototype.getSendEtherTotal = function () {
@@ -186,6 +195,9 @@ TxListItem.prototype.showRetryButton = function () {
transactionId,
txParams,
} = this.props
+ if (!txParams) {
+ return false
+ }
const currentNonce = txParams.nonce
const currentNonceTxs = selectedAddressTxList.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted')
@@ -307,21 +319,21 @@ TxListItem.prototype.txStatusIndicator = function () {
let name
if (transactionStatus === 'unapproved') {
- name = t('unapproved')
+ name = this.context.t('unapproved')
} else if (transactionStatus === 'rejected') {
- name = t('rejected')
+ name = this.context.t('rejected')
} else if (transactionStatus === 'approved') {
- name = t('approved')
+ name = this.context.t('approved')
} else if (transactionStatus === 'signed') {
- name = t('signed')
+ name = this.context.t('signed')
} else if (transactionStatus === 'submitted') {
- name = t('submitted')
+ name = this.context.t('submitted')
} else if (transactionStatus === 'confirmed') {
- name = t('confirmed')
+ name = this.context.t('confirmed')
} else if (transactionStatus === 'failed') {
- name = t('failed')
+ name = this.context.t('failed')
} else if (transactionStatus === 'dropped') {
- name = t('dropped')
+ name = this.context.t('dropped')
}
return name
}