mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Convert decimals to string in getSymbolAndDecimals; return null for symbol or decimals.
This commit is contained in:
parent
6de450488b
commit
b71dbf52d1
@ -192,7 +192,7 @@ AddTokenScreen.prototype.attemptToAutoFillTokenParams = async function (address)
|
||||
if (symbol && decimals) {
|
||||
this.setState({
|
||||
customSymbol: symbol,
|
||||
customDecimals: decimals.toString(),
|
||||
customDecimals: decimals,
|
||||
autoFilled: true,
|
||||
})
|
||||
}
|
||||
|
@ -94,23 +94,13 @@ PendingTx.prototype.setTokenData = async function () {
|
||||
if (isTokenTransaction) {
|
||||
const { symbol, decimals } = await getSymbolAndDecimals(txParams.to, existingTokens)
|
||||
|
||||
if (symbol && decimals) {
|
||||
this.setState({
|
||||
transactionType: TX_TYPES.SEND_TOKEN,
|
||||
tokenAddress: txParams.to,
|
||||
tokenSymbol: symbol,
|
||||
tokenDecimals: decimals,
|
||||
isFetching: false,
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
transactionType: TX_TYPES.SEND_TOKEN,
|
||||
tokenAddress: txParams.to,
|
||||
tokenSymbol: null,
|
||||
tokenDecimals: null,
|
||||
isFetching: false,
|
||||
})
|
||||
}
|
||||
this.setState({
|
||||
transactionType: TX_TYPES.SEND_TOKEN,
|
||||
tokenAddress: txParams.to,
|
||||
tokenSymbol: symbol,
|
||||
tokenDecimals: decimals,
|
||||
isFetching: false,
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
transactionType: TX_TYPES.SEND_ETHER,
|
||||
|
@ -38,8 +38,8 @@ async function getSymbolAndDecimals (tokenAddress, existingTokens = []) {
|
||||
const [ symbol = [], decimals = [] ] = result
|
||||
|
||||
return {
|
||||
symbol: symbol[0],
|
||||
decimals: decimals[0],
|
||||
symbol: symbol[0] || null,
|
||||
decimals: decimals[0] && decimals[0].toString() || null,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user