diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index ce289d74c..2b4a686e8 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -10,10 +10,10 @@ restoreContextAfterImports() log.setDefaultLevel(process.env.METAMASK_DEBUG ? 'debug' : 'warn') -console.warn('ATTENTION: In an effort to improve user privacy, MetaMask will ' + -'stop exposing user accounts to dapps by default beginning November 2nd, 2018. ' + -'Dapps should call provider.enable() in order to view and use accounts. Please see ' + -'https://bit.ly/2QQHXvF for complete information and up-to-date example code.') +// console.warn('ATTENTION: In an effort to improve user privacy, MetaMask will ' + +// 'stop exposing user accounts to dapps by default beginning November 2nd, 2018. ' + +// 'Dapps should call provider.enable() in order to view and use accounts. Please see ' + +// 'https://bit.ly/2QQHXvF for complete information and up-to-date example code.') // // setup plugin communication diff --git a/old-ui/app/components/pending-tx.js b/old-ui/app/components/pending-tx.js index ac7a499e4..fc4574ce9 100644 --- a/old-ui/app/components/pending-tx.js +++ b/old-ui/app/components/pending-tx.js @@ -600,10 +600,15 @@ PendingTx.prototype.componentWillUnmount = function () { } PendingTx.prototype.updateTokenInfo = async function (txParams) { - const tokenParams = await this.tokenInfoGetter(txParams.to) + let tokenParams + try { + tokenParams = await this.tokenInfoGetter(txParams.to) + } catch (e) { + log.error(e) + } this.setState({ - tokenSymbol: tokenParams.symbol, - tokenDecimals: tokenParams.decimals, + tokenSymbol: (tokenParams && tokenParams.symbol), + tokenDecimals: (tokenParams && tokenParams.decimals), tokenDataRetrieved: true, }) } diff --git a/ui/app/token-util.js b/ui/app/token-util.js index 027a1bfcb..45a2669e5 100644 --- a/ui/app/token-util.js +++ b/ui/app/token-util.js @@ -26,24 +26,32 @@ const DEFAULT_DECIMALS = '0' async function getSymbolFromContract (tokenAddress) { const token = util.getContractAtAddress(tokenAddress) - try { - const result = await token.symbol() - return result[0] - } catch (error) { - log.warn(`symbol() call for token at address ${tokenAddress} resulted in error:`, error) + if (token.bytecode !== '0x') { + try { + const result = await token.symbol() + return result[0] + } catch (error) { + log.warn(`symbol() call for token at address ${tokenAddress} resulted in error:`, error) + return '' + } } + return '' } async function getDecimalsFromContract (tokenAddress) { const token = util.getContractAtAddress(tokenAddress) - try { - const result = await token.decimals() - const decimalsBN = result[0] - return decimalsBN && decimalsBN.toString() - } catch (error) { - log.warn(`decimals() call for token at address ${tokenAddress} resulted in error:`, error) + if (token.bytecode !== '0x') { + try { + const result = await token.decimals() + const decimalsBN = result[0] + return decimalsBN && decimalsBN.toString() + } catch (error) { + log.warn(`decimals() call for token at address ${tokenAddress} resulted in error:`, error) + return '0' + } } + return '0' } function getContractMetadata (tokenAddress) {