@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.
@@ -24,6 +24,7 @@ interface IGasFeeControllerOptions {
24
24
  */
25
25
  export default class GasFeeController extends BaseController<EthereumGasConfig, EthereumGasState> {
26
26
  name: string;
27
+ readonly API_SUPPORTED_CHAINIDS: Set<string>;
27
28
  private intervalId;
28
29
  private provider;
29
30
  private currentChainId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toruslabs/ethereum-controllers",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "homepage": "https://github.com/torusresearch/controllers#readme",
5
5
  "license": "ISC",
6
6
  "main": "dist/ethereumControllers.cjs.js",
@@ -22,11 +22,11 @@
22
22
  "@ethereumjs/common": "^4.1.0",
23
23
  "@ethereumjs/tx": "^5.1.0",
24
24
  "@ethereumjs/util": "^9.0.1",
25
- "@metamask/eth-sig-util": "^7.0.0",
25
+ "@metamask/eth-sig-util": "^7.0.1",
26
26
  "@metamask/rpc-errors": "^6.1.0",
27
- "@toruslabs/base-controllers": "^4.8.0",
27
+ "@toruslabs/base-controllers": "^4.9.1",
28
28
  "@toruslabs/http-helpers": "^5.0.0",
29
- "@toruslabs/openlogin-jrpc": "^6.0.0",
29
+ "@toruslabs/openlogin-jrpc": "^6.1.0",
30
30
  "async-mutex": "^0.4.0",
31
31
  "bignumber.js": "^9.1.2",
32
32
  "bn.js": "^5.2.1",
@@ -64,8 +64,8 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "49adaf20315ce8e194679e32fd18b0379b5779d6",
67
+ "gitHead": "1e4afc8613898d60f1c903c655003250e34b5387",
68
68
  "devDependencies": {
69
- "hardhat": "^2.19.0"
69
+ "hardhat": "^2.19.1"
70
70
  }
71
71
  }
@@ -40,6 +40,9 @@ interface IGasFeeControllerOptions {
40
40
  export default class GasFeeController extends BaseController<EthereumGasConfig, EthereumGasState> {
41
41
  name = "GasFeeController";
42
42
 
43
+ // https://0x.org/docs/introduction/0x-cheat-sheet#swap-api-endpoints
44
+ readonly API_SUPPORTED_CHAINIDS = new Set(["0x1", "0x5", "0x13881", "0xa4b1", "0xa86a", "0x2105", "0x38", "0xfa", "0xa", "0x89"]);
45
+
43
46
  private intervalId: number;
44
47
 
45
48
  private provider: SafeEventEmitterProvider;
@@ -181,7 +184,11 @@ export default class GasFeeController extends BaseController<EthereumGasConfig,
181
184
  if (isEIP1559Compatible) {
182
185
  let estimates: EthereumGasFeeEstimates;
183
186
  try {
184
- estimates = await this.fetchGasEstimates(this.config.EIP1559APIEndpoint.replace("<chain_id>", `${chainIdInt}`));
187
+ if (this.API_SUPPORTED_CHAINIDS.has(chainId)) {
188
+ estimates = await this.fetchGasEstimates(this.config.EIP1559APIEndpoint.replace("<chain_id>", `${chainIdInt}`));
189
+ } else {
190
+ throw new Error("ChainId not supported by api");
191
+ }
185
192
  } catch (error) {
186
193
  estimates = await this.fetchGasEstimatesViaEthFeeHistory(this.provider);
187
194
  }