Fix token images // Error in Contract Queries (#4169)
This commit is contained in:
parent
d0cebc3982
commit
42ddb4f26c
@ -62,11 +62,15 @@ class Balance extends Component {
|
|||||||
value = api.util.fromWei(balance.value).toFormat(3);
|
value = api.util.fromWei(balance.value).toFormat(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
let imagesrc = token.image;
|
const imageurl = token.image || images[token.address];
|
||||||
if (!imagesrc) {
|
let imagesrc = unknownImage;
|
||||||
imagesrc = images[token.address]
|
|
||||||
? `${api.dappsUrl}${images[token.address]}`
|
if (imageurl) {
|
||||||
: unknownImage;
|
const host = /^(\/)?api/.test(imageurl)
|
||||||
|
? api.dappsUrl
|
||||||
|
: '';
|
||||||
|
|
||||||
|
imagesrc = `${host}${imageurl}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -71,7 +71,9 @@ export default class TypedInput extends Component {
|
|||||||
const { isEth, value } = this.props;
|
const { isEth, value } = this.props;
|
||||||
|
|
||||||
if (typeof isEth === 'boolean' && value) {
|
if (typeof isEth === 'boolean' && value) {
|
||||||
const ethValue = isEth ? fromWei(value) : value;
|
// Remove formatting commas
|
||||||
|
const sanitizedValue = typeof value === 'string' ? value.replace(/,/g, '') : value;
|
||||||
|
const ethValue = isEth ? fromWei(sanitizedValue) : value;
|
||||||
this.setState({ isEth, ethValue });
|
this.setState({ isEth, ethValue });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -393,7 +395,9 @@ export default class TypedInput extends Component {
|
|||||||
return this.setState({ isEth: !isEth });
|
return this.setState({ isEth: !isEth });
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = isEth ? toWei(ethValue) : fromWei(ethValue);
|
// Remove formatting commas
|
||||||
|
const sanitizedValue = typeof ethValue === 'string' ? ethValue.replace(/,/g, '') : ethValue;
|
||||||
|
const value = isEth ? toWei(sanitizedValue) : fromWei(sanitizedValue);
|
||||||
this.setState({ isEth: !isEth, ethValue: value }, () => {
|
this.setState({ isEth: !isEth, ethValue: value }, () => {
|
||||||
this.onEthValueChange(null, value);
|
this.onEthValueChange(null, value);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user