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

fix images for watched tokens

This commit is contained in:
Esteban MIno 2018-08-29 23:13:25 -03:00
parent 9ab0354e36
commit 07cb6adc31
8 changed files with 28 additions and 4 deletions

View File

@ -18,6 +18,7 @@ export default class ConfirmPageContainerContent extends Component {
hideSubtitle: PropTypes.bool,
identiconAddress: PropTypes.string,
nonce: PropTypes.string,
assetImage: PropTypes.string,
subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
summaryComponent: PropTypes.node,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@ -60,6 +61,7 @@ export default class ConfirmPageContainerContent extends Component {
hideSubtitle,
identiconAddress,
nonce,
assetImage,
summaryComponent,
detailsComponent,
dataComponent,
@ -85,6 +87,7 @@ export default class ConfirmPageContainerContent extends Component {
hideSubtitle={hideSubtitle}
identiconAddress={identiconAddress}
nonce={nonce}
assetImage={assetImage}
/>
)
}

View File

@ -4,7 +4,7 @@ import classnames from 'classnames'
import Identicon from '../../../identicon'
const ConfirmPageContainerSummary = props => {
const { action, title, subtitle, hideSubtitle, className, identiconAddress, nonce } = props
const { action, title, subtitle, hideSubtitle, className, identiconAddress, nonce, assetImage } = props
return (
<div className={classnames('confirm-page-container-summary', className)}>
@ -27,6 +27,7 @@ const ConfirmPageContainerSummary = props => {
className="confirm-page-container-summary__identicon"
diameter={36}
address={identiconAddress}
image={assetImage}
/>
)
}
@ -51,6 +52,7 @@ ConfirmPageContainerSummary.propTypes = {
className: PropTypes.string,
identiconAddress: PropTypes.string,
nonce: PropTypes.string,
assetImage: PropTypes.string,
}
export default ConfirmPageContainerSummary

View File

@ -38,6 +38,7 @@ export default class ConfirmPageContainer extends Component {
detailsComponent: PropTypes.node,
identiconAddress: PropTypes.string,
nonce: PropTypes.string,
assetImage: PropTypes.string,
summaryComponent: PropTypes.node,
warning: PropTypes.string,
// Footer
@ -70,6 +71,7 @@ export default class ConfirmPageContainer extends Component {
onSubmit,
identiconAddress,
nonce,
assetImage,
warning,
} = this.props
@ -101,6 +103,7 @@ export default class ConfirmPageContainer extends Component {
errorKey={errorKey}
identiconAddress={identiconAddress}
nonce={nonce}
assetImage={assetImage}
warning={warning}
/>
)

View File

@ -38,6 +38,7 @@ export default class ConfirmTransactionBase extends Component {
isTxReprice: PropTypes.bool,
methodData: PropTypes.object,
nonce: PropTypes.string,
assetImage: PropTypes.string,
sendTransaction: PropTypes.func,
showCustomizeGasModal: PropTypes.func,
showTransactionConfirmedModal: PropTypes.func,
@ -310,6 +311,7 @@ export default class ConfirmTransactionBase extends Component {
contentComponent,
onEdit,
nonce,
assetImage,
warning,
} = this.props
const { submitting, submitError } = this.state
@ -334,6 +336,7 @@ export default class ConfirmTransactionBase extends Component {
dataComponent={this.renderData()}
contentComponent={contentComponent}
nonce={nonce}
assetImage={assetImage}
identiconAddress={identiconAddress}
errorMessage={errorMessage || submitError}
errorKey={propsErrorKey || errorKey}

View File

@ -52,8 +52,9 @@ const mapStateToProps = (state, props) => {
accounts,
selectedAddress,
selectedAddressTxList,
assetImages,
} = metamask
const assetImage = assetImages[txParamsToAddress]
const { balance } = accounts[selectedAddress]
const { name: fromName } = identities[selectedAddress]
const toAddress = propsToAddress || txParamsToAddress
@ -88,6 +89,7 @@ const mapStateToProps = (state, props) => {
conversionRate,
transactionStatus,
nonce,
assetImage,
}
}

View File

@ -18,6 +18,7 @@ export default class TransactionViewBalance extends PureComponent {
history: PropTypes.object,
network: PropTypes.string,
balance: PropTypes.string,
assetImage: PropTypes.string,
}
renderBalance () {
@ -75,7 +76,7 @@ export default class TransactionViewBalance extends PureComponent {
}
render () {
const { network, selectedToken } = this.props
const { network, selectedToken, assetImage } = this.props
return (
<div className="transaction-view-balance">
@ -84,6 +85,7 @@ export default class TransactionViewBalance extends PureComponent {
diameter={50}
address={selectedToken && selectedToken.address}
network={network}
image={assetImage}
/>
{ this.renderBalance() }
</div>

View File

@ -2,7 +2,7 @@ import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
import TransactionViewBalance from './transaction-view-balance.component'
import { getSelectedToken, getSelectedAddress } from '../../selectors'
import { getSelectedToken, getSelectedAddress, getSelectedTokenAssetImage } from '../../selectors'
import { showModal } from '../../actions'
const mapStateToProps = state => {
@ -15,6 +15,7 @@ const mapStateToProps = state => {
selectedToken: getSelectedToken(state),
network,
balance,
assetImage: getSelectedTokenAssetImage(state),
}
}

View File

@ -14,6 +14,7 @@ const selectors = {
getSelectedAccount,
getSelectedToken,
getSelectedTokenExchangeRate,
getSelectedTokenAssetImage,
getTokenExchangeRate,
conversionRateSelector,
transactionsSelector,
@ -71,6 +72,13 @@ function getSelectedTokenExchangeRate (state) {
return contractExchangeRates[address] || 0
}
function getSelectedTokenAssetImage (state) {
const assetImages = state.metamask.assetImages
const selectedToken = getSelectedToken(state) || {}
const { address } = selectedToken
return assetImages[address]
}
function getTokenExchangeRate (state, address) {
const contractExchangeRates = state.metamask.contractExchangeRates
return contractExchangeRates[address] || 0