@gearbox-protocol/sdk 14.10.9 → 14.10.10

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.
@@ -32,7 +32,8 @@ class RewardAmountAPI {
32
32
  pools,
33
33
  account,
34
34
  network,
35
- reportError
35
+ reportError,
36
+ apiKey
36
37
  }) {
37
38
  const [merkleXYZLMResponse] = await Promise.allSettled([
38
39
  import_merkl_api.MerkleXYZApi.fetchWithFallback(
@@ -41,7 +42,8 @@ class RewardAmountAPI {
41
42
  chainId: import_sdk.chains[network].id,
42
43
  user: (0, import_viem.getAddress)(account)
43
44
  }
44
- })
45
+ }),
46
+ apiKey
45
47
  )
46
48
  ]);
47
49
  const merkleXYZLm = RewardAmountAPI.extractFulfilled(
@@ -37,11 +37,17 @@ class MerkleXYZApi {
37
37
  }
38
38
  static defaultDomain = "https://api.merkl.xyz";
39
39
  static angleDomain = "https://api-merkl.angle.money";
40
- static fetchWithFallback = async (getUrl) => {
40
+ static apiKeyHeader = "X-API-Key";
41
+ static fetchWithFallback = async (getUrl, apiKey) => {
42
+ const headers = apiKey ? { [MerkleXYZApi.apiKeyHeader]: apiKey } : void 0;
41
43
  try {
42
- return await import_axios.default.get(getUrl(MerkleXYZApi.defaultDomain));
44
+ return await import_axios.default.get(getUrl(MerkleXYZApi.defaultDomain), {
45
+ headers
46
+ });
43
47
  } catch {
44
- return await import_axios.default.get(getUrl(MerkleXYZApi.angleDomain));
48
+ return await import_axios.default.get(getUrl(MerkleXYZApi.angleDomain), {
49
+ headers
50
+ });
45
51
  }
46
52
  };
47
53
  static getUserRewardsUrl = (options) => (domain) => `${domain}/v4/users/${options.params.user}/rewards?chainId=${options.params.chainId}`;
@@ -11,7 +11,8 @@ class RewardAmountAPI {
11
11
  pools,
12
12
  account,
13
13
  network,
14
- reportError
14
+ reportError,
15
+ apiKey
15
16
  }) {
16
17
  const [merkleXYZLMResponse] = await Promise.allSettled([
17
18
  MerkleXYZApi.fetchWithFallback(
@@ -20,7 +21,8 @@ class RewardAmountAPI {
20
21
  chainId: chains[network].id,
21
22
  user: getAddress(account)
22
23
  }
23
- })
24
+ }),
25
+ apiKey
24
26
  )
25
27
  ]);
26
28
  const merkleXYZLm = RewardAmountAPI.extractFulfilled(
@@ -4,11 +4,17 @@ class MerkleXYZApi {
4
4
  }
5
5
  static defaultDomain = "https://api.merkl.xyz";
6
6
  static angleDomain = "https://api-merkl.angle.money";
7
- static fetchWithFallback = async (getUrl) => {
7
+ static apiKeyHeader = "X-API-Key";
8
+ static fetchWithFallback = async (getUrl, apiKey) => {
9
+ const headers = apiKey ? { [MerkleXYZApi.apiKeyHeader]: apiKey } : void 0;
8
10
  try {
9
- return await axios.get(getUrl(MerkleXYZApi.defaultDomain));
11
+ return await axios.get(getUrl(MerkleXYZApi.defaultDomain), {
12
+ headers
13
+ });
10
14
  } catch {
11
- return await axios.get(getUrl(MerkleXYZApi.angleDomain));
15
+ return await axios.get(getUrl(MerkleXYZApi.angleDomain), {
16
+ headers
17
+ });
12
18
  }
13
19
  };
14
20
  static getUserRewardsUrl = (options) => (domain) => `${domain}/v4/users/${options.params.user}/rewards?chainId=${options.params.chainId}`;
@@ -26,10 +26,11 @@ export interface GetLmRewardsMerkleProps {
26
26
  account: Address;
27
27
  network: NetworkType;
28
28
  reportError?: ReportHandler;
29
+ apiKey?: string;
29
30
  }
30
31
  export declare class RewardAmountAPI {
31
32
  private constructor();
32
- static getLmRewardsMerkle({ pools, account, network, reportError, }: GetLmRewardsMerkleProps): Promise<GearboxExtraMerkleLmReward[]>;
33
+ static getLmRewardsMerkle({ pools, account, network, reportError, apiKey, }: GetLmRewardsMerkleProps): Promise<GearboxExtraMerkleLmReward[]>;
33
34
  private static extractFulfilled;
34
35
  }
35
36
  export {};
@@ -39,7 +39,8 @@ export declare class MerkleXYZApi {
39
39
  private constructor();
40
40
  static defaultDomain: string;
41
41
  static angleDomain: string;
42
- static fetchWithFallback: <T>(getUrl: (domain: string) => string) => Promise<import("axios").AxiosResponse<T, any, {}>>;
42
+ static apiKeyHeader: string;
43
+ static fetchWithFallback: <T>(getUrl: (domain: string) => string, apiKey?: string) => Promise<import("axios").AxiosResponse<T, any, {}>>;
43
44
  static getUserRewardsUrl: (options: UserOptions) => (domain: string) => string;
44
45
  }
45
46
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "14.10.9",
3
+ "version": "14.10.10",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {