1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

fix watched tokens images showing in tx list

This commit is contained in:
Esteban MIno 2018-08-30 13:51:57 -03:00
parent 208312b239
commit c8e5068537
4 changed files with 16 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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