@imtbl/sdk 0.28.2 → 0.28.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.
@@ -1,5 +1,5 @@
1
- import { ethers, ContractFactory, utils, Contract as Contract$1, BigNumber as BigNumber$1, providers, constants as constants$1 } from 'ethers';
2
1
  import globalAxios, { HttpStatusCode } from 'axios';
2
+ import { ethers, ContractFactory, utils, Contract as Contract$1, BigNumber as BigNumber$1, providers, constants as constants$1 } from 'ethers';
3
3
  import { Web3Provider, JsonRpcProvider } from '@ethersproject/providers';
4
4
  import $7v2Z6$metamaskdetectprovider from '@metamask/detect-provider';
5
5
  import * as Uniswap from '@uniswap/sdk-core';
@@ -18,10 +18,29 @@ var Environment$1;
18
18
  })(Environment$1 || (Environment$1 = {}));
19
19
  class ImmutableConfiguration {
20
20
  environment;
21
+ rateLimitingKey;
21
22
  apiKey;
23
+ clientAppId;
22
24
  constructor(options) {
23
25
  this.environment = options.environment;
24
- this.apiKey = options.apiKey;
26
+ if (options.rateLimitingKey) {
27
+ this.rateLimitingKey = options.rateLimitingKey;
28
+ globalAxios.defaults.headers.common['x-api-key'] = this.rateLimitingKey;
29
+ }
30
+ if (options.apiKey) {
31
+ if (!options.apiKey.startsWith('sk_imapik-')) {
32
+ throw new Error('Invalid API key');
33
+ }
34
+ this.apiKey = options.apiKey;
35
+ globalAxios.defaults.headers.common['x-immutable-api-key'] = this.apiKey;
36
+ }
37
+ if (options.clientAppId) {
38
+ if (!options.clientAppId.startsWith('cai_imapik-')) {
39
+ throw new Error('Invalid Client App Id');
40
+ }
41
+ this.clientAppId = options.clientAppId;
42
+ globalAxios.defaults.headers.common['x-immutable-client-app-id'] = this.clientAppId;
43
+ }
25
44
  }
26
45
  }
27
46
 
@@ -20768,7 +20787,7 @@ class APIError extends Error {
20768
20787
 
20769
20788
  /* eslint-disable implicit-arrow-linebreak */
20770
20789
  const defaultHeaders = {
20771
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.2',
20790
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.3',
20772
20791
  };
20773
20792
  /**
20774
20793
  * createAPIConfiguration to create a custom Configuration