@@ -6,7 +6,7 @@ import IERC20 from '../../../contracts/compiled/IERC20.json'
66import gasTankFeeTokens from '../../consts/gasTankFeeTokens'
77import humanizerInfoRaw from '../../consts/humanizer/humanizerInfo.json'
88import { PINNED_TOKENS } from '../../consts/pinnedTokens'
9- import { Price , TokenMarketData } from '../../interfaces/assets'
9+ import { Price } from '../../interfaces/assets'
1010import { Network } from '../../interfaces/network'
1111import { RPCProvider } from '../../interfaces/provider'
1212import { AssetType } from '../defiPositions/types'
@@ -26,7 +26,6 @@ import {
2626 PortfolioNetworkResult ,
2727 SuspectedType ,
2828 ToBeLearnedAssets ,
29- TokenDataCache ,
3029 TokenDataCacheValue ,
3130 TokenResult ,
3231 TokenValidationResult ,
@@ -394,9 +393,9 @@ export const validateERC20Token = async (
394393 let decimals
395394 try {
396395 ; [ balance , symbol , decimals ] = await Promise . all ( [
397- erc20 . balanceOf ( accountId ) . catch ( ( e ) => handleERC20Error ( e , 'balance' ) ) ,
398- erc20 . symbol ( ) . catch ( ( e ) => handleERC20Error ( e , 'symbol' ) ) ,
399- erc20 . decimals ( ) . catch ( ( e ) => handleERC20Error ( e , 'decimals' ) )
396+ erc20 . balanceOf ! ( accountId ) . catch ( ( e ) => handleERC20Error ( e , 'balance' ) ) ,
397+ erc20 . symbol ! ( ) . catch ( ( e ) => handleERC20Error ( e , 'symbol' ) ) ,
398+ erc20 . decimals ! ( ) . catch ( ( e ) => handleERC20Error ( e , 'decimals' ) )
400399 ] )
401400 } catch ( e ) {
402401 handleERC20Error ( e , 'token validation' )
@@ -833,32 +832,34 @@ export const convertApiTokenDataToTokenDataCache = (
833832 if ( ! tokenData ) {
834833 return {
835834 priceIn : [ ] ,
836- marketData : {
837- marketDataIn : [ ] ,
838- exchanges : [ ]
839- }
835+ marketDataIn : [ ]
840836 }
841837 }
842838
843839 const baseCurrency = ( tokenData . baseCurrency || 'usd' ) as 'usd' // stop ts from complaining, we only support usd as base currency for now
844840 const price = ( tokenData . price || tokenData . usd ) as number | undefined
845841
846- const baseCurrency24hChange = tokenData [ `${ baseCurrency } _24h_change` ] || null
847- const baseCurrency24hVolume = tokenData [ `${ baseCurrency } _24h_vol` ] || null
848- const baseCurrencyMarketCap = tokenData [ `${ baseCurrency } _market_cap` ] || null
842+ const baseCurrency24hChange = tokenData [ `${ baseCurrency } _24h_change` ]
843+ const baseCurrency24hVolume = tokenData [ `${ baseCurrency } _24h_vol` ]
844+ const baseCurrencyMarketCap = tokenData [ `${ baseCurrency } _market_cap` ]
845+ const fullyDilutedValuation = tokenData [ `${ baseCurrency } _fully_diluted_valuation` ]
846+ const website = tokenData . homepage ? tokenData . homepage [ 0 ] : undefined
849847
850848 return {
851849 priceIn : typeof price === 'number' ? [ { baseCurrency, price } ] : [ ] ,
852- marketData : {
853- marketDataIn : [
854- {
855- baseCurrency,
856- change24h : baseCurrency24hChange ,
857- volume24h : baseCurrency24hVolume ,
858- marketCap : baseCurrencyMarketCap
859- }
860- ] ,
861- exchanges : tokenData . exchanges || [ ]
850+ marketDataIn : [
851+ {
852+ baseCurrency,
853+ change24h : baseCurrency24hChange ,
854+ volume24h : baseCurrency24hVolume ,
855+ marketCap : baseCurrencyMarketCap ,
856+ fullyDilutedValuation : fullyDilutedValuation ,
857+ totalSupply : tokenData . total_supply
858+ }
859+ ] ,
860+ meta : {
861+ exchanges : tokenData . exchanges || [ ] ,
862+ website : website
862863 }
863864 }
864865}
0 commit comments