@steerprotocol/data-connector-loader 4.1.0 → 5.0.0-next.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.
Files changed (51) hide show
  1. package/README.md +136 -20
  2. package/lib/bundle/bundleBase.d.ts +11 -14
  3. package/lib/bundle/bundleBase.js +58 -90
  4. package/lib/bundle/bundleDataConnector.d.ts +2 -6
  5. package/lib/bundle/bundleDataConnector.js +22 -47
  6. package/lib/esm/bundle/bundleBase.d.ts +11 -14
  7. package/lib/esm/bundle/bundleBase.js +79 -93
  8. package/lib/esm/bundle/bundleDataConnector.d.ts +2 -6
  9. package/lib/esm/bundle/bundleDataConnector.js +26 -49
  10. package/lib/esm/execution/executionApp.d.ts +18 -17
  11. package/lib/esm/execution/executionApp.js +390 -370
  12. package/lib/esm/execution/executionBase.d.ts +6 -6
  13. package/lib/esm/execution/executionBase.js +27 -13
  14. package/lib/esm/execution/executionDataConnector.d.ts +7 -4
  15. package/lib/esm/execution/executionDataConnector.js +143 -76
  16. package/lib/esm/index.d.ts +7 -7
  17. package/lib/esm/index.js +4 -4
  18. package/lib/esm/types.d.ts +23 -25
  19. package/lib/esm/types.js +5 -5
  20. package/lib/esm/utils/blockFinder.d.ts +2 -2
  21. package/lib/esm/utils/blockFinder.js +3 -3
  22. package/lib/esm/utils/consts.js +39 -39
  23. package/lib/esm/utils/pluginManager.d.ts +1 -1
  24. package/lib/esm/utils/pluginManager.js +6 -5
  25. package/lib/esm/utils/replace-old-subgraphs.js +79 -61
  26. package/lib/esm/utils/rpc.d.ts +4 -0
  27. package/lib/esm/utils/rpc.js +32 -0
  28. package/lib/esm/utils/utils.d.ts +8 -11
  29. package/lib/esm/utils/utils.js +61 -55
  30. package/lib/execution/executionApp.d.ts +18 -17
  31. package/lib/execution/executionApp.js +379 -364
  32. package/lib/execution/executionBase.d.ts +6 -6
  33. package/lib/execution/executionBase.js +27 -13
  34. package/lib/execution/executionDataConnector.d.ts +7 -4
  35. package/lib/execution/executionDataConnector.js +146 -71
  36. package/lib/index.d.ts +7 -7
  37. package/lib/index.js +1 -1
  38. package/lib/package.json +1 -0
  39. package/lib/types.d.ts +23 -25
  40. package/lib/types.js +5 -5
  41. package/lib/utils/blockFinder.d.ts +2 -2
  42. package/lib/utils/blockFinder.js +3 -3
  43. package/lib/utils/consts.js +39 -39
  44. package/lib/utils/pluginManager.d.ts +1 -1
  45. package/lib/utils/pluginManager.js +5 -4
  46. package/lib/utils/replace-old-subgraphs.js +79 -61
  47. package/lib/utils/rpc.d.ts +4 -0
  48. package/lib/utils/rpc.js +47 -0
  49. package/lib/utils/utils.d.ts +8 -11
  50. package/lib/utils/utils.js +55 -60
  51. package/package.json +22 -17
@@ -16,42 +16,40 @@ const utils_js_1 = require("../utils/utils.js");
16
16
  const executionBase_js_1 = require("./executionBase.js");
17
17
  class ExecutionApp extends executionBase_js_1.ExecutionBase {
18
18
  constructor(config) {
19
- var _a;
19
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
20
20
  super((_a = config.maxRetries) !== null && _a !== void 0 ? _a : 3);
21
- this.getSlot0 = (pool, currentExecutionContext, provider, rpc) => __awaiter(this, void 0, void 0, function* () {
21
+ this.getSlot0 = (pool, currentExecutionContext, provider) => __awaiter(this, void 0, void 0, function* () {
22
22
  const slot0Abi = [
23
23
  {
24
24
  inputs: [],
25
- name: 'slot0',
25
+ name: "slot0",
26
26
  outputs: [
27
- { internalType: 'uint160', name: 'sqrtPriceX96', type: 'uint160' },
28
- { internalType: 'int24', name: 'tick', type: 'int24' },
29
- { internalType: 'uint16', name: 'observationIndex', type: 'uint16' },
27
+ { internalType: "uint160", name: "sqrtPriceX96", type: "uint160" },
28
+ { internalType: "int24", name: "tick", type: "int24" },
29
+ { internalType: "uint16", name: "observationIndex", type: "uint16" },
30
30
  {
31
- internalType: 'uint16',
32
- name: 'observationCardinality',
33
- type: 'uint16',
31
+ internalType: "uint16",
32
+ name: "observationCardinality",
33
+ type: "uint16",
34
34
  },
35
35
  {
36
- internalType: 'uint16',
37
- name: 'observationCardinalityNext',
38
- type: 'uint16',
36
+ internalType: "uint16",
37
+ name: "observationCardinalityNext",
38
+ type: "uint16",
39
39
  },
40
- { internalType: 'uint8', name: 'feeProtocol', type: 'uint8' },
41
- { internalType: 'bool', name: 'unlocked', type: 'bool' },
40
+ { internalType: "uint8", name: "feeProtocol", type: "uint8" },
41
+ { internalType: "bool", name: "unlocked", type: "bool" },
42
42
  ],
43
- stateMutability: 'view',
44
- type: 'function',
43
+ stateMutability: "view",
44
+ type: "function",
45
45
  },
46
46
  ];
47
47
  const slot0 = yield (0, utils_js_1.readContract)({
48
48
  address: pool,
49
49
  abi: slot0Abi,
50
50
  currentExecutionContext,
51
- functionName: 'slot0',
51
+ functionName: "slot0",
52
52
  provider,
53
- rpc,
54
- chainId: this.chainId,
55
53
  });
56
54
  return {
57
55
  sqrtPriceX96: slot0[0],
@@ -63,55 +61,53 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
63
61
  unlocked: slot0[6],
64
62
  };
65
63
  });
66
- this.getSlot0Aerodrome = (pool, currentExecutionContext, provider, rpc) => __awaiter(this, void 0, void 0, function* () {
64
+ this.getSlot0Aerodrome = (pool, currentExecutionContext, provider) => __awaiter(this, void 0, void 0, function* () {
67
65
  const slot0Abi = [
68
66
  {
69
67
  inputs: [],
70
- name: 'slot0',
68
+ name: "slot0",
71
69
  outputs: [
72
70
  {
73
- internalType: 'uint160',
74
- name: 'sqrtPriceX96',
75
- type: 'uint160',
71
+ internalType: "uint160",
72
+ name: "sqrtPriceX96",
73
+ type: "uint160",
76
74
  },
77
75
  {
78
- internalType: 'int24',
79
- name: 'tick',
80
- type: 'int24',
76
+ internalType: "int24",
77
+ name: "tick",
78
+ type: "int24",
81
79
  },
82
80
  {
83
- internalType: 'uint16',
84
- name: 'observationIndex',
85
- type: 'uint16',
81
+ internalType: "uint16",
82
+ name: "observationIndex",
83
+ type: "uint16",
86
84
  },
87
85
  {
88
- internalType: 'uint16',
89
- name: 'observationCardinality',
90
- type: 'uint16',
86
+ internalType: "uint16",
87
+ name: "observationCardinality",
88
+ type: "uint16",
91
89
  },
92
90
  {
93
- internalType: 'uint16',
94
- name: 'observationCardinalityNext',
95
- type: 'uint16',
91
+ internalType: "uint16",
92
+ name: "observationCardinalityNext",
93
+ type: "uint16",
96
94
  },
97
95
  {
98
- internalType: 'bool',
99
- name: 'unlocked',
100
- type: 'bool',
96
+ internalType: "bool",
97
+ name: "unlocked",
98
+ type: "bool",
101
99
  },
102
100
  ],
103
- stateMutability: 'view',
104
- type: 'function',
101
+ stateMutability: "view",
102
+ type: "function",
105
103
  },
106
104
  ];
107
105
  const slot0 = yield (0, utils_js_1.readContract)({
108
106
  address: pool,
109
107
  abi: slot0Abi,
110
108
  currentExecutionContext,
111
- functionName: 'slot0',
109
+ functionName: "slot0",
112
110
  provider,
113
- rpc,
114
- chainId: this.chainId,
115
111
  });
116
112
  return {
117
113
  sqrtPriceX96: slot0[0],
@@ -126,317 +122,315 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
126
122
  if (this.isAlgebraIntegralPool) {
127
123
  return {
128
124
  inputs: [],
129
- name: 'globalState',
125
+ name: "globalState",
130
126
  outputs: [
131
127
  {
132
- internalType: 'uint160',
133
- name: 'price',
134
- type: 'uint160',
128
+ internalType: "uint160",
129
+ name: "price",
130
+ type: "uint160",
135
131
  },
136
132
  {
137
- internalType: 'int24',
138
- name: 'tick',
139
- type: 'int24',
133
+ internalType: "int24",
134
+ name: "tick",
135
+ type: "int24",
140
136
  },
141
137
  {
142
- internalType: 'uint16',
143
- name: 'lastFee',
144
- type: 'uint16',
138
+ internalType: "uint16",
139
+ name: "lastFee",
140
+ type: "uint16",
145
141
  },
146
142
  {
147
- internalType: 'uint8',
148
- name: 'pluginConfig',
149
- type: 'uint8',
143
+ internalType: "uint8",
144
+ name: "pluginConfig",
145
+ type: "uint8",
150
146
  },
151
147
  {
152
- internalType: 'uint16',
153
- name: 'communityFee',
154
- type: 'uint16',
148
+ internalType: "uint16",
149
+ name: "communityFee",
150
+ type: "uint16",
155
151
  },
156
152
  {
157
- internalType: 'bool',
158
- name: 'unlocked',
159
- type: 'bool',
153
+ internalType: "bool",
154
+ name: "unlocked",
155
+ type: "bool",
160
156
  },
161
157
  ],
162
- stateMutability: 'view',
163
- type: 'function',
158
+ stateMutability: "view",
159
+ type: "function",
164
160
  };
165
161
  }
166
162
  else if (this.isDirectionalPool) {
167
163
  return {
168
164
  inputs: [],
169
- name: 'globalState',
165
+ name: "globalState",
170
166
  outputs: [
171
167
  {
172
- internalType: 'uint160',
173
- name: 'price',
174
- type: 'uint160',
168
+ internalType: "uint160",
169
+ name: "price",
170
+ type: "uint160",
175
171
  },
176
172
  {
177
- internalType: 'int24',
178
- name: 'tick',
179
- type: 'int24',
173
+ internalType: "int24",
174
+ name: "tick",
175
+ type: "int24",
180
176
  },
181
177
  {
182
- internalType: 'uint16',
183
- name: 'feeZto',
184
- type: 'uint16',
178
+ internalType: "uint16",
179
+ name: "feeZto",
180
+ type: "uint16",
185
181
  },
186
182
  {
187
- internalType: 'uint16',
188
- name: 'feeOtz',
189
- type: 'uint16',
183
+ internalType: "uint16",
184
+ name: "feeOtz",
185
+ type: "uint16",
190
186
  },
191
187
  {
192
- internalType: 'uint16',
193
- name: 'timepointIndex',
194
- type: 'uint16',
188
+ internalType: "uint16",
189
+ name: "timepointIndex",
190
+ type: "uint16",
195
191
  },
196
192
  {
197
- internalType: 'uint8',
198
- name: 'communityFeeToken0',
199
- type: 'uint8',
193
+ internalType: "uint8",
194
+ name: "communityFeeToken0",
195
+ type: "uint8",
200
196
  },
201
197
  {
202
- internalType: 'uint8',
203
- name: 'communityFeeToken1',
204
- type: 'uint8',
198
+ internalType: "uint8",
199
+ name: "communityFeeToken1",
200
+ type: "uint8",
205
201
  },
206
202
  {
207
- internalType: 'bool',
208
- name: 'unlocked',
209
- type: 'bool',
203
+ internalType: "bool",
204
+ name: "unlocked",
205
+ type: "bool",
210
206
  },
211
207
  ],
212
- stateMutability: 'view',
213
- type: 'function',
208
+ stateMutability: "view",
209
+ type: "function",
214
210
  };
215
211
  }
216
212
  else if (this.isPoolSharkPool) {
217
213
  return {
218
214
  inputs: [],
219
- name: 'globalState',
215
+ name: "globalState",
220
216
  outputs: [
221
217
  {
222
218
  components: [
223
219
  {
224
220
  components: [
225
221
  {
226
- internalType: 'uint16',
227
- name: 'index',
228
- type: 'uint16',
222
+ internalType: "uint16",
223
+ name: "index",
224
+ type: "uint16",
229
225
  },
230
226
  {
231
- internalType: 'uint16',
232
- name: 'count',
233
- type: 'uint16',
227
+ internalType: "uint16",
228
+ name: "count",
229
+ type: "uint16",
234
230
  },
235
231
  {
236
- internalType: 'uint16',
237
- name: 'countMax',
238
- type: 'uint16',
232
+ internalType: "uint16",
233
+ name: "countMax",
234
+ type: "uint16",
239
235
  },
240
236
  ],
241
- internalType: 'struct PoolsharkStructs.SampleState',
242
- name: 'samples',
243
- type: 'tuple',
237
+ internalType: "struct PoolsharkStructs.SampleState",
238
+ name: "samples",
239
+ type: "tuple",
244
240
  },
245
241
  {
246
- internalType: 'uint200',
247
- name: 'feeGrowthGlobal0',
248
- type: 'uint200',
242
+ internalType: "uint200",
243
+ name: "feeGrowthGlobal0",
244
+ type: "uint200",
249
245
  },
250
246
  {
251
- internalType: 'uint200',
252
- name: 'feeGrowthGlobal1',
253
- type: 'uint200',
247
+ internalType: "uint200",
248
+ name: "feeGrowthGlobal1",
249
+ type: "uint200",
254
250
  },
255
251
  {
256
- internalType: 'uint160',
257
- name: 'secondsPerLiquidityAccum',
258
- type: 'uint160',
252
+ internalType: "uint160",
253
+ name: "secondsPerLiquidityAccum",
254
+ type: "uint160",
259
255
  },
260
256
  {
261
- internalType: 'uint160',
262
- name: 'price',
263
- type: 'uint160',
257
+ internalType: "uint160",
258
+ name: "price",
259
+ type: "uint160",
264
260
  },
265
261
  {
266
- internalType: 'uint128',
267
- name: 'liquidity',
268
- type: 'uint128',
262
+ internalType: "uint128",
263
+ name: "liquidity",
264
+ type: "uint128",
269
265
  },
270
266
  {
271
- internalType: 'int56',
272
- name: 'tickSecondsAccum',
273
- type: 'int56',
267
+ internalType: "int56",
268
+ name: "tickSecondsAccum",
269
+ type: "int56",
274
270
  },
275
271
  {
276
- internalType: 'int24',
277
- name: 'tickAtPrice',
278
- type: 'int24',
272
+ internalType: "int24",
273
+ name: "tickAtPrice",
274
+ type: "int24",
279
275
  },
280
276
  {
281
- internalType: 'uint16',
282
- name: 'protocolSwapFee0',
283
- type: 'uint16',
277
+ internalType: "uint16",
278
+ name: "protocolSwapFee0",
279
+ type: "uint16",
284
280
  },
285
281
  {
286
- internalType: 'uint16',
287
- name: 'protocolSwapFee1',
288
- type: 'uint16',
282
+ internalType: "uint16",
283
+ name: "protocolSwapFee1",
284
+ type: "uint16",
289
285
  },
290
286
  ],
291
- internalType: 'struct PoolsharkStructs.RangePoolState',
292
- name: 'pool',
293
- type: 'tuple',
287
+ internalType: "struct PoolsharkStructs.RangePoolState",
288
+ name: "pool",
289
+ type: "tuple",
294
290
  },
295
291
  {
296
292
  components: [
297
293
  {
298
- internalType: 'uint160',
299
- name: 'price',
300
- type: 'uint160',
294
+ internalType: "uint160",
295
+ name: "price",
296
+ type: "uint160",
301
297
  },
302
298
  {
303
- internalType: 'uint128',
304
- name: 'liquidity',
305
- type: 'uint128',
299
+ internalType: "uint128",
300
+ name: "liquidity",
301
+ type: "uint128",
306
302
  },
307
303
  {
308
- internalType: 'uint128',
309
- name: 'protocolFees',
310
- type: 'uint128',
304
+ internalType: "uint128",
305
+ name: "protocolFees",
306
+ type: "uint128",
311
307
  },
312
308
  {
313
- internalType: 'uint16',
314
- name: 'protocolFillFee',
315
- type: 'uint16',
309
+ internalType: "uint16",
310
+ name: "protocolFillFee",
311
+ type: "uint16",
316
312
  },
317
313
  {
318
- internalType: 'int24',
319
- name: 'tickAtPrice',
320
- type: 'int24',
314
+ internalType: "int24",
315
+ name: "tickAtPrice",
316
+ type: "int24",
321
317
  },
322
318
  ],
323
- internalType: 'struct PoolsharkStructs.LimitPoolState',
324
- name: 'pool0',
325
- type: 'tuple',
319
+ internalType: "struct PoolsharkStructs.LimitPoolState",
320
+ name: "pool0",
321
+ type: "tuple",
326
322
  },
327
323
  {
328
324
  components: [
329
325
  {
330
- internalType: 'uint160',
331
- name: 'price',
332
- type: 'uint160',
326
+ internalType: "uint160",
327
+ name: "price",
328
+ type: "uint160",
333
329
  },
334
330
  {
335
- internalType: 'uint128',
336
- name: 'liquidity',
337
- type: 'uint128',
331
+ internalType: "uint128",
332
+ name: "liquidity",
333
+ type: "uint128",
338
334
  },
339
335
  {
340
- internalType: 'uint128',
341
- name: 'protocolFees',
342
- type: 'uint128',
336
+ internalType: "uint128",
337
+ name: "protocolFees",
338
+ type: "uint128",
343
339
  },
344
340
  {
345
- internalType: 'uint16',
346
- name: 'protocolFillFee',
347
- type: 'uint16',
341
+ internalType: "uint16",
342
+ name: "protocolFillFee",
343
+ type: "uint16",
348
344
  },
349
345
  {
350
- internalType: 'int24',
351
- name: 'tickAtPrice',
352
- type: 'int24',
346
+ internalType: "int24",
347
+ name: "tickAtPrice",
348
+ type: "int24",
353
349
  },
354
350
  ],
355
- internalType: 'struct PoolsharkStructs.LimitPoolState',
356
- name: 'pool1',
357
- type: 'tuple',
351
+ internalType: "struct PoolsharkStructs.LimitPoolState",
352
+ name: "pool1",
353
+ type: "tuple",
358
354
  },
359
355
  {
360
- internalType: 'uint128',
361
- name: 'liquidityGlobal',
362
- type: 'uint128',
356
+ internalType: "uint128",
357
+ name: "liquidityGlobal",
358
+ type: "uint128",
363
359
  },
364
360
  {
365
- internalType: 'uint32',
366
- name: 'positionIdNext',
367
- type: 'uint32',
361
+ internalType: "uint32",
362
+ name: "positionIdNext",
363
+ type: "uint32",
368
364
  },
369
365
  {
370
- internalType: 'uint32',
371
- name: 'epoch',
372
- type: 'uint32',
366
+ internalType: "uint32",
367
+ name: "epoch",
368
+ type: "uint32",
373
369
  },
374
370
  {
375
- internalType: 'uint8',
376
- name: 'unlocked',
377
- type: 'uint8',
371
+ internalType: "uint8",
372
+ name: "unlocked",
373
+ type: "uint8",
378
374
  },
379
375
  ],
380
- stateMutability: 'view',
381
- type: 'function',
376
+ stateMutability: "view",
377
+ type: "function",
382
378
  };
383
379
  }
384
380
  else {
385
381
  return {
386
382
  inputs: [],
387
- name: 'globalState',
383
+ name: "globalState",
388
384
  outputs: [
389
385
  {
390
- internalType: 'uint160',
391
- name: 'price',
392
- type: 'uint160',
386
+ internalType: "uint160",
387
+ name: "price",
388
+ type: "uint160",
393
389
  },
394
390
  {
395
- internalType: 'int24',
396
- name: 'tick',
397
- type: 'int24',
391
+ internalType: "int24",
392
+ name: "tick",
393
+ type: "int24",
398
394
  },
399
395
  {
400
- internalType: 'int24',
401
- name: 'prevInitializedTick',
402
- type: 'int24',
396
+ internalType: "int24",
397
+ name: "prevInitializedTick",
398
+ type: "int24",
403
399
  },
404
400
  {
405
- internalType: 'uint16',
406
- name: 'fee',
407
- type: 'uint16',
401
+ internalType: "uint16",
402
+ name: "fee",
403
+ type: "uint16",
408
404
  },
409
405
  {
410
- internalType: 'uint16',
411
- name: 'timepointIndex',
412
- type: 'uint16',
406
+ internalType: "uint16",
407
+ name: "timepointIndex",
408
+ type: "uint16",
413
409
  },
414
410
  {
415
- internalType: 'uint8',
416
- name: 'communityFee',
417
- type: 'uint8',
411
+ internalType: "uint8",
412
+ name: "communityFee",
413
+ type: "uint8",
418
414
  },
419
415
  {
420
- internalType: 'bool',
421
- name: 'unlocked',
422
- type: 'bool',
416
+ internalType: "bool",
417
+ name: "unlocked",
418
+ type: "bool",
423
419
  },
424
420
  ],
425
- stateMutability: 'view',
426
- type: 'function',
421
+ stateMutability: "view",
422
+ type: "function",
427
423
  };
428
424
  }
429
425
  };
430
- this.getGlobalState = (pool, currentExecutionContext, provider, rpc) => __awaiter(this, void 0, void 0, function* () {
426
+ this.getGlobalState = (pool, currentExecutionContext, provider) => __awaiter(this, void 0, void 0, function* () {
431
427
  const slot0Abi = [this.getGlobalStateAbi()];
432
428
  const slot0 = yield (0, utils_js_1.readContract)({
433
429
  address: pool,
434
430
  abi: slot0Abi,
435
431
  currentExecutionContext,
436
- functionName: 'globalState',
432
+ functionName: "globalState",
437
433
  provider,
438
- rpc,
439
- chainId: this.chainId,
440
434
  });
441
435
  if (this.isPoolSharkPool) {
442
436
  return {
@@ -470,48 +464,60 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
470
464
  };
471
465
  });
472
466
  this.vault = config.vault;
473
- this.steerSubgraph = config.steerSubgraph;
467
+ this.steerSubgraph = (_b = config.steerSubgraph) !== null && _b !== void 0 ? _b : "";
474
468
  this.chainId = config.chainId;
475
- this.isAlgebraPool = config.poolType.isAlgebraPool;
476
- this.isAlgebraIntegralPool = config.poolType.isAlgebraIntegralPool;
477
- this.isDirectionalPool = config.poolType.isDirectionalPool;
478
- this.isPoolSharkPool = config.poolType.isPoolSharkPool;
479
- this.isAerodromePool = config.poolType.isAerodromePool;
480
- this.subgraphStudioKey = config.apiKeys.subgraphStudioKey;
481
- this.sentioApiKey = config.apiKeys.sentioApiKey;
469
+ this.isAlgebraPool = (_d = (_c = config.poolType) === null || _c === void 0 ? void 0 : _c.isAlgebraPool) !== null && _d !== void 0 ? _d : false;
470
+ this.isAlgebraIntegralPool =
471
+ (_f = (_e = config.poolType) === null || _e === void 0 ? void 0 : _e.isAlgebraIntegralPool) !== null && _f !== void 0 ? _f : false;
472
+ this.isDirectionalPool = (_h = (_g = config.poolType) === null || _g === void 0 ? void 0 : _g.isDirectionalPool) !== null && _h !== void 0 ? _h : false;
473
+ this.isPoolSharkPool = (_k = (_j = config.poolType) === null || _j === void 0 ? void 0 : _j.isPoolSharkPool) !== null && _k !== void 0 ? _k : false;
474
+ this.isAerodromePool = (_m = (_l = config.poolType) === null || _l === void 0 ? void 0 : _l.isAerodromePool) !== null && _m !== void 0 ? _m : false;
475
+ this.sentioApiKey = (_p = (_o = config.apiKeys) === null || _o === void 0 ? void 0 : _o.sentioApiKey) !== null && _p !== void 0 ? _p : "";
482
476
  this.config = config;
483
477
  }
484
- execute(_wasmFile, _vaultConfig, _data, _identity, _etherRpcConfig, forceDeposit) {
478
+ execute(_wasmFile, _vaultConfig, _data, rpc, forceDeposit) {
485
479
  return __awaiter(this, void 0, void 0, function* () {
486
- const dataConnector = new bundleDataConnector_js_1.DataConnector(_wasmFile, _vaultConfig, this.config, _identity, _etherRpcConfig);
480
+ if (!this.config.poolType) {
481
+ throw new Error("poolType is required by execute() for pool discovery.");
482
+ }
483
+ if (!this.steerSubgraph.trim()) {
484
+ throw new Error("steerSubgraph is required by execute() for pool discovery.");
485
+ }
486
+ const dataConnector = new bundleDataConnector_js_1.DataConnector({
487
+ wasmFile: _wasmFile,
488
+ config: _vaultConfig,
489
+ executionConfig: this.config,
490
+ rpc,
491
+ });
487
492
  yield dataConnector.loadSync();
488
493
  const executionContext = yield this.getExecutionContext(dataConnector, JSON.parse(_vaultConfig));
489
- let rpc = '';
490
- if (_etherRpcConfig) {
491
- rpc = _etherRpcConfig[this.chainId.toString()].url;
492
- }
493
- const smartPoolExecutionContext = yield this.getSmartPoolExecutionContext(executionContext, dataConnector, JSON.parse(_vaultConfig), rpc);
494
+ const smartPoolExecutionContext = yield this.getSmartPoolExecutionContext(executionContext, dataConnector, JSON.parse(_vaultConfig));
494
495
  dataConnector.setExecutionContextStrategyExecution(Object.assign(Object.assign({}, executionContext), smartPoolExecutionContext), forceDeposit);
495
496
  _data = _data.map((element) => JSON.stringify(element));
496
497
  const result = yield dataConnector.executeBundle(_data);
497
- return JSON.parse(result);
498
+ return this.parseStrategyResult(result);
498
499
  });
499
500
  }
500
501
  /**
501
- * Executes a strategy against the immutable context resolved by SDK 3.3+.
502
+ * Executes a strategy against a supplied execution context.
502
503
  * This is the recommended API for new consumers. It intentionally bypasses
503
504
  * all legacy vault, pool, subgraph, clock, and block-estimation reads.
504
505
  */
505
506
  executeWithContext(options) {
506
507
  return __awaiter(this, void 0, void 0, function* () {
507
508
  const vaultConfig = this.parseVaultConfig(options.vaultConfig);
508
- const executionContext = this.mapSdkExecutionContext(options.executionContext, vaultConfig);
509
- const dataConnector = new bundleDataConnector_js_1.DataConnector(options.wasmFile, options.vaultConfig, this.config, options.identity, options.etherRpcConfig);
509
+ this.validateExecutionContext(options.executionContext, vaultConfig);
510
+ const executionContext = Object.assign(Object.assign({}, options.executionContext), { positions: options.executionContext.positions.map((position) => (Object.assign({}, position))) });
511
+ const dataConnector = new bundleDataConnector_js_1.DataConnector({
512
+ wasmFile: options.wasmFile,
513
+ config: options.vaultConfig,
514
+ executionConfig: this.config,
515
+ });
510
516
  try {
511
517
  yield dataConnector.loadSync();
512
- dataConnector.setExecutionContextStrategyExecutionPinned(executionContext, options.forceDeposit);
518
+ dataConnector.initializeStrategyWithContext(executionContext, options.forceDeposit);
513
519
  const result = yield dataConnector.executeBundle(options.data.map((item) => JSON.stringify(item)));
514
- return JSON.parse(result);
520
+ return this.parseStrategyResult(result);
515
521
  }
516
522
  catch (error) {
517
523
  if (error instanceof types_js_1.ExecutionContextError)
@@ -520,117 +526,116 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
520
526
  }
521
527
  });
522
528
  }
529
+ /** T is the complete decoded JSON result. Only the exact sentinel skips JSON decoding. */
530
+ parseStrategyResult(result) {
531
+ if (result === "continue")
532
+ return result;
533
+ try {
534
+ return JSON.parse(result);
535
+ }
536
+ catch (error) {
537
+ throw new types_js_1.StrategyExecutionError(this.redactError(error));
538
+ }
539
+ }
523
540
  parseVaultConfig(vaultConfig) {
524
541
  try {
525
542
  return JSON.parse(vaultConfig);
526
543
  }
527
544
  catch (_a) {
528
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', 'vaultConfig must be valid JSON.');
545
+ throw new types_js_1.ExecutionContextError("INVALID_EXECUTION_CONTEXT", "vaultConfig must be valid JSON.");
529
546
  }
530
547
  }
531
- mapSdkExecutionContext(context, vaultConfig) {
548
+ validateExecutionContext(context, vaultConfig) {
532
549
  var _a;
533
- if (!context || typeof context !== 'object') {
534
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', 'A successful SDK VaultExecutionContext is required.');
550
+ if (!context || typeof context !== "object") {
551
+ throw new types_js_1.ExecutionContextError("INVALID_EXECUTION_CONTEXT", "An execution context is required.");
535
552
  }
536
- const requiredStringFields = [
537
- 'blockNumber',
538
- 'epochTimestamp',
539
- 'vaultAddress',
540
- 'totalAmount0',
541
- 'totalAmount1',
542
- ];
543
- for (const field of requiredStringFields) {
544
- if (typeof context[field] !== 'string' || context[field].length === 0) {
545
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', `SDK execution context has invalid ${field}.`);
546
- }
547
- }
548
- if (!Number.isInteger(context.chainId) ||
553
+ if (!Number.isSafeInteger(context.chainId) ||
554
+ !Number.isSafeInteger(context.blockNumber) ||
555
+ context.blockNumber < 0 ||
556
+ !Number.isSafeInteger(context.epochTimestamp) ||
557
+ context.epochTimestamp < 0 ||
558
+ !Number.isSafeInteger(context.executionTimestamp) ||
559
+ context.executionTimestamp < 0 ||
560
+ context.executionTimestamp !== context.epochTimestamp * 1000 ||
561
+ !Number.isFinite(context.epochLength) ||
562
+ !Number.isFinite(context.blockTime) ||
549
563
  !Number.isInteger(context.currentTick) ||
550
- !Number.isInteger(context.tickSpacing)) {
551
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', 'SDK execution context has invalid chain or pool state.');
552
- }
553
- if (!Array.isArray(context.positions) ||
554
- !/^\d+$/.test(context.blockNumber) ||
555
- !/^\d+$/.test(context.epochTimestamp)) {
556
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', 'SDK execution context has malformed anchor fields.');
557
- }
558
- if (!/^\d+$/.test(context.totalAmount0) || !/^\d+$/.test(context.totalAmount1)) {
559
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', 'SDK execution context totals must be decimal strings.');
564
+ !Number.isInteger(context.tickSpacing) ||
565
+ typeof context.vaultAddress !== "string" ||
566
+ context.vaultAddress.length === 0 ||
567
+ typeof context.totalAmount0 !== "string" ||
568
+ !/^\d+$/.test(context.totalAmount0) ||
569
+ typeof context.totalAmount1 !== "string" ||
570
+ !/^\d+$/.test(context.totalAmount1) ||
571
+ !Array.isArray(context.positions) ||
572
+ !Number.isFinite(context.lastExecutionTime) ||
573
+ context.lastExecutionTime < 0) {
574
+ throw new types_js_1.ExecutionContextError("INVALID_EXECUTION_CONTEXT", "Execution context is malformed.");
560
575
  }
561
576
  const sameAddress = (left, right) => (left === null || left === void 0 ? void 0 : left.toLowerCase()) === (right === null || right === void 0 ? void 0 : right.toLowerCase());
562
577
  if (!sameAddress(this.vault, context.vaultAddress) ||
563
578
  !sameAddress(vaultConfig.vaultAddress, context.vaultAddress)) {
564
- throw new types_js_1.ExecutionContextError('EXECUTION_CONTEXT_MISMATCH', 'Supplied context vault does not match the execution request.');
579
+ throw new types_js_1.ExecutionContextError("EXECUTION_CONTEXT_MISMATCH", "Supplied context vault does not match the execution request.");
565
580
  }
566
581
  if (this.chainId !== context.chainId ||
567
- (vaultConfig.chainId !== undefined && Number(vaultConfig.chainId) !== context.chainId)) {
568
- throw new types_js_1.ExecutionContextError('EXECUTION_CONTEXT_MISMATCH', 'Supplied context chain does not match the execution request.');
582
+ (vaultConfig.chainId !== undefined &&
583
+ Number(vaultConfig.chainId) !== context.chainId)) {
584
+ throw new types_js_1.ExecutionContextError("EXECUTION_CONTEXT_MISMATCH", "Supplied context chain does not match the execution request.");
569
585
  }
570
- if (vaultConfig.anchorBlockNumber !== undefined && String(vaultConfig.anchorBlockNumber) !== context.blockNumber) {
571
- throw new types_js_1.ExecutionContextError('EXECUTION_CONTEXT_MISMATCH', 'Supplied context block does not match anchorBlockNumber.');
586
+ if (vaultConfig.anchorBlockNumber !== undefined &&
587
+ String(vaultConfig.anchorBlockNumber) !== String(context.blockNumber)) {
588
+ throw new types_js_1.ExecutionContextError("EXECUTION_CONTEXT_MISMATCH", "Supplied context block does not match anchorBlockNumber.");
572
589
  }
573
- const epochLength = Number((_a = vaultConfig.strategyConfigData) === null || _a === void 0 ? void 0 : _a.epochLength);
574
- if (!Number.isFinite(epochLength)) {
575
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', 'vaultConfig.strategyConfigData.epochLength is required.');
590
+ if (Number((_a = vaultConfig.strategyConfigData) === null || _a === void 0 ? void 0 : _a.epochLength) !==
591
+ context.epochLength) {
592
+ throw new types_js_1.ExecutionContextError("EXECUTION_CONTEXT_MISMATCH", "Supplied context epoch length does not match vaultConfig.");
576
593
  }
577
594
  for (const position of context.positions) {
578
- if (!Number.isInteger(position.lowerTick) ||
579
- !Number.isInteger(position.upperTick) ||
580
- !Number.isFinite(position.relativeWeight)) {
581
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', 'SDK execution context contains an invalid position.');
595
+ if (!position ||
596
+ !Number.isInteger(position.startTick) ||
597
+ !Number.isInteger(position.endTick) ||
598
+ !Number.isFinite(position.weight)) {
599
+ throw new types_js_1.ExecutionContextError("INVALID_EXECUTION_CONTEXT", "Execution context contains an invalid position.");
582
600
  }
583
601
  }
584
- // Null is deterministic: WASM receives zero elapsed seconds, never wall-clock time.
585
- const lastExecutionTime = context.lastExecutionTimeSeconds === null ? 0 : Number(context.lastExecutionTimeSeconds);
586
- if (!Number.isFinite(lastExecutionTime) || lastExecutionTime < 0) {
587
- throw new types_js_1.ExecutionContextError('INVALID_EXECUTION_CONTEXT', 'SDK execution context has invalid lastExecutionTimeSeconds.');
588
- }
589
- return {
590
- executionTimestamp: Number(context.epochTimestamp) * 1000,
591
- epochTimestamp: Number(context.epochTimestamp),
592
- epochLength,
593
- vaultAddress: context.vaultAddress,
594
- blockTime: 0,
595
- blockNumber: Number(context.blockNumber),
596
- currentTick: context.currentTick,
597
- tickSpacing: context.tickSpacing,
598
- positions: context.positions.map(({ lowerTick, upperTick, relativeWeight }) => ({
599
- startTick: lowerTick,
600
- endTick: upperTick,
601
- weight: relativeWeight,
602
- })),
603
- totalAmount0: context.totalAmount0,
604
- totalAmount1: context.totalAmount1,
605
- lastExecutionTime,
606
- };
607
602
  }
608
603
  redactError(error) {
609
604
  const message = error instanceof Error ? error.message : String(error);
610
605
  return message
611
- .replace(/https?:\/\/[^\s@/]+(?::[^\s@/]+)?@/gi, 'https://[REDACTED]@')
612
- .replace(/([?&](?:key|token|api[_-]?key|password)=)[^&\s]+/gi, '$1[REDACTED]');
606
+ .replace(/https?:\/\/[^\s@/]+(?::[^\s@/]+)?@/gi, "https://[REDACTED]@")
607
+ .replace(/([?&](?:key|token|api[_-]?key|password)=)[^&\s]+/gi, "$1[REDACTED]");
613
608
  }
614
- executeStabilityVault(_wasmFile, _vaultConfig, _data, _identity, _etherRpcConfig, forceDeposit) {
609
+ executeStabilityVault(_wasmFile, _vaultConfig, _data, rpc, forceDeposit) {
615
610
  return __awaiter(this, void 0, void 0, function* () {
616
- const dataConnector = new bundleDataConnector_js_1.DataConnector(_wasmFile, _vaultConfig, this.config, _identity, _etherRpcConfig);
611
+ const dataConnector = new bundleDataConnector_js_1.DataConnector({
612
+ wasmFile: _wasmFile,
613
+ config: _vaultConfig,
614
+ executionConfig: this.config,
615
+ rpc,
616
+ });
617
617
  yield dataConnector.loadSync();
618
618
  const executionContext = yield this.getExecutionContext(dataConnector, JSON.parse(_vaultConfig));
619
619
  const dynamicJobExecutionContext = {};
620
620
  dataConnector.setExecutionContextStrategyExecution(Object.assign(Object.assign({}, executionContext), dynamicJobExecutionContext), forceDeposit);
621
621
  _data = _data.map((element) => JSON.stringify(element));
622
622
  const result = yield dataConnector.executeDynamicJobBundle(_data);
623
- return JSON.parse(result);
623
+ return this.parseStrategyResult(result);
624
624
  });
625
625
  }
626
- executeDynamicJobs(_wasmFile, _vaultConfig, _data, _job, _identity, _etherRpcConfig, forceDeposit) {
626
+ executeDynamicJobs(_wasmFile, _vaultConfig, _data, _job, rpc, forceDeposit) {
627
627
  return __awaiter(this, void 0, void 0, function* () {
628
- const dataConnector = new bundleDataConnector_js_1.DataConnector(_wasmFile, _vaultConfig, this.config, _identity, _etherRpcConfig);
628
+ const dataConnector = new bundleDataConnector_js_1.DataConnector({
629
+ wasmFile: _wasmFile,
630
+ config: _vaultConfig,
631
+ executionConfig: this.config,
632
+ rpc,
633
+ });
629
634
  yield dataConnector.loadSync();
630
635
  const executionContext = yield this.getExecutionContext(dataConnector, JSON.parse(_vaultConfig));
631
636
  const smartRewardsContractAddress = _job.targetAddresses[0];
632
637
  if (!smartRewardsContractAddress) {
633
- throw new Error('Dynamic job must include at least one target address');
638
+ throw new Error("Dynamic job must include at least one target address");
634
639
  }
635
640
  const dynamicJobExecutionContext = {
636
641
  smartRewardsContractAddress,
@@ -638,19 +643,21 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
638
643
  dataConnector.setExecutionContextStrategyExecution(Object.assign(Object.assign({}, executionContext), dynamicJobExecutionContext), forceDeposit);
639
644
  _data = _data.map((element) => JSON.stringify(element));
640
645
  const result = yield dataConnector.executeDynamicJobBundle(_data);
641
- return JSON.parse(result);
646
+ return this.parseStrategyResult(result);
642
647
  });
643
648
  }
644
- getSmartPoolExecutionContext(currentExecutionContext, dataConnector, vaultConfig, rpc) {
649
+ getSmartPoolExecutionContext(currentExecutionContext, dataConnector, vaultConfig) {
645
650
  var _a, _b, _c, _d, _e, _f;
646
651
  return __awaiter(this, void 0, void 0, function* () {
647
652
  const smartPoolExecutionContext = {};
648
653
  const request = {
649
- method: 'POST',
654
+ method: "POST",
650
655
  url: this.steerSubgraph,
651
- headers: Object.assign({ 'Content-Type': !this.steerSubgraph.includes('subgraph-proxy-server')
652
- ? 'application/json'
653
- : 'text/plain;charset=UTF-8' }, (this.steerSubgraph.includes('sentio') ? { 'api-key': this.sentioApiKey } : {})),
656
+ headers: Object.assign({ "Content-Type": !this.steerSubgraph.includes("subgraph-proxy-server")
657
+ ? "application/json"
658
+ : "text/plain;charset=UTF-8" }, (this.steerSubgraph.includes("sentio")
659
+ ? { "api-key": this.sentioApiKey }
660
+ : {})),
654
661
  data: {
655
662
  query: `
656
663
  {
@@ -669,13 +676,15 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
669
676
  },
670
677
  };
671
678
  const response = yield (0, utils_js_1.fetchData)(request, 4);
672
- this.log('Subgraph response vault positions :', response);
679
+ this.log("Subgraph response vault positions :", response);
673
680
  const requestSnapshot = {
674
- method: 'POST',
681
+ method: "POST",
675
682
  url: this.steerSubgraph,
676
- headers: Object.assign({ 'Content-Type': !this.steerSubgraph.includes('subgraph-proxy-server')
677
- ? 'application/json'
678
- : 'text/plain;charset=UTF-8' }, (this.steerSubgraph.includes('sentio') ? { 'api-key': this.sentioApiKey } : {})),
683
+ headers: Object.assign({ "Content-Type": !this.steerSubgraph.includes("subgraph-proxy-server")
684
+ ? "application/json"
685
+ : "text/plain;charset=UTF-8" }, (this.steerSubgraph.includes("sentio")
686
+ ? { "api-key": this.sentioApiKey }
687
+ : {})),
679
688
  data: {
680
689
  query: `
681
690
  {
@@ -691,9 +700,10 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
691
700
  },
692
701
  };
693
702
  const responseSnapshot = yield (0, utils_js_1.fetchData)(requestSnapshot, 4);
694
- this.log('Subgraph response current snapshot', responseSnapshot);
703
+ this.log("Subgraph response current snapshot", responseSnapshot);
695
704
  const positions = [];
696
- if (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.vaultPositions) && ((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.vaultPositions.length) > 0) {
705
+ if (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.vaultPositions) &&
706
+ ((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.vaultPositions.length) > 0) {
697
707
  const positionResponse = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.vaultPositions[0];
698
708
  for (let i = 0; i < positionResponse.upperTick.length; i++) {
699
709
  const position = positionResponse;
@@ -705,25 +715,31 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
705
715
  }
706
716
  }
707
717
  let lastSnapshot;
708
- if (((_d = responseSnapshot === null || responseSnapshot === void 0 ? void 0 : responseSnapshot.data) === null || _d === void 0 ? void 0 : _d.vaultSnapshots) && ((_e = responseSnapshot === null || responseSnapshot === void 0 ? void 0 : responseSnapshot.data) === null || _e === void 0 ? void 0 : _e.vaultSnapshots.length) > 0) {
718
+ if (((_d = responseSnapshot === null || responseSnapshot === void 0 ? void 0 : responseSnapshot.data) === null || _d === void 0 ? void 0 : _d.vaultSnapshots) &&
719
+ ((_e = responseSnapshot === null || responseSnapshot === void 0 ? void 0 : responseSnapshot.data) === null || _e === void 0 ? void 0 : _e.vaultSnapshots.length) > 0) {
709
720
  lastSnapshot = (_f = responseSnapshot === null || responseSnapshot === void 0 ? void 0 : responseSnapshot.data) === null || _f === void 0 ? void 0 : _f.vaultSnapshots[0];
710
721
  }
711
- this.log('Subgraph response vault positions', positions);
722
+ this.log("Subgraph response vault positions", positions);
712
723
  smartPoolExecutionContext.positions = positions;
713
724
  if (lastSnapshot) {
714
- smartPoolExecutionContext.lastExecutionTime = (Date.now() - Number(lastSnapshot.timestamp) * 1000) / 1000;
725
+ smartPoolExecutionContext.lastExecutionTime =
726
+ (Date.now() - Number(lastSnapshot.timestamp) * 1000) / 1000;
715
727
  }
716
728
  else {
717
- smartPoolExecutionContext.lastExecutionTime = currentExecutionContext.epochTimestamp;
729
+ smartPoolExecutionContext.lastExecutionTime =
730
+ currentExecutionContext.epochTimestamp;
718
731
  }
719
- const provider = dataConnector.getProvider(vaultConfig);
732
+ const provider = dataConnector.getClient();
720
733
  if (!provider) {
721
- throw new Error('Provider configuration issue, unable to process Smart Pool execution context.');
734
+ throw new Error("Provider configuration issue, unable to process Smart Pool execution context.");
735
+ }
736
+ if ((yield provider.getChainId()) !== currentExecutionContext.chainId) {
737
+ throw new Error("EXECUTION_CONTEXT_MISMATCH: provider chain does not match supplied context.");
722
738
  }
723
739
  const poolAddress = yield this.getVaultPoolAddress();
724
- const currentTick = yield this.getPoolCurrentTick(poolAddress, provider, currentExecutionContext, rpc);
725
- const tickSpacing = yield this.getTickSpacing(poolAddress, provider, rpc, currentExecutionContext);
726
- const totalAmounts = yield this.getTotalAmounts(this.vault, currentExecutionContext, provider, rpc);
740
+ const currentTick = yield this.getPoolCurrentTick(poolAddress, provider, currentExecutionContext);
741
+ const tickSpacing = yield this.getTickSpacing(poolAddress, provider, currentExecutionContext);
742
+ const totalAmounts = yield this.getTotalAmounts(this.vault, currentExecutionContext, provider);
727
743
  // Handle both bigint and serialized bigint from centralized API
728
744
  smartPoolExecutionContext.totalAmount0 = this.convertToString(totalAmounts.total0);
729
745
  smartPoolExecutionContext.totalAmount1 = this.convertToString(totalAmounts.total1);
@@ -733,61 +749,59 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
733
749
  return smartPoolExecutionContext;
734
750
  });
735
751
  }
736
- getPoolCurrentTick(poolAddress, provider, currentExecutionContext, rpc) {
752
+ getPoolCurrentTick(poolAddress, provider, currentExecutionContext) {
737
753
  return __awaiter(this, void 0, void 0, function* () {
738
754
  if (this.isAlgebraPool || this.isPoolSharkPool) {
739
- const slot0 = yield this.getGlobalState(poolAddress, currentExecutionContext, provider, rpc);
755
+ const slot0 = yield this.getGlobalState(poolAddress, currentExecutionContext, provider);
740
756
  return slot0.tick;
741
757
  }
742
758
  else if (this.isAerodromePool) {
743
- const slot0 = yield this.getSlot0Aerodrome(poolAddress, currentExecutionContext, provider, rpc);
759
+ const slot0 = yield this.getSlot0Aerodrome(poolAddress, currentExecutionContext, provider);
744
760
  return slot0.tick;
745
761
  }
746
762
  else {
747
- const slot0 = yield this.getSlot0(poolAddress, currentExecutionContext, provider, rpc);
763
+ const slot0 = yield this.getSlot0(poolAddress, currentExecutionContext, provider);
748
764
  return slot0.tick;
749
765
  }
750
766
  });
751
767
  }
752
- getTickSpacing(poolAddress, provider, rpc, currentExecutionContext) {
768
+ getTickSpacing(poolAddress, provider, currentExecutionContext) {
753
769
  return __awaiter(this, void 0, void 0, function* () {
754
770
  const tickSpacingAbi = [
755
771
  this.isPoolSharkPool
756
772
  ? {
757
773
  inputs: [],
758
- name: 'tickSpacing',
774
+ name: "tickSpacing",
759
775
  outputs: [
760
776
  {
761
- internalType: 'int24',
762
- name: '',
763
- type: 'int24',
777
+ internalType: "int24",
778
+ name: "",
779
+ type: "int24",
764
780
  },
765
781
  ],
766
- stateMutability: 'view',
767
- type: 'function',
782
+ stateMutability: "view",
783
+ type: "function",
768
784
  }
769
785
  : {
770
786
  inputs: [],
771
- name: 'tickSpacing',
787
+ name: "tickSpacing",
772
788
  outputs: [
773
789
  {
774
- internalType: 'int16',
775
- name: '',
776
- type: 'int16',
790
+ internalType: "int16",
791
+ name: "",
792
+ type: "int16",
777
793
  },
778
794
  ],
779
- stateMutability: 'pure',
780
- type: 'function',
795
+ stateMutability: "pure",
796
+ type: "function",
781
797
  },
782
798
  ];
783
799
  const tickSpacing = yield (0, utils_js_1.readContract)({
784
800
  address: poolAddress,
785
801
  abi: tickSpacingAbi,
786
802
  currentExecutionContext,
787
- functionName: 'tickSpacing',
803
+ functionName: "tickSpacing",
788
804
  provider,
789
- rpc,
790
- chainId: this.chainId,
791
805
  });
792
806
  return tickSpacing;
793
807
  });
@@ -797,17 +811,17 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
797
811
  * from the centralized API
798
812
  */
799
813
  convertToString(value) {
800
- if (typeof value === 'bigint') {
814
+ if (typeof value === "bigint") {
801
815
  return value.toString();
802
816
  }
803
- if (typeof value === 'number') {
817
+ if (typeof value === "number") {
804
818
  return value.toString();
805
819
  }
806
- if (typeof value === 'string') {
820
+ if (typeof value === "string") {
807
821
  return value;
808
822
  }
809
823
  // Handle serialized bigint from centralized API (e.g., { type: 'BigNumber', hex: '0x...' })
810
- if (value && typeof value === 'object') {
824
+ if (value && typeof value === "object") {
811
825
  // If it's a BigNumber-like object with hex property
812
826
  if (value.hex !== undefined) {
813
827
  return BigInt(value.hex).toString();
@@ -817,35 +831,34 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
817
831
  return BigInt(value._hex).toString();
818
832
  }
819
833
  // If it has toString method, try using it
820
- if (typeof value.toString === 'function' && value.toString() !== '[object Object]') {
834
+ if (typeof value.toString === "function" &&
835
+ value.toString() !== "[object Object]") {
821
836
  return value.toString();
822
837
  }
823
838
  }
824
839
  // Fallback: convert to string (may result in '[object Object]' if not handled above)
825
840
  return String(value);
826
841
  }
827
- getTotalAmounts(vaultAddress, currentExecutionContext, provider, rpc) {
842
+ getTotalAmounts(vaultAddress, currentExecutionContext, provider) {
828
843
  return __awaiter(this, void 0, void 0, function* () {
829
844
  const getTotalAmountsABI = [
830
845
  {
831
846
  inputs: [],
832
- name: 'getTotalAmounts',
847
+ name: "getTotalAmounts",
833
848
  outputs: [
834
- { internalType: 'uint256', name: 'total0', type: 'uint256' },
835
- { internalType: 'uint256', name: 'total1', type: 'uint256' },
849
+ { internalType: "uint256", name: "total0", type: "uint256" },
850
+ { internalType: "uint256", name: "total1", type: "uint256" },
836
851
  ],
837
- stateMutability: 'view',
838
- type: 'function',
852
+ stateMutability: "view",
853
+ type: "function",
839
854
  },
840
855
  ];
841
856
  const totalAmounts = yield (0, utils_js_1.readContract)({
842
857
  address: vaultAddress,
843
858
  abi: getTotalAmountsABI,
844
859
  currentExecutionContext,
845
- functionName: 'getTotalAmounts',
860
+ functionName: "getTotalAmounts",
846
861
  provider,
847
- rpc,
848
- chainId: this.chainId,
849
862
  });
850
863
  return {
851
864
  total0: totalAmounts[0],
@@ -856,7 +869,7 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
856
869
  getVaultPoolAddress() {
857
870
  return __awaiter(this, void 0, void 0, function* () {
858
871
  const requestSnapshot = {
859
- method: 'POST',
872
+ method: "POST",
860
873
  url: this.steerSubgraph,
861
874
  data: {
862
875
  query: `
@@ -868,9 +881,11 @@ class ExecutionApp extends executionBase_js_1.ExecutionBase {
868
881
  }
869
882
  `,
870
883
  },
871
- headers: Object.assign({ 'Content-Type': !this.steerSubgraph.includes('subgraph-proxy-server')
872
- ? 'application/json'
873
- : 'text/plain;charset=UTF-8' }, (this.steerSubgraph.includes('sentio') ? { 'api-key': this.sentioApiKey } : {})),
884
+ headers: Object.assign({ "Content-Type": !this.steerSubgraph.includes("subgraph-proxy-server")
885
+ ? "application/json"
886
+ : "text/plain;charset=UTF-8" }, (this.steerSubgraph.includes("sentio")
887
+ ? { "api-key": this.sentioApiKey }
888
+ : {})),
874
889
  };
875
890
  const response = yield (0, utils_js_1.fetchData)(requestSnapshot, 4);
876
891
  return response.data.vault.pool;