1
0
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:
Dan 2018-04-27 21:33:56 -02:30
parent 6de450488b
commit b71dbf52d1
3 changed files with 10 additions and 20 deletions

View File

@ -192,7 +192,7 @@ AddTokenScreen.prototype.attemptToAutoFillTokenParams = async function (address)
if (symbol && decimals) {
this.setState({
customSymbol: symbol,
customDecimals: decimals.toString(),
customDecimals: decimals,
autoFilled: true,
})
}

View File

@ -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,

View File

@ -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,
}
}