@toruslabs/ethereum-controllers 5.6.1 → 5.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1930,7 +1930,6 @@ class CurrencyController extends base_controllers_namespaceObject.BaseCurrencyCo
1930
1930
  }
1931
1931
  async retrieveConversionRate(fromCurrency, toCurrency, commonDenomination) {
1932
1932
  try {
1933
- // query cryptocompare
1934
1933
  let apiUrl = `${this.config.api}/currency?fsym=${fromCurrency.toUpperCase()}&tsyms=${toCurrency.toUpperCase()}`;
1935
1934
  if (commonDenomination && commonDenomination.toUpperCase() !== toCurrency.toUpperCase()) {
1936
1935
  apiUrl += `,${commonDenomination.toUpperCase()}`;
@@ -5091,14 +5090,14 @@ class TokenRatesController extends base_controllers_namespaceObject.BaseControll
5091
5090
  const contractAddresses = this.config.tokens.map(token => token.tokenAddress);
5092
5091
  const isNativeCurrencySupported = COINGECKO_SUPPORTED_CURRENCIES.has(nativeCurrency.toLowerCase());
5093
5092
  if (isNativeCurrencySupported) {
5094
- const response = await (0,http_helpers_namespaceObject.get)(`${this.config.api}/simple/token_price/${chainCodes.platform}?contract_addresses=${contractAddresses.join(",")}&vs_currencies=${nativeCurrency.toLowerCase()}&include_market_cap=false&include_24hr_vol=false&include_24hr_change=false&include_last_updated_at=false`);
5093
+ const response = await (0,http_helpers_namespaceObject.get)(`${this.config.currencyApi}/currency/exchange-rates?platform=${chainCodes.platform}&contract_addresses=${contractAddresses.join(",")}&vs_currencies=${nativeCurrency.toLowerCase()}`);
5095
5094
  const newContractExchangeRates = {};
5096
5095
  Object.keys(response).forEach(contractAddress => {
5097
5096
  newContractExchangeRates[contractAddress] = response[contractAddress][nativeCurrency.toLowerCase()] || 0;
5098
5097
  });
5099
5098
  return newContractExchangeRates;
5100
5099
  }
5101
- const [response, currencyResponse] = await Promise.all([(0,http_helpers_namespaceObject.get)(`${this.config.api}/simple/token_price/${chainCodes.platform}?contract_addresses=${contractAddresses.join(",")}&vs_currencies=${DEFAULT_CURRENCY}&include_market_cap=false&include_24hr_vol=false&include_24hr_change=false&include_last_updated_at=false`), (0,http_helpers_namespaceObject.get)(`${this.config.currencyApi}/currency?fsym=${nativeCurrency.toUpperCase()}&tsyms=${DEFAULT_CURRENCY.toUpperCase()}`)]);
5100
+ const [response, currencyResponse] = await Promise.all([(0,http_helpers_namespaceObject.get)(`${this.config.currencyApi}/currency/exchange-rates?platform=${chainCodes.platform}&contract_addresses=${contractAddresses.join(",")}&vs_currencies=${DEFAULT_CURRENCY}`), (0,http_helpers_namespaceObject.get)(`${this.config.currencyApi}/currency?fsym=${nativeCurrency.toUpperCase()}&tsyms=${DEFAULT_CURRENCY.toUpperCase()}`)]);
5102
5101
  const newContractExchangeRates = {};
5103
5102
  Object.keys(response).forEach(contractAddress => {
5104
5103
  newContractExchangeRates[contractAddress] = response[contractAddress][DEFAULT_CURRENCY] * Number.parseFloat(currencyResponse[DEFAULT_CURRENCY]) || 0;
@@ -1696,7 +1696,6 @@ class CurrencyController extends BaseCurrencyController {
1696
1696
  }
1697
1697
  async retrieveConversionRate(fromCurrency, toCurrency, commonDenomination) {
1698
1698
  try {
1699
- // query cryptocompare
1700
1699
  let apiUrl = `${this.config.api}/currency?fsym=${fromCurrency.toUpperCase()}&tsyms=${toCurrency.toUpperCase()}`;
1701
1700
  if (commonDenomination && commonDenomination.toUpperCase() !== toCurrency.toUpperCase()) {
1702
1701
  apiUrl += `,${commonDenomination.toUpperCase()}`;
@@ -4678,14 +4677,14 @@ class TokenRatesController extends BaseController {
4678
4677
  const contractAddresses = this.config.tokens.map(token => token.tokenAddress);
4679
4678
  const isNativeCurrencySupported = COINGECKO_SUPPORTED_CURRENCIES.has(nativeCurrency.toLowerCase());
4680
4679
  if (isNativeCurrencySupported) {
4681
- const response = await get(`${this.config.api}/simple/token_price/${chainCodes.platform}?contract_addresses=${contractAddresses.join(",")}&vs_currencies=${nativeCurrency.toLowerCase()}&include_market_cap=false&include_24hr_vol=false&include_24hr_change=false&include_last_updated_at=false`);
4680
+ const response = await get(`${this.config.currencyApi}/currency/exchange-rates?platform=${chainCodes.platform}&contract_addresses=${contractAddresses.join(",")}&vs_currencies=${nativeCurrency.toLowerCase()}`);
4682
4681
  const newContractExchangeRates = {};
4683
4682
  Object.keys(response).forEach(contractAddress => {
4684
4683
  newContractExchangeRates[contractAddress] = response[contractAddress][nativeCurrency.toLowerCase()] || 0;
4685
4684
  });
4686
4685
  return newContractExchangeRates;
4687
4686
  }
4688
- const [response, currencyResponse] = await Promise.all([get(`${this.config.api}/simple/token_price/${chainCodes.platform}?contract_addresses=${contractAddresses.join(",")}&vs_currencies=${DEFAULT_CURRENCY}&include_market_cap=false&include_24hr_vol=false&include_24hr_change=false&include_last_updated_at=false`), get(`${this.config.currencyApi}/currency?fsym=${nativeCurrency.toUpperCase()}&tsyms=${DEFAULT_CURRENCY.toUpperCase()}`)]);
4687
+ const [response, currencyResponse] = await Promise.all([get(`${this.config.currencyApi}/currency/exchange-rates?platform=${chainCodes.platform}&contract_addresses=${contractAddresses.join(",")}&vs_currencies=${DEFAULT_CURRENCY}`), get(`${this.config.currencyApi}/currency?fsym=${nativeCurrency.toUpperCase()}&tsyms=${DEFAULT_CURRENCY.toUpperCase()}`)]);
4689
4688
  const newContractExchangeRates = {};
4690
4689
  Object.keys(response).forEach(contractAddress => {
4691
4690
  newContractExchangeRates[contractAddress] = response[contractAddress][DEFAULT_CURRENCY] * Number.parseFloat(currencyResponse[DEFAULT_CURRENCY]) || 0;