@paxoslabs/amplify-sdk 0.5.2 → 0.5.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.
Files changed (58) hide show
  1. package/dist/{chain-utils-BdJecHBA.d.mts → chain-utils-5r2UnCDS.d.mts} +47 -1
  2. package/dist/{chain-utils-BdJecHBA.d.ts → chain-utils-5r2UnCDS.d.ts} +47 -1
  3. package/dist/{chunk-5OK753GA.js → chunk-4NQPS3JC.js} +470 -358
  4. package/dist/chunk-4NQPS3JC.js.map +1 -0
  5. package/dist/chunk-6JLKHV6O.js +128 -0
  6. package/dist/chunk-6JLKHV6O.js.map +1 -0
  7. package/dist/{chunk-NNDY5TID.js → chunk-FHE43NKY.js} +12 -12
  8. package/dist/{chunk-NNDY5TID.js.map → chunk-FHE43NKY.js.map} +1 -1
  9. package/dist/chunk-GOJQYEJQ.js +3212 -0
  10. package/dist/chunk-GOJQYEJQ.js.map +1 -0
  11. package/dist/{chunk-HU5CTL4C.mjs → chunk-LMNADWTH.mjs} +364 -253
  12. package/dist/chunk-LMNADWTH.mjs.map +1 -0
  13. package/dist/chunk-ODXJYXUH.mjs +3168 -0
  14. package/dist/chunk-ODXJYXUH.mjs.map +1 -0
  15. package/dist/{chunk-QZHI2T7O.mjs → chunk-QMFYPHX5.mjs} +280 -47
  16. package/dist/chunk-QMFYPHX5.mjs.map +1 -0
  17. package/dist/{chunk-Q5FXJU5Y.mjs → chunk-UY2WD7MF.mjs} +3 -3
  18. package/dist/{chunk-Q5FXJU5Y.mjs.map → chunk-UY2WD7MF.mjs.map} +1 -1
  19. package/dist/chunk-WD6QFSXZ.js +701 -0
  20. package/dist/chunk-WD6QFSXZ.js.map +1 -0
  21. package/dist/chunk-Y5LBT2WT.mjs +118 -0
  22. package/dist/chunk-Y5LBT2WT.mjs.map +1 -0
  23. package/dist/core.d.mts +50 -7
  24. package/dist/core.d.ts +50 -7
  25. package/dist/core.js +32 -16
  26. package/dist/core.mjs +4 -4
  27. package/dist/display.d.mts +211 -2
  28. package/dist/display.d.ts +211 -2
  29. package/dist/display.js +26 -10
  30. package/dist/display.mjs +4 -4
  31. package/dist/{index-DXXA8gEA.d.mts → index-D8RtV9cB.d.mts} +498 -410
  32. package/dist/{index-aE5lTOUH.d.ts → index-ev_V5sjt.d.ts} +498 -410
  33. package/dist/index.d.mts +40 -5
  34. package/dist/index.d.ts +40 -5
  35. package/dist/index.js +80 -60
  36. package/dist/index.mjs +5 -5
  37. package/dist/utils.d.mts +1 -1
  38. package/dist/utils.d.ts +1 -1
  39. package/dist/utils.js +7 -7
  40. package/dist/utils.mjs +2 -2
  41. package/dist/vaults.d.mts +2 -2
  42. package/dist/vaults.d.ts +2 -2
  43. package/dist/vaults.js +25 -25
  44. package/dist/vaults.mjs +4 -4
  45. package/package.json +1 -1
  46. package/dist/chunk-5OK753GA.js.map +0 -1
  47. package/dist/chunk-7JQQ2TH4.mjs +0 -1231
  48. package/dist/chunk-7JQQ2TH4.mjs.map +0 -1
  49. package/dist/chunk-HU5CTL4C.mjs.map +0 -1
  50. package/dist/chunk-QZHI2T7O.mjs.map +0 -1
  51. package/dist/chunk-SWUG4PTB.js +0 -464
  52. package/dist/chunk-SWUG4PTB.js.map +0 -1
  53. package/dist/chunk-WK7EJRBB.mjs +0 -1482
  54. package/dist/chunk-WK7EJRBB.mjs.map +0 -1
  55. package/dist/chunk-WYBYBPX5.js +0 -1518
  56. package/dist/chunk-WYBYBPX5.js.map +0 -1
  57. package/dist/chunk-ZKDXRGI5.js +0 -1239
  58. package/dist/chunk-ZKDXRGI5.js.map +0 -1
@@ -0,0 +1,3168 @@
1
+ import { defineChain, createPublicClient, http, zeroAddress, maxUint256 } from 'viem';
2
+ import { baseSepolia, base, sepolia, mainnet } from 'viem/chains';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+
8
+ // src/abi/distributor-code-depositor-abi-v0.ts
9
+ var DistributorCodeDepositorAbiV0 = [
10
+ {
11
+ inputs: [
12
+ {
13
+ internalType: "contract TellerWithMultiAssetSupport",
14
+ name: "_teller",
15
+ type: "address"
16
+ },
17
+ {
18
+ internalType: "contract INativeWrapper",
19
+ name: "_nativeWrapper",
20
+ type: "address"
21
+ },
22
+ {
23
+ internalType: "contract Authority",
24
+ name: "_rolesAuthority",
25
+ type: "address"
26
+ },
27
+ { internalType: "bool", name: "_isNativeDepositSupported", type: "bool" },
28
+ { internalType: "address", name: "_owner", type: "address" }
29
+ ],
30
+ stateMutability: "nonpayable",
31
+ type: "constructor"
32
+ },
33
+ { inputs: [], name: "IncorrectNativeDepositAmount", type: "error" },
34
+ { inputs: [], name: "NativeDepositNotSupported", type: "error" },
35
+ {
36
+ inputs: [],
37
+ name: "NativeWrapperAccountantDecimalsMismatch",
38
+ type: "error"
39
+ },
40
+ { inputs: [], name: "PermitFailedAndAllowanceTooLow", type: "error" },
41
+ { inputs: [], name: "ZeroAddress", type: "error" },
42
+ {
43
+ anonymous: false,
44
+ inputs: [
45
+ { indexed: true, internalType: "address", name: "user", type: "address" },
46
+ {
47
+ indexed: true,
48
+ internalType: "contract Authority",
49
+ name: "newAuthority",
50
+ type: "address"
51
+ }
52
+ ],
53
+ name: "AuthorityUpdated",
54
+ type: "event"
55
+ },
56
+ {
57
+ anonymous: false,
58
+ inputs: [
59
+ {
60
+ indexed: true,
61
+ internalType: "address",
62
+ name: "depositor",
63
+ type: "address"
64
+ },
65
+ {
66
+ indexed: true,
67
+ internalType: "contract ERC20",
68
+ name: "depositAsset",
69
+ type: "address"
70
+ },
71
+ {
72
+ indexed: false,
73
+ internalType: "uint256",
74
+ name: "depositAmount",
75
+ type: "uint256"
76
+ },
77
+ {
78
+ indexed: false,
79
+ internalType: "uint256",
80
+ name: "minimumMint",
81
+ type: "uint256"
82
+ },
83
+ { indexed: false, internalType: "address", name: "to", type: "address" },
84
+ {
85
+ indexed: false,
86
+ internalType: "bytes32",
87
+ name: "depositHash",
88
+ type: "bytes32"
89
+ },
90
+ {
91
+ indexed: true,
92
+ internalType: "bytes",
93
+ name: "distributorCode",
94
+ type: "bytes"
95
+ }
96
+ ],
97
+ name: "DepositWithDistributorCode",
98
+ type: "event"
99
+ },
100
+ {
101
+ anonymous: false,
102
+ inputs: [
103
+ { indexed: true, internalType: "address", name: "user", type: "address" },
104
+ {
105
+ indexed: true,
106
+ internalType: "address",
107
+ name: "newOwner",
108
+ type: "address"
109
+ }
110
+ ],
111
+ name: "OwnershipTransferred",
112
+ type: "event"
113
+ },
114
+ {
115
+ inputs: [],
116
+ name: "authority",
117
+ outputs: [
118
+ { internalType: "contract Authority", name: "", type: "address" }
119
+ ],
120
+ stateMutability: "view",
121
+ type: "function"
122
+ },
123
+ {
124
+ inputs: [],
125
+ name: "boringVault",
126
+ outputs: [{ internalType: "address", name: "", type: "address" }],
127
+ stateMutability: "view",
128
+ type: "function"
129
+ },
130
+ {
131
+ inputs: [
132
+ { internalType: "contract ERC20", name: "depositAsset", type: "address" },
133
+ { internalType: "uint256", name: "depositAmount", type: "uint256" },
134
+ { internalType: "uint256", name: "minimumMint", type: "uint256" },
135
+ { internalType: "address", name: "to", type: "address" },
136
+ { internalType: "bytes", name: "distributorCode", type: "bytes" }
137
+ ],
138
+ name: "deposit",
139
+ outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
140
+ stateMutability: "nonpayable",
141
+ type: "function"
142
+ },
143
+ {
144
+ inputs: [
145
+ { internalType: "uint256", name: "depositAmount", type: "uint256" },
146
+ { internalType: "uint256", name: "minimumMint", type: "uint256" },
147
+ { internalType: "address", name: "to", type: "address" },
148
+ { internalType: "bytes", name: "distributorCode", type: "bytes" }
149
+ ],
150
+ name: "depositNative",
151
+ outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
152
+ stateMutability: "payable",
153
+ type: "function"
154
+ },
155
+ {
156
+ inputs: [],
157
+ name: "depositNonce",
158
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
159
+ stateMutability: "view",
160
+ type: "function"
161
+ },
162
+ {
163
+ inputs: [
164
+ { internalType: "contract ERC20", name: "depositAsset", type: "address" },
165
+ { internalType: "uint256", name: "depositAmount", type: "uint256" },
166
+ { internalType: "uint256", name: "minimumMint", type: "uint256" },
167
+ { internalType: "address", name: "to", type: "address" },
168
+ { internalType: "bytes", name: "distributorCode", type: "bytes" },
169
+ { internalType: "uint256", name: "deadline", type: "uint256" },
170
+ { internalType: "uint8", name: "v", type: "uint8" },
171
+ { internalType: "bytes32", name: "r", type: "bytes32" },
172
+ { internalType: "bytes32", name: "s", type: "bytes32" }
173
+ ],
174
+ name: "depositWithPermit",
175
+ outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
176
+ stateMutability: "nonpayable",
177
+ type: "function"
178
+ },
179
+ {
180
+ inputs: [],
181
+ name: "feeModule",
182
+ outputs: [
183
+ { internalType: "contract IFeeModule", name: "", type: "address" }
184
+ ],
185
+ stateMutability: "view",
186
+ type: "function"
187
+ },
188
+ {
189
+ inputs: [],
190
+ name: "feeRecipient",
191
+ outputs: [{ internalType: "address", name: "", type: "address" }],
192
+ stateMutability: "view",
193
+ type: "function"
194
+ },
195
+ {
196
+ inputs: [],
197
+ name: "isNativeDepositSupported",
198
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
199
+ stateMutability: "view",
200
+ type: "function"
201
+ },
202
+ {
203
+ inputs: [],
204
+ name: "nativeWrapper",
205
+ outputs: [
206
+ { internalType: "contract INativeWrapper", name: "", type: "address" }
207
+ ],
208
+ stateMutability: "view",
209
+ type: "function"
210
+ },
211
+ {
212
+ inputs: [],
213
+ name: "owner",
214
+ outputs: [{ internalType: "address", name: "", type: "address" }],
215
+ stateMutability: "view",
216
+ type: "function"
217
+ },
218
+ {
219
+ inputs: [],
220
+ name: "supplyCapInBase",
221
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
222
+ stateMutability: "view",
223
+ type: "function"
224
+ },
225
+ {
226
+ inputs: [
227
+ {
228
+ internalType: "contract Authority",
229
+ name: "newAuthority",
230
+ type: "address"
231
+ }
232
+ ],
233
+ name: "setAuthority",
234
+ outputs: [],
235
+ stateMutability: "nonpayable",
236
+ type: "function"
237
+ },
238
+ {
239
+ inputs: [],
240
+ name: "teller",
241
+ outputs: [
242
+ {
243
+ internalType: "contract TellerWithMultiAssetSupport",
244
+ name: "",
245
+ type: "address"
246
+ }
247
+ ],
248
+ stateMutability: "view",
249
+ type: "function"
250
+ },
251
+ {
252
+ inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
253
+ name: "transferOwnership",
254
+ outputs: [],
255
+ stateMutability: "nonpayable",
256
+ type: "function"
257
+ }
258
+ ];
259
+
260
+ // src/abi/fee-module-abi.ts
261
+ var DCDAssetSpecificFeeModuleAbi = [
262
+ {
263
+ inputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
264
+ name: "depositTokenFeeData",
265
+ outputs: [
266
+ { internalType: "uint256", name: "feePercentage", type: "uint256" },
267
+ { internalType: "uint256", name: "flatFee", type: "uint256" }
268
+ ],
269
+ stateMutability: "view",
270
+ type: "function"
271
+ },
272
+ {
273
+ inputs: [],
274
+ name: "ONE_HUNDRED_PERCENT",
275
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
276
+ stateMutability: "view",
277
+ type: "function"
278
+ }
279
+ ];
280
+ var FeeModuleAbi = [
281
+ {
282
+ inputs: [
283
+ { internalType: "uint256", name: "_offerFeePercentage", type: "uint256" }
284
+ ],
285
+ stateMutability: "nonpayable",
286
+ type: "constructor"
287
+ },
288
+ {
289
+ inputs: [
290
+ { internalType: "uint256", name: "feePercentage", type: "uint256" },
291
+ { internalType: "uint256", name: "maxAllowed", type: "uint256" }
292
+ ],
293
+ name: "FeePercentageTooHigh",
294
+ type: "error"
295
+ },
296
+ {
297
+ inputs: [
298
+ { internalType: "uint256", name: "amount", type: "uint256" },
299
+ { internalType: "contract IERC20", name: "offerAsset", type: "address" },
300
+ { internalType: "contract IERC20", name: "wantAsset", type: "address" },
301
+ { internalType: "address", name: "receiver", type: "address" }
302
+ ],
303
+ name: "calculateOfferFees",
304
+ outputs: [{ internalType: "uint256", name: "feeAmount", type: "uint256" }],
305
+ stateMutability: "view",
306
+ type: "function"
307
+ },
308
+ {
309
+ inputs: [],
310
+ name: "offerFeePercentage",
311
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
312
+ stateMutability: "view",
313
+ type: "function"
314
+ }
315
+ ];
316
+
317
+ // src/abi/withdraw-queue-abi.ts
318
+ var WithdrawQueueAbi = [
319
+ {
320
+ inputs: [
321
+ { internalType: "string", name: "_name", type: "string" },
322
+ { internalType: "string", name: "_symbol", type: "string" },
323
+ { internalType: "address", name: "_feeRecipient", type: "address" },
324
+ {
325
+ internalType: "contract TellerWithMultiAssetSupport",
326
+ name: "_tellerWithMultiAssetSupport",
327
+ type: "address"
328
+ },
329
+ {
330
+ internalType: "contract IFeeModule",
331
+ name: "_feeModule",
332
+ type: "address"
333
+ },
334
+ { internalType: "uint256", name: "_minimumOrderSize", type: "uint256" },
335
+ { internalType: "address", name: "_owner", type: "address" }
336
+ ],
337
+ stateMutability: "nonpayable",
338
+ type: "constructor"
339
+ },
340
+ { inputs: [], name: "ECDSAInvalidSignature", type: "error" },
341
+ {
342
+ inputs: [{ internalType: "uint256", name: "length", type: "uint256" }],
343
+ name: "ECDSAInvalidSignatureLength",
344
+ type: "error"
345
+ },
346
+ {
347
+ inputs: [{ internalType: "bytes32", name: "s", type: "bytes32" }],
348
+ name: "ECDSAInvalidSignatureS",
349
+ type: "error"
350
+ },
351
+ { inputs: [], name: "ERC721EnumerableForbiddenBatchMint", type: "error" },
352
+ {
353
+ inputs: [
354
+ { internalType: "address", name: "sender", type: "address" },
355
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
356
+ { internalType: "address", name: "owner", type: "address" }
357
+ ],
358
+ name: "ERC721IncorrectOwner",
359
+ type: "error"
360
+ },
361
+ {
362
+ inputs: [
363
+ { internalType: "address", name: "operator", type: "address" },
364
+ { internalType: "uint256", name: "tokenId", type: "uint256" }
365
+ ],
366
+ name: "ERC721InsufficientApproval",
367
+ type: "error"
368
+ },
369
+ {
370
+ inputs: [{ internalType: "address", name: "approver", type: "address" }],
371
+ name: "ERC721InvalidApprover",
372
+ type: "error"
373
+ },
374
+ {
375
+ inputs: [{ internalType: "address", name: "operator", type: "address" }],
376
+ name: "ERC721InvalidOperator",
377
+ type: "error"
378
+ },
379
+ {
380
+ inputs: [{ internalType: "address", name: "owner", type: "address" }],
381
+ name: "ERC721InvalidOwner",
382
+ type: "error"
383
+ },
384
+ {
385
+ inputs: [{ internalType: "address", name: "receiver", type: "address" }],
386
+ name: "ERC721InvalidReceiver",
387
+ type: "error"
388
+ },
389
+ {
390
+ inputs: [{ internalType: "address", name: "sender", type: "address" }],
391
+ name: "ERC721InvalidSender",
392
+ type: "error"
393
+ },
394
+ {
395
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
396
+ name: "ERC721NonexistentToken",
397
+ type: "error"
398
+ },
399
+ {
400
+ inputs: [
401
+ { internalType: "address", name: "owner", type: "address" },
402
+ { internalType: "uint256", name: "index", type: "uint256" }
403
+ ],
404
+ name: "ERC721OutOfBoundsIndex",
405
+ type: "error"
406
+ },
407
+ {
408
+ inputs: [{ internalType: "address", name: "token", type: "address" }],
409
+ name: "SafeERC20FailedOperation",
410
+ type: "error"
411
+ },
412
+ { inputs: [], name: "Unauthorized", type: "error" },
413
+ { inputs: [], name: "ZeroAddress", type: "error" },
414
+ {
415
+ inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
416
+ name: "OrderAlreadyProcessed",
417
+ type: "error"
418
+ },
419
+ {
420
+ inputs: [
421
+ { internalType: "uint256", name: "orderIndex", type: "uint256" },
422
+ {
423
+ internalType: "enum WithdrawQueue.OrderType",
424
+ name: "currentStatus",
425
+ type: "uint8"
426
+ }
427
+ ],
428
+ name: "InvalidOrderType",
429
+ type: "error"
430
+ },
431
+ {
432
+ inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
433
+ name: "InvalidOrderIndex",
434
+ type: "error"
435
+ },
436
+ {
437
+ inputs: [
438
+ { internalType: "uint256", name: "amount", type: "uint256" },
439
+ { internalType: "uint256", name: "minimum", type: "uint256" }
440
+ ],
441
+ name: "AmountBelowMinimum",
442
+ type: "error"
443
+ },
444
+ {
445
+ inputs: [
446
+ { internalType: "uint256", name: "deadline", type: "uint256" },
447
+ { internalType: "uint256", name: "currentTimestamp", type: "uint256" }
448
+ ],
449
+ name: "SignatureExpired",
450
+ type: "error"
451
+ },
452
+ {
453
+ inputs: [
454
+ { internalType: "uint256", name: "ordersToProcess", type: "uint256" },
455
+ { internalType: "uint256", name: "latestOrder", type: "uint256" }
456
+ ],
457
+ name: "NotEnoughOrdersToProcess",
458
+ type: "error"
459
+ },
460
+ {
461
+ inputs: [
462
+ { internalType: "uint256", name: "ordersToProcess", type: "uint256" }
463
+ ],
464
+ name: "InvalidOrdersCount",
465
+ type: "error"
466
+ },
467
+ {
468
+ inputs: [
469
+ { internalType: "address", name: "intendedDepositor", type: "address" },
470
+ { internalType: "address", name: "depositor", type: "address" }
471
+ ],
472
+ name: "InvalidEip2612Signature",
473
+ type: "error"
474
+ },
475
+ {
476
+ inputs: [
477
+ { internalType: "address", name: "intendedDepositor", type: "address" },
478
+ { internalType: "address", name: "depositor", type: "address" }
479
+ ],
480
+ name: "InvalidDepositor",
481
+ type: "error"
482
+ },
483
+ { inputs: [], name: "PermitFailedAndAllowanceTooLow", type: "error" },
484
+ { inputs: [], name: "TellerVaultMissmatch", type: "error" },
485
+ {
486
+ inputs: [
487
+ { internalType: "address", name: "attemptedToCancel", type: "address" },
488
+ { internalType: "address", name: "orderOwner", type: "address" }
489
+ ],
490
+ name: "OnlyOrderOwnerCanCancel",
491
+ type: "error"
492
+ },
493
+ { inputs: [], name: "QueueMustBeEmpty", type: "error" },
494
+ {
495
+ inputs: [
496
+ { internalType: "contract IERC20", name: "asset", type: "address" }
497
+ ],
498
+ name: "AssetNotSupported",
499
+ type: "error"
500
+ },
501
+ { inputs: [], name: "InvalidAssetsOut", type: "error" },
502
+ { inputs: [], name: "EmptyArray", type: "error" },
503
+ {
504
+ inputs: [
505
+ { internalType: "contract IERC20", name: "wantAsset", type: "address" },
506
+ { internalType: "uint256", name: "expectedAssetsOut", type: "uint256" },
507
+ {
508
+ internalType: "uint256",
509
+ name: "vaultBalanceOfWantAsset",
510
+ type: "uint256"
511
+ }
512
+ ],
513
+ name: "VaultInsufficientBalance",
514
+ type: "error"
515
+ },
516
+ { inputs: [], name: "TellerIsPaused", type: "error" },
517
+ {
518
+ anonymous: false,
519
+ inputs: [
520
+ {
521
+ indexed: true,
522
+ internalType: "address",
523
+ name: "owner",
524
+ type: "address"
525
+ },
526
+ {
527
+ indexed: true,
528
+ internalType: "address",
529
+ name: "approved",
530
+ type: "address"
531
+ },
532
+ {
533
+ indexed: true,
534
+ internalType: "uint256",
535
+ name: "tokenId",
536
+ type: "uint256"
537
+ }
538
+ ],
539
+ name: "Approval",
540
+ type: "event"
541
+ },
542
+ {
543
+ anonymous: false,
544
+ inputs: [
545
+ {
546
+ indexed: true,
547
+ internalType: "address",
548
+ name: "owner",
549
+ type: "address"
550
+ },
551
+ {
552
+ indexed: true,
553
+ internalType: "address",
554
+ name: "operator",
555
+ type: "address"
556
+ },
557
+ { indexed: false, internalType: "bool", name: "approved", type: "bool" }
558
+ ],
559
+ name: "ApprovalForAll",
560
+ type: "event"
561
+ },
562
+ {
563
+ anonymous: false,
564
+ inputs: [
565
+ {
566
+ indexed: true,
567
+ internalType: "address",
568
+ name: "user",
569
+ type: "address"
570
+ },
571
+ {
572
+ indexed: true,
573
+ internalType: "address",
574
+ name: "newAuthority",
575
+ type: "address"
576
+ }
577
+ ],
578
+ name: "AuthorityUpdated",
579
+ type: "event"
580
+ },
581
+ {
582
+ anonymous: false,
583
+ inputs: [
584
+ {
585
+ indexed: true,
586
+ internalType: "contract IFeeModule",
587
+ name: "oldFeeModule",
588
+ type: "address"
589
+ },
590
+ {
591
+ indexed: true,
592
+ internalType: "contract IFeeModule",
593
+ name: "newFeeModule",
594
+ type: "address"
595
+ }
596
+ ],
597
+ name: "FeeModuleUpdated",
598
+ type: "event"
599
+ },
600
+ {
601
+ anonymous: false,
602
+ inputs: [
603
+ {
604
+ indexed: true,
605
+ internalType: "address",
606
+ name: "oldFeeRecipient",
607
+ type: "address"
608
+ },
609
+ {
610
+ indexed: true,
611
+ internalType: "address",
612
+ name: "newFeeRecipient",
613
+ type: "address"
614
+ }
615
+ ],
616
+ name: "FeeRecipientUpdated",
617
+ type: "event"
618
+ },
619
+ {
620
+ anonymous: false,
621
+ inputs: [
622
+ {
623
+ indexed: false,
624
+ internalType: "uint256",
625
+ name: "oldMinimum",
626
+ type: "uint256"
627
+ },
628
+ {
629
+ indexed: false,
630
+ internalType: "uint256",
631
+ name: "newMinimum",
632
+ type: "uint256"
633
+ }
634
+ ],
635
+ name: "MinimumOrderSizeUpdated",
636
+ type: "event"
637
+ },
638
+ {
639
+ anonymous: false,
640
+ inputs: [
641
+ {
642
+ indexed: true,
643
+ internalType: "uint256",
644
+ name: "orderIndex",
645
+ type: "uint256"
646
+ },
647
+ {
648
+ components: [
649
+ { internalType: "uint256", name: "amountOffer", type: "uint256" },
650
+ {
651
+ internalType: "contract IERC20",
652
+ name: "wantAsset",
653
+ type: "address"
654
+ },
655
+ { internalType: "address", name: "refundReceiver", type: "address" },
656
+ {
657
+ internalType: "enum WithdrawQueue.OrderType",
658
+ name: "orderType",
659
+ type: "uint8"
660
+ },
661
+ {
662
+ internalType: "bool",
663
+ name: "didOrderFailTransfer",
664
+ type: "bool"
665
+ }
666
+ ],
667
+ indexed: false,
668
+ internalType: "struct WithdrawQueue.Order",
669
+ name: "order",
670
+ type: "tuple"
671
+ },
672
+ {
673
+ indexed: true,
674
+ internalType: "address",
675
+ name: "receiver",
676
+ type: "address"
677
+ },
678
+ {
679
+ indexed: true,
680
+ internalType: "address",
681
+ name: "depositor",
682
+ type: "address"
683
+ },
684
+ {
685
+ indexed: false,
686
+ internalType: "bool",
687
+ name: "isSubmittedViaSignature",
688
+ type: "bool"
689
+ }
690
+ ],
691
+ name: "OrderSubmitted",
692
+ type: "event"
693
+ },
694
+ {
695
+ anonymous: false,
696
+ inputs: [
697
+ {
698
+ indexed: true,
699
+ internalType: "uint256",
700
+ name: "startIndex",
701
+ type: "uint256"
702
+ },
703
+ {
704
+ indexed: true,
705
+ internalType: "uint256",
706
+ name: "endIndex",
707
+ type: "uint256"
708
+ }
709
+ ],
710
+ name: "OrdersProcessedInRange",
711
+ type: "event"
712
+ },
713
+ {
714
+ anonymous: false,
715
+ inputs: [
716
+ {
717
+ indexed: true,
718
+ internalType: "uint256",
719
+ name: "orderIndex",
720
+ type: "uint256"
721
+ },
722
+ {
723
+ components: [
724
+ { internalType: "uint256", name: "amountOffer", type: "uint256" },
725
+ {
726
+ internalType: "contract IERC20",
727
+ name: "wantAsset",
728
+ type: "address"
729
+ },
730
+ { internalType: "address", name: "refundReceiver", type: "address" },
731
+ {
732
+ internalType: "enum WithdrawQueue.OrderType",
733
+ name: "orderType",
734
+ type: "uint8"
735
+ },
736
+ {
737
+ internalType: "bool",
738
+ name: "didOrderFailTransfer",
739
+ type: "bool"
740
+ }
741
+ ],
742
+ indexed: false,
743
+ internalType: "struct WithdrawQueue.Order",
744
+ name: "order",
745
+ type: "tuple"
746
+ },
747
+ {
748
+ indexed: true,
749
+ internalType: "address",
750
+ name: "receiver",
751
+ type: "address"
752
+ },
753
+ {
754
+ indexed: true,
755
+ internalType: "bool",
756
+ name: "isForceProcessed",
757
+ type: "bool"
758
+ }
759
+ ],
760
+ name: "OrderProcessed",
761
+ type: "event"
762
+ },
763
+ {
764
+ anonymous: false,
765
+ inputs: [
766
+ {
767
+ indexed: true,
768
+ internalType: "uint256",
769
+ name: "orderIndex",
770
+ type: "uint256"
771
+ },
772
+ {
773
+ components: [
774
+ { internalType: "uint256", name: "amountOffer", type: "uint256" },
775
+ {
776
+ internalType: "contract IERC20",
777
+ name: "wantAsset",
778
+ type: "address"
779
+ },
780
+ { internalType: "address", name: "refundReceiver", type: "address" },
781
+ {
782
+ internalType: "enum WithdrawQueue.OrderType",
783
+ name: "orderType",
784
+ type: "uint8"
785
+ },
786
+ {
787
+ internalType: "bool",
788
+ name: "didOrderFailTransfer",
789
+ type: "bool"
790
+ }
791
+ ],
792
+ indexed: false,
793
+ internalType: "struct WithdrawQueue.Order",
794
+ name: "order",
795
+ type: "tuple"
796
+ }
797
+ ],
798
+ name: "OrderRefunded",
799
+ type: "event"
800
+ },
801
+ {
802
+ anonymous: false,
803
+ inputs: [
804
+ {
805
+ indexed: true,
806
+ internalType: "uint256",
807
+ name: "orderIndex",
808
+ type: "uint256"
809
+ },
810
+ {
811
+ indexed: true,
812
+ internalType: "bool",
813
+ name: "isMarkedByUser",
814
+ type: "bool"
815
+ }
816
+ ],
817
+ name: "OrderMarkedForRefund",
818
+ type: "event"
819
+ },
820
+ {
821
+ anonymous: false,
822
+ inputs: [
823
+ {
824
+ indexed: true,
825
+ internalType: "address",
826
+ name: "user",
827
+ type: "address"
828
+ },
829
+ {
830
+ indexed: true,
831
+ internalType: "address",
832
+ name: "newOwner",
833
+ type: "address"
834
+ }
835
+ ],
836
+ name: "OwnershipTransferred",
837
+ type: "event"
838
+ },
839
+ {
840
+ anonymous: false,
841
+ inputs: [
842
+ {
843
+ indexed: true,
844
+ internalType: "contract TellerWithMultiAssetSupport",
845
+ name: "oldTeller",
846
+ type: "address"
847
+ },
848
+ {
849
+ indexed: true,
850
+ internalType: "contract TellerWithMultiAssetSupport",
851
+ name: "newTeller",
852
+ type: "address"
853
+ }
854
+ ],
855
+ name: "TellerUpdated",
856
+ type: "event"
857
+ },
858
+ {
859
+ anonymous: false,
860
+ inputs: [
861
+ {
862
+ indexed: true,
863
+ internalType: "address",
864
+ name: "from",
865
+ type: "address"
866
+ },
867
+ { indexed: true, internalType: "address", name: "to", type: "address" },
868
+ {
869
+ indexed: true,
870
+ internalType: "uint256",
871
+ name: "tokenId",
872
+ type: "uint256"
873
+ }
874
+ ],
875
+ name: "Transfer",
876
+ type: "event"
877
+ },
878
+ {
879
+ inputs: [],
880
+ name: "CANCEL_ORDER_TYPEHASH",
881
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
882
+ stateMutability: "view",
883
+ type: "function"
884
+ },
885
+ {
886
+ inputs: [],
887
+ name: "authority",
888
+ outputs: [
889
+ { internalType: "contract Authority", name: "", type: "address" }
890
+ ],
891
+ stateMutability: "view",
892
+ type: "function"
893
+ },
894
+ {
895
+ inputs: [{ internalType: "address", name: "owner", type: "address" }],
896
+ name: "balanceOf",
897
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
898
+ stateMutability: "view",
899
+ type: "function"
900
+ },
901
+ {
902
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
903
+ name: "ownerOf",
904
+ outputs: [{ internalType: "address", name: "", type: "address" }],
905
+ stateMutability: "view",
906
+ type: "function"
907
+ },
908
+ {
909
+ inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
910
+ name: "cancelOrder",
911
+ outputs: [],
912
+ stateMutability: "nonpayable",
913
+ type: "function"
914
+ },
915
+ {
916
+ inputs: [
917
+ { internalType: "uint256", name: "orderIndex", type: "uint256" },
918
+ { internalType: "uint256", name: "deadline", type: "uint256" },
919
+ { internalType: "bytes", name: "cancelSignature", type: "bytes" }
920
+ ],
921
+ name: "cancelOrderWithSignature",
922
+ outputs: [],
923
+ stateMutability: "nonpayable",
924
+ type: "function"
925
+ },
926
+ {
927
+ inputs: [],
928
+ name: "feeModule",
929
+ outputs: [
930
+ { internalType: "contract IFeeModule", name: "", type: "address" }
931
+ ],
932
+ stateMutability: "view",
933
+ type: "function"
934
+ },
935
+ {
936
+ inputs: [],
937
+ name: "feeRecipient",
938
+ outputs: [{ internalType: "address", name: "", type: "address" }],
939
+ stateMutability: "view",
940
+ type: "function"
941
+ },
942
+ {
943
+ inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
944
+ name: "forceProcess",
945
+ outputs: [],
946
+ stateMutability: "nonpayable",
947
+ type: "function"
948
+ },
949
+ {
950
+ inputs: [
951
+ { internalType: "uint256[]", name: "orderIndices", type: "uint256[]" }
952
+ ],
953
+ name: "forceProcessOrders",
954
+ outputs: [],
955
+ stateMutability: "nonpayable",
956
+ type: "function"
957
+ },
958
+ {
959
+ inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
960
+ name: "getOrderStatus",
961
+ outputs: [
962
+ {
963
+ internalType: "enum WithdrawQueue.OrderStatus",
964
+ name: "",
965
+ type: "uint8"
966
+ }
967
+ ],
968
+ stateMutability: "view",
969
+ type: "function"
970
+ },
971
+ {
972
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
973
+ name: "getApproved",
974
+ outputs: [{ internalType: "address", name: "", type: "address" }],
975
+ stateMutability: "view",
976
+ type: "function"
977
+ },
978
+ {
979
+ inputs: [],
980
+ name: "lastProcessedOrder",
981
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
982
+ stateMutability: "view",
983
+ type: "function"
984
+ },
985
+ {
986
+ inputs: [],
987
+ name: "latestOrder",
988
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
989
+ stateMutability: "view",
990
+ type: "function"
991
+ },
992
+ {
993
+ inputs: [
994
+ { internalType: "contract IERC20", name: "token", type: "address" },
995
+ { internalType: "uint256", name: "amount", type: "uint256" },
996
+ { internalType: "address", name: "receiver", type: "address" }
997
+ ],
998
+ name: "manageERC20",
999
+ outputs: [],
1000
+ stateMutability: "nonpayable",
1001
+ type: "function"
1002
+ },
1003
+ {
1004
+ inputs: [],
1005
+ name: "minimumOrderSize",
1006
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1007
+ stateMutability: "view",
1008
+ type: "function"
1009
+ },
1010
+ {
1011
+ inputs: [],
1012
+ name: "name",
1013
+ outputs: [{ internalType: "string", name: "", type: "string" }],
1014
+ stateMutability: "view",
1015
+ type: "function"
1016
+ },
1017
+ {
1018
+ inputs: [{ internalType: "address", name: "", type: "address" }],
1019
+ name: "nonces",
1020
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1021
+ stateMutability: "view",
1022
+ type: "function"
1023
+ },
1024
+ {
1025
+ inputs: [],
1026
+ name: "offerAsset",
1027
+ outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
1028
+ stateMutability: "view",
1029
+ type: "function"
1030
+ },
1031
+ {
1032
+ inputs: [],
1033
+ name: "owner",
1034
+ outputs: [{ internalType: "address", name: "", type: "address" }],
1035
+ stateMutability: "view",
1036
+ type: "function"
1037
+ },
1038
+ {
1039
+ inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1040
+ name: "orderAtQueueIndex",
1041
+ outputs: [
1042
+ {
1043
+ components: [
1044
+ { internalType: "uint256", name: "amountOffer", type: "uint256" },
1045
+ {
1046
+ internalType: "contract IERC20",
1047
+ name: "wantAsset",
1048
+ type: "address"
1049
+ },
1050
+ { internalType: "address", name: "refundReceiver", type: "address" },
1051
+ {
1052
+ internalType: "enum WithdrawQueue.OrderType",
1053
+ name: "orderType",
1054
+ type: "uint8"
1055
+ },
1056
+ {
1057
+ internalType: "bool",
1058
+ name: "didOrderFailTransfer",
1059
+ type: "bool"
1060
+ }
1061
+ ],
1062
+ internalType: "struct WithdrawQueue.Order",
1063
+ name: "",
1064
+ type: "tuple"
1065
+ }
1066
+ ],
1067
+ stateMutability: "view",
1068
+ type: "function"
1069
+ },
1070
+ {
1071
+ inputs: [
1072
+ { internalType: "address", name: "owner", type: "address" },
1073
+ { internalType: "address", name: "operator", type: "address" }
1074
+ ],
1075
+ name: "isApprovedForAll",
1076
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
1077
+ stateMutability: "view",
1078
+ type: "function"
1079
+ },
1080
+ {
1081
+ inputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
1082
+ name: "refundOrder",
1083
+ outputs: [],
1084
+ stateMutability: "nonpayable",
1085
+ type: "function"
1086
+ },
1087
+ {
1088
+ inputs: [
1089
+ { internalType: "uint256[]", name: "orderIndices", type: "uint256[]" }
1090
+ ],
1091
+ name: "refundOrders",
1092
+ outputs: [],
1093
+ stateMutability: "nonpayable",
1094
+ type: "function"
1095
+ },
1096
+ {
1097
+ inputs: [
1098
+ { internalType: "uint256", name: "ordersToProcess", type: "uint256" }
1099
+ ],
1100
+ name: "processOrders",
1101
+ outputs: [],
1102
+ stateMutability: "nonpayable",
1103
+ type: "function"
1104
+ },
1105
+ {
1106
+ inputs: [
1107
+ {
1108
+ components: [
1109
+ { internalType: "uint256", name: "amountOffer", type: "uint256" },
1110
+ {
1111
+ internalType: "contract IERC20",
1112
+ name: "wantAsset",
1113
+ type: "address"
1114
+ },
1115
+ {
1116
+ internalType: "address",
1117
+ name: "intendedDepositor",
1118
+ type: "address"
1119
+ },
1120
+ { internalType: "address", name: "receiver", type: "address" },
1121
+ { internalType: "address", name: "refundReceiver", type: "address" },
1122
+ {
1123
+ components: [
1124
+ {
1125
+ internalType: "enum WithdrawQueue.ApprovalMethod",
1126
+ name: "approvalMethod",
1127
+ type: "uint8"
1128
+ },
1129
+ { internalType: "uint8", name: "approvalV", type: "uint8" },
1130
+ { internalType: "bytes32", name: "approvalR", type: "bytes32" },
1131
+ { internalType: "bytes32", name: "approvalS", type: "bytes32" },
1132
+ {
1133
+ internalType: "bool",
1134
+ name: "submitWithSignature",
1135
+ type: "bool"
1136
+ },
1137
+ { internalType: "uint256", name: "deadline", type: "uint256" },
1138
+ {
1139
+ internalType: "bytes",
1140
+ name: "eip2612Signature",
1141
+ type: "bytes"
1142
+ }
1143
+ ],
1144
+ internalType: "struct WithdrawQueue.SignatureParams",
1145
+ name: "signatureParams",
1146
+ type: "tuple"
1147
+ }
1148
+ ],
1149
+ internalType: "struct WithdrawQueue.SubmitOrderParams",
1150
+ name: "params",
1151
+ type: "tuple"
1152
+ }
1153
+ ],
1154
+ name: "submitOrder",
1155
+ outputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
1156
+ stateMutability: "nonpayable",
1157
+ type: "function"
1158
+ },
1159
+ {
1160
+ inputs: [
1161
+ {
1162
+ components: [
1163
+ { internalType: "uint256", name: "amountOffer", type: "uint256" },
1164
+ {
1165
+ internalType: "contract IERC20",
1166
+ name: "wantAsset",
1167
+ type: "address"
1168
+ },
1169
+ {
1170
+ internalType: "address",
1171
+ name: "intendedDepositor",
1172
+ type: "address"
1173
+ },
1174
+ { internalType: "address", name: "receiver", type: "address" },
1175
+ { internalType: "address", name: "refundReceiver", type: "address" },
1176
+ {
1177
+ components: [
1178
+ {
1179
+ internalType: "enum WithdrawQueue.ApprovalMethod",
1180
+ name: "approvalMethod",
1181
+ type: "uint8"
1182
+ },
1183
+ { internalType: "uint8", name: "approvalV", type: "uint8" },
1184
+ { internalType: "bytes32", name: "approvalR", type: "bytes32" },
1185
+ { internalType: "bytes32", name: "approvalS", type: "bytes32" },
1186
+ {
1187
+ internalType: "bool",
1188
+ name: "submitWithSignature",
1189
+ type: "bool"
1190
+ },
1191
+ { internalType: "uint256", name: "deadline", type: "uint256" },
1192
+ {
1193
+ internalType: "bytes",
1194
+ name: "eip2612Signature",
1195
+ type: "bytes"
1196
+ }
1197
+ ],
1198
+ internalType: "struct WithdrawQueue.SignatureParams",
1199
+ name: "signatureParams",
1200
+ type: "tuple"
1201
+ }
1202
+ ],
1203
+ internalType: "struct WithdrawQueue.SubmitOrderParams",
1204
+ name: "params",
1205
+ type: "tuple"
1206
+ },
1207
+ { internalType: "uint256", name: "ordersToProcess", type: "uint256" }
1208
+ ],
1209
+ name: "submitOrderAndProcess",
1210
+ outputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
1211
+ stateMutability: "nonpayable",
1212
+ type: "function"
1213
+ },
1214
+ {
1215
+ inputs: [
1216
+ {
1217
+ components: [
1218
+ { internalType: "uint256", name: "amountOffer", type: "uint256" },
1219
+ {
1220
+ internalType: "contract IERC20",
1221
+ name: "wantAsset",
1222
+ type: "address"
1223
+ },
1224
+ {
1225
+ internalType: "address",
1226
+ name: "intendedDepositor",
1227
+ type: "address"
1228
+ },
1229
+ { internalType: "address", name: "receiver", type: "address" },
1230
+ { internalType: "address", name: "refundReceiver", type: "address" },
1231
+ {
1232
+ components: [
1233
+ {
1234
+ internalType: "enum WithdrawQueue.ApprovalMethod",
1235
+ name: "approvalMethod",
1236
+ type: "uint8"
1237
+ },
1238
+ { internalType: "uint8", name: "approvalV", type: "uint8" },
1239
+ { internalType: "bytes32", name: "approvalR", type: "bytes32" },
1240
+ { internalType: "bytes32", name: "approvalS", type: "bytes32" },
1241
+ {
1242
+ internalType: "bool",
1243
+ name: "submitWithSignature",
1244
+ type: "bool"
1245
+ },
1246
+ { internalType: "uint256", name: "deadline", type: "uint256" },
1247
+ {
1248
+ internalType: "bytes",
1249
+ name: "eip2612Signature",
1250
+ type: "bytes"
1251
+ }
1252
+ ],
1253
+ internalType: "struct WithdrawQueue.SignatureParams",
1254
+ name: "signatureParams",
1255
+ type: "tuple"
1256
+ }
1257
+ ],
1258
+ internalType: "struct WithdrawQueue.SubmitOrderParams",
1259
+ name: "params",
1260
+ type: "tuple"
1261
+ }
1262
+ ],
1263
+ name: "submitOrderAndProcessAll",
1264
+ outputs: [{ internalType: "uint256", name: "orderIndex", type: "uint256" }],
1265
+ stateMutability: "nonpayable",
1266
+ type: "function"
1267
+ },
1268
+ {
1269
+ inputs: [],
1270
+ name: "symbol",
1271
+ outputs: [{ internalType: "string", name: "", type: "string" }],
1272
+ stateMutability: "view",
1273
+ type: "function"
1274
+ },
1275
+ {
1276
+ inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
1277
+ name: "supportsInterface",
1278
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
1279
+ stateMutability: "view",
1280
+ type: "function"
1281
+ },
1282
+ {
1283
+ inputs: [],
1284
+ name: "tellerWithMultiAssetSupport",
1285
+ outputs: [
1286
+ {
1287
+ internalType: "contract TellerWithMultiAssetSupport",
1288
+ name: "",
1289
+ type: "address"
1290
+ }
1291
+ ],
1292
+ stateMutability: "view",
1293
+ type: "function"
1294
+ },
1295
+ {
1296
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
1297
+ name: "tokenByIndex",
1298
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1299
+ stateMutability: "view",
1300
+ type: "function"
1301
+ },
1302
+ {
1303
+ inputs: [
1304
+ { internalType: "address", name: "owner", type: "address" },
1305
+ { internalType: "uint256", name: "index", type: "uint256" }
1306
+ ],
1307
+ name: "tokenOfOwnerByIndex",
1308
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1309
+ stateMutability: "view",
1310
+ type: "function"
1311
+ },
1312
+ {
1313
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
1314
+ name: "tokenURI",
1315
+ outputs: [{ internalType: "string", name: "", type: "string" }],
1316
+ stateMutability: "view",
1317
+ type: "function"
1318
+ },
1319
+ {
1320
+ inputs: [],
1321
+ name: "totalSupply",
1322
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1323
+ stateMutability: "view",
1324
+ type: "function"
1325
+ },
1326
+ {
1327
+ inputs: [
1328
+ { internalType: "address", name: "from", type: "address" },
1329
+ { internalType: "address", name: "to", type: "address" },
1330
+ { internalType: "uint256", name: "tokenId", type: "uint256" }
1331
+ ],
1332
+ name: "transferFrom",
1333
+ outputs: [],
1334
+ stateMutability: "nonpayable",
1335
+ type: "function"
1336
+ },
1337
+ {
1338
+ inputs: [
1339
+ { internalType: "address", name: "from", type: "address" },
1340
+ { internalType: "address", name: "to", type: "address" },
1341
+ { internalType: "uint256", name: "tokenId", type: "uint256" }
1342
+ ],
1343
+ name: "safeTransferFrom",
1344
+ outputs: [],
1345
+ stateMutability: "nonpayable",
1346
+ type: "function"
1347
+ },
1348
+ {
1349
+ inputs: [
1350
+ { internalType: "address", name: "from", type: "address" },
1351
+ { internalType: "address", name: "to", type: "address" },
1352
+ { internalType: "uint256", name: "tokenId", type: "uint256" },
1353
+ { internalType: "bytes", name: "_data", type: "bytes" }
1354
+ ],
1355
+ name: "safeTransferFrom",
1356
+ outputs: [],
1357
+ stateMutability: "nonpayable",
1358
+ type: "function"
1359
+ },
1360
+ {
1361
+ inputs: [
1362
+ { internalType: "address", name: "operator", type: "address" },
1363
+ { internalType: "bool", name: "approved", type: "bool" }
1364
+ ],
1365
+ name: "setApprovalForAll",
1366
+ outputs: [],
1367
+ stateMutability: "nonpayable",
1368
+ type: "function"
1369
+ },
1370
+ {
1371
+ inputs: [
1372
+ {
1373
+ internalType: "contract IFeeModule",
1374
+ name: "_feeModule",
1375
+ type: "address"
1376
+ }
1377
+ ],
1378
+ name: "setFeeModule",
1379
+ outputs: [],
1380
+ stateMutability: "nonpayable",
1381
+ type: "function"
1382
+ },
1383
+ {
1384
+ inputs: [
1385
+ { internalType: "address", name: "_feeRecipient", type: "address" }
1386
+ ],
1387
+ name: "setFeeRecipient",
1388
+ outputs: [],
1389
+ stateMutability: "nonpayable",
1390
+ type: "function"
1391
+ },
1392
+ {
1393
+ inputs: [
1394
+ {
1395
+ internalType: "contract TellerWithMultiAssetSupport",
1396
+ name: "_newTeller",
1397
+ type: "address"
1398
+ }
1399
+ ],
1400
+ name: "setTellerWithMultiAssetSupport",
1401
+ outputs: [],
1402
+ stateMutability: "nonpayable",
1403
+ type: "function"
1404
+ },
1405
+ {
1406
+ inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
1407
+ name: "setOwner",
1408
+ outputs: [],
1409
+ stateMutability: "nonpayable",
1410
+ type: "function"
1411
+ },
1412
+ {
1413
+ inputs: [
1414
+ {
1415
+ internalType: "contract Authority",
1416
+ name: "newAuthority",
1417
+ type: "address"
1418
+ }
1419
+ ],
1420
+ name: "setAuthority",
1421
+ outputs: [],
1422
+ stateMutability: "nonpayable",
1423
+ type: "function"
1424
+ },
1425
+ {
1426
+ inputs: [{ internalType: "uint256", name: "_newMinimum", type: "uint256" }],
1427
+ name: "updateAssetMinimumOrderSize",
1428
+ outputs: [],
1429
+ stateMutability: "nonpayable",
1430
+ type: "function"
1431
+ },
1432
+ {
1433
+ inputs: [
1434
+ { internalType: "address", name: "to", type: "address" },
1435
+ { internalType: "uint256", name: "tokenId", type: "uint256" }
1436
+ ],
1437
+ name: "approve",
1438
+ outputs: [],
1439
+ stateMutability: "nonpayable",
1440
+ type: "function"
1441
+ }
1442
+ ];
1443
+
1444
+ // src/constants/environment.ts
1445
+ var BASE_URL = "https://api.paxoslabs.com";
1446
+ function getGraphQLEndpoint() {
1447
+ return `${BASE_URL}/graphql`;
1448
+ }
1449
+ function getRestV2BaseURL() {
1450
+ return `${BASE_URL}/v2`;
1451
+ }
1452
+
1453
+ // src/types/telemetry.ts
1454
+ var LogLevel = {
1455
+ DEBUG: 0,
1456
+ INFO: 1,
1457
+ WARN: 2,
1458
+ ERROR: 3,
1459
+ NONE: 4
1460
+ };
1461
+
1462
+ // src/lib/logger.ts
1463
+ var ConsoleLogger = class {
1464
+ constructor(level = LogLevel.ERROR) {
1465
+ __publicField(this, "level");
1466
+ this.level = level;
1467
+ }
1468
+ /**
1469
+ * Update log level
1470
+ */
1471
+ setLevel(level) {
1472
+ this.level = level;
1473
+ }
1474
+ /**
1475
+ * Get current log level
1476
+ */
1477
+ getLevel() {
1478
+ return this.level;
1479
+ }
1480
+ debug(message, context) {
1481
+ if (this.level <= LogLevel.DEBUG) {
1482
+ if (context) {
1483
+ console.debug("[Amplify SDK]", message, context);
1484
+ } else {
1485
+ console.debug("[Amplify SDK]", message);
1486
+ }
1487
+ }
1488
+ }
1489
+ info(message, context) {
1490
+ if (this.level <= LogLevel.INFO) {
1491
+ if (context) {
1492
+ console.info("[Amplify SDK]", message, context);
1493
+ } else {
1494
+ console.info("[Amplify SDK]", message);
1495
+ }
1496
+ }
1497
+ }
1498
+ warn(message, context) {
1499
+ if (this.level <= LogLevel.WARN) {
1500
+ if (context) {
1501
+ console.warn("[Amplify SDK]", message, context);
1502
+ } else {
1503
+ console.warn("[Amplify SDK]", message);
1504
+ }
1505
+ }
1506
+ }
1507
+ error(message, context) {
1508
+ if (this.level <= LogLevel.ERROR) {
1509
+ if (context) {
1510
+ console.error("[Amplify SDK]", message, context);
1511
+ } else {
1512
+ console.error("[Amplify SDK]", message);
1513
+ }
1514
+ }
1515
+ }
1516
+ };
1517
+ var currentLogger = new ConsoleLogger(LogLevel.ERROR);
1518
+ var defaultLogger = currentLogger;
1519
+ function setLogger(logger) {
1520
+ currentLogger = logger;
1521
+ }
1522
+ function getLogger() {
1523
+ return currentLogger;
1524
+ }
1525
+ function setLogLevel(level) {
1526
+ if (defaultLogger && typeof defaultLogger.setLevel === "function") {
1527
+ defaultLogger.setLevel(level);
1528
+ }
1529
+ }
1530
+
1531
+ // src/lib/vault-cache.ts
1532
+ var DEFAULT_TTL = 6e5;
1533
+ var VaultCache = class {
1534
+ /**
1535
+ * Creates a new VaultCache instance
1536
+ *
1537
+ * @param ttl - Time-to-live in milliseconds (default: 600000 = 10 minutes)
1538
+ */
1539
+ constructor(ttl = DEFAULT_TTL) {
1540
+ /**
1541
+ * Vaults keyed by baseTokenAddress
1542
+ * One key can map to multiple vaults (different chains/yield types)
1543
+ */
1544
+ __publicField(this, "vaults");
1545
+ /**
1546
+ * Assets keyed by token address
1547
+ */
1548
+ __publicField(this, "assets");
1549
+ /**
1550
+ * Vaults keyed by boringVaultAddress (lowercase, for case-insensitive lookup)
1551
+ */
1552
+ __publicField(this, "vaultsByAddress");
1553
+ /**
1554
+ * Vaults keyed by vault name (lowercase, for case-insensitive lookup)
1555
+ */
1556
+ __publicField(this, "vaultsByName");
1557
+ /**
1558
+ * Unix timestamp (milliseconds) of last successful fetch
1559
+ */
1560
+ __publicField(this, "lastFetch");
1561
+ /**
1562
+ * Time-to-live in milliseconds
1563
+ */
1564
+ __publicField(this, "ttl");
1565
+ /**
1566
+ * Current refresh promise (prevents duplicate concurrent refreshes)
1567
+ * When non-null, a refresh is in progress and callers should await this promise
1568
+ */
1569
+ __publicField(this, "refreshPromise");
1570
+ /**
1571
+ * Unix timestamp (milliseconds) when current refresh started.
1572
+ * Used to detect stale refresh promises.
1573
+ */
1574
+ __publicField(this, "refreshStartedAt");
1575
+ this.vaults = /* @__PURE__ */ new Map();
1576
+ this.assets = /* @__PURE__ */ new Map();
1577
+ this.vaultsByAddress = /* @__PURE__ */ new Map();
1578
+ this.vaultsByName = /* @__PURE__ */ new Map();
1579
+ this.lastFetch = 0;
1580
+ this.ttl = ttl;
1581
+ this.refreshPromise = null;
1582
+ this.refreshStartedAt = 0;
1583
+ }
1584
+ /**
1585
+ * Gets vaults by deposit token address
1586
+ *
1587
+ * Returns undefined if no vaults found for the given token address.
1588
+ * Does NOT automatically refresh if cache is expired; use refresh() for that.
1589
+ *
1590
+ * @param tokenAddress - Deposit token address (baseTokenAddress)
1591
+ * @returns Array of AmplifyVault objects, or undefined if not found
1592
+ */
1593
+ getVault(tokenAddress) {
1594
+ return this.vaults.get(tokenAddress);
1595
+ }
1596
+ /**
1597
+ * Gets a vault by its boringVaultAddress (on-chain vault contract).
1598
+ * Case-insensitive lookup.
1599
+ */
1600
+ getVaultByAddress(address) {
1601
+ return this.vaultsByAddress.get(address.toLowerCase());
1602
+ }
1603
+ /**
1604
+ * Gets a vault by its human-readable name.
1605
+ * Case-insensitive lookup.
1606
+ */
1607
+ getVaultByName(name) {
1608
+ return this.vaultsByName.get(name.toLowerCase());
1609
+ }
1610
+ /**
1611
+ * Gets asset by token address
1612
+ *
1613
+ * Returns undefined if asset not found.
1614
+ * Does NOT automatically refresh if cache is expired; use refresh() for that.
1615
+ *
1616
+ * @param tokenAddress - Token address
1617
+ * @returns SupportedAsset object, or undefined if not found
1618
+ */
1619
+ getAsset(tokenAddress) {
1620
+ return this.assets.get(tokenAddress);
1621
+ }
1622
+ /**
1623
+ * Gets all cached vaults
1624
+ *
1625
+ * Returns an array of all vaults across all deposit tokens.
1626
+ * Does NOT automatically refresh if cache is expired; use refresh() for that.
1627
+ *
1628
+ * @returns Array of all AmplifyVault objects
1629
+ */
1630
+ getAllVaults() {
1631
+ const seen = /* @__PURE__ */ new Set();
1632
+ const allVaults = [];
1633
+ for (const vaultArray of this.vaults.values()) {
1634
+ for (const vault of vaultArray) {
1635
+ if (!seen.has(vault.id)) {
1636
+ seen.add(vault.id);
1637
+ allVaults.push(vault);
1638
+ }
1639
+ }
1640
+ }
1641
+ return allVaults;
1642
+ }
1643
+ /**
1644
+ * Gets all cached assets
1645
+ *
1646
+ * Returns an array of all assets.
1647
+ * Does NOT automatically refresh if cache is expired; use refresh() for that.
1648
+ *
1649
+ * @returns Array of all SupportedAsset objects
1650
+ */
1651
+ getAllAssets() {
1652
+ return Array.from(this.assets.values());
1653
+ }
1654
+ /**
1655
+ * Checks if cache is expired
1656
+ *
1657
+ * Cache is considered expired if current time exceeds lastFetch + ttl.
1658
+ *
1659
+ * @returns true if cache is expired, false otherwise
1660
+ */
1661
+ isExpired() {
1662
+ return Date.now() > this.lastFetch + this.ttl;
1663
+ }
1664
+ /**
1665
+ * Gets the time until cache expires
1666
+ *
1667
+ * @returns Milliseconds until expiry, or 0 if already expired
1668
+ */
1669
+ getTimeUntilExpiry() {
1670
+ const expiryTime = this.lastFetch + this.ttl;
1671
+ const now = Date.now();
1672
+ return Math.max(0, expiryTime - now);
1673
+ }
1674
+ /**
1675
+ * Checks if cache is empty (never populated)
1676
+ *
1677
+ * @returns true if cache has never been populated, false otherwise
1678
+ */
1679
+ isEmpty() {
1680
+ return this.lastFetch === 0;
1681
+ }
1682
+ /**
1683
+ * Manually refreshes the cache
1684
+ *
1685
+ * Fetches fresh data from the API and updates both vaults and assets maps.
1686
+ * Updates lastFetch timestamp on success.
1687
+ *
1688
+ * If a refresh is already in progress, this method returns the existing
1689
+ * promise instead of starting a concurrent refresh. This is more efficient
1690
+ * than polling and ensures all callers wait for the same refresh operation.
1691
+ *
1692
+ * @throws {APIError} If the API request fails
1693
+ */
1694
+ async refresh() {
1695
+ const STALE_REFRESH_MS = 3e4;
1696
+ if (this.refreshPromise) {
1697
+ if (Date.now() - this.refreshStartedAt < STALE_REFRESH_MS) {
1698
+ return this.refreshPromise;
1699
+ }
1700
+ this.refreshPromise = null;
1701
+ }
1702
+ this.refreshStartedAt = Date.now();
1703
+ this.refreshPromise = this._doRefresh();
1704
+ try {
1705
+ await this.refreshPromise;
1706
+ } finally {
1707
+ this.refreshPromise = null;
1708
+ }
1709
+ }
1710
+ /**
1711
+ * Internal refresh implementation
1712
+ * Separated to allow promise reuse in refresh()
1713
+ *
1714
+ * Fetches data via GraphQL and derives both vaults and assets
1715
+ * from the same response.
1716
+ */
1717
+ async _doRefresh() {
1718
+ const { vaults, assets } = await fetchVaultDataFromGraphQL();
1719
+ this.vaults.clear();
1720
+ this.assets.clear();
1721
+ this.vaultsByAddress.clear();
1722
+ this.vaultsByName.clear();
1723
+ for (const vault of vaults) {
1724
+ for (const asset of vault.supportedAssets) {
1725
+ const tokenAddress = asset.address;
1726
+ const existing = this.vaults.get(tokenAddress);
1727
+ if (existing) {
1728
+ if (!existing.includes(vault)) {
1729
+ existing.push(vault);
1730
+ }
1731
+ } else {
1732
+ this.vaults.set(tokenAddress, [vault]);
1733
+ }
1734
+ }
1735
+ this.vaultsByAddress.set(
1736
+ vault.vault.boringVaultAddress.toLowerCase(),
1737
+ vault
1738
+ );
1739
+ if (vault.name) {
1740
+ this.vaultsByName.set(vault.name.toLowerCase(), vault);
1741
+ }
1742
+ }
1743
+ for (const asset of assets) {
1744
+ this.assets.set(asset.address, asset);
1745
+ }
1746
+ this.lastFetch = Date.now();
1747
+ }
1748
+ /**
1749
+ * Check if a refresh is currently in progress
1750
+ *
1751
+ * @returns true if cache is being refreshed, false otherwise
1752
+ */
1753
+ isRefreshing() {
1754
+ return this.refreshPromise !== null;
1755
+ }
1756
+ /**
1757
+ * Clears the cache
1758
+ *
1759
+ * Removes all cached data and resets lastFetch timestamp.
1760
+ * Does not affect TTL setting.
1761
+ */
1762
+ clear() {
1763
+ this.vaults.clear();
1764
+ this.assets.clear();
1765
+ this.vaultsByAddress.clear();
1766
+ this.vaultsByName.clear();
1767
+ this.lastFetch = 0;
1768
+ }
1769
+ /**
1770
+ * Gets cache statistics
1771
+ *
1772
+ * @returns Object with cache statistics
1773
+ */
1774
+ getStats() {
1775
+ return {
1776
+ vaultCount: this.getAllVaults().length,
1777
+ assetCount: this.assets.size,
1778
+ tokenCount: this.vaults.size,
1779
+ lastFetch: this.lastFetch,
1780
+ ttl: this.ttl,
1781
+ isExpired: this.isExpired(),
1782
+ isEmpty: this.isEmpty(),
1783
+ timeUntilExpiry: this.getTimeUntilExpiry()
1784
+ };
1785
+ }
1786
+ };
1787
+
1788
+ // src/constants/index.ts
1789
+ var DEFAULT_DEADLINE = 3;
1790
+ var CHAINLINK_ADDRESS = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
1791
+ var DEFAULT_APPROVAL_AMOUNT = BigInt(2) ** BigInt(256) - BigInt(1);
1792
+ var API_BASE_URL = "https://api.paxoslabs.com";
1793
+
1794
+ // src/utils/fetch.ts
1795
+ var DEFAULT_TIMEOUT = 1e4;
1796
+ function createTimeoutSignal(timeoutMs) {
1797
+ const controller = new AbortController();
1798
+ setTimeout(() => controller.abort(), timeoutMs);
1799
+ return controller.signal;
1800
+ }
1801
+
1802
+ // src/lib/sdk-config.ts
1803
+ var MAX_CACHE_RETRIES = 3;
1804
+ var RETRY_DELAYS = [1e3, 2e3, 4e3];
1805
+ var sdkConfig = {
1806
+ apiKey: null,
1807
+ isInitialized: false,
1808
+ initializedAt: null,
1809
+ isInitializing: false,
1810
+ initPromise: null,
1811
+ telemetryEnabled: true,
1812
+ cachePopulationPromise: null,
1813
+ isCacheReady: false,
1814
+ rpcUrls: {}
1815
+ };
1816
+ var ERROR_MESSAGES = {
1817
+ INVALID_API_KEY: "Invalid API key format. Expected format: pxl_<type>_<string>",
1818
+ EMPTY_API_KEY: "API key cannot be empty. Provide a valid API key from Paxos Labs.",
1819
+ UNKNOWN_ERROR: "Unexpected initialization error. Contact support if issue persists."};
1820
+ function validateAPIKey(apiKey) {
1821
+ if (!apiKey || apiKey.trim().length === 0) {
1822
+ throw new APIError(ERROR_MESSAGES.EMPTY_API_KEY, {
1823
+ endpoint: "initAmplifySDK",
1824
+ statusCode: void 0
1825
+ });
1826
+ }
1827
+ if (apiKey.length < 10) {
1828
+ throw new APIError(ERROR_MESSAGES.INVALID_API_KEY, {
1829
+ endpoint: "initAmplifySDK",
1830
+ statusCode: void 0
1831
+ });
1832
+ }
1833
+ if (!apiKey.startsWith("pxl_")) {
1834
+ getLogger().warn(
1835
+ 'API key does not start with expected prefix "pxl_". It may not be valid.'
1836
+ );
1837
+ }
1838
+ }
1839
+ function setAPIKey(apiKey) {
1840
+ sdkConfig.apiKey = apiKey;
1841
+ }
1842
+ function getAPIKey() {
1843
+ return sdkConfig.apiKey;
1844
+ }
1845
+ function getRpcUrls() {
1846
+ return { ...sdkConfig.rpcUrls };
1847
+ }
1848
+ function clearConfig() {
1849
+ sdkConfig.apiKey = null;
1850
+ sdkConfig.isInitialized = false;
1851
+ sdkConfig.initializedAt = null;
1852
+ sdkConfig.isInitializing = false;
1853
+ sdkConfig.initPromise = null;
1854
+ sdkConfig.telemetryEnabled = true;
1855
+ sdkConfig.cachePopulationPromise = null;
1856
+ sdkConfig.isCacheReady = false;
1857
+ sdkConfig.rpcUrls = {};
1858
+ clearClients();
1859
+ resetTelemetry();
1860
+ }
1861
+ function getRequestHeaders() {
1862
+ const apiKey = getAPIKey();
1863
+ const headers = {
1864
+ "Content-Type": "application/json"
1865
+ };
1866
+ if (apiKey) {
1867
+ headers["x-api-key"] = apiKey;
1868
+ }
1869
+ return headers;
1870
+ }
1871
+ async function populateCacheInBackground(cache) {
1872
+ const logger = getLogger();
1873
+ for (let attempt = 0; attempt < MAX_CACHE_RETRIES; attempt++) {
1874
+ try {
1875
+ await cache.refresh();
1876
+ sdkConfig.isCacheReady = true;
1877
+ logger.debug("Background cache population completed", {
1878
+ attempt: attempt + 1
1879
+ });
1880
+ return;
1881
+ } catch (error) {
1882
+ const isLastAttempt = attempt === MAX_CACHE_RETRIES - 1;
1883
+ if (isLastAttempt) {
1884
+ logger.warn(
1885
+ "Background cache population failed after all retries, falling back to on-demand fetching",
1886
+ {
1887
+ error: error instanceof Error ? error.message : String(error),
1888
+ attempts: MAX_CACHE_RETRIES
1889
+ }
1890
+ );
1891
+ return;
1892
+ }
1893
+ logger.debug(
1894
+ `Cache population attempt ${attempt + 1} failed, retrying...`,
1895
+ {
1896
+ error: error instanceof Error ? error.message : String(error),
1897
+ nextRetryIn: RETRY_DELAYS[attempt]
1898
+ }
1899
+ );
1900
+ await new Promise((resolve) => setTimeout(resolve, RETRY_DELAYS[attempt]));
1901
+ }
1902
+ }
1903
+ }
1904
+ function isCacheReady() {
1905
+ return sdkConfig.isCacheReady;
1906
+ }
1907
+ async function waitForCacheReady() {
1908
+ if (sdkConfig.isCacheReady) {
1909
+ return;
1910
+ }
1911
+ if (sdkConfig.cachePopulationPromise) {
1912
+ await sdkConfig.cachePopulationPromise;
1913
+ if (sdkConfig.isCacheReady) {
1914
+ return;
1915
+ }
1916
+ }
1917
+ const cache = getCache();
1918
+ await cache.refresh();
1919
+ sdkConfig.isCacheReady = true;
1920
+ }
1921
+ async function initAmplifySDK(apiKey, options) {
1922
+ validateAPIKey(apiKey);
1923
+ if (sdkConfig.isInitialized && sdkConfig.apiKey === apiKey) {
1924
+ const nextRpcUrls = options?.rpcUrls ?? {};
1925
+ const hasRpcUrlChange = Object.keys(nextRpcUrls).length !== Object.keys(sdkConfig.rpcUrls).length || Object.entries(nextRpcUrls).some(
1926
+ ([chainId, url]) => sdkConfig.rpcUrls[Number(chainId)] !== url
1927
+ );
1928
+ if (hasRpcUrlChange) {
1929
+ sdkConfig.rpcUrls = { ...nextRpcUrls };
1930
+ clearClients();
1931
+ }
1932
+ return;
1933
+ }
1934
+ if (sdkConfig.isInitializing && sdkConfig.initPromise) {
1935
+ await sdkConfig.initPromise;
1936
+ return;
1937
+ }
1938
+ if (sdkConfig.isInitialized && sdkConfig.apiKey !== apiKey) {
1939
+ clearConfig();
1940
+ clearCache();
1941
+ }
1942
+ if (options?.logger) {
1943
+ setLogger(options.logger);
1944
+ }
1945
+ if (options?.logLevel !== void 0) {
1946
+ setLogLevel(options.logLevel);
1947
+ }
1948
+ sdkConfig.telemetryEnabled = options?.telemetry !== false;
1949
+ sdkConfig.rpcUrls = options?.rpcUrls ?? {};
1950
+ sdkConfig.isInitializing = true;
1951
+ sdkConfig.initPromise = (async () => {
1952
+ try {
1953
+ setAPIKey(apiKey);
1954
+ const cache = initializeCache();
1955
+ sdkConfig.isInitialized = true;
1956
+ sdkConfig.initializedAt = /* @__PURE__ */ new Date();
1957
+ sdkConfig.isCacheReady = false;
1958
+ sdkConfig.cachePopulationPromise = populateCacheInBackground(cache);
1959
+ if (sdkConfig.telemetryEnabled) {
1960
+ initTelemetry(apiKey).catch(() => {
1961
+ });
1962
+ }
1963
+ getLogger().info(
1964
+ "Amplify SDK initialized (cache populating in background)"
1965
+ );
1966
+ } catch (error) {
1967
+ clearConfig();
1968
+ clearCache();
1969
+ if (error instanceof APIError) {
1970
+ throw error;
1971
+ }
1972
+ throw new APIError(ERROR_MESSAGES.UNKNOWN_ERROR, {
1973
+ endpoint: "initAmplifySDK",
1974
+ cause: error
1975
+ });
1976
+ } finally {
1977
+ sdkConfig.isInitializing = false;
1978
+ sdkConfig.initPromise = null;
1979
+ }
1980
+ })();
1981
+ await sdkConfig.initPromise;
1982
+ }
1983
+
1984
+ // src/lib/telemetry.ts
1985
+ var SDK_VERSION = "0.1.1-beta.1";
1986
+ var MAX_ERROR_BUFFER_SIZE = 10;
1987
+ var CONFIG_FETCH_TIMEOUT = 5e3;
1988
+ var telemetryState = {
1989
+ enabled: false,
1990
+ isInitialized: false,
1991
+ isInitializing: false,
1992
+ initPromise: null,
1993
+ config: null,
1994
+ apiKey: null
1995
+ };
1996
+ var posthogClient = null;
1997
+ var errorBuffer = [];
1998
+ var bufferFullWarningLogged = false;
1999
+ function hashApiKey(apiKey) {
2000
+ const FNV_OFFSET = BigInt("0xcbf29ce484222325");
2001
+ const FNV_PRIME = BigInt("0x100000001b3");
2002
+ let hash = FNV_OFFSET;
2003
+ for (let i = 0; i < apiKey.length; i++) {
2004
+ hash ^= BigInt(apiKey.charCodeAt(i));
2005
+ hash = hash * FNV_PRIME & BigInt("0xffffffffffffffff");
2006
+ }
2007
+ return `sdk_${hash.toString(16).slice(0, 12)}`;
2008
+ }
2009
+ async function fetchTelemetryConfig(apiKey) {
2010
+ const endpoint = "/v1/earn-sdk/config";
2011
+ const url = `${API_BASE_URL}${endpoint}`;
2012
+ try {
2013
+ const headers = getRequestHeaders();
2014
+ if (!headers["x-api-key"]) {
2015
+ headers["x-api-key"] = apiKey;
2016
+ }
2017
+ const response = await fetch(url, {
2018
+ method: "GET",
2019
+ headers,
2020
+ signal: createTimeoutSignal(CONFIG_FETCH_TIMEOUT)
2021
+ });
2022
+ if (!response.ok) {
2023
+ return null;
2024
+ }
2025
+ const data = await response.json();
2026
+ if (!data || typeof data.posthogApiKey !== "string") {
2027
+ return null;
2028
+ }
2029
+ return {
2030
+ posthogApiKey: data.posthogApiKey,
2031
+ posthogHost: data.posthogHost || "https://us.i.posthog.com"
2032
+ };
2033
+ } catch {
2034
+ return null;
2035
+ }
2036
+ }
2037
+ async function flushErrorBuffer() {
2038
+ if (errorBuffer.length === 0 || !posthogClient) {
2039
+ return;
2040
+ }
2041
+ for (const bufferedError of errorBuffer) {
2042
+ const payload = {
2043
+ error_type: bufferedError.name,
2044
+ error_message: bufferedError.message,
2045
+ error_code: bufferedError.code,
2046
+ sdk_version: SDK_VERSION,
2047
+ buffered: true,
2048
+ ...bufferedError.context
2049
+ };
2050
+ posthogClient.capture("sdk_error", payload);
2051
+ }
2052
+ errorBuffer.length = 0;
2053
+ }
2054
+ async function initTelemetry(apiKey) {
2055
+ if (telemetryState.isInitialized) {
2056
+ return;
2057
+ }
2058
+ if (telemetryState.isInitializing && telemetryState.initPromise) {
2059
+ await telemetryState.initPromise;
2060
+ return;
2061
+ }
2062
+ telemetryState.isInitializing = true;
2063
+ telemetryState.apiKey = apiKey;
2064
+ telemetryState.initPromise = (async () => {
2065
+ try {
2066
+ const config = await fetchTelemetryConfig(apiKey);
2067
+ if (!config) {
2068
+ telemetryState.enabled = false;
2069
+ telemetryState.isInitialized = true;
2070
+ return;
2071
+ }
2072
+ telemetryState.config = config;
2073
+ const posthogModule = await import('posthog-js');
2074
+ const posthog = posthogModule.default;
2075
+ posthog.init(config.posthogApiKey, {
2076
+ api_host: config.posthogHost,
2077
+ autocapture: false,
2078
+ capture_pageview: false,
2079
+ capture_pageleave: false,
2080
+ disable_session_recording: true,
2081
+ persistence: "memory",
2082
+ // Don't persist to localStorage
2083
+ loaded: (ph) => {
2084
+ ph.identify(hashApiKey(apiKey));
2085
+ }
2086
+ });
2087
+ posthogClient = posthog;
2088
+ telemetryState.enabled = true;
2089
+ telemetryState.isInitialized = true;
2090
+ await flushErrorBuffer();
2091
+ posthog.capture("sdk_initialized", {
2092
+ sdk_version: SDK_VERSION
2093
+ });
2094
+ } catch (error) {
2095
+ const logger = getLogger();
2096
+ logger.warn("Telemetry initialization failed", {
2097
+ error: error instanceof Error ? error.message : String(error)
2098
+ });
2099
+ telemetryState.enabled = false;
2100
+ telemetryState.isInitialized = true;
2101
+ } finally {
2102
+ telemetryState.isInitializing = false;
2103
+ telemetryState.initPromise = null;
2104
+ }
2105
+ })();
2106
+ await telemetryState.initPromise;
2107
+ }
2108
+ function trackError(error, context) {
2109
+ const logger = getLogger();
2110
+ logger.error(error.message, {
2111
+ name: error.name,
2112
+ stack: error.stack,
2113
+ ...context
2114
+ });
2115
+ const errorDetails = {
2116
+ name: error.name,
2117
+ message: error.message,
2118
+ code: error.code,
2119
+ context: context || {},
2120
+ timestamp: Date.now()
2121
+ };
2122
+ if (!posthogClient || !telemetryState.enabled) {
2123
+ if (errorBuffer.length < MAX_ERROR_BUFFER_SIZE) {
2124
+ errorBuffer.push(errorDetails);
2125
+ } else if (!bufferFullWarningLogged) {
2126
+ logger.warn(
2127
+ `Telemetry error buffer full (${MAX_ERROR_BUFFER_SIZE} errors). Additional errors will not be tracked until telemetry initializes.`
2128
+ );
2129
+ bufferFullWarningLogged = true;
2130
+ }
2131
+ return;
2132
+ }
2133
+ const payload = {
2134
+ error_type: error.name,
2135
+ error_message: error.message,
2136
+ error_code: error.code,
2137
+ endpoint: error.endpoint,
2138
+ status_code: error.statusCode,
2139
+ sdk_version: SDK_VERSION,
2140
+ ...context
2141
+ };
2142
+ posthogClient.capture("sdk_error", payload);
2143
+ }
2144
+ function resetTelemetry() {
2145
+ telemetryState.enabled = false;
2146
+ telemetryState.isInitialized = false;
2147
+ telemetryState.isInitializing = false;
2148
+ telemetryState.initPromise = null;
2149
+ telemetryState.config = null;
2150
+ telemetryState.apiKey = null;
2151
+ posthogClient = null;
2152
+ errorBuffer.length = 0;
2153
+ bufferFullWarningLogged = false;
2154
+ }
2155
+
2156
+ // src/types/amplify-sdk-api.ts
2157
+ var APIError = class _APIError extends Error {
2158
+ constructor(message, options) {
2159
+ super(message);
2160
+ /**
2161
+ * HTTP status code (if available)
2162
+ */
2163
+ __publicField(this, "statusCode");
2164
+ /**
2165
+ * API endpoint that failed
2166
+ */
2167
+ __publicField(this, "endpoint");
2168
+ /**
2169
+ * Original error cause
2170
+ */
2171
+ __publicField(this, "cause");
2172
+ this.name = "APIError";
2173
+ this.statusCode = options?.statusCode;
2174
+ this.endpoint = options?.endpoint;
2175
+ this.cause = options?.cause;
2176
+ Object.setPrototypeOf(this, _APIError.prototype);
2177
+ if (Error.captureStackTrace) {
2178
+ Error.captureStackTrace(this, _APIError);
2179
+ }
2180
+ try {
2181
+ trackError(this, {
2182
+ endpoint: this.endpoint,
2183
+ statusCode: this.statusCode
2184
+ });
2185
+ } catch {
2186
+ }
2187
+ }
2188
+ };
2189
+ function isValidYieldType(value) {
2190
+ return typeof value === "string" && (value === "CORE" || value === "TREASURY" || value === "FRONTIER");
2191
+ }
2192
+ function isValidAddress(value) {
2193
+ return typeof value === "string" && /^0x[a-fA-F0-9]{40}$/.test(value);
2194
+ }
2195
+ function isValidChainId(value) {
2196
+ return typeof value === "number" && value > 0 && Number.isInteger(value);
2197
+ }
2198
+
2199
+ // src/client/graphql-client.ts
2200
+ var VAULT_FIELDS = `
2201
+ id
2202
+ name
2203
+ chainId
2204
+ isDeleted
2205
+ inDeprecation
2206
+ boringVaultModuleId
2207
+ boringVaultAddress
2208
+ rolesAuthorityModuleId
2209
+ tellerModuleId
2210
+ accountantModuleId
2211
+ managerModuleId
2212
+ withdrawQueueModuleId
2213
+ communityCodeDepositorModuleId
2214
+ depositFeeModuleId
2215
+ withdrawFeeModuleId
2216
+ enterpriseConfig {
2217
+ predicatePolicyId
2218
+ }
2219
+ baseTokenAddressId
2220
+ baseTokenStandInId
2221
+ baseTokenStandIn {
2222
+ decimals
2223
+ symbol
2224
+ coinGeckoApiId
2225
+ }
2226
+ withdrawalSla {
2227
+ withdrawAssetAddress
2228
+ externalWithdrawalQueueDelaySLA
2229
+ externalAccountantRateUpdateSLA
2230
+ }
2231
+ supportedAssets {
2232
+ address
2233
+ chainId
2234
+ depositable
2235
+ withdrawable
2236
+ symbol
2237
+ tokenName
2238
+ decimals
2239
+ }
2240
+ depositFeeConfigs {
2241
+ feeModuleAddress
2242
+ depositAsset
2243
+ feePercentage
2244
+ flatFee
2245
+ }
2246
+ withdrawQueueFeeConfig {
2247
+ queueAddress
2248
+ feeModule
2249
+ offerFeeBps
2250
+ offerFeeRate
2251
+ }
2252
+ atomicWithdrawal
2253
+ `;
2254
+ var DEPOSIT_TOKEN_FIELDS = `
2255
+ id
2256
+ address
2257
+ chainId
2258
+ name
2259
+ `;
2260
+ var TOKEN_METADATA_FIELDS = `
2261
+ address
2262
+ chainId
2263
+ symbol
2264
+ tokenName
2265
+ decimals
2266
+ coinGeckoTokenId
2267
+ tokenStandard
2268
+ source
2269
+ firstSeenAt
2270
+ metadataRefreshedAt
2271
+ `;
2272
+ var VAULT_ASSET_FLAGS_FIELDS = `
2273
+ depositable
2274
+ withdrawable
2275
+ `;
2276
+ var SDK_CONFIG_CORE_FIELDS = `
2277
+ id
2278
+ chainId
2279
+ environment
2280
+ yieldType
2281
+ vaultId
2282
+ depositTokenAddressId
2283
+ `;
2284
+ function buildSdkConfigsQuery(options) {
2285
+ const nestedFields = [];
2286
+ if (options.vault) {
2287
+ nestedFields.push(`vault { ${options.vault} }`);
2288
+ }
2289
+ if (options.depositTokenAddress) {
2290
+ nestedFields.push(`depositTokenAddress { ${options.depositTokenAddress} }`);
2291
+ }
2292
+ if (options.tokenMetadata) {
2293
+ nestedFields.push(`tokenMetadata { ${options.tokenMetadata} }`);
2294
+ }
2295
+ if (options.vaultAssetFlags) {
2296
+ nestedFields.push(`vaultAssetFlags { ${options.vaultAssetFlags} }`);
2297
+ }
2298
+ const allFields = [...options.fields, ...nestedFields].join("\n ");
2299
+ return `
2300
+ query AmplifySdkConfigs(
2301
+ $environment: Environment
2302
+ $chainId: Int
2303
+ $yieldType: YieldType
2304
+ ) {
2305
+ amplifySdkConfigs(
2306
+ environment: $environment
2307
+ chainId: $chainId
2308
+ yieldType: $yieldType
2309
+ ) {
2310
+ ${allFields}
2311
+ }
2312
+ }
2313
+ `;
2314
+ }
2315
+ async function executeGraphQLQuery(endpoint, query, variables) {
2316
+ const headers = getRequestHeaders();
2317
+ let response;
2318
+ try {
2319
+ response = await fetch(endpoint, {
2320
+ method: "POST",
2321
+ headers,
2322
+ body: JSON.stringify({ query, variables }),
2323
+ signal: createTimeoutSignal(DEFAULT_TIMEOUT)
2324
+ });
2325
+ } catch (error) {
2326
+ if (error instanceof Error && error.name === "AbortError") {
2327
+ throw new APIError("GraphQL request timed out", {
2328
+ endpoint,
2329
+ cause: error
2330
+ });
2331
+ }
2332
+ throw new APIError(
2333
+ `GraphQL network error: ${error instanceof Error ? error.message : String(error)}`,
2334
+ { endpoint, cause: error }
2335
+ );
2336
+ }
2337
+ if (!response.ok) {
2338
+ throw new APIError(
2339
+ `GraphQL HTTP error: ${response.status} ${response.statusText}`,
2340
+ { endpoint, statusCode: response.status }
2341
+ );
2342
+ }
2343
+ let body;
2344
+ try {
2345
+ body = await response.json();
2346
+ } catch (error) {
2347
+ throw new APIError("GraphQL response is not valid JSON", {
2348
+ endpoint,
2349
+ cause: error
2350
+ });
2351
+ }
2352
+ if (body.errors && body.errors.length > 0) {
2353
+ const messages = body.errors.map((e) => e.message).join("; ");
2354
+ throw new APIError(`GraphQL errors: ${messages}`, {
2355
+ endpoint,
2356
+ cause: body.errors
2357
+ });
2358
+ }
2359
+ if (!body.data) {
2360
+ throw new APIError("GraphQL response missing data field", { endpoint });
2361
+ }
2362
+ return body.data;
2363
+ }
2364
+ async function fetchAmplifySdkConfigs(endpoint, variables) {
2365
+ const query = buildSdkConfigsQuery({
2366
+ fields: SDK_CONFIG_CORE_FIELDS.trim().split(/\s+/),
2367
+ vault: VAULT_FIELDS,
2368
+ depositTokenAddress: DEPOSIT_TOKEN_FIELDS,
2369
+ tokenMetadata: TOKEN_METADATA_FIELDS,
2370
+ vaultAssetFlags: VAULT_ASSET_FLAGS_FIELDS
2371
+ });
2372
+ return executeGraphQLQuery(
2373
+ endpoint,
2374
+ query,
2375
+ variables
2376
+ );
2377
+ }
2378
+
2379
+ // src/constants/config.ts
2380
+ var YieldType = {
2381
+ CORE: "CORE",
2382
+ TREASURY: "TREASURY",
2383
+ FRONTIER: "FRONTIER"
2384
+ };
2385
+ var DEFAULT_SLIPPAGE_BPS = 50;
2386
+
2387
+ // src/client/graphql-mapper.ts
2388
+ function mapYieldType(graphqlYieldType) {
2389
+ switch (graphqlYieldType) {
2390
+ case "CORE":
2391
+ case "PRIME":
2392
+ return YieldType.CORE;
2393
+ case "TREASURY":
2394
+ case "TBILL":
2395
+ return YieldType.TREASURY;
2396
+ case "FRONTIER":
2397
+ case "LENDING":
2398
+ return YieldType.FRONTIER;
2399
+ default: {
2400
+ const logger = getLogger();
2401
+ logger.warn(`Unknown GraphQL yield type: ${graphqlYieldType}, skipping`);
2402
+ return null;
2403
+ }
2404
+ }
2405
+ }
2406
+ function mapGraphQLConfigToVault(config) {
2407
+ if (!config.vault || !config.depositTokenAddress) {
2408
+ return null;
2409
+ }
2410
+ const yieldType = mapYieldType(config.yieldType);
2411
+ if (!yieldType) {
2412
+ return null;
2413
+ }
2414
+ const { vault, depositTokenAddress } = config;
2415
+ const indexerAssets = vault.supportedAssets && vault.supportedAssets.length > 0 ? vault.supportedAssets.map((a) => ({
2416
+ address: a.address,
2417
+ chainId: a.chainId,
2418
+ symbol: a.symbol ?? a.address,
2419
+ name: a.tokenName ?? a.symbol ?? a.address,
2420
+ decimals: a.decimals ?? 0,
2421
+ depositable: a.depositable,
2422
+ withdrawable: a.withdrawable
2423
+ })) : [
2424
+ {
2425
+ address: depositTokenAddress.address,
2426
+ symbol: config.tokenMetadata?.symbol ?? depositTokenAddress.name,
2427
+ name: config.tokenMetadata?.tokenName ?? depositTokenAddress.name,
2428
+ decimals: config.tokenMetadata?.decimals ?? 0,
2429
+ ...config.vaultAssetFlags && {
2430
+ depositable: config.vaultAssetFlags.depositable,
2431
+ withdrawable: config.vaultAssetFlags.withdrawable
2432
+ }
2433
+ }
2434
+ ];
2435
+ return {
2436
+ id: config.id,
2437
+ chainId: config.chainId,
2438
+ yieldType,
2439
+ name: vault.name,
2440
+ inDeprecation: vault.inDeprecation,
2441
+ vault: {
2442
+ boringVaultAddress: vault.boringVaultAddress,
2443
+ tellerAddress: vault.tellerModuleId,
2444
+ accountantAddress: vault.accountantModuleId,
2445
+ managerAddress: vault.managerModuleId,
2446
+ rolesAuthorityAddress: vault.rolesAuthorityModuleId,
2447
+ baseTokenAddress: vault.baseTokenAddressId,
2448
+ baseTokenStandIn: vault.baseTokenStandInId ? vault.baseTokenStandInId : void 0,
2449
+ withdrawQueueAddress: vault.withdrawQueueModuleId ? vault.withdrawQueueModuleId : void 0,
2450
+ communityCodeDepositorAddress: vault.communityCodeDepositorModuleId ? vault.communityCodeDepositorModuleId : void 0,
2451
+ depositFeeModuleAddress: vault.depositFeeModuleId ? vault.depositFeeModuleId : void 0,
2452
+ withdrawFeeModuleAddress: vault.withdrawFeeModuleId ? vault.withdrawFeeModuleId : void 0
2453
+ },
2454
+ atomicWithdrawal: vault.atomicWithdrawal ?? false,
2455
+ enterpriseConfig: vault.enterpriseConfig ? { predicatePolicyId: vault.enterpriseConfig.predicatePolicyId } : void 0,
2456
+ supportedAssets: indexerAssets,
2457
+ sla: vault.withdrawalSla && vault.withdrawalSla.length > 0 ? {
2458
+ externalWithdrawalQueueDelaySLA: vault.withdrawalSla[0].externalWithdrawalQueueDelaySLA,
2459
+ externalAccountantRateUpdateSLA: vault.withdrawalSla[0].externalAccountantRateUpdateSLA
2460
+ } : void 0,
2461
+ depositFees: (() => {
2462
+ const configs = vault.depositFeeConfigs ?? [];
2463
+ if (configs.length > 0) {
2464
+ return {
2465
+ hasFees: true,
2466
+ feeModuleAddress: configs[0].feeModuleAddress,
2467
+ fees: configs.map((fc) => ({
2468
+ depositAsset: fc.depositAsset ? fc.depositAsset : null,
2469
+ feePercentage: BigInt(fc.feePercentage ?? "0"),
2470
+ flatFee: BigInt(fc.flatFee ?? "0")
2471
+ }))
2472
+ };
2473
+ }
2474
+ if (vault.depositFeeModuleId) {
2475
+ return {
2476
+ hasFees: false,
2477
+ feeModuleAddress: vault.depositFeeModuleId,
2478
+ fees: []
2479
+ };
2480
+ }
2481
+ return void 0;
2482
+ })(),
2483
+ withdrawFees: vault.withdrawQueueFeeConfig && (vault.withdrawQueueFeeConfig.feeModule != null || vault.withdrawQueueFeeConfig.offerFeeBps != null || vault.withdrawQueueFeeConfig.offerFeeRate != null) ? {
2484
+ hasFees: true,
2485
+ feeModuleAddress: vault.withdrawQueueFeeConfig.feeModule || vault.withdrawFeeModuleId || null,
2486
+ offerFeeBps: vault.withdrawQueueFeeConfig.offerFeeBps != null ? BigInt(vault.withdrawQueueFeeConfig.offerFeeBps) : 0n,
2487
+ offerFeeRate: BigInt(
2488
+ vault.withdrawQueueFeeConfig.offerFeeRate ?? "0"
2489
+ )
2490
+ } : vault.withdrawFeeModuleId ? {
2491
+ hasFees: false,
2492
+ feeModuleAddress: vault.withdrawFeeModuleId,
2493
+ offerFeeBps: 0n,
2494
+ offerFeeRate: 0n
2495
+ } : void 0
2496
+ };
2497
+ }
2498
+ function aggregateVaultConfigs(configs) {
2499
+ const vaultMap = /* @__PURE__ */ new Map();
2500
+ for (const config of configs) {
2501
+ if (!config.vault || !config.depositTokenAddress) continue;
2502
+ if (vaultMap.has(config.vaultId)) continue;
2503
+ const mapped = mapGraphQLConfigToVault(config);
2504
+ if (mapped) {
2505
+ vaultMap.set(config.vaultId, mapped);
2506
+ }
2507
+ }
2508
+ return Array.from(vaultMap.values());
2509
+ }
2510
+ function extractSupportedAssetsFromConfigs(configs) {
2511
+ const assetMap = /* @__PURE__ */ new Map();
2512
+ for (const config of configs) {
2513
+ if (!config.depositTokenAddress) continue;
2514
+ const key = config.depositTokenAddress.address.toLowerCase();
2515
+ const existing = assetMap.get(key);
2516
+ if (existing) {
2517
+ existing.chains.add(config.chainId);
2518
+ if (existing.decimals === 0 && config.tokenMetadata?.decimals) {
2519
+ existing.decimals = config.tokenMetadata.decimals;
2520
+ existing.symbol = config.tokenMetadata.symbol ?? existing.symbol;
2521
+ existing.name = config.tokenMetadata.tokenName ?? existing.name;
2522
+ }
2523
+ } else {
2524
+ assetMap.set(key, {
2525
+ address: config.depositTokenAddress.address,
2526
+ symbol: config.tokenMetadata?.symbol ?? config.depositTokenAddress.name,
2527
+ name: config.tokenMetadata?.tokenName ?? config.depositTokenAddress.name,
2528
+ decimals: config.tokenMetadata?.decimals ?? 0,
2529
+ chains: /* @__PURE__ */ new Set([config.chainId])
2530
+ });
2531
+ }
2532
+ }
2533
+ return Array.from(assetMap.values()).map((asset) => ({
2534
+ address: asset.address,
2535
+ symbol: asset.symbol,
2536
+ name: asset.name,
2537
+ decimals: asset.decimals,
2538
+ chains: Array.from(asset.chains)
2539
+ }));
2540
+ }
2541
+
2542
+ // src/client/amplify-sdk-client.ts
2543
+ function validateVaultFilterOptions(options) {
2544
+ if (!options) return;
2545
+ if (options.chainId !== void 0 && !isValidChainId(options.chainId)) {
2546
+ throw new APIError(
2547
+ `Invalid chainId: ${options.chainId}. Must be a positive integer.`,
2548
+ { endpoint: "/v1/earn-sdk/vaults" }
2549
+ );
2550
+ }
2551
+ if (options.yieldType !== void 0 && !isValidYieldType(options.yieldType)) {
2552
+ throw new APIError(
2553
+ `Invalid yieldType: ${options.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
2554
+ { endpoint: "/v1/earn-sdk/vaults" }
2555
+ );
2556
+ }
2557
+ if (options.depositTokenAddress !== void 0 && !isValidAddress(options.depositTokenAddress)) {
2558
+ throw new APIError(
2559
+ `Invalid depositTokenAddress: ${options.depositTokenAddress}. Must be a valid Ethereum address.`,
2560
+ { endpoint: "/v1/earn-sdk/vaults" }
2561
+ );
2562
+ }
2563
+ }
2564
+ function validateAssetFilterOptions(options) {
2565
+ if (!options) return;
2566
+ if (options.chains !== void 0) {
2567
+ if (!Array.isArray(options.chains) || options.chains.length === 0) {
2568
+ throw new APIError(
2569
+ "Invalid chains: Must be a non-empty array of chain IDs.",
2570
+ { endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
2571
+ );
2572
+ }
2573
+ for (const chainId of options.chains) {
2574
+ if (!isValidChainId(chainId)) {
2575
+ throw new APIError(
2576
+ `Invalid chainId in chains array: ${chainId}. Must be a positive integer.`,
2577
+ { endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
2578
+ );
2579
+ }
2580
+ }
2581
+ }
2582
+ if (options.yieldType !== void 0 && !isValidYieldType(options.yieldType)) {
2583
+ throw new APIError(
2584
+ `Invalid yieldType: ${options.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
2585
+ { endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
2586
+ );
2587
+ }
2588
+ if (options.address !== void 0 && !isValidAddress(options.address)) {
2589
+ throw new APIError(
2590
+ `Invalid address: ${options.address}. Must be a valid Ethereum address.`,
2591
+ { endpoint: "/v1/earn-sdk/supported-assets-by-chains" }
2592
+ );
2593
+ }
2594
+ if (options.symbol !== void 0 && typeof options.symbol !== "string") {
2595
+ throw new APIError(`Invalid symbol: ${options.symbol}. Must be a string.`, {
2596
+ endpoint: "/v1/earn-sdk/supported-assets-by-chains"
2597
+ });
2598
+ }
2599
+ }
2600
+ async function fetchVaultDataFromGraphQL() {
2601
+ const endpoint = getGraphQLEndpoint();
2602
+ const response = await fetchAmplifySdkConfigs(endpoint);
2603
+ const configs = response.amplifySdkConfigs;
2604
+ const vaults = aggregateVaultConfigs(configs);
2605
+ const assets = extractSupportedAssetsFromConfigs(configs);
2606
+ let enrichedVaults = vaults;
2607
+ try {
2608
+ enrichedVaults = await enrichVaultsWithSupplyCapsAndFees(vaults);
2609
+ } catch (err) {
2610
+ getLogger().debug(
2611
+ `enrichVaultsWithSupplyCapsAndFees failed for ${vaults.length} vault(s)`,
2612
+ { error: err instanceof Error ? err.message : String(err) }
2613
+ );
2614
+ }
2615
+ return { vaults: enrichedVaults, assets };
2616
+ }
2617
+ function applyVaultFilters(vaults, options) {
2618
+ if (!options) return vaults;
2619
+ let filtered = vaults;
2620
+ if (options.chainId !== void 0) {
2621
+ filtered = filtered.filter((v) => v.chainId === options.chainId);
2622
+ }
2623
+ if (options.yieldType) {
2624
+ filtered = filtered.filter((v) => v.yieldType === options.yieldType);
2625
+ }
2626
+ if (options.depositTokenAddress) {
2627
+ const normalized = options.depositTokenAddress.toLowerCase();
2628
+ filtered = filtered.filter(
2629
+ (v) => v.supportedAssets.some((a) => a.address.toLowerCase() === normalized)
2630
+ );
2631
+ }
2632
+ return filtered;
2633
+ }
2634
+ function applyAssetFilters(assets, options) {
2635
+ if (!options) return assets;
2636
+ let filtered = assets;
2637
+ if (options.chains !== void 0 && options.chains.length > 0) {
2638
+ filtered = filtered.filter(
2639
+ (asset) => options.chains?.some((chainId) => asset.chains.includes(chainId))
2640
+ );
2641
+ }
2642
+ if (options.address) {
2643
+ const normalizedAddress = options.address.toLowerCase();
2644
+ filtered = filtered.filter(
2645
+ (asset) => asset.address.toLowerCase() === normalizedAddress
2646
+ );
2647
+ }
2648
+ if (options.symbol) {
2649
+ filtered = filtered.filter((asset) => asset.symbol === options.symbol);
2650
+ }
2651
+ return filtered;
2652
+ }
2653
+ async function getVaults(options) {
2654
+ validateVaultFilterOptions(options);
2655
+ const cache = getCache();
2656
+ if (cache.isEmpty() || cache.isExpired()) {
2657
+ await cache.refresh();
2658
+ }
2659
+ return applyVaultFilters(cache.getAllVaults(), options);
2660
+ }
2661
+ async function getSupportedAssets(options) {
2662
+ validateAssetFilterOptions(options);
2663
+ const cache = getCache();
2664
+ if (cache.isEmpty() || cache.isExpired()) {
2665
+ await cache.refresh();
2666
+ }
2667
+ return applyAssetFilters(cache.getAllAssets(), options);
2668
+ }
2669
+ var globalCache = null;
2670
+ function initializeCache(ttl) {
2671
+ globalCache = new VaultCache(ttl);
2672
+ return globalCache;
2673
+ }
2674
+ function getCache() {
2675
+ if (!globalCache) {
2676
+ globalCache = new VaultCache();
2677
+ }
2678
+ return globalCache;
2679
+ }
2680
+ async function refreshVaultCache() {
2681
+ const cache = getCache();
2682
+ await cache.refresh();
2683
+ }
2684
+ function clearCache() {
2685
+ const cache = getCache();
2686
+ cache.clear();
2687
+ }
2688
+ async function getAssetsFromCache(options) {
2689
+ return getSupportedAssets(options);
2690
+ }
2691
+ async function findVaultByConfig(params) {
2692
+ if (!isValidAddress(params.assetAddress)) {
2693
+ throw new APIError(
2694
+ `Invalid assetAddress: ${params.assetAddress}. Must be a valid Ethereum address.`,
2695
+ { endpoint: "findVaultByConfig" }
2696
+ );
2697
+ }
2698
+ if (!isValidYieldType(params.yieldType)) {
2699
+ throw new APIError(
2700
+ `Invalid yieldType: ${params.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
2701
+ { endpoint: "findVaultByConfig" }
2702
+ );
2703
+ }
2704
+ if (!isValidChainId(params.chainId)) {
2705
+ throw new APIError(
2706
+ `Invalid chainId: ${params.chainId}. Must be a positive integer.`,
2707
+ { endpoint: "findVaultByConfig" }
2708
+ );
2709
+ }
2710
+ const cache = getCache();
2711
+ if (cache.isEmpty() || cache.isExpired()) {
2712
+ await cache.refresh();
2713
+ }
2714
+ const normalizedAddress = params.assetAddress.toLowerCase();
2715
+ let vaultsByToken = cache.getVault(params.assetAddress);
2716
+ if (!vaultsByToken) {
2717
+ vaultsByToken = cache.getVault(normalizedAddress);
2718
+ }
2719
+ if (!vaultsByToken) {
2720
+ const allVaults = cache.getAllVaults();
2721
+ const matchingVaults = allVaults.filter(
2722
+ (vault) => vault.supportedAssets.some(
2723
+ (a) => a.address.toLowerCase() === normalizedAddress
2724
+ )
2725
+ );
2726
+ vaultsByToken = matchingVaults.length > 0 ? matchingVaults : void 0;
2727
+ }
2728
+ if (!vaultsByToken || vaultsByToken.length === 0) {
2729
+ return null;
2730
+ }
2731
+ const matchingVault = vaultsByToken.find(
2732
+ (vault) => vault.yieldType === params.yieldType && vault.chainId === params.chainId
2733
+ );
2734
+ return matchingVault || null;
2735
+ }
2736
+ async function getVaultsByConfig(params) {
2737
+ const cache = getCache();
2738
+ if (cache.isEmpty() || cache.isExpired()) {
2739
+ await cache.refresh();
2740
+ }
2741
+ let vaults = cache.getAllVaults();
2742
+ if (params?.yieldType) {
2743
+ if (!isValidYieldType(params.yieldType)) {
2744
+ throw new APIError(
2745
+ `Invalid yieldType: ${params.yieldType}. Must be one of: CORE, TREASURY, FRONTIER.`,
2746
+ { endpoint: "getVaultsByConfig" }
2747
+ );
2748
+ }
2749
+ vaults = vaults.filter((v) => v.yieldType === params.yieldType);
2750
+ }
2751
+ if (params?.chainId !== void 0) {
2752
+ if (!isValidChainId(params.chainId)) {
2753
+ throw new APIError(
2754
+ `Invalid chainId: ${params.chainId}. Must be a positive integer.`,
2755
+ { endpoint: "getVaultsByConfig" }
2756
+ );
2757
+ }
2758
+ vaults = vaults.filter((v) => v.chainId === params.chainId);
2759
+ }
2760
+ if (params?.depositAssetAddress) {
2761
+ if (!isValidAddress(params.depositAssetAddress)) {
2762
+ throw new APIError(
2763
+ `Invalid depositAssetAddress: ${params.depositAssetAddress}.`,
2764
+ { endpoint: "getVaultsByConfig" }
2765
+ );
2766
+ }
2767
+ const normalized = params.depositAssetAddress.toLowerCase();
2768
+ vaults = vaults.filter(
2769
+ (v) => v.supportedAssets.some((a) => a.address.toLowerCase() === normalized)
2770
+ );
2771
+ }
2772
+ if (params?.withdrawAssetAddress) {
2773
+ if (!isValidAddress(params.withdrawAssetAddress)) {
2774
+ throw new APIError(
2775
+ `Invalid withdrawAssetAddress: ${params.withdrawAssetAddress}.`,
2776
+ { endpoint: "getVaultsByConfig" }
2777
+ );
2778
+ }
2779
+ const normalized = params.withdrawAssetAddress.toLowerCase();
2780
+ vaults = vaults.filter(
2781
+ (v) => v.supportedAssets.some(
2782
+ (a) => a.withdrawable !== false && a.address.toLowerCase() === normalized
2783
+ )
2784
+ );
2785
+ }
2786
+ if (params?.settlementAssetAddress) {
2787
+ if (!isValidAddress(params.settlementAssetAddress)) {
2788
+ throw new APIError(
2789
+ `Invalid settlementAssetAddress: ${params.settlementAssetAddress}.`,
2790
+ { endpoint: "getVaultsByConfig" }
2791
+ );
2792
+ }
2793
+ const normalized = params.settlementAssetAddress.toLowerCase();
2794
+ vaults = vaults.filter(
2795
+ (v) => v.supportedAssets.some((a) => a.address.toLowerCase() === normalized)
2796
+ );
2797
+ }
2798
+ return vaults;
2799
+ }
2800
+ async function getWithdrawSupportedAssets() {
2801
+ const cache = getCache();
2802
+ if (cache.isEmpty() || cache.isExpired()) {
2803
+ await cache.refresh();
2804
+ }
2805
+ const vaults = cache.getAllVaults();
2806
+ const assets = cache.getAllAssets();
2807
+ const result = [];
2808
+ const assetMap = /* @__PURE__ */ new Map();
2809
+ for (const asset of assets) {
2810
+ assetMap.set(asset.address.toLowerCase(), asset);
2811
+ }
2812
+ const assetVaultMap = /* @__PURE__ */ new Map();
2813
+ for (const vault of vaults) {
2814
+ for (const asset of vault.supportedAssets) {
2815
+ const assetAddress = asset.address.toLowerCase();
2816
+ if (!assetVaultMap.has(assetAddress)) {
2817
+ assetVaultMap.set(assetAddress, []);
2818
+ }
2819
+ assetVaultMap.get(assetAddress)?.push({
2820
+ id: vault.id,
2821
+ yieldType: vault.yieldType,
2822
+ chainId: vault.chainId,
2823
+ vaultId: vault.id
2824
+ });
2825
+ }
2826
+ }
2827
+ for (const [assetAddress, vaultsData] of assetVaultMap.entries()) {
2828
+ const asset = assetMap.get(assetAddress);
2829
+ if (asset) {
2830
+ result.push({
2831
+ address: asset.address,
2832
+ symbol: asset.symbol,
2833
+ decimals: asset.decimals,
2834
+ vaults: vaultsData
2835
+ });
2836
+ }
2837
+ }
2838
+ return result;
2839
+ }
2840
+ var hyperEvm = defineChain({
2841
+ id: 999,
2842
+ name: "HyperEVM",
2843
+ nativeCurrency: {
2844
+ decimals: 18,
2845
+ name: "Hyperliquid",
2846
+ symbol: "HYPE"
2847
+ },
2848
+ rpcUrls: {
2849
+ default: {
2850
+ http: ["https://rpc.hyperliquid.xyz/evm"],
2851
+ webSocket: ["wss://hyperliquid.drpc.org"]
2852
+ }
2853
+ },
2854
+ blockExplorers: {
2855
+ default: { name: "Explorer", url: "https://purrsec.com/" }
2856
+ },
2857
+ contracts: {
2858
+ multicall3: {
2859
+ address: "0xcA11bde05977b3631167028862bE2a173976CA11",
2860
+ blockCreated: 13051
2861
+ }
2862
+ }
2863
+ });
2864
+ var stableTestnet = defineChain({
2865
+ id: 2201,
2866
+ name: "Stable Testnet",
2867
+ nativeCurrency: {
2868
+ decimals: 18,
2869
+ name: "Ether",
2870
+ symbol: "ETH"
2871
+ },
2872
+ rpcUrls: {
2873
+ default: {
2874
+ http: ["https://rpc.testnet.stable.xyz"]
2875
+ }
2876
+ },
2877
+ blockExplorers: {
2878
+ default: { name: "Stablescan", url: "https://testnet.stablescan.xyz" }
2879
+ },
2880
+ contracts: {
2881
+ multicall3: {
2882
+ address: "0xcA11bde05977b3631167028862bE2a173976CA11",
2883
+ blockCreated: 0
2884
+ }
2885
+ },
2886
+ testnet: true
2887
+ });
2888
+ var CHAIN_ID_TO_CHAIN_MAP = {
2889
+ [mainnet.id]: mainnet,
2890
+ [sepolia.id]: sepolia,
2891
+ [base.id]: base,
2892
+ [hyperEvm.id]: hyperEvm,
2893
+ [stableTestnet.id]: stableTestnet,
2894
+ [baseSepolia.id]: baseSepolia
2895
+ };
2896
+
2897
+ // src/utils/chain-utils.ts
2898
+ function toChainId(value) {
2899
+ return typeof value === "number" ? value : Number(value);
2900
+ }
2901
+ var chainsCache = null;
2902
+ async function getChainFromConfig(chainId, config) {
2903
+ if (chainsCache && !config) {
2904
+ const chain2 = chainsCache.get(Number(chainId));
2905
+ if (chain2) {
2906
+ return chain2;
2907
+ }
2908
+ }
2909
+ const vaults = config ?? await getVaults();
2910
+ const numericChainId = Number(chainId);
2911
+ const knownChain = CHAIN_ID_TO_CHAIN_MAP[numericChainId];
2912
+ const vaultForChain = vaults.find((v) => v.chainId === numericChainId);
2913
+ if (!knownChain && !vaultForChain) {
2914
+ throw new Error(`Vault not found for ID: ${chainId}`);
2915
+ }
2916
+ if (config && !chainsCache) {
2917
+ const cache = /* @__PURE__ */ new Map();
2918
+ for (const v of vaults) {
2919
+ const chainConfig = CHAIN_ID_TO_CHAIN_MAP[v.chainId];
2920
+ if (!chainConfig) {
2921
+ throw new Error(`Chain config not found for ID: ${v.chainId}`);
2922
+ }
2923
+ cache.set(v.chainId, {
2924
+ id: v.chainId,
2925
+ name: chainConfig.name,
2926
+ nativeCurrency: chainConfig.nativeCurrency,
2927
+ rpcUrls: chainConfig.rpcUrls,
2928
+ contracts: chainConfig.contracts
2929
+ });
2930
+ }
2931
+ if (knownChain && !cache.has(numericChainId)) {
2932
+ cache.set(numericChainId, {
2933
+ id: numericChainId,
2934
+ name: knownChain.name,
2935
+ nativeCurrency: knownChain.nativeCurrency,
2936
+ rpcUrls: knownChain.rpcUrls,
2937
+ contracts: knownChain.contracts
2938
+ });
2939
+ }
2940
+ chainsCache = cache;
2941
+ }
2942
+ const chain = chainsCache ? chainsCache.get(numericChainId) : void 0;
2943
+ if (!chain) {
2944
+ throw new Error(`Chain not found for ID: ${chainId}`);
2945
+ }
2946
+ return chain;
2947
+ }
2948
+ function getChainNameById(chainId) {
2949
+ return CHAIN_ID_TO_CHAIN_MAP[chainId]?.name || null;
2950
+ }
2951
+ function clearChainsCache() {
2952
+ chainsCache = null;
2953
+ }
2954
+
2955
+ // src/lib/viem/client.ts
2956
+ var clients = /* @__PURE__ */ new Map();
2957
+ var directClients = /* @__PURE__ */ new Map();
2958
+ var warnedChains = /* @__PURE__ */ new Set();
2959
+ var getClient = async (chainId) => {
2960
+ if (!chainId) {
2961
+ throw new Error("Chain ID is required");
2962
+ }
2963
+ const numericChainId = toChainId(chainId);
2964
+ if (!clients.has(numericChainId)) {
2965
+ const chain = await getChainFromConfig(numericChainId, await getVaults());
2966
+ const customRpcUrl = getRpcUrls()[numericChainId];
2967
+ if (!customRpcUrl && !warnedChains.has(numericChainId)) {
2968
+ warnedChains.add(numericChainId);
2969
+ getLogger().warn(
2970
+ `No custom RPC URL provided for chain ${numericChainId} (${chain.name}). Using default public RPC. Public RPCs may be unreliable \u2014 pass rpcUrls in initAmplifySDK() options for better reliability.`
2971
+ );
2972
+ }
2973
+ const rpcUrl = customRpcUrl ?? chain.rpcUrls.default.http[0];
2974
+ const client2 = createPublicClient({
2975
+ chain,
2976
+ transport: http(rpcUrl)
2977
+ });
2978
+ clients.set(numericChainId, client2);
2979
+ }
2980
+ const client = clients.get(numericChainId);
2981
+ if (!client) {
2982
+ throw new Error(`Client not found for chain ID ${chainId}`);
2983
+ }
2984
+ return client;
2985
+ };
2986
+ var getClientDirect = async (chainId) => {
2987
+ if (!chainId) {
2988
+ throw new Error("Chain ID is required");
2989
+ }
2990
+ const numericChainId = toChainId(chainId);
2991
+ if (!directClients.has(numericChainId)) {
2992
+ const chain = CHAIN_ID_TO_CHAIN_MAP[numericChainId];
2993
+ if (!chain) {
2994
+ throw new Error(`Chain config not found for ID: ${numericChainId}`);
2995
+ }
2996
+ const customRpcUrl = getRpcUrls()[numericChainId];
2997
+ if (!customRpcUrl && !warnedChains.has(numericChainId)) {
2998
+ warnedChains.add(numericChainId);
2999
+ getLogger().warn(
3000
+ `No custom RPC URL provided for chain ${numericChainId} (${chain.name}). Using default public RPC. Public RPCs may be unreliable \u2014 pass rpcUrls in initAmplifySDK() options for better reliability.`
3001
+ );
3002
+ }
3003
+ const rpcUrl = customRpcUrl ?? chain.rpcUrls.default.http[0];
3004
+ const client2 = createPublicClient({
3005
+ chain,
3006
+ transport: http(rpcUrl)
3007
+ });
3008
+ directClients.set(numericChainId, client2);
3009
+ }
3010
+ const client = directClients.get(numericChainId);
3011
+ if (!client) {
3012
+ throw new Error(`Client not found for chain ID ${chainId}`);
3013
+ }
3014
+ return client;
3015
+ };
3016
+ function clearClients() {
3017
+ clients.clear();
3018
+ directClients.clear();
3019
+ warnedChains.clear();
3020
+ }
3021
+
3022
+ // src/api/fees-and-supply-cap.ts
3023
+ async function readSupplyCapInBase(dcdAddress, chainId) {
3024
+ const client = await getClientDirect(chainId);
3025
+ const result = await client.readContract({
3026
+ abi: DistributorCodeDepositorAbiV0,
3027
+ address: dcdAddress,
3028
+ functionName: "supplyCapInBase"
3029
+ });
3030
+ return result;
3031
+ }
3032
+ async function readFeeModuleFromDCD(dcdAddress, chainId) {
3033
+ try {
3034
+ const client = await getClientDirect(chainId);
3035
+ const result = await client.readContract({
3036
+ abi: DistributorCodeDepositorAbiV0,
3037
+ address: dcdAddress,
3038
+ functionName: "feeModule"
3039
+ });
3040
+ return result || zeroAddress;
3041
+ } catch {
3042
+ return zeroAddress;
3043
+ }
3044
+ }
3045
+ async function readDepositFeeStructure(feeModuleAddress, depositAsset, chainId) {
3046
+ const client = await getClientDirect(chainId);
3047
+ const results = await client.multicall({
3048
+ contracts: [
3049
+ {
3050
+ abi: DCDAssetSpecificFeeModuleAbi,
3051
+ address: feeModuleAddress,
3052
+ functionName: "depositTokenFeeData",
3053
+ args: [depositAsset]
3054
+ },
3055
+ {
3056
+ abi: DCDAssetSpecificFeeModuleAbi,
3057
+ address: feeModuleAddress,
3058
+ functionName: "ONE_HUNDRED_PERCENT"
3059
+ }
3060
+ ]
3061
+ });
3062
+ const [feeDataResult, oneHundredPercentResult] = results;
3063
+ if (feeDataResult.status === "failure" || oneHundredPercentResult.status === "failure") {
3064
+ throw new Error(
3065
+ "Failed to read fee data from fee module contract: RPC call failed"
3066
+ );
3067
+ }
3068
+ const [feePercentage, flatFee] = feeDataResult.result;
3069
+ const oneHundredPercent = oneHundredPercentResult.result;
3070
+ return { feePercentage, flatFee, oneHundredPercent };
3071
+ }
3072
+ async function readOneHundredPercent(feeModuleAddress, chainId) {
3073
+ const client = await getClientDirect(chainId);
3074
+ const result = await client.readContract({
3075
+ abi: DCDAssetSpecificFeeModuleAbi,
3076
+ address: feeModuleAddress,
3077
+ functionName: "ONE_HUNDRED_PERCENT"
3078
+ });
3079
+ return result;
3080
+ }
3081
+ async function readWithdrawFeePercentage(withdrawQueueAddress, chainId) {
3082
+ const client = await getClientDirect(chainId);
3083
+ const feeModuleAddress = await client.readContract({
3084
+ abi: WithdrawQueueAbi,
3085
+ address: withdrawQueueAddress,
3086
+ functionName: "feeModule"
3087
+ });
3088
+ if (!feeModuleAddress || feeModuleAddress === zeroAddress) {
3089
+ return null;
3090
+ }
3091
+ const result = await client.readContract({
3092
+ abi: FeeModuleAbi,
3093
+ address: feeModuleAddress,
3094
+ functionName: "offerFeePercentage"
3095
+ });
3096
+ return {
3097
+ feeModuleAddress,
3098
+ offerFeePercentage: result
3099
+ };
3100
+ }
3101
+ async function enrichVaultsWithSupplyCapsAndFees(vaults) {
3102
+ const enrichmentPromises = vaults.map(async (vault) => {
3103
+ const enriched = { ...vault };
3104
+ if (vault.vault.communityCodeDepositorAddress && vault.vault.depositFeeModuleAddress) {
3105
+ try {
3106
+ const supplyCapInBase = await readSupplyCapInBase(
3107
+ vault.vault.communityCodeDepositorAddress,
3108
+ vault.chainId
3109
+ );
3110
+ enriched.depositCap = {
3111
+ supplyCapInBase,
3112
+ hasDepositCap: supplyCapInBase !== 0n && supplyCapInBase !== maxUint256
3113
+ };
3114
+ } catch {
3115
+ }
3116
+ }
3117
+ const depositFeeModuleAddr = vault.vault.depositFeeModuleAddress;
3118
+ if (depositFeeModuleAddr && depositFeeModuleAddr !== zeroAddress) {
3119
+ if (!vault.depositFees?.hasFees || vault.depositFees.fees.length === 0) {
3120
+ const defaultFees = vault.supportedAssets.filter((a) => a.depositable !== false).map((a) => ({
3121
+ depositAsset: a.address,
3122
+ feePercentage: 0n,
3123
+ flatFee: 0n
3124
+ }));
3125
+ enriched.depositFees = {
3126
+ hasFees: true,
3127
+ feeModuleAddress: depositFeeModuleAddr,
3128
+ fees: defaultFees
3129
+ };
3130
+ }
3131
+ if (!enriched.depositFees?.oneHundredPercent) {
3132
+ try {
3133
+ const oneHundredPercentFromFeeModule = await readOneHundredPercent(
3134
+ depositFeeModuleAddr,
3135
+ vault.chainId
3136
+ );
3137
+ enriched.depositFees = {
3138
+ ...enriched.depositFees,
3139
+ oneHundredPercent: oneHundredPercentFromFeeModule
3140
+ };
3141
+ } catch {
3142
+ }
3143
+ }
3144
+ }
3145
+ const wfAddr = vault.vault.withdrawFeeModuleAddress;
3146
+ if (wfAddr && wfAddr !== zeroAddress) {
3147
+ if (!vault.withdrawFees?.hasFees) {
3148
+ enriched.withdrawFees = {
3149
+ hasFees: true,
3150
+ feeModuleAddress: wfAddr,
3151
+ offerFeeBps: 0n,
3152
+ offerFeeRate: 0n
3153
+ };
3154
+ } else if (!enriched.withdrawFees?.feeModuleAddress) {
3155
+ enriched.withdrawFees = {
3156
+ ...enriched.withdrawFees,
3157
+ feeModuleAddress: wfAddr
3158
+ };
3159
+ }
3160
+ }
3161
+ return enriched;
3162
+ });
3163
+ return Promise.all(enrichmentPromises);
3164
+ }
3165
+
3166
+ export { APIError, API_BASE_URL, CHAINLINK_ADDRESS, DEFAULT_APPROVAL_AMOUNT, DEFAULT_DEADLINE, DEFAULT_SLIPPAGE_BPS, DEFAULT_TIMEOUT, DistributorCodeDepositorAbiV0, FeeModuleAbi, LogLevel, WithdrawQueueAbi, YieldType, __publicField, clearChainsCache, createTimeoutSignal, enrichVaultsWithSupplyCapsAndFees, findVaultByConfig, getAssetsFromCache, getCache, getChainFromConfig, getChainNameById, getClient, getLogger, getRequestHeaders, getRestV2BaseURL, getSupportedAssets, getVaults, getVaultsByConfig, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, isCacheReady, isValidAddress, isValidChainId, readDepositFeeStructure, readFeeModuleFromDCD, readSupplyCapInBase, readWithdrawFeePercentage, refreshVaultCache, setLogLevel, setLogger, toChainId, waitForCacheReady };
3167
+ //# sourceMappingURL=chunk-ODXJYXUH.mjs.map
3168
+ //# sourceMappingURL=chunk-ODXJYXUH.mjs.map