import type { CurrencyType , CryptoPrice } from '@masknet/web3-shared-evm' ; const URL_BASE = 'https://api.coingecko.com/api/v3' ; export async function getTokenPrices ( platform , contractAddresses , currency ) { const addressList = contractAddresses . join ( ',' ) ; const requestPath = `${ URL_BASE }/simple/token_price/${ platform }?contract_addresses=${ addressList }&vs_currencies=${ currency }` ; const prices = await fetch ( requestPath ) . then ( ( r ) => r . json ( ) as Promise < CryptoPrice > ) ; return prices ; } export async function getNativeTokenPrice ( tokenIds , currency ) { const requestPath = `${ URL_BASE }/simple/price?ids=${ tokenIds . join ( ',' ) }&vs_currencies=${ currency }` ; const prices = await fetch ( requestPath ) . then ( ( r ) => r . json ( ) as Promise < CryptoPrice > ) ; return prices ; }