@gearbox-protocol/sdk 14.8.7 → 14.10.0-next.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.
Files changed (45) hide show
  1. package/dist/cjs/abi/IWithdrawalCompressorV311.js +315 -0
  2. package/dist/cjs/{plugins/apy/apy-cache.js → common-utils/axios-cache/AxiosCache.js} +31 -20
  3. package/dist/cjs/common-utils/axios-cache/index.js +22 -0
  4. package/dist/cjs/common-utils/index.js +2 -0
  5. package/dist/cjs/plugins/apy/ApyPlugin.js +4 -4
  6. package/dist/cjs/plugins/apy/index.js +0 -2
  7. package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +3 -2
  8. package/dist/cjs/plugins/remote-configs/CustomConfigSource.js +41 -0
  9. package/dist/cjs/plugins/remote-configs/RemoteConfigSource.js +56 -0
  10. package/dist/cjs/plugins/remote-configs/RemoteConfigsPlugin.js +186 -0
  11. package/dist/cjs/plugins/remote-configs/index.js +28 -0
  12. package/dist/cjs/plugins/remote-configs/package.json +1 -0
  13. package/dist/cjs/plugins/remote-configs/types.js +16 -0
  14. package/dist/cjs/sdk/OnchainSDK.js +2 -2
  15. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +13 -6
  16. package/dist/cjs/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  17. package/dist/esm/abi/IWithdrawalCompressorV311.js +291 -0
  18. package/dist/esm/{plugins/apy/apy-cache.js → common-utils/axios-cache/AxiosCache.js} +27 -16
  19. package/dist/esm/common-utils/axios-cache/index.js +1 -0
  20. package/dist/esm/common-utils/index.js +1 -0
  21. package/dist/esm/plugins/apy/ApyPlugin.js +4 -4
  22. package/dist/esm/plugins/apy/index.js +0 -1
  23. package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +3 -2
  24. package/dist/esm/plugins/remote-configs/CustomConfigSource.js +17 -0
  25. package/dist/esm/plugins/remote-configs/RemoteConfigSource.js +32 -0
  26. package/dist/esm/plugins/remote-configs/RemoteConfigsPlugin.js +165 -0
  27. package/dist/esm/plugins/remote-configs/index.js +4 -0
  28. package/dist/esm/plugins/remote-configs/package.json +1 -0
  29. package/dist/esm/plugins/remote-configs/types.js +0 -0
  30. package/dist/esm/sdk/OnchainSDK.js +2 -2
  31. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +13 -6
  32. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  33. package/dist/types/abi/IWithdrawalCompressorV311.d.ts +327 -0
  34. package/dist/types/{plugins/apy/apy-cache.d.ts → common-utils/axios-cache/AxiosCache.d.ts} +6 -7
  35. package/dist/types/common-utils/axios-cache/index.d.ts +1 -0
  36. package/dist/types/common-utils/index.d.ts +1 -0
  37. package/dist/types/plugins/apy/index.d.ts +0 -1
  38. package/dist/types/plugins/delayed-withdrawal/types.d.ts +10 -2
  39. package/dist/types/plugins/remote-configs/CustomConfigSource.d.ts +13 -0
  40. package/dist/types/plugins/remote-configs/RemoteConfigSource.d.ts +31 -0
  41. package/dist/types/plugins/remote-configs/RemoteConfigsPlugin.d.ts +24 -0
  42. package/dist/types/plugins/remote-configs/index.d.ts +4 -0
  43. package/dist/types/plugins/remote-configs/types.d.ts +24 -0
  44. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +4 -1
  45. package/package.json +1 -1
@@ -0,0 +1,315 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var IWithdrawalCompressorV311_exports = {};
20
+ __export(IWithdrawalCompressorV311_exports, {
21
+ iWithdrawalCompressorV311Abi: () => iWithdrawalCompressorV311Abi
22
+ });
23
+ module.exports = __toCommonJS(IWithdrawalCompressorV311_exports);
24
+ const iWithdrawalCompressorV311Abi = [
25
+ {
26
+ inputs: [
27
+ { internalType: "address", name: "_owner", type: "address" },
28
+ { internalType: "address", name: "addressProvider_", type: "address" }
29
+ ],
30
+ stateMutability: "nonpayable",
31
+ type: "constructor"
32
+ },
33
+ {
34
+ anonymous: false,
35
+ inputs: [
36
+ {
37
+ indexed: true,
38
+ internalType: "address",
39
+ name: "previousOwner",
40
+ type: "address"
41
+ },
42
+ {
43
+ indexed: true,
44
+ internalType: "address",
45
+ name: "newOwner",
46
+ type: "address"
47
+ }
48
+ ],
49
+ name: "OwnershipTransferred",
50
+ type: "event"
51
+ },
52
+ {
53
+ inputs: [],
54
+ name: "addressProvider",
55
+ outputs: [{ internalType: "address", name: "", type: "address" }],
56
+ stateMutability: "view",
57
+ type: "function"
58
+ },
59
+ {
60
+ inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
61
+ name: "compressorTypeToCompressor",
62
+ outputs: [{ internalType: "address", name: "", type: "address" }],
63
+ stateMutability: "view",
64
+ type: "function"
65
+ },
66
+ {
67
+ inputs: [],
68
+ name: "contractType",
69
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
70
+ stateMutability: "view",
71
+ type: "function"
72
+ },
73
+ {
74
+ inputs: [
75
+ { internalType: "address", name: "creditAccount", type: "address" }
76
+ ],
77
+ name: "getCurrentWithdrawals",
78
+ outputs: [
79
+ {
80
+ components: [
81
+ { internalType: "address", name: "token", type: "address" },
82
+ {
83
+ internalType: "address",
84
+ name: "withdrawalPhantomToken",
85
+ type: "address"
86
+ },
87
+ {
88
+ internalType: "uint256",
89
+ name: "withdrawalTokenSpent",
90
+ type: "uint256"
91
+ },
92
+ {
93
+ components: [
94
+ { internalType: "address", name: "token", type: "address" },
95
+ { internalType: "bool", name: "isDelayed", type: "bool" },
96
+ { internalType: "uint256", name: "amount", type: "uint256" }
97
+ ],
98
+ internalType: "struct WithdrawalOutput[]",
99
+ name: "outputs",
100
+ type: "tuple[]"
101
+ },
102
+ {
103
+ components: [
104
+ { internalType: "address", name: "target", type: "address" },
105
+ { internalType: "bytes", name: "callData", type: "bytes" }
106
+ ],
107
+ internalType: "struct MultiCall[]",
108
+ name: "claimCalls",
109
+ type: "tuple[]"
110
+ }
111
+ ],
112
+ internalType: "struct ClaimableWithdrawal[]",
113
+ name: "",
114
+ type: "tuple[]"
115
+ },
116
+ {
117
+ components: [
118
+ { internalType: "address", name: "token", type: "address" },
119
+ {
120
+ internalType: "address",
121
+ name: "withdrawalPhantomToken",
122
+ type: "address"
123
+ },
124
+ {
125
+ components: [
126
+ { internalType: "address", name: "token", type: "address" },
127
+ { internalType: "bool", name: "isDelayed", type: "bool" },
128
+ { internalType: "uint256", name: "amount", type: "uint256" }
129
+ ],
130
+ internalType: "struct WithdrawalOutput[]",
131
+ name: "expectedOutputs",
132
+ type: "tuple[]"
133
+ },
134
+ { internalType: "uint256", name: "claimableAt", type: "uint256" }
135
+ ],
136
+ internalType: "struct PendingWithdrawal[]",
137
+ name: "",
138
+ type: "tuple[]"
139
+ }
140
+ ],
141
+ stateMutability: "view",
142
+ type: "function"
143
+ },
144
+ {
145
+ inputs: [
146
+ { internalType: "address", name: "creditManager", type: "address" }
147
+ ],
148
+ name: "getWithdrawableAssets",
149
+ outputs: [
150
+ {
151
+ components: [
152
+ { internalType: "address", name: "token", type: "address" },
153
+ {
154
+ internalType: "address",
155
+ name: "withdrawalPhantomToken",
156
+ type: "address"
157
+ },
158
+ { internalType: "address", name: "underlying", type: "address" },
159
+ {
160
+ internalType: "uint256",
161
+ name: "withdrawalLength",
162
+ type: "uint256"
163
+ },
164
+ { internalType: "uint256", name: "maxWithdrawals", type: "uint256" }
165
+ ],
166
+ internalType: "struct WithdrawableAsset[]",
167
+ name: "",
168
+ type: "tuple[]"
169
+ }
170
+ ],
171
+ stateMutability: "view",
172
+ type: "function"
173
+ },
174
+ {
175
+ inputs: [
176
+ { internalType: "address", name: "creditAccount", type: "address" },
177
+ { internalType: "address", name: "token", type: "address" },
178
+ { internalType: "uint256", name: "amount", type: "uint256" }
179
+ ],
180
+ name: "getWithdrawalRequestResult",
181
+ outputs: [
182
+ {
183
+ components: [
184
+ { internalType: "address", name: "token", type: "address" },
185
+ { internalType: "uint256", name: "amountIn", type: "uint256" },
186
+ {
187
+ components: [
188
+ { internalType: "address", name: "token", type: "address" },
189
+ { internalType: "bool", name: "isDelayed", type: "bool" },
190
+ { internalType: "uint256", name: "amount", type: "uint256" }
191
+ ],
192
+ internalType: "struct WithdrawalOutput[]",
193
+ name: "outputs",
194
+ type: "tuple[]"
195
+ },
196
+ {
197
+ components: [
198
+ { internalType: "address", name: "target", type: "address" },
199
+ { internalType: "bytes", name: "callData", type: "bytes" }
200
+ ],
201
+ internalType: "struct MultiCall[]",
202
+ name: "requestCalls",
203
+ type: "tuple[]"
204
+ },
205
+ { internalType: "uint256", name: "claimableAt", type: "uint256" }
206
+ ],
207
+ internalType: "struct RequestableWithdrawal",
208
+ name: "withdrawal",
209
+ type: "tuple"
210
+ }
211
+ ],
212
+ stateMutability: "view",
213
+ type: "function"
214
+ },
215
+ // {
216
+ // inputs: [
217
+ // { internalType: "address", name: "creditAccount", type: "address" },
218
+ // { internalType: "address", name: "token", type: "address" },
219
+ // { internalType: "address", name: "withdrawalToken", type: "address" },
220
+ // { internalType: "uint256", name: "amount", type: "uint256" },
221
+ // ],
222
+ // name: "getWithdrawalRequestResult",
223
+ // outputs: [
224
+ // {
225
+ // components: [
226
+ // { internalType: "address", name: "token", type: "address" },
227
+ // { internalType: "uint256", name: "amountIn", type: "uint256" },
228
+ // {
229
+ // components: [
230
+ // { internalType: "address", name: "token", type: "address" },
231
+ // { internalType: "bool", name: "isDelayed", type: "bool" },
232
+ // { internalType: "uint256", name: "amount", type: "uint256" },
233
+ // ],
234
+ // internalType: "struct WithdrawalOutput[]",
235
+ // name: "outputs",
236
+ // type: "tuple[]",
237
+ // },
238
+ // {
239
+ // components: [
240
+ // { internalType: "address", name: "target", type: "address" },
241
+ // { internalType: "bytes", name: "callData", type: "bytes" },
242
+ // ],
243
+ // internalType: "struct MultiCall[]",
244
+ // name: "requestCalls",
245
+ // type: "tuple[]",
246
+ // },
247
+ // { internalType: "uint256", name: "claimableAt", type: "uint256" },
248
+ // ],
249
+ // internalType: "struct RequestableWithdrawal",
250
+ // name: "withdrawal",
251
+ // type: "tuple",
252
+ // },
253
+ // ],
254
+ // stateMutability: "view",
255
+ // type: "function",
256
+ // },
257
+ {
258
+ inputs: [],
259
+ name: "owner",
260
+ outputs: [{ internalType: "address", name: "", type: "address" }],
261
+ stateMutability: "view",
262
+ type: "function"
263
+ },
264
+ {
265
+ inputs: [],
266
+ name: "renounceOwnership",
267
+ outputs: [],
268
+ stateMutability: "nonpayable",
269
+ type: "function"
270
+ },
271
+ {
272
+ inputs: [
273
+ { internalType: "address", name: "subcompressor", type: "address" }
274
+ ],
275
+ name: "setSubcompressor",
276
+ outputs: [],
277
+ stateMutability: "nonpayable",
278
+ type: "function"
279
+ },
280
+ {
281
+ inputs: [
282
+ { internalType: "bytes32", name: "withdrawableType", type: "bytes32" },
283
+ { internalType: "bytes32", name: "compressorType", type: "bytes32" }
284
+ ],
285
+ name: "setWithdrawableTypeToCompressorType",
286
+ outputs: [],
287
+ stateMutability: "nonpayable",
288
+ type: "function"
289
+ },
290
+ {
291
+ inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
292
+ name: "transferOwnership",
293
+ outputs: [],
294
+ stateMutability: "nonpayable",
295
+ type: "function"
296
+ },
297
+ {
298
+ inputs: [],
299
+ name: "version",
300
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
301
+ stateMutability: "view",
302
+ type: "function"
303
+ },
304
+ {
305
+ inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
306
+ name: "withdrawableTypeToCompressorType",
307
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
308
+ stateMutability: "view",
309
+ type: "function"
310
+ }
311
+ ];
312
+ // Annotate the CommonJS export names for ESM import in node:
313
+ 0 && (module.exports = {
314
+ iWithdrawalCompressorV311Abi
315
+ });
@@ -26,50 +26,57 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var apy_cache_exports = {};
30
- __export(apy_cache_exports, {
31
- ApyOutputCache: () => ApyOutputCache
29
+ var AxiosCache_exports = {};
30
+ __export(AxiosCache_exports, {
31
+ AxiosCache: () => AxiosCache
32
32
  });
33
- module.exports = __toCommonJS(apy_cache_exports);
33
+ module.exports = __toCommonJS(AxiosCache_exports);
34
34
  var import_axios = __toESM(require("axios"));
35
- class ApyOutputCache {
35
+ class AxiosCache {
36
36
  static #instances = /* @__PURE__ */ new Map();
37
37
  #url;
38
38
  #ttlMs;
39
39
  #cache;
40
40
  #pending;
41
41
  #logger;
42
- constructor(url, ttlMs, logger) {
42
+ #getLogMeta;
43
+ constructor(url, ttlMs, logger, getLogMeta) {
43
44
  this.#url = url;
44
45
  this.#ttlMs = ttlMs;
45
46
  this.#logger = logger;
47
+ this.#getLogMeta = getLogMeta;
46
48
  }
47
49
  /**
48
50
  * Returns a shared cache instance for the given URL.
49
51
  * The same instance is reused across all callers with identical URL.
50
52
  */
51
- static get(url, ttlMs, logger) {
52
- let instance = ApyOutputCache.#instances.get(url);
53
+ static get(url, ttlMs, logger, getLogMeta) {
54
+ let instance = AxiosCache.#instances.get(url);
53
55
  if (!instance) {
54
- instance = new ApyOutputCache(url, ttlMs, logger);
55
- ApyOutputCache.#instances.set(url, instance);
56
+ instance = new AxiosCache(url, ttlMs, logger, getLogMeta);
57
+ AxiosCache.#instances.set(url, instance);
56
58
  }
57
59
  if (logger) {
58
60
  instance.#logger = logger;
59
61
  }
62
+ if (getLogMeta) {
63
+ instance.#getLogMeta = getLogMeta;
64
+ }
60
65
  return instance;
61
66
  }
62
67
  /**
63
- * Returns cached Output if fresh, otherwise fetches from the network.
68
+ * Returns cached data if fresh, otherwise fetches from the network.
64
69
  * Concurrent calls are de-duplicated.
65
70
  */
66
71
  async fetch() {
67
72
  if (this.#cache && Date.now() - this.#cache.fetchedAt < this.#ttlMs) {
68
- this.#logger?.debug("apy cache: TTL still valid, returning cached data");
73
+ this.#logger?.debug(
74
+ "axios cache: TTL still valid, returning cached data"
75
+ );
69
76
  return this.#cache.data;
70
77
  }
71
78
  if (this.#pending) {
72
- this.#logger?.debug("apy cache: request in flight, waiting");
79
+ this.#logger?.debug("axios cache: request in flight, waiting");
73
80
  return this.#pending;
74
81
  }
75
82
  this.#pending = this.#doFetch();
@@ -91,30 +98,34 @@ class ApyOutputCache {
91
98
  });
92
99
  if (response.status === 304 && this.#cache) {
93
100
  this.#cache.fetchedAt = Date.now();
94
- this.#logger?.debug("apy cache: 304 Not Modified, extended TTL");
101
+ this.#logger?.debug("axios cache: 304 Not Modified, extended TTL");
95
102
  return this.#cache.data;
96
103
  }
97
- const etag = response.headers["etag"];
104
+ const etag = response.headers.etag;
98
105
  this.#cache = {
99
106
  data: response.data,
100
107
  etag,
101
108
  fetchedAt: Date.now()
102
109
  };
110
+ const meta = this.#getLogMeta?.(response.data);
103
111
  this.#logger?.debug(
104
- `apy cache: fetched fresh data (timestamp: ${response.data.timestamp})`
112
+ `axios cache: fetched fresh data${meta ? ` (${meta})` : ""}`
105
113
  );
106
114
  return response.data;
107
115
  } catch (e) {
108
- this.#logger?.error(e, "apy cache: fetch failed");
109
- return this.#cache?.data;
116
+ this.#logger?.error(e, "axios cache: fetch failed");
117
+ if (this.#cache) {
118
+ return this.#cache.data;
119
+ }
120
+ throw e;
110
121
  }
111
122
  }
112
123
  /** Evicts all cached entries. Mainly useful for tests. */
113
124
  static clearAll() {
114
- ApyOutputCache.#instances.clear();
125
+ AxiosCache.#instances.clear();
115
126
  }
116
127
  }
117
128
  // Annotate the CommonJS export names for ESM import in node:
118
129
  0 && (module.exports = {
119
- ApyOutputCache
130
+ AxiosCache
120
131
  });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var axios_cache_exports = {};
17
+ module.exports = __toCommonJS(axios_cache_exports);
18
+ __reExport(axios_cache_exports, require("./AxiosCache.js"), module.exports);
19
+ // Annotate the CommonJS export names for ESM import in node:
20
+ 0 && (module.exports = {
21
+ ...require("./AxiosCache.js")
22
+ });
@@ -15,11 +15,13 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var common_utils_exports = {};
17
17
  module.exports = __toCommonJS(common_utils_exports);
18
+ __reExport(common_utils_exports, require("./axios-cache/index.js"), module.exports);
18
19
  __reExport(common_utils_exports, require("./charts/index.js"), module.exports);
19
20
  __reExport(common_utils_exports, require("./static/index.js"), module.exports);
20
21
  __reExport(common_utils_exports, require("./utils/index.js"), module.exports);
21
22
  // Annotate the CommonJS export names for ESM import in node:
22
23
  0 && (module.exports = {
24
+ ...require("./axios-cache/index.js"),
23
25
  ...require("./charts/index.js"),
24
26
  ...require("./static/index.js"),
25
27
  ...require("./utils/index.js")
@@ -22,12 +22,12 @@ __export(ApyPlugin_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(ApyPlugin_exports);
24
24
  var import_marketCompressor = require("../../abi/compressors/marketCompressor.js");
25
+ var import_axios_cache = require("../../common-utils/axios-cache/index.js");
25
26
  var import_strategies = require("../../common-utils/utils/strategies/index.js");
26
27
  var import_extra_apy = require("../../rewards/rewards/extra-apy.js");
27
28
  var import_sdk = require("../../sdk/index.js");
28
29
  var import_formatter = require("../../sdk/utils/formatter.js");
29
30
  var import_hex = require("../../sdk/utils/hex.js");
30
- var import_apy_cache = require("./apy-cache.js");
31
31
  var import_apy_parser = require("./apy-parser.js");
32
32
  var import_constants = require("./constants.js");
33
33
  var import_pool_apy_utils = require("./pool-apy-utils.js");
@@ -277,13 +277,13 @@ class ApyPlugin extends import_sdk.BasePlugin {
277
277
  // ---------------------------------------------------------------------------
278
278
  async #fetchApy() {
279
279
  try {
280
- const cache = import_apy_cache.ApyOutputCache.get(
280
+ const cache = import_axios_cache.AxiosCache.get(
281
281
  this.#apyUrl,
282
282
  this.#cacheTtlMs,
283
- this.#logger
283
+ this.#logger,
284
+ (data) => `timestamp: ${data.timestamp}`
284
285
  );
285
286
  const output = await cache.fetch();
286
- if (!output) return void 0;
287
287
  const chainData = output.chains[this.sdk.chainId];
288
288
  if (!chainData) {
289
289
  this.#logger?.debug(
@@ -16,7 +16,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var apy_exports = {};
17
17
  module.exports = __toCommonJS(apy_exports);
18
18
  __reExport(apy_exports, require("./ApyPlugin.js"), module.exports);
19
- __reExport(apy_exports, require("./apy-cache.js"), module.exports);
20
19
  __reExport(apy_exports, require("./apy-parser.js"), module.exports);
21
20
  __reExport(apy_exports, require("./constants.js"), module.exports);
22
21
  __reExport(apy_exports, require("./pool-apy-types.js"), module.exports);
@@ -25,7 +24,6 @@ __reExport(apy_exports, require("./types.js"), module.exports);
25
24
  // Annotate the CommonJS export names for ESM import in node:
26
25
  0 && (module.exports = {
27
26
  ...require("./ApyPlugin.js"),
28
- ...require("./apy-cache.js"),
29
27
  ...require("./apy-parser.js"),
30
28
  ...require("./constants.js"),
31
29
  ...require("./pool-apy-types.js"),
@@ -22,6 +22,7 @@ __export(DelayedWithdrawalPlugin_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(DelayedWithdrawalPlugin_exports);
24
24
  var import_IWithdrawalCompressorV310 = require("../../abi/IWithdrawalCompressorV310.js");
25
+ var import_IWithdrawalCompressorV311 = require("../../abi/IWithdrawalCompressorV311.js");
25
26
  var import_sdk = require("../../sdk/index.js");
26
27
  const MAP_LABEL = "delayedWithdrawal";
27
28
  class DelayedWithdrawalPlugin extends import_sdk.BasePlugin {
@@ -38,8 +39,8 @@ class DelayedWithdrawalPlugin extends import_sdk.BasePlugin {
38
39
  const resp = await this.client.multicall({
39
40
  contracts: compressor ? creditManagers.map(
40
41
  (cm) => ({
41
- abi: import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi,
42
- address: compressor,
42
+ address: compressor.address,
43
+ abi: compressor.version === 310 ? import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi : import_IWithdrawalCompressorV311.iWithdrawalCompressorV311Abi,
43
44
  functionName: "getWithdrawableAssets",
44
45
  args: [cm.creditManager.address]
45
46
  })
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var CustomConfigSource_exports = {};
20
+ __export(CustomConfigSource_exports, {
21
+ CustomConfigSource: () => CustomConfigSource
22
+ });
23
+ module.exports = __toCommonJS(CustomConfigSource_exports);
24
+ class CustomConfigSource {
25
+ #getPools;
26
+ #getStrategies;
27
+ constructor(options) {
28
+ this.#getPools = options.getPools;
29
+ this.#getStrategies = options.getStrategies;
30
+ }
31
+ async getPools() {
32
+ return this.#getPools();
33
+ }
34
+ async getStrategies() {
35
+ return this.#getStrategies();
36
+ }
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ CustomConfigSource
41
+ });
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var RemoteConfigSource_exports = {};
20
+ __export(RemoteConfigSource_exports, {
21
+ RemoteConfigSource: () => RemoteConfigSource
22
+ });
23
+ module.exports = __toCommonJS(RemoteConfigSource_exports);
24
+ var import_axios_cache = require("../../common-utils/axios-cache/index.js");
25
+ const DEFAULT_POOLS_URL = "https://static.gearbox.finance/client-v3/configs/pools/pools.json";
26
+ const DEFAULT_STRATEGIES_URL = "https://static.gearbox.finance/client-v3/configs/strategies/strategies.json";
27
+ const DEFAULT_CACHE_TTL_MS = 30 * 60 * 1e3;
28
+ class RemoteConfigSource {
29
+ #poolsCache;
30
+ #strategiesCache;
31
+ constructor(options) {
32
+ const poolsUrl = options?.poolsUrl ?? DEFAULT_POOLS_URL;
33
+ const strategiesUrl = options?.strategiesUrl ?? DEFAULT_STRATEGIES_URL;
34
+ const ttlMs = options?.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;
35
+ this.#poolsCache = import_axios_cache.AxiosCache.get(
36
+ poolsUrl,
37
+ ttlMs,
38
+ options?.logger
39
+ );
40
+ this.#strategiesCache = import_axios_cache.AxiosCache.get(
41
+ strategiesUrl,
42
+ ttlMs,
43
+ options?.logger
44
+ );
45
+ }
46
+ async getPools() {
47
+ return this.#poolsCache.fetch();
48
+ }
49
+ async getStrategies() {
50
+ return this.#strategiesCache.fetch();
51
+ }
52
+ }
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ RemoteConfigSource
56
+ });