fix watched tokens images showing in tx list

feature/default_network_editable
Esteban MIno 6 years ago
parent 208312b239
commit c8e5068537
  1. 3
      ui/app/components/transaction-list-item/transaction-list-item.component.js
  2. 8
      ui/app/components/transaction-list/transaction-list.component.js
  3. 3
      ui/app/components/transaction-list/transaction-list.container.js
  4. 6
      ui/app/selectors.js

@ -21,6 +21,7 @@ export default class TransactionListItem extends PureComponent {
setSelectedToken: PropTypes.func, setSelectedToken: PropTypes.func,
nonceAndDate: PropTypes.string, nonceAndDate: PropTypes.string,
token: PropTypes.object, token: PropTypes.object,
assetImages: PropTypes.object,
} }
handleClick = () => { handleClick = () => {
@ -100,6 +101,7 @@ export default class TransactionListItem extends PureComponent {
methodData, methodData,
showRetry, showRetry,
nonceAndDate, nonceAndDate,
assetImages,
} = this.props } = this.props
const { txParams = {} } = transaction const { txParams = {} } = transaction
@ -113,6 +115,7 @@ export default class TransactionListItem extends PureComponent {
className="transaction-list-item__identicon" className="transaction-list-item__identicon"
address={txParams.to} address={txParams.to}
diameter={34} diameter={34}
image={assetImages[txParams.to]}
/> />
<TransactionAction <TransactionAction
transaction={transaction} transaction={transaction}

@ -21,6 +21,7 @@ export default class TransactionList extends PureComponent {
transactionToRetry: PropTypes.object, transactionToRetry: PropTypes.object,
selectedToken: PropTypes.object, selectedToken: PropTypes.object,
updateNetworkNonce: PropTypes.func, updateNetworkNonce: PropTypes.func,
assetImages: PropTypes.object,
} }
componentDidMount () { componentDidMount () {
@ -44,8 +45,8 @@ export default class TransactionList extends PureComponent {
renderTransactions () { renderTransactions () {
const { t } = this.context const { t } = this.context
const { pendingTransactions = [], completedTransactions = [] } = this.props const { pendingTransactions = [], completedTransactions = [], assetImages } = this.props
console.log('REMDERING FROM TX LIST', assetImages)
return ( return (
<div className="transaction-list__transactions"> <div className="transaction-list__transactions">
{ {
@ -79,7 +80,7 @@ export default class TransactionList extends PureComponent {
} }
renderTransaction (transaction, index) { renderTransaction (transaction, index) {
const { selectedToken } = this.props const { selectedToken, assetImages } = this.props
return transaction.key === TRANSACTION_TYPE_SHAPESHIFT return transaction.key === TRANSACTION_TYPE_SHAPESHIFT
? ( ? (
@ -93,6 +94,7 @@ export default class TransactionList extends PureComponent {
key={transaction.id} key={transaction.id}
showRetry={this.shouldShowRetry(transaction)} showRetry={this.shouldShowRetry(transaction)}
token={selectedToken} token={selectedToken}
assetImages={assetImages}
/> />
) )
} }

@ -7,7 +7,7 @@ import {
submittedPendingTransactionsSelector, submittedPendingTransactionsSelector,
completedTransactionsSelector, completedTransactionsSelector,
} from '../../selectors/transactions' } from '../../selectors/transactions'
import { getSelectedAddress } from '../../selectors' import { getSelectedAddress, getAssetImages } from '../../selectors'
import { selectedTokenSelector } from '../../selectors/tokens' import { selectedTokenSelector } from '../../selectors/tokens'
import { getLatestSubmittedTxWithNonce } from '../../helpers/transactions.util' import { getLatestSubmittedTxWithNonce } from '../../helpers/transactions.util'
import { updateNetworkNonce } from '../../actions' import { updateNetworkNonce } from '../../actions'
@ -23,6 +23,7 @@ const mapStateToProps = state => {
transactionToRetry: getLatestSubmittedTxWithNonce(submittedPendingTransactions, networkNonce), transactionToRetry: getLatestSubmittedTxWithNonce(submittedPendingTransactions, networkNonce),
selectedToken: selectedTokenSelector(state), selectedToken: selectedTokenSelector(state),
selectedAddress: getSelectedAddress(state), selectedAddress: getSelectedAddress(state),
assetImages: getAssetImages(state),
} }
} }

@ -15,6 +15,7 @@ const selectors = {
getSelectedToken, getSelectedToken,
getSelectedTokenExchangeRate, getSelectedTokenExchangeRate,
getSelectedTokenAssetImage, getSelectedTokenAssetImage,
getAssetImages,
getTokenExchangeRate, getTokenExchangeRate,
conversionRateSelector, conversionRateSelector,
transactionsSelector, transactionsSelector,
@ -79,6 +80,11 @@ function getSelectedTokenAssetImage (state) {
return assetImages[address] return assetImages[address]
} }
function getAssetImages (state) {
const assetImages = state.metamask.assetImages
return assetImages
}
function getTokenExchangeRate (state, address) { function getTokenExchangeRate (state, address) {
const contractExchangeRates = state.metamask.contractExchangeRates const contractExchangeRates = state.metamask.contractExchangeRates
return contractExchangeRates[address] || 0 return contractExchangeRates[address] || 0

Loading…
Cancel
Save