diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-04-28 06:01:19 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-04-28 06:05:23 +0800 |
commit | 2403323463be66166dae9f8ca7903caab2546717 (patch) | |
tree | 22a784994bd3b9347f34c2f801b10ab286ba535f /packages/website/ts/components/wallet | |
parent | feb7dfffa107211e76b87d2028b8c821e914f0d6 (diff) | |
download | dexon-0x-contracts-2403323463be66166dae9f8ca7903caab2546717.tar dexon-0x-contracts-2403323463be66166dae9f8ca7903caab2546717.tar.gz dexon-0x-contracts-2403323463be66166dae9f8ca7903caab2546717.tar.bz2 dexon-0x-contracts-2403323463be66166dae9f8ca7903caab2546717.tar.lz dexon-0x-contracts-2403323463be66166dae9f8ca7903caab2546717.tar.xz dexon-0x-contracts-2403323463be66166dae9f8ca7903caab2546717.tar.zst dexon-0x-contracts-2403323463be66166dae9f8ca7903caab2546717.zip |
Style suggestions
Diffstat (limited to 'packages/website/ts/components/wallet')
-rw-r--r-- | packages/website/ts/components/wallet/wallet.tsx | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 33b8bbffb..51399ae0b 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -510,21 +510,16 @@ export class Wallet extends React.Component<WalletProps, WalletState> { } // for each input token address, search for the corresponding symbol in this.props.tokenByAddress, if it exists // create a mapping from existing symbols -> address - const tokenAddressBySymbol = _.fromPairs( - _.compact( - _.map(tokenAddresses, address => { - const tokenIfExists = _.get(this.props.tokenByAddress, address); - if (!_.isUndefined(tokenIfExists)) { - const symbol = tokenIfExists.symbol; - // the crypto compare api doesn't understand 'WETH' so we need to replace it with 'ETH' - const key = symbol === ETHER_TOKEN_SYMBOL ? ETHER_SYMBOL : symbol; - return [key, address]; - } else { - return undefined; - } - }), - ), - ); + const tokenAddressBySymbol: { [symbol: string]: string } = {}; + _.each(tokenAddresses, address => { + const tokenIfExists = _.get(this.props.tokenByAddress, address); + if (!_.isUndefined(tokenIfExists)) { + const symbol = tokenIfExists.symbol; + // the crypto compare api doesn't understand 'WETH' so we need to replace it with 'ETH' + const key = symbol === ETHER_TOKEN_SYMBOL ? ETHER_SYMBOL : symbol; + tokenAddressBySymbol[key] = address; + } + }); const joinedTokenSymbols = _.keys(tokenAddressBySymbol).join(','); const queryParams = { fsyms: joinedTokenSymbols, |