diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index a03abbf79..d57aec71a 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -67,9 +67,9 @@ class PreferencesController { addSuggestedERC20Asset (tokenOpts) { this._validateERC20AssetParams(tokenOpts) const suggested = this.getSuggestedTokens() - const { rawAddress, symbol, decimals, imageUrl } = tokenOpts + const { rawAddress, symbol, decimals, image } = tokenOpts const address = normalizeAddress(rawAddress) - const newEntry = { address, symbol, decimals, imageUrl } + const newEntry = { address, symbol, decimals, image } suggested[address] = newEntry this.store.updateState({ suggestedTokens: suggested }) } @@ -291,7 +291,7 @@ class PreferencesController { * @returns {Promise} Promises the new array of AddedToken objects. * */ - async addToken (rawAddress, symbol, decimals, imageUrl) { + async addToken (rawAddress, symbol, decimals, image) { const address = normalizeAddress(rawAddress) const newEntry = { address, symbol, decimals } const tokens = this.store.getState().tokens @@ -306,7 +306,7 @@ class PreferencesController { } else { tokens.push(newEntry) } - assetImages[address] = imageUrl + assetImages[address] = image this._updateAccountTokens(tokens, assetImages) return Promise.resolve(tokens) } @@ -509,14 +509,14 @@ class PreferencesController { * */ async _handleWatchAssetERC20 (options) { - const { address, symbol, decimals, imageUrl } = options + const { address, symbol, decimals, image } = options const rawAddress = address try { this._validateERC20AssetParams({ rawAddress, symbol, decimals }) } catch (err) { return err } - const tokenOpts = { rawAddress, decimals, symbol, imageUrl } + const tokenOpts = { rawAddress, decimals, symbol, image } this.addSuggestedERC20Asset(tokenOpts) return this.showWatchAssetUi().then(() => { const tokenAddresses = this.getTokens().filter(token => token.address === normalizeAddress(rawAddress)) diff --git a/test/unit/app/controllers/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js index 58fc3d9c5..d63356215 100644 --- a/test/unit/app/controllers/preferences-controller-test.js +++ b/test/unit/app/controllers/preferences-controller-test.js @@ -409,8 +409,8 @@ describe('preferences controller', function () { const address = '0xabcdef1234567' const symbol = 'ABBR' const decimals = 5 - const imageUrl = 'someimageurl' - req.params.options = { address, symbol, decimals, imageUrl } + const image = 'someimage' + req.params.options = { address, symbol, decimals, image } sandbox.stub(preferencesController, '_validateERC20AssetParams').returns(true) preferencesController.showWatchAssetUi = async () => {} @@ -422,19 +422,19 @@ describe('preferences controller', function () { assert.equal(suggested[address].address, address, 'set address correctly') assert.equal(suggested[address].symbol, symbol, 'set symbol correctly') assert.equal(suggested[address].decimals, decimals, 'set decimals correctly') - assert.equal(suggested[address].imageUrl, imageUrl, 'set imageUrl correctly') + assert.equal(suggested[address].image, image, 'set image correctly') }) it('should add token correctly if user confirms', async function () { const address = '0xabcdef1234567' const symbol = 'ABBR' const decimals = 5 - const imageUrl = 'someimageurl' - req.params.options = { address, symbol, decimals, imageUrl } + const image = 'someimage' + req.params.options = { address, symbol, decimals, image } sandbox.stub(preferencesController, '_validateERC20AssetParams').returns(true) preferencesController.showWatchAssetUi = async () => { - await preferencesController.addToken(address, symbol, decimals, imageUrl) + await preferencesController.addToken(address, symbol, decimals, image) } await preferencesController._handleWatchAssetERC20(req.params.options) @@ -446,7 +446,7 @@ describe('preferences controller', function () { assert.equal(added.decimals, decimals, 'set decimals correctly') const assetImages = preferencesController.getAssetImages() - assert.ok(assetImages[address], `set imageurl correctly`) + assert.ok(assetImages[address], `set image correctly`) }) }) }) diff --git a/ui/app/actions.js b/ui/app/actions.js index b5f97d374..870ba42be 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -1599,11 +1599,11 @@ function showAddSuggestedTokenPage (transitionForward = true) { } } -function addToken (address, symbol, decimals, imageUrl) { +function addToken (address, symbol, decimals, image) { return (dispatch) => { dispatch(actions.showLoadingIndication()) return new Promise((resolve, reject) => { - background.addToken(address, symbol, decimals, imageUrl, (err, tokens) => { + background.addToken(address, symbol, decimals, image, (err, tokens) => { dispatch(actions.hideLoadingIndication()) if (err) { dispatch(actions.displayWarning(err.message)) diff --git a/ui/app/components/balance-component.js b/ui/app/components/balance-component.js index f85d1cdcd..9b6f13c80 100644 --- a/ui/app/components/balance-component.js +++ b/ui/app/components/balance-component.js @@ -35,7 +35,7 @@ BalanceComponent.prototype.render = function () { const props = this.props const { token, network, assetImages } = props const address = token && token.address - const imageUrl = assetImages && address ? assetImages[token.address] : undefined + const image = assetImages && address ? assetImages[token.address] : undefined return h('div.balance-container', {}, [ @@ -48,7 +48,7 @@ BalanceComponent.prototype.render = function () { diameter: 50, address, network, - imageUrl, + image, }), token ? this.renderTokenBalance() : this.renderBalance(), diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index 6b632352f..076e65b81 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -26,17 +26,17 @@ function mapStateToProps (state) { IdenticonComponent.prototype.render = function () { var props = this.props - const { className = '', address, imageUrl } = props + const { className = '', address, image } = props var diameter = props.diameter || this.defaultDiameter const style = { height: diameter, width: diameter, borderRadius: diameter / 2, } - if (imageUrl) { + if (image) { return h('img', { className: `${className} identicon`, - src: imageUrl, + src: image, style: { ...style, }, diff --git a/ui/app/components/modals/hide-token-confirmation-modal.js b/ui/app/components/modals/hide-token-confirmation-modal.js index bdecc0593..fb38516d3 100644 --- a/ui/app/components/modals/hide-token-confirmation-modal.js +++ b/ui/app/components/modals/hide-token-confirmation-modal.js @@ -43,7 +43,7 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(HideTokenConfirmat HideTokenConfirmationModal.prototype.render = function () { const { token, network, hideToken, hideModal, assetImages } = this.props const { symbol, address } = token - const imageUrl = assetImages[address] + const image = assetImages[address] return h('div.hide-token-confirmation', {}, [ h('div.hide-token-confirmation__container', { @@ -57,7 +57,7 @@ HideTokenConfirmationModal.prototype.render = function () { diameter: 45, address, network, - imageUrl, + image, }), h('div.hide-token-confirmation__symbol', {}, symbol), diff --git a/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js b/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js index 37d9aca02..025435a3b 100644 --- a/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js +++ b/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js @@ -61,7 +61,7 @@ export default class ConfirmAddSuggestedToken extends Component { { Object.entries(pendingTokens) .map(([ address, token ]) => { - const { name, symbol, imageUrl } = token + const { name, symbol, image } = token return (
{ this.getTokenName(name, symbol) } diff --git a/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js b/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js index 89291ff4f..1f2737e52 100644 --- a/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js +++ b/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js @@ -18,7 +18,7 @@ const mapStateToProps = ({ metamask }) => { const mapDispatchToProps = dispatch => { return { - addToken: ({address, symbol, decimals, imageUrl}) => dispatch(addToken(address, symbol, decimals, imageUrl)), + addToken: ({address, symbol, decimals, image}) => dispatch(addToken(address, symbol, decimals, image)), removeSuggestedTokens: () => dispatch(removeSuggestedTokens()), } } diff --git a/ui/app/components/token-cell.js b/ui/app/components/token-cell.js index a84d8eda0..58a30228d 100644 --- a/ui/app/components/token-cell.js +++ b/ui/app/components/token-cell.js @@ -56,7 +56,7 @@ TokenCell.prototype.render = function () { sidebarOpen, currentCurrency, // userAddress, - imageUrl, + image, } = props let currentTokenToFiatRate let currentTokenInFiat @@ -97,7 +97,7 @@ TokenCell.prototype.render = function () { diameter: 50, address, network, - imageUrl, + image, }), h('div.token-list-item__balance-ellipsis', null, [ diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 907793026..6a88f30bf 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -75,7 +75,7 @@ TokenList.prototype.render = function () { } return h('div', tokens.map((tokenData) => { - tokenData.imageUrl = assetImages[tokenData.address] + tokenData.image = assetImages[tokenData.address] return h(TokenCell, tokenData) }))