mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
typo watchAsset imageUrl to image
This commit is contained in:
parent
56bed3f1bc
commit
b59a1e91b8
@ -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<array>} 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))
|
||||
|
@ -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`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -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))
|
||||
|
@ -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(),
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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),
|
||||
|
@ -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 (
|
||||
<div
|
||||
@ -73,7 +73,7 @@ export default class ConfirmAddSuggestedToken extends Component {
|
||||
className="confirm-add-token__token-icon"
|
||||
diameter={48}
|
||||
address={address}
|
||||
imageUrl={imageUrl}
|
||||
image={image}
|
||||
/>
|
||||
<div className="confirm-add-token__name">
|
||||
{ this.getTokenName(name, symbol) }
|
||||
|
@ -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()),
|
||||
}
|
||||
}
|
||||
|
@ -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, [
|
||||
|
@ -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)
|
||||
}))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user