fix images for watched tokens

feature/default_network_editable
Esteban MIno 6 years ago
parent 9ab0354e36
commit 07cb6adc31
  1. 3
      ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js
  2. 4
      ui/app/components/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js
  3. 3
      ui/app/components/confirm-page-container/confirm-page-container.component.js
  4. 3
      ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js
  5. 4
      ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js
  6. 4
      ui/app/components/transaction-view-balance/transaction-view-balance.component.js
  7. 3
      ui/app/components/transaction-view-balance/transaction-view-balance.container.js
  8. 8
      ui/app/selectors.js

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

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

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

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

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

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

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

@ -14,6 +14,7 @@ const selectors = {
getSelectedAccount, getSelectedAccount,
getSelectedToken, getSelectedToken,
getSelectedTokenExchangeRate, getSelectedTokenExchangeRate,
getSelectedTokenAssetImage,
getTokenExchangeRate, getTokenExchangeRate,
conversionRateSelector, conversionRateSelector,
transactionsSelector, transactionsSelector,
@ -71,6 +72,13 @@ function getSelectedTokenExchangeRate (state) {
return contractExchangeRates[address] || 0 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) { 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