@toruslabs/ethereum-controllers 4.9.0 → 4.9.1

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.
@@ -1910,6 +1910,8 @@ class GasFeeController extends base_controllers_namespaceObject.BaseController {
1910
1910
  state
1911
1911
  });
1912
1912
  defineProperty_default()(this, "name", "GasFeeController");
1913
+ // https://0x.org/docs/introduction/0x-cheat-sheet#swap-api-endpoints
1914
+ defineProperty_default()(this, "API_SUPPORTED_CHAINIDS", new Set(["0x1", "0x5", "0x13881", "0xa4b1", "0xa86a", "0x2105", "0x38", "0xfa", "0xa", "0x89"]));
1913
1915
  defineProperty_default()(this, "intervalId", void 0);
1914
1916
  defineProperty_default()(this, "provider", void 0);
1915
1917
  defineProperty_default()(this, "currentChainId", void 0);
@@ -2013,7 +2015,11 @@ class GasFeeController extends base_controllers_namespaceObject.BaseController {
2013
2015
  if (isEIP1559Compatible) {
2014
2016
  let estimates;
2015
2017
  try {
2016
- estimates = await this.fetchGasEstimates(this.config.EIP1559APIEndpoint.replace("<chain_id>", `${chainIdInt}`));
2018
+ if (this.API_SUPPORTED_CHAINIDS.has(chainId)) {
2019
+ estimates = await this.fetchGasEstimates(this.config.EIP1559APIEndpoint.replace("<chain_id>", `${chainIdInt}`));
2020
+ } else {
2021
+ throw new Error("ChainId not supported by api");
2022
+ }
2017
2023
  } catch (error) {
2018
2024
  estimates = await this.fetchGasEstimatesViaEthFeeHistory(this.provider);
2019
2025
  }