@paxoslabs/amplify-sdk 0.5.3 → 1.0.0

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 (62) hide show
  1. package/dist/index.d.mts +3157 -759
  2. package/dist/index.d.ts +3157 -759
  3. package/dist/index.js +15008 -186
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +15067 -6
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +25 -86
  8. package/CHANGELOG.md +0 -320
  9. package/LICENSE +0 -28
  10. package/README.md +0 -119
  11. package/dist/chain-utils-5r2UnCDS.d.mts +0 -380
  12. package/dist/chain-utils-5r2UnCDS.d.ts +0 -380
  13. package/dist/chunk-4NQPS3JC.js +0 -2101
  14. package/dist/chunk-4NQPS3JC.js.map +0 -1
  15. package/dist/chunk-6CU533DM.mjs +0 -39
  16. package/dist/chunk-6CU533DM.mjs.map +0 -1
  17. package/dist/chunk-6JLKHV6O.js +0 -128
  18. package/dist/chunk-6JLKHV6O.js.map +0 -1
  19. package/dist/chunk-FHE43NKY.js +0 -1143
  20. package/dist/chunk-FHE43NKY.js.map +0 -1
  21. package/dist/chunk-GOJQYEJQ.js +0 -3212
  22. package/dist/chunk-GOJQYEJQ.js.map +0 -1
  23. package/dist/chunk-LMNADWTH.mjs +0 -2073
  24. package/dist/chunk-LMNADWTH.mjs.map +0 -1
  25. package/dist/chunk-ODXJYXUH.mjs +0 -3168
  26. package/dist/chunk-ODXJYXUH.mjs.map +0 -1
  27. package/dist/chunk-QMFYPHX5.mjs +0 -690
  28. package/dist/chunk-QMFYPHX5.mjs.map +0 -1
  29. package/dist/chunk-TNL23CO2.js +0 -45
  30. package/dist/chunk-TNL23CO2.js.map +0 -1
  31. package/dist/chunk-UY2WD7MF.mjs +0 -1133
  32. package/dist/chunk-UY2WD7MF.mjs.map +0 -1
  33. package/dist/chunk-WD6QFSXZ.js +0 -701
  34. package/dist/chunk-WD6QFSXZ.js.map +0 -1
  35. package/dist/chunk-Y5LBT2WT.mjs +0 -118
  36. package/dist/chunk-Y5LBT2WT.mjs.map +0 -1
  37. package/dist/core.d.mts +0 -195
  38. package/dist/core.d.ts +0 -195
  39. package/dist/core.js +0 -1236
  40. package/dist/core.js.map +0 -1
  41. package/dist/core.mjs +0 -1194
  42. package/dist/core.mjs.map +0 -1
  43. package/dist/display.d.mts +0 -472
  44. package/dist/display.d.ts +0 -472
  45. package/dist/display.js +0 -52
  46. package/dist/display.js.map +0 -1
  47. package/dist/display.mjs +0 -7
  48. package/dist/display.mjs.map +0 -1
  49. package/dist/index-D8RtV9cB.d.mts +0 -5114
  50. package/dist/index-ev_V5sjt.d.ts +0 -5114
  51. package/dist/utils.d.mts +0 -112
  52. package/dist/utils.d.ts +0 -112
  53. package/dist/utils.js +0 -67
  54. package/dist/utils.js.map +0 -1
  55. package/dist/utils.mjs +0 -25
  56. package/dist/utils.mjs.map +0 -1
  57. package/dist/vaults.d.mts +0 -4
  58. package/dist/vaults.d.ts +0 -4
  59. package/dist/vaults.js +0 -96
  60. package/dist/vaults.js.map +0 -1
  61. package/dist/vaults.mjs +0 -7
  62. package/dist/vaults.mjs.map +0 -1
@@ -1,1133 +0,0 @@
1
- import { getClient, APIError } from './chunk-ODXJYXUH.mjs';
2
- import { erc20Abi } from 'viem';
3
-
4
- // src/abi/accountant-abi.ts
5
- var AccountantAbi = [
6
- {
7
- type: "constructor",
8
- inputs: [
9
- { name: "_owner", type: "address", internalType: "address" },
10
- { name: "_vault", type: "address", internalType: "address" },
11
- { name: "payoutAddress", type: "address", internalType: "address" },
12
- { name: "startingExchangeRate", type: "uint96", internalType: "uint96" },
13
- { name: "_base", type: "address", internalType: "address" },
14
- {
15
- name: "allowedExchangeRateChangeUpper",
16
- type: "uint16",
17
- internalType: "uint16"
18
- },
19
- {
20
- name: "allowedExchangeRateChangeLower",
21
- type: "uint16",
22
- internalType: "uint16"
23
- },
24
- {
25
- name: "minimumUpdateDelayInSeconds",
26
- type: "uint32",
27
- internalType: "uint32"
28
- },
29
- { name: "managementFee", type: "uint16", internalType: "uint16" }
30
- ],
31
- stateMutability: "nonpayable"
32
- },
33
- {
34
- type: "function",
35
- name: "accountantState",
36
- inputs: [],
37
- outputs: [
38
- { name: "payoutAddress", type: "address", internalType: "address" },
39
- { name: "feesOwedInBase", type: "uint128", internalType: "uint128" },
40
- {
41
- name: "totalSharesLastUpdate",
42
- type: "uint128",
43
- internalType: "uint128"
44
- },
45
- { name: "exchangeRate", type: "uint96", internalType: "uint96" },
46
- {
47
- name: "allowedExchangeRateChangeUpper",
48
- type: "uint16",
49
- internalType: "uint16"
50
- },
51
- {
52
- name: "allowedExchangeRateChangeLower",
53
- type: "uint16",
54
- internalType: "uint16"
55
- },
56
- { name: "lastUpdateTimestamp", type: "uint64", internalType: "uint64" },
57
- { name: "isPaused", type: "bool", internalType: "bool" },
58
- {
59
- name: "minimumUpdateDelayInSeconds",
60
- type: "uint32",
61
- internalType: "uint32"
62
- },
63
- { name: "managementFee", type: "uint16", internalType: "uint16" }
64
- ],
65
- stateMutability: "view"
66
- },
67
- {
68
- type: "function",
69
- name: "authority",
70
- inputs: [],
71
- outputs: [
72
- { name: "", type: "address", internalType: "contract Authority" }
73
- ],
74
- stateMutability: "view"
75
- },
76
- {
77
- type: "function",
78
- name: "base",
79
- inputs: [],
80
- outputs: [{ name: "", type: "address", internalType: "contract ERC20" }],
81
- stateMutability: "view"
82
- },
83
- {
84
- type: "function",
85
- name: "claimFees",
86
- inputs: [
87
- { name: "feeAsset", type: "address", internalType: "contract ERC20" }
88
- ],
89
- outputs: [],
90
- stateMutability: "nonpayable"
91
- },
92
- {
93
- type: "function",
94
- name: "decimals",
95
- inputs: [],
96
- outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
97
- stateMutability: "view"
98
- },
99
- {
100
- type: "function",
101
- name: "getRate",
102
- inputs: [],
103
- outputs: [{ name: "rate", type: "uint256", internalType: "uint256" }],
104
- stateMutability: "view"
105
- },
106
- {
107
- type: "function",
108
- name: "getRateInQuote",
109
- inputs: [
110
- { name: "quote", type: "address", internalType: "contract ERC20" }
111
- ],
112
- outputs: [
113
- { name: "rateInQuote", type: "uint256", internalType: "uint256" }
114
- ],
115
- stateMutability: "view"
116
- },
117
- {
118
- type: "function",
119
- name: "getRateInQuoteSafe",
120
- inputs: [
121
- { name: "quote", type: "address", internalType: "contract ERC20" }
122
- ],
123
- outputs: [
124
- { name: "rateInQuote", type: "uint256", internalType: "uint256" }
125
- ],
126
- stateMutability: "view"
127
- },
128
- {
129
- type: "function",
130
- name: "getRateSafe",
131
- inputs: [],
132
- outputs: [{ name: "rate", type: "uint256", internalType: "uint256" }],
133
- stateMutability: "view"
134
- },
135
- {
136
- type: "function",
137
- name: "owner",
138
- inputs: [],
139
- outputs: [{ name: "", type: "address", internalType: "address" }],
140
- stateMutability: "view"
141
- },
142
- {
143
- type: "function",
144
- name: "pause",
145
- inputs: [],
146
- outputs: [],
147
- stateMutability: "nonpayable"
148
- },
149
- {
150
- type: "function",
151
- name: "rateProviderData",
152
- inputs: [{ name: "", type: "address", internalType: "contract ERC20" }],
153
- outputs: [
154
- { name: "isPeggedToBase", type: "bool", internalType: "bool" },
155
- {
156
- name: "rateProvider",
157
- type: "address",
158
- internalType: "contract IRateProvider"
159
- }
160
- ],
161
- stateMutability: "view"
162
- },
163
- {
164
- type: "function",
165
- name: "setAuthority",
166
- inputs: [
167
- {
168
- name: "newAuthority",
169
- type: "address",
170
- internalType: "contract Authority"
171
- }
172
- ],
173
- outputs: [],
174
- stateMutability: "nonpayable"
175
- },
176
- {
177
- type: "function",
178
- name: "setRateProviderData",
179
- inputs: [
180
- { name: "asset", type: "address", internalType: "contract ERC20" },
181
- { name: "isPeggedToBase", type: "bool", internalType: "bool" },
182
- { name: "rateProvider", type: "address", internalType: "address" }
183
- ],
184
- outputs: [],
185
- stateMutability: "nonpayable"
186
- },
187
- {
188
- type: "function",
189
- name: "transferOwnership",
190
- inputs: [{ name: "newOwner", type: "address", internalType: "address" }],
191
- outputs: [],
192
- stateMutability: "nonpayable"
193
- },
194
- {
195
- type: "function",
196
- name: "unpause",
197
- inputs: [],
198
- outputs: [],
199
- stateMutability: "nonpayable"
200
- },
201
- {
202
- type: "function",
203
- name: "updateDelay",
204
- inputs: [
205
- {
206
- name: "minimumUpdateDelayInSeconds",
207
- type: "uint32",
208
- internalType: "uint32"
209
- }
210
- ],
211
- outputs: [],
212
- stateMutability: "nonpayable"
213
- },
214
- {
215
- type: "function",
216
- name: "updateExchangeRate",
217
- inputs: [
218
- { name: "newExchangeRate", type: "uint96", internalType: "uint96" }
219
- ],
220
- outputs: [],
221
- stateMutability: "nonpayable"
222
- },
223
- {
224
- type: "function",
225
- name: "updateLower",
226
- inputs: [
227
- {
228
- name: "allowedExchangeRateChangeLower",
229
- type: "uint16",
230
- internalType: "uint16"
231
- }
232
- ],
233
- outputs: [],
234
- stateMutability: "nonpayable"
235
- },
236
- {
237
- type: "function",
238
- name: "updateManagementFee",
239
- inputs: [{ name: "managementFee", type: "uint16", internalType: "uint16" }],
240
- outputs: [],
241
- stateMutability: "nonpayable"
242
- },
243
- {
244
- type: "function",
245
- name: "updatePayoutAddress",
246
- inputs: [
247
- { name: "payoutAddress", type: "address", internalType: "address" }
248
- ],
249
- outputs: [],
250
- stateMutability: "nonpayable"
251
- },
252
- {
253
- type: "function",
254
- name: "updateUpper",
255
- inputs: [
256
- {
257
- name: "allowedExchangeRateChangeUpper",
258
- type: "uint16",
259
- internalType: "uint16"
260
- }
261
- ],
262
- outputs: [],
263
- stateMutability: "nonpayable"
264
- },
265
- {
266
- type: "function",
267
- name: "vault",
268
- inputs: [],
269
- outputs: [
270
- { name: "", type: "address", internalType: "contract BoringVault" }
271
- ],
272
- stateMutability: "view"
273
- },
274
- {
275
- type: "event",
276
- name: "AuthorityUpdated",
277
- inputs: [
278
- { name: "user", type: "address", indexed: true, internalType: "address" },
279
- {
280
- name: "newAuthority",
281
- type: "address",
282
- indexed: true,
283
- internalType: "contract Authority"
284
- }
285
- ],
286
- anonymous: false
287
- },
288
- {
289
- type: "event",
290
- name: "DelayInSecondsUpdated",
291
- inputs: [
292
- {
293
- name: "oldDelay",
294
- type: "uint32",
295
- indexed: false,
296
- internalType: "uint32"
297
- },
298
- {
299
- name: "newDelay",
300
- type: "uint32",
301
- indexed: false,
302
- internalType: "uint32"
303
- }
304
- ],
305
- anonymous: false
306
- },
307
- {
308
- type: "event",
309
- name: "ExchangeRateUpdated",
310
- inputs: [
311
- {
312
- name: "oldRate",
313
- type: "uint96",
314
- indexed: false,
315
- internalType: "uint96"
316
- },
317
- {
318
- name: "newRate",
319
- type: "uint96",
320
- indexed: false,
321
- internalType: "uint96"
322
- },
323
- {
324
- name: "currentTime",
325
- type: "uint64",
326
- indexed: false,
327
- internalType: "uint64"
328
- }
329
- ],
330
- anonymous: false
331
- },
332
- {
333
- type: "event",
334
- name: "FeesClaimed",
335
- inputs: [
336
- {
337
- name: "feeAsset",
338
- type: "address",
339
- indexed: true,
340
- internalType: "address"
341
- },
342
- {
343
- name: "amount",
344
- type: "uint256",
345
- indexed: false,
346
- internalType: "uint256"
347
- }
348
- ],
349
- anonymous: false
350
- },
351
- {
352
- type: "event",
353
- name: "LowerBoundUpdated",
354
- inputs: [
355
- {
356
- name: "oldBound",
357
- type: "uint16",
358
- indexed: false,
359
- internalType: "uint16"
360
- },
361
- {
362
- name: "newBound",
363
- type: "uint16",
364
- indexed: false,
365
- internalType: "uint16"
366
- }
367
- ],
368
- anonymous: false
369
- },
370
- {
371
- type: "event",
372
- name: "ManagementFeeUpdated",
373
- inputs: [
374
- {
375
- name: "oldFee",
376
- type: "uint16",
377
- indexed: false,
378
- internalType: "uint16"
379
- },
380
- {
381
- name: "newFee",
382
- type: "uint16",
383
- indexed: false,
384
- internalType: "uint16"
385
- }
386
- ],
387
- anonymous: false
388
- },
389
- {
390
- type: "event",
391
- name: "OwnershipTransferred",
392
- inputs: [
393
- { name: "user", type: "address", indexed: true, internalType: "address" },
394
- {
395
- name: "newOwner",
396
- type: "address",
397
- indexed: true,
398
- internalType: "address"
399
- }
400
- ],
401
- anonymous: false
402
- },
403
- { type: "event", name: "Paused", inputs: [], anonymous: false },
404
- {
405
- type: "event",
406
- name: "PayoutAddressUpdated",
407
- inputs: [
408
- {
409
- name: "oldPayout",
410
- type: "address",
411
- indexed: false,
412
- internalType: "address"
413
- },
414
- {
415
- name: "newPayout",
416
- type: "address",
417
- indexed: false,
418
- internalType: "address"
419
- }
420
- ],
421
- anonymous: false
422
- },
423
- {
424
- type: "event",
425
- name: "RateProviderUpdated",
426
- inputs: [
427
- {
428
- name: "asset",
429
- type: "address",
430
- indexed: false,
431
- internalType: "address"
432
- },
433
- { name: "isPegged", type: "bool", indexed: false, internalType: "bool" },
434
- {
435
- name: "rateProvider",
436
- type: "address",
437
- indexed: false,
438
- internalType: "address"
439
- }
440
- ],
441
- anonymous: false
442
- },
443
- { type: "event", name: "Unpaused", inputs: [], anonymous: false },
444
- {
445
- type: "event",
446
- name: "UpperBoundUpdated",
447
- inputs: [
448
- {
449
- name: "oldBound",
450
- type: "uint16",
451
- indexed: false,
452
- internalType: "uint16"
453
- },
454
- {
455
- name: "newBound",
456
- type: "uint16",
457
- indexed: false,
458
- internalType: "uint16"
459
- }
460
- ],
461
- anonymous: false
462
- },
463
- {
464
- type: "error",
465
- name: "AccountantWithRateProviders__LowerBoundTooLarge",
466
- inputs: []
467
- },
468
- {
469
- type: "error",
470
- name: "AccountantWithRateProviders__ManagementFeeTooLarge",
471
- inputs: []
472
- },
473
- {
474
- type: "error",
475
- name: "AccountantWithRateProviders__OnlyCallableByBoringVault",
476
- inputs: []
477
- },
478
- { type: "error", name: "AccountantWithRateProviders__Paused", inputs: [] },
479
- {
480
- type: "error",
481
- name: "AccountantWithRateProviders__UpdateDelayTooLarge",
482
- inputs: []
483
- },
484
- {
485
- type: "error",
486
- name: "AccountantWithRateProviders__UpperBoundTooSmall",
487
- inputs: []
488
- },
489
- {
490
- type: "error",
491
- name: "AccountantWithRateProviders__ZeroFeesOwed",
492
- inputs: []
493
- }
494
- ];
495
-
496
- // src/abi/boring-vault-abi.ts
497
- var BoringVaultAbi = [
498
- {
499
- type: "constructor",
500
- inputs: [
501
- { name: "_owner", type: "address", internalType: "address" },
502
- { name: "_name", type: "string", internalType: "string" },
503
- { name: "_symbol", type: "string", internalType: "string" },
504
- { name: "_decimals", type: "uint8", internalType: "uint8" }
505
- ],
506
- stateMutability: "nonpayable"
507
- },
508
- { type: "receive", stateMutability: "payable" },
509
- {
510
- type: "function",
511
- name: "DOMAIN_SEPARATOR",
512
- inputs: [],
513
- outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
514
- stateMutability: "view"
515
- },
516
- {
517
- type: "function",
518
- name: "allowance",
519
- inputs: [
520
- { name: "", type: "address", internalType: "address" },
521
- { name: "", type: "address", internalType: "address" }
522
- ],
523
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
524
- stateMutability: "view"
525
- },
526
- {
527
- type: "function",
528
- name: "approve",
529
- inputs: [
530
- { name: "spender", type: "address", internalType: "address" },
531
- { name: "amount", type: "uint256", internalType: "uint256" }
532
- ],
533
- outputs: [{ name: "", type: "bool", internalType: "bool" }],
534
- stateMutability: "nonpayable"
535
- },
536
- {
537
- type: "function",
538
- name: "authority",
539
- inputs: [],
540
- outputs: [
541
- { name: "", type: "address", internalType: "contract Authority" }
542
- ],
543
- stateMutability: "view"
544
- },
545
- {
546
- type: "function",
547
- name: "balanceOf",
548
- inputs: [{ name: "", type: "address", internalType: "address" }],
549
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
550
- stateMutability: "view"
551
- },
552
- {
553
- type: "function",
554
- name: "decimals",
555
- inputs: [],
556
- outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
557
- stateMutability: "view"
558
- },
559
- {
560
- type: "function",
561
- name: "enter",
562
- inputs: [
563
- { name: "from", type: "address", internalType: "address" },
564
- { name: "asset", type: "address", internalType: "contract ERC20" },
565
- { name: "assetAmount", type: "uint256", internalType: "uint256" },
566
- { name: "to", type: "address", internalType: "address" },
567
- { name: "shareAmount", type: "uint256", internalType: "uint256" }
568
- ],
569
- outputs: [],
570
- stateMutability: "nonpayable"
571
- },
572
- {
573
- type: "function",
574
- name: "exit",
575
- inputs: [
576
- { name: "to", type: "address", internalType: "address" },
577
- { name: "asset", type: "address", internalType: "contract ERC20" },
578
- { name: "assetAmount", type: "uint256", internalType: "uint256" },
579
- { name: "from", type: "address", internalType: "address" },
580
- { name: "shareAmount", type: "uint256", internalType: "uint256" }
581
- ],
582
- outputs: [],
583
- stateMutability: "nonpayable"
584
- },
585
- {
586
- type: "function",
587
- name: "hook",
588
- inputs: [],
589
- outputs: [
590
- {
591
- name: "",
592
- type: "address",
593
- internalType: "contract BeforeTransferHook"
594
- }
595
- ],
596
- stateMutability: "view"
597
- },
598
- {
599
- type: "function",
600
- name: "manage",
601
- inputs: [
602
- { name: "targets", type: "address[]", internalType: "address[]" },
603
- { name: "data", type: "bytes[]", internalType: "bytes[]" },
604
- { name: "values", type: "uint256[]", internalType: "uint256[]" }
605
- ],
606
- outputs: [{ name: "results", type: "bytes[]", internalType: "bytes[]" }],
607
- stateMutability: "nonpayable"
608
- },
609
- {
610
- type: "function",
611
- name: "manage",
612
- inputs: [
613
- { name: "target", type: "address", internalType: "address" },
614
- { name: "data", type: "bytes", internalType: "bytes" },
615
- { name: "value", type: "uint256", internalType: "uint256" }
616
- ],
617
- outputs: [{ name: "result", type: "bytes", internalType: "bytes" }],
618
- stateMutability: "nonpayable"
619
- },
620
- {
621
- type: "function",
622
- name: "name",
623
- inputs: [],
624
- outputs: [{ name: "", type: "string", internalType: "string" }],
625
- stateMutability: "view"
626
- },
627
- {
628
- type: "function",
629
- name: "nonces",
630
- inputs: [{ name: "", type: "address", internalType: "address" }],
631
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
632
- stateMutability: "view"
633
- },
634
- {
635
- type: "function",
636
- name: "onERC1155BatchReceived",
637
- inputs: [
638
- { name: "", type: "address", internalType: "address" },
639
- { name: "", type: "address", internalType: "address" },
640
- { name: "", type: "uint256[]", internalType: "uint256[]" },
641
- { name: "", type: "uint256[]", internalType: "uint256[]" },
642
- { name: "", type: "bytes", internalType: "bytes" }
643
- ],
644
- outputs: [{ name: "", type: "bytes4", internalType: "bytes4" }],
645
- stateMutability: "nonpayable"
646
- },
647
- {
648
- type: "function",
649
- name: "onERC1155Received",
650
- inputs: [
651
- { name: "", type: "address", internalType: "address" },
652
- { name: "", type: "address", internalType: "address" },
653
- { name: "", type: "uint256", internalType: "uint256" },
654
- { name: "", type: "uint256", internalType: "uint256" },
655
- { name: "", type: "bytes", internalType: "bytes" }
656
- ],
657
- outputs: [{ name: "", type: "bytes4", internalType: "bytes4" }],
658
- stateMutability: "nonpayable"
659
- },
660
- {
661
- type: "function",
662
- name: "onERC721Received",
663
- inputs: [
664
- { name: "", type: "address", internalType: "address" },
665
- { name: "", type: "address", internalType: "address" },
666
- { name: "", type: "uint256", internalType: "uint256" },
667
- { name: "", type: "bytes", internalType: "bytes" }
668
- ],
669
- outputs: [{ name: "", type: "bytes4", internalType: "bytes4" }],
670
- stateMutability: "nonpayable"
671
- },
672
- {
673
- type: "function",
674
- name: "owner",
675
- inputs: [],
676
- outputs: [{ name: "", type: "address", internalType: "address" }],
677
- stateMutability: "view"
678
- },
679
- {
680
- type: "function",
681
- name: "permit",
682
- inputs: [
683
- { name: "owner", type: "address", internalType: "address" },
684
- { name: "spender", type: "address", internalType: "address" },
685
- { name: "value", type: "uint256", internalType: "uint256" },
686
- { name: "deadline", type: "uint256", internalType: "uint256" },
687
- { name: "v", type: "uint8", internalType: "uint8" },
688
- { name: "r", type: "bytes32", internalType: "bytes32" },
689
- { name: "s", type: "bytes32", internalType: "bytes32" }
690
- ],
691
- outputs: [],
692
- stateMutability: "nonpayable"
693
- },
694
- {
695
- type: "function",
696
- name: "setAuthority",
697
- inputs: [
698
- {
699
- name: "newAuthority",
700
- type: "address",
701
- internalType: "contract Authority"
702
- }
703
- ],
704
- outputs: [],
705
- stateMutability: "nonpayable"
706
- },
707
- {
708
- type: "function",
709
- name: "setBeforeTransferHook",
710
- inputs: [{ name: "_hook", type: "address", internalType: "address" }],
711
- outputs: [],
712
- stateMutability: "nonpayable"
713
- },
714
- {
715
- type: "function",
716
- name: "supportsInterface",
717
- inputs: [{ name: "interfaceId", type: "bytes4", internalType: "bytes4" }],
718
- outputs: [{ name: "", type: "bool", internalType: "bool" }],
719
- stateMutability: "view"
720
- },
721
- {
722
- type: "function",
723
- name: "symbol",
724
- inputs: [],
725
- outputs: [{ name: "", type: "string", internalType: "string" }],
726
- stateMutability: "view"
727
- },
728
- {
729
- type: "function",
730
- name: "totalSupply",
731
- inputs: [],
732
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
733
- stateMutability: "view"
734
- },
735
- {
736
- type: "function",
737
- name: "transfer",
738
- inputs: [
739
- { name: "to", type: "address", internalType: "address" },
740
- { name: "amount", type: "uint256", internalType: "uint256" }
741
- ],
742
- outputs: [{ name: "", type: "bool", internalType: "bool" }],
743
- stateMutability: "nonpayable"
744
- },
745
- {
746
- type: "function",
747
- name: "transferFrom",
748
- inputs: [
749
- { name: "from", type: "address", internalType: "address" },
750
- { name: "to", type: "address", internalType: "address" },
751
- { name: "amount", type: "uint256", internalType: "uint256" }
752
- ],
753
- outputs: [{ name: "", type: "bool", internalType: "bool" }],
754
- stateMutability: "nonpayable"
755
- },
756
- {
757
- type: "function",
758
- name: "transferOwnership",
759
- inputs: [{ name: "newOwner", type: "address", internalType: "address" }],
760
- outputs: [],
761
- stateMutability: "nonpayable"
762
- },
763
- {
764
- type: "event",
765
- name: "Approval",
766
- inputs: [
767
- {
768
- name: "owner",
769
- type: "address",
770
- indexed: true,
771
- internalType: "address"
772
- },
773
- {
774
- name: "spender",
775
- type: "address",
776
- indexed: true,
777
- internalType: "address"
778
- },
779
- {
780
- name: "amount",
781
- type: "uint256",
782
- indexed: false,
783
- internalType: "uint256"
784
- }
785
- ],
786
- anonymous: false
787
- },
788
- {
789
- type: "event",
790
- name: "AuthorityUpdated",
791
- inputs: [
792
- { name: "user", type: "address", indexed: true, internalType: "address" },
793
- {
794
- name: "newAuthority",
795
- type: "address",
796
- indexed: true,
797
- internalType: "contract Authority"
798
- }
799
- ],
800
- anonymous: false
801
- },
802
- {
803
- type: "event",
804
- name: "Enter",
805
- inputs: [
806
- { name: "from", type: "address", indexed: true, internalType: "address" },
807
- {
808
- name: "asset",
809
- type: "address",
810
- indexed: true,
811
- internalType: "address"
812
- },
813
- {
814
- name: "amount",
815
- type: "uint256",
816
- indexed: false,
817
- internalType: "uint256"
818
- },
819
- { name: "to", type: "address", indexed: true, internalType: "address" },
820
- {
821
- name: "shares",
822
- type: "uint256",
823
- indexed: false,
824
- internalType: "uint256"
825
- }
826
- ],
827
- anonymous: false
828
- },
829
- {
830
- type: "event",
831
- name: "Exit",
832
- inputs: [
833
- { name: "to", type: "address", indexed: true, internalType: "address" },
834
- {
835
- name: "asset",
836
- type: "address",
837
- indexed: true,
838
- internalType: "address"
839
- },
840
- {
841
- name: "amount",
842
- type: "uint256",
843
- indexed: false,
844
- internalType: "uint256"
845
- },
846
- { name: "from", type: "address", indexed: true, internalType: "address" },
847
- {
848
- name: "shares",
849
- type: "uint256",
850
- indexed: false,
851
- internalType: "uint256"
852
- }
853
- ],
854
- anonymous: false
855
- },
856
- {
857
- type: "event",
858
- name: "OwnershipTransferred",
859
- inputs: [
860
- { name: "user", type: "address", indexed: true, internalType: "address" },
861
- {
862
- name: "newOwner",
863
- type: "address",
864
- indexed: true,
865
- internalType: "address"
866
- }
867
- ],
868
- anonymous: false
869
- },
870
- {
871
- type: "event",
872
- name: "Transfer",
873
- inputs: [
874
- { name: "from", type: "address", indexed: true, internalType: "address" },
875
- { name: "to", type: "address", indexed: true, internalType: "address" },
876
- {
877
- name: "amount",
878
- type: "uint256",
879
- indexed: false,
880
- internalType: "uint256"
881
- }
882
- ],
883
- anonymous: false
884
- },
885
- {
886
- type: "error",
887
- name: "AddressEmptyCode",
888
- inputs: [{ name: "target", type: "address", internalType: "address" }]
889
- },
890
- {
891
- type: "error",
892
- name: "AddressInsufficientBalance",
893
- inputs: [{ name: "account", type: "address", internalType: "address" }]
894
- },
895
- { type: "error", name: "FailedInnerCall", inputs: [] }
896
- ];
897
-
898
- // src/api/accountant.ts
899
- var getRateInQuoteWithAssetDecimals = async ({
900
- assetAddress,
901
- accountantAddress,
902
- chainId
903
- }) => {
904
- const client = await getClient(chainId);
905
- const results = await client.multicall({
906
- contracts: [
907
- {
908
- abi: erc20Abi,
909
- address: assetAddress,
910
- functionName: "decimals"
911
- },
912
- {
913
- abi: AccountantAbi,
914
- address: accountantAddress,
915
- functionName: "getRateInQuote",
916
- args: [assetAddress]
917
- }
918
- ]
919
- });
920
- return results;
921
- };
922
-
923
- // src/abi/erc2612-abi.ts
924
- var erc2612Abi = [
925
- // Standard ERC20 functions (subset needed for permit flow)
926
- {
927
- constant: true,
928
- inputs: [{ name: "_owner", type: "address" }],
929
- name: "nonces",
930
- outputs: [{ name: "", type: "uint256" }],
931
- type: "function"
932
- },
933
- {
934
- constant: true,
935
- inputs: [],
936
- name: "DOMAIN_SEPARATOR",
937
- outputs: [{ name: "", type: "bytes32" }],
938
- type: "function"
939
- },
940
- {
941
- constant: false,
942
- inputs: [
943
- { name: "owner", type: "address" },
944
- { name: "spender", type: "address" },
945
- { name: "value", type: "uint256" },
946
- { name: "deadline", type: "uint256" },
947
- { name: "v", type: "uint8" },
948
- { name: "r", type: "bytes32" },
949
- { name: "s", type: "bytes32" }
950
- ],
951
- name: "permit",
952
- outputs: [],
953
- type: "function"
954
- },
955
- {
956
- constant: true,
957
- inputs: [],
958
- name: "name",
959
- outputs: [{ name: "", type: "string" }],
960
- type: "function"
961
- },
962
- {
963
- constant: true,
964
- inputs: [],
965
- name: "version",
966
- outputs: [{ name: "", type: "string" }],
967
- type: "function"
968
- }
969
- ];
970
-
971
- // src/api/erc20.ts
972
- var getErc20Balance = async ({
973
- chainId,
974
- tokenAddress,
975
- recipientAddress
976
- }) => {
977
- const client = await getClient(chainId);
978
- const balance = await client.readContract({
979
- abi: erc20Abi,
980
- address: tokenAddress,
981
- functionName: "balanceOf",
982
- args: [recipientAddress]
983
- });
984
- return balance;
985
- };
986
- var getErc20Decimals = async ({
987
- chainId,
988
- tokenAddress
989
- }) => {
990
- const client = await getClient(chainId);
991
- const balance = await client.readContract({
992
- abi: erc20Abi,
993
- address: tokenAddress,
994
- functionName: "decimals"
995
- });
996
- return balance;
997
- };
998
- var getErc20Allowance = async ({
999
- chainId,
1000
- tokenAddress,
1001
- recipientAddress,
1002
- spenderAddress
1003
- }) => {
1004
- const client = await getClient(chainId);
1005
- const allowance = await client.readContract({
1006
- abi: erc20Abi,
1007
- address: tokenAddress,
1008
- functionName: "allowance",
1009
- args: [recipientAddress, spenderAddress]
1010
- });
1011
- return allowance;
1012
- };
1013
- var getErc20AllowanceWithDecimals = async ({
1014
- chainId,
1015
- tokenAddress,
1016
- recipientAddress,
1017
- spenderAddress
1018
- }) => {
1019
- const client = await getClient(chainId);
1020
- const allowance = await client.multicall({
1021
- contracts: [
1022
- {
1023
- abi: erc20Abi,
1024
- address: tokenAddress,
1025
- functionName: "allowance",
1026
- args: [recipientAddress, spenderAddress]
1027
- },
1028
- {
1029
- abi: erc20Abi,
1030
- address: tokenAddress,
1031
- functionName: "decimals"
1032
- }
1033
- ]
1034
- });
1035
- return allowance;
1036
- };
1037
- var getTokenPermitInfoWithAllowance = async ({
1038
- chainId,
1039
- tokenAddress,
1040
- owner,
1041
- spender
1042
- }) => {
1043
- const client = await getClient(chainId);
1044
- const results = await client.multicall({
1045
- contracts: [
1046
- {
1047
- abi: erc20Abi,
1048
- address: tokenAddress,
1049
- functionName: "decimals"
1050
- },
1051
- {
1052
- abi: erc20Abi,
1053
- address: tokenAddress,
1054
- functionName: "allowance",
1055
- args: [owner, spender]
1056
- },
1057
- {
1058
- abi: erc2612Abi,
1059
- address: tokenAddress,
1060
- functionName: "nonces",
1061
- args: [owner]
1062
- },
1063
- {
1064
- abi: erc2612Abi,
1065
- address: tokenAddress,
1066
- functionName: "DOMAIN_SEPARATOR"
1067
- },
1068
- {
1069
- abi: erc20Abi,
1070
- address: tokenAddress,
1071
- functionName: "name"
1072
- },
1073
- {
1074
- abi: erc2612Abi,
1075
- address: tokenAddress,
1076
- functionName: "version"
1077
- }
1078
- ],
1079
- allowFailure: true
1080
- });
1081
- const [
1082
- decimalsResult,
1083
- allowanceResult,
1084
- nonceResult,
1085
- domainSeparatorResult,
1086
- nameResult,
1087
- versionResult
1088
- ] = results;
1089
- if (decimalsResult.status === "failure") {
1090
- throw new APIError(
1091
- `Failed to read decimals from token ${tokenAddress}: ${decimalsResult.error?.message || "Unknown error"}`,
1092
- {
1093
- endpoint: "getTokenPermitInfoWithAllowance",
1094
- cause: decimalsResult.error
1095
- }
1096
- );
1097
- }
1098
- if (allowanceResult.status === "failure") {
1099
- throw new APIError(
1100
- `Failed to read allowance from token ${tokenAddress}: ${allowanceResult.error?.message || "Unknown error"}`,
1101
- {
1102
- endpoint: "getTokenPermitInfoWithAllowance",
1103
- cause: allowanceResult.error
1104
- }
1105
- );
1106
- }
1107
- if (nameResult.status === "failure") {
1108
- throw new APIError(
1109
- `Failed to read name from token ${tokenAddress}: ${nameResult.error?.message || "Unknown error"}`,
1110
- {
1111
- endpoint: "getTokenPermitInfoWithAllowance",
1112
- cause: nameResult.error
1113
- }
1114
- );
1115
- }
1116
- const nonce = nonceResult.status === "success" ? nonceResult.result : null;
1117
- const domainSeparator = domainSeparatorResult.status === "success" ? domainSeparatorResult.result : null;
1118
- const supportsPermit = nonce !== null && domainSeparator !== null;
1119
- const tokenVersion = versionResult.status === "success" ? versionResult.result : "1";
1120
- return {
1121
- decimals: decimalsResult.result,
1122
- allowance: allowanceResult.result,
1123
- supportsPermit,
1124
- nonce,
1125
- domainSeparator,
1126
- tokenName: nameResult.result,
1127
- tokenVersion
1128
- };
1129
- };
1130
-
1131
- export { AccountantAbi, BoringVaultAbi, erc2612Abi, getErc20Allowance, getErc20AllowanceWithDecimals, getErc20Balance, getErc20Decimals, getRateInQuoteWithAssetDecimals, getTokenPermitInfoWithAllowance };
1132
- //# sourceMappingURL=chunk-UY2WD7MF.mjs.map
1133
- //# sourceMappingURL=chunk-UY2WD7MF.mjs.map