@morpho-dev/router 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +20 -5
  2. package/dist/cli.js +12198 -6809
  3. package/dist/drizzle/migrations/0034_chain-checkpoints.sql +1 -0
  4. package/dist/drizzle/migrations/0035_chain-tip-hash-cas.sql +1 -0
  5. package/dist/drizzle/migrations/0036_pending-links.sql +22 -0
  6. package/dist/drizzle/migrations/0037_chain-finalized-anchor.sql +2 -0
  7. package/dist/drizzle/migrations/0038_add-obligation-rcf-threshold.sql +2 -0
  8. package/dist/drizzle/migrations/0039_add-offers-composite-indexes.sql +2 -0
  9. package/dist/drizzle/migrations/0040_drop-redundant-offers-indexes.sql +2 -0
  10. package/dist/drizzle/migrations/0041_add-group-winner-expression-index.sql +10 -0
  11. package/dist/drizzle/migrations/0042_contract-sync-v1.14.sql +284 -0
  12. package/dist/drizzle/migrations/0043_add-obligation-side-tick-index.sql +1 -0
  13. package/dist/drizzle/migrations/0044_index-audit-cleanup.sql +27 -0
  14. package/dist/drizzle/migrations/0045_add-lots-offsets-availability-indexes.sql +5 -0
  15. package/dist/drizzle/migrations/0046_add-offers-active-tick-index.sql +1 -0
  16. package/dist/drizzle/migrations/0047_add-offers-book-winners-index.sql +1 -0
  17. package/dist/drizzle/migrations/0048_covering-indexes-for-winners-queries.sql +34 -0
  18. package/dist/drizzle/migrations/0049_contract-sync-v1.15.sql +305 -0
  19. package/dist/drizzle/migrations/0050_contract-sync-v1.16.sql +305 -0
  20. package/dist/drizzle/migrations/meta/0036_snapshot.json +1864 -0
  21. package/dist/drizzle/migrations/meta/0037_snapshot.json +1876 -0
  22. package/dist/drizzle/migrations/meta/0038_snapshot.json +1882 -0
  23. package/dist/drizzle/migrations/meta/0039_snapshot.json +1960 -0
  24. package/dist/drizzle/migrations/meta/0040_snapshot.json +1912 -0
  25. package/dist/drizzle/migrations/meta/0041_snapshot.json +1912 -0
  26. package/dist/drizzle/migrations/meta/0042_snapshot.json +1882 -0
  27. package/dist/drizzle/migrations/meta/0043_snapshot.json +1909 -0
  28. package/dist/drizzle/migrations/meta/0044_snapshot.json +1853 -0
  29. package/dist/drizzle/migrations/meta/0045_snapshot.json +1921 -0
  30. package/dist/drizzle/migrations/meta/0046_snapshot.json +1966 -0
  31. package/dist/drizzle/migrations/meta/0047_snapshot.json +2005 -0
  32. package/dist/drizzle/migrations/meta/0048_snapshot.json +2035 -0
  33. package/dist/drizzle/migrations/meta/0049_snapshot.json +2035 -0
  34. package/dist/drizzle/migrations/meta/0050_snapshot.json +2035 -0
  35. package/dist/drizzle/migrations/meta/_journal.json +119 -0
  36. package/dist/evm/bytecode/morpho.txt +1 -1
  37. package/dist/index.browser.d.mts +611 -282
  38. package/dist/index.browser.d.mts.map +1 -1
  39. package/dist/index.browser.mjs +735 -448
  40. package/dist/index.browser.mjs.map +1 -1
  41. package/dist/index.node.d.mts +1525 -614
  42. package/dist/index.node.d.mts.map +1 -1
  43. package/dist/index.node.mjs +9493 -5238
  44. package/dist/index.node.mjs.map +1 -1
  45. package/dist/server-DNFuP89-.js +9573 -0
  46. package/dist/server.js +9617 -0
  47. package/docs/integrator.md +14 -24
  48. package/package.json +7 -4
@@ -1,7 +1,7 @@
1
1
  import { AbiEvent, Account, Address, ChainContract, ChainFormatters, Client, GetLogsReturnType, Hex, MulticallParameters, PublicClient, Transport, WalletClient } from "viem";
2
2
  import { Chain } from "viem/chains";
3
3
  import * as z$1 from "zod";
4
- import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
4
+ import { SimpleMerkleTree } from "@openzeppelin/merkle-tree";
5
5
  import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
6
6
  import { Hono } from "hono";
7
7
  import { z } from "zod/v4";
@@ -157,34 +157,36 @@ declare const MorphoV2: readonly [{
157
157
  readonly stateMutability: "nonpayable";
158
158
  readonly inputs: readonly [];
159
159
  }, {
160
- readonly name: "collateralOf";
160
+ readonly name: "activatedCollaterals";
161
161
  readonly type: "function";
162
162
  readonly stateMutability: "view";
163
163
  readonly inputs: readonly [{
164
- readonly type: "bytes20";
164
+ readonly type: "bytes32";
165
165
  readonly name: "id";
166
166
  }, {
167
167
  readonly type: "address";
168
168
  readonly name: "user";
169
- }, {
170
- readonly type: "uint256";
171
- readonly name: "collateralIndex";
172
169
  }];
173
170
  readonly outputs: readonly [{
174
171
  readonly type: "uint128";
175
172
  }];
176
173
  }, {
177
- readonly name: "consume";
174
+ readonly name: "collateralOf";
178
175
  readonly type: "function";
179
- readonly stateMutability: "nonpayable";
176
+ readonly stateMutability: "view";
180
177
  readonly inputs: readonly [{
181
178
  readonly type: "bytes32";
182
- readonly name: "group";
179
+ readonly name: "id";
180
+ }, {
181
+ readonly type: "address";
182
+ readonly name: "user";
183
183
  }, {
184
184
  readonly type: "uint256";
185
- readonly name: "amount";
185
+ readonly name: "index";
186
+ }];
187
+ readonly outputs: readonly [{
188
+ readonly type: "uint128";
186
189
  }];
187
- readonly outputs: readonly [];
188
190
  }, {
189
191
  readonly name: "consumed";
190
192
  readonly type: "function";
@@ -199,12 +201,40 @@ declare const MorphoV2: readonly [{
199
201
  readonly outputs: readonly [{
200
202
  readonly type: "uint256";
201
203
  }];
204
+ }, {
205
+ readonly name: "creditAfterSlashing";
206
+ readonly type: "function";
207
+ readonly stateMutability: "view";
208
+ readonly inputs: readonly [{
209
+ readonly type: "bytes32";
210
+ readonly name: "id";
211
+ }, {
212
+ readonly type: "address";
213
+ readonly name: "user";
214
+ }];
215
+ readonly outputs: readonly [{
216
+ readonly type: "uint256";
217
+ }];
218
+ }, {
219
+ readonly name: "creditOf";
220
+ readonly type: "function";
221
+ readonly stateMutability: "view";
222
+ readonly inputs: readonly [{
223
+ readonly type: "bytes32";
224
+ readonly name: "id";
225
+ }, {
226
+ readonly type: "address";
227
+ readonly name: "user";
228
+ }];
229
+ readonly outputs: readonly [{
230
+ readonly type: "uint256";
231
+ }];
202
232
  }, {
203
233
  readonly name: "debtOf";
204
234
  readonly type: "function";
205
235
  readonly stateMutability: "view";
206
236
  readonly inputs: readonly [{
207
- readonly type: "bytes20";
237
+ readonly type: "bytes32";
208
238
  readonly name: "id";
209
239
  }, {
210
240
  readonly type: "address";
@@ -222,7 +252,6 @@ declare const MorphoV2: readonly [{
222
252
  readonly name: "loanToken";
223
253
  }, {
224
254
  readonly type: "uint256";
225
- readonly name: "index";
226
255
  }];
227
256
  readonly outputs: readonly [{
228
257
  readonly type: "uint16";
@@ -240,11 +269,11 @@ declare const MorphoV2: readonly [{
240
269
  readonly type: "function";
241
270
  readonly stateMutability: "view";
242
271
  readonly inputs: readonly [{
243
- readonly type: "bytes20";
272
+ readonly type: "bytes32";
244
273
  readonly name: "id";
245
274
  }];
246
275
  readonly outputs: readonly [{
247
- readonly type: "uint16[6]";
276
+ readonly type: "uint16[7]";
248
277
  }];
249
278
  }, {
250
279
  readonly name: "flashLoan";
@@ -264,6 +293,20 @@ declare const MorphoV2: readonly [{
264
293
  readonly name: "data";
265
294
  }];
266
295
  readonly outputs: readonly [];
296
+ }, {
297
+ readonly name: "isAuthorized";
298
+ readonly type: "function";
299
+ readonly stateMutability: "view";
300
+ readonly inputs: readonly [{
301
+ readonly type: "address";
302
+ readonly name: "authorizer";
303
+ }, {
304
+ readonly type: "address";
305
+ readonly name: "authorized";
306
+ }];
307
+ readonly outputs: readonly [{
308
+ readonly type: "bool";
309
+ }];
267
310
  }, {
268
311
  readonly name: "isHealthy";
269
312
  readonly type: "function";
@@ -281,6 +324,9 @@ declare const MorphoV2: readonly [{
281
324
  }, {
282
325
  readonly type: "uint256";
283
326
  readonly name: "lltv";
327
+ }, {
328
+ readonly type: "uint256";
329
+ readonly name: "maxLif";
284
330
  }, {
285
331
  readonly type: "address";
286
332
  readonly name: "oracle";
@@ -291,11 +337,11 @@ declare const MorphoV2: readonly [{
291
337
  readonly name: "maturity";
292
338
  }, {
293
339
  readonly type: "uint256";
294
- readonly name: "minCollatValue";
340
+ readonly name: "rcfThreshold";
295
341
  }];
296
342
  readonly name: "obligation";
297
343
  }, {
298
- readonly type: "bytes20";
344
+ readonly type: "bytes32";
299
345
  readonly name: "id";
300
346
  }, {
301
347
  readonly type: "address";
@@ -321,6 +367,9 @@ declare const MorphoV2: readonly [{
321
367
  }, {
322
368
  readonly type: "uint256";
323
369
  readonly name: "lltv";
370
+ }, {
371
+ readonly type: "uint256";
372
+ readonly name: "maxLif";
324
373
  }, {
325
374
  readonly type: "address";
326
375
  readonly name: "oracle";
@@ -331,7 +380,7 @@ declare const MorphoV2: readonly [{
331
380
  readonly name: "maturity";
332
381
  }, {
333
382
  readonly type: "uint256";
334
- readonly name: "minCollatValue";
383
+ readonly name: "rcfThreshold";
335
384
  }];
336
385
  readonly name: "obligation";
337
386
  }, {
@@ -355,6 +404,64 @@ declare const MorphoV2: readonly [{
355
404
  }, {
356
405
  readonly type: "uint256";
357
406
  }];
407
+ }, {
408
+ readonly name: "maxCollateralPerUser";
409
+ readonly type: "function";
410
+ readonly stateMutability: "view";
411
+ readonly inputs: readonly [{
412
+ readonly type: "address";
413
+ readonly name: "collateralToken";
414
+ }];
415
+ readonly outputs: readonly [{
416
+ readonly type: "uint256";
417
+ }];
418
+ }, {
419
+ readonly name: "maxLif";
420
+ readonly type: "function";
421
+ readonly stateMutability: "pure";
422
+ readonly inputs: readonly [{
423
+ readonly type: "uint256";
424
+ readonly name: "lltv";
425
+ }, {
426
+ readonly type: "uint256";
427
+ readonly name: "cursor";
428
+ }];
429
+ readonly outputs: readonly [{
430
+ readonly type: "uint256";
431
+ }];
432
+ }, {
433
+ readonly name: "maxTakeableAssets";
434
+ readonly type: "function";
435
+ readonly stateMutability: "view";
436
+ readonly inputs: readonly [{
437
+ readonly type: "address";
438
+ readonly name: "loanToken";
439
+ }];
440
+ readonly outputs: readonly [{
441
+ readonly type: "uint256";
442
+ }];
443
+ }, {
444
+ readonly name: "maxTotalUnits";
445
+ readonly type: "function";
446
+ readonly stateMutability: "view";
447
+ readonly inputs: readonly [{
448
+ readonly type: "address";
449
+ readonly name: "loanToken";
450
+ }];
451
+ readonly outputs: readonly [{
452
+ readonly type: "uint128";
453
+ }];
454
+ }, {
455
+ readonly name: "maxTradingFee";
456
+ readonly type: "function";
457
+ readonly stateMutability: "pure";
458
+ readonly inputs: readonly [{
459
+ readonly type: "uint256";
460
+ readonly name: "index";
461
+ }];
462
+ readonly outputs: readonly [{
463
+ readonly type: "uint256";
464
+ }];
358
465
  }, {
359
466
  readonly name: "multicall";
360
467
  readonly type: "function";
@@ -369,7 +476,7 @@ declare const MorphoV2: readonly [{
369
476
  readonly type: "function";
370
477
  readonly stateMutability: "view";
371
478
  readonly inputs: readonly [{
372
- readonly type: "bytes20";
479
+ readonly type: "bytes32";
373
480
  readonly name: "id";
374
481
  }];
375
482
  readonly outputs: readonly [{
@@ -380,24 +487,21 @@ declare const MorphoV2: readonly [{
380
487
  readonly type: "function";
381
488
  readonly stateMutability: "view";
382
489
  readonly inputs: readonly [{
383
- readonly type: "bytes20";
490
+ readonly type: "bytes32";
384
491
  readonly name: "id";
385
492
  }];
386
493
  readonly outputs: readonly [{
387
494
  readonly type: "uint128";
388
495
  readonly name: "totalUnits";
389
- }, {
390
- readonly type: "uint128";
391
- readonly name: "totalShares";
392
496
  }, {
393
497
  readonly type: "uint256";
394
498
  readonly name: "withdrawable";
499
+ }, {
500
+ readonly type: "uint128";
501
+ readonly name: "lossIndex";
395
502
  }, {
396
503
  readonly type: "bool";
397
504
  readonly name: "created";
398
- }, {
399
- readonly type: "uint16[6]";
400
- readonly name: "fees";
401
505
  }];
402
506
  }, {
403
507
  readonly name: "owner";
@@ -424,6 +528,9 @@ declare const MorphoV2: readonly [{
424
528
  }, {
425
529
  readonly type: "uint256";
426
530
  readonly name: "lltv";
531
+ }, {
532
+ readonly type: "uint256";
533
+ readonly name: "maxLif";
427
534
  }, {
428
535
  readonly type: "address";
429
536
  readonly name: "oracle";
@@ -434,12 +541,12 @@ declare const MorphoV2: readonly [{
434
541
  readonly name: "maturity";
435
542
  }, {
436
543
  readonly type: "uint256";
437
- readonly name: "minCollatValue";
544
+ readonly name: "rcfThreshold";
438
545
  }];
439
546
  readonly name: "obligation";
440
547
  }, {
441
548
  readonly type: "uint256";
442
- readonly name: "obligationUnits";
549
+ readonly name: "units";
443
550
  }, {
444
551
  readonly type: "address";
445
552
  readonly name: "onBehalf";
@@ -456,6 +563,21 @@ declare const MorphoV2: readonly [{
456
563
  readonly outputs: readonly [{
457
564
  readonly type: "bytes32";
458
565
  }];
566
+ }, {
567
+ readonly name: "setConsumed";
568
+ readonly type: "function";
569
+ readonly stateMutability: "nonpayable";
570
+ readonly inputs: readonly [{
571
+ readonly type: "bytes32";
572
+ readonly name: "group";
573
+ }, {
574
+ readonly type: "uint256";
575
+ readonly name: "amount";
576
+ }, {
577
+ readonly type: "address";
578
+ readonly name: "onBehalf";
579
+ }];
580
+ readonly outputs: readonly [];
459
581
  }, {
460
582
  readonly name: "setDefaultTradingFee";
461
583
  readonly type: "function";
@@ -480,12 +602,63 @@ declare const MorphoV2: readonly [{
480
602
  readonly name: "newFeeSetter";
481
603
  }];
482
604
  readonly outputs: readonly [];
605
+ }, {
606
+ readonly name: "setIsAuthorized";
607
+ readonly type: "function";
608
+ readonly stateMutability: "nonpayable";
609
+ readonly inputs: readonly [{
610
+ readonly type: "address";
611
+ readonly name: "onBehalf";
612
+ }, {
613
+ readonly type: "address";
614
+ readonly name: "authorized";
615
+ }, {
616
+ readonly type: "bool";
617
+ readonly name: "newIsAuthorized";
618
+ }];
619
+ readonly outputs: readonly [];
620
+ }, {
621
+ readonly name: "setMaxCollateralPerUser";
622
+ readonly type: "function";
623
+ readonly stateMutability: "nonpayable";
624
+ readonly inputs: readonly [{
625
+ readonly type: "address";
626
+ readonly name: "collateralToken";
627
+ }, {
628
+ readonly type: "uint256";
629
+ readonly name: "newMaxCollateralPerUser";
630
+ }];
631
+ readonly outputs: readonly [];
632
+ }, {
633
+ readonly name: "setMaxTakeableAssets";
634
+ readonly type: "function";
635
+ readonly stateMutability: "nonpayable";
636
+ readonly inputs: readonly [{
637
+ readonly type: "address";
638
+ readonly name: "loanToken";
639
+ }, {
640
+ readonly type: "uint256";
641
+ readonly name: "newMaxTakeableAssets";
642
+ }];
643
+ readonly outputs: readonly [];
644
+ }, {
645
+ readonly name: "setMaxTotalUnits";
646
+ readonly type: "function";
647
+ readonly stateMutability: "nonpayable";
648
+ readonly inputs: readonly [{
649
+ readonly type: "address";
650
+ readonly name: "loanToken";
651
+ }, {
652
+ readonly type: "uint128";
653
+ readonly name: "newMaxTotalUnits";
654
+ }];
655
+ readonly outputs: readonly [];
483
656
  }, {
484
657
  readonly name: "setObligationTradingFee";
485
658
  readonly type: "function";
486
659
  readonly stateMutability: "nonpayable";
487
660
  readonly inputs: readonly [{
488
- readonly type: "bytes20";
661
+ readonly type: "bytes32";
489
662
  readonly name: "id";
490
663
  }, {
491
664
  readonly type: "uint256";
@@ -514,24 +687,25 @@ declare const MorphoV2: readonly [{
514
687
  }];
515
688
  readonly outputs: readonly [];
516
689
  }, {
517
- readonly name: "sharesOf";
690
+ readonly name: "shuffleSession";
518
691
  readonly type: "function";
519
- readonly stateMutability: "view";
692
+ readonly stateMutability: "nonpayable";
520
693
  readonly inputs: readonly [{
521
- readonly type: "bytes20";
522
- readonly name: "id";
523
- }, {
524
694
  readonly type: "address";
525
- readonly name: "user";
526
- }];
527
- readonly outputs: readonly [{
528
- readonly type: "uint256";
695
+ readonly name: "onBehalf";
529
696
  }];
697
+ readonly outputs: readonly [];
530
698
  }, {
531
- readonly name: "shuffleSession";
699
+ readonly name: "slash";
532
700
  readonly type: "function";
533
701
  readonly stateMutability: "nonpayable";
534
- readonly inputs: readonly [];
702
+ readonly inputs: readonly [{
703
+ readonly type: "bytes32";
704
+ readonly name: "id";
705
+ }, {
706
+ readonly type: "address";
707
+ readonly name: "user";
708
+ }];
535
709
  readonly outputs: readonly [];
536
710
  }, {
537
711
  readonly name: "supplyCollateral";
@@ -550,6 +724,9 @@ declare const MorphoV2: readonly [{
550
724
  }, {
551
725
  readonly type: "uint256";
552
726
  readonly name: "lltv";
727
+ }, {
728
+ readonly type: "uint256";
729
+ readonly name: "maxLif";
553
730
  }, {
554
731
  readonly type: "address";
555
732
  readonly name: "oracle";
@@ -560,7 +737,7 @@ declare const MorphoV2: readonly [{
560
737
  readonly name: "maturity";
561
738
  }, {
562
739
  readonly type: "uint256";
563
- readonly name: "minCollatValue";
740
+ readonly name: "rcfThreshold";
564
741
  }];
565
742
  readonly name: "obligation";
566
743
  }, {
@@ -580,16 +757,7 @@ declare const MorphoV2: readonly [{
580
757
  readonly stateMutability: "nonpayable";
581
758
  readonly inputs: readonly [{
582
759
  readonly type: "uint256";
583
- readonly name: "buyerAssets";
584
- }, {
585
- readonly type: "uint256";
586
- readonly name: "sellerAssets";
587
- }, {
588
- readonly type: "uint256";
589
- readonly name: "obligationUnits";
590
- }, {
591
- readonly type: "uint256";
592
- readonly name: "obligationShares";
760
+ readonly name: "units";
593
761
  }, {
594
762
  readonly type: "address";
595
763
  readonly name: "taker";
@@ -617,6 +785,9 @@ declare const MorphoV2: readonly [{
617
785
  }, {
618
786
  readonly type: "uint256";
619
787
  readonly name: "lltv";
788
+ }, {
789
+ readonly type: "uint256";
790
+ readonly name: "maxLif";
620
791
  }, {
621
792
  readonly type: "address";
622
793
  readonly name: "oracle";
@@ -627,7 +798,7 @@ declare const MorphoV2: readonly [{
627
798
  readonly name: "maturity";
628
799
  }, {
629
800
  readonly type: "uint256";
630
- readonly name: "minCollatValue";
801
+ readonly name: "rcfThreshold";
631
802
  }];
632
803
  readonly name: "obligation";
633
804
  }, {
@@ -638,13 +809,7 @@ declare const MorphoV2: readonly [{
638
809
  readonly name: "maker";
639
810
  }, {
640
811
  readonly type: "uint256";
641
- readonly name: "assets";
642
- }, {
643
- readonly type: "uint256";
644
- readonly name: "obligationUnits";
645
- }, {
646
- readonly type: "uint256";
647
- readonly name: "obligationShares";
812
+ readonly name: "maxUnits";
648
813
  }, {
649
814
  readonly type: "uint256";
650
815
  readonly name: "start";
@@ -669,6 +834,9 @@ declare const MorphoV2: readonly [{
669
834
  }, {
670
835
  readonly type: "address";
671
836
  readonly name: "receiverIfMakerIsSeller";
837
+ }, {
838
+ readonly type: "bool";
839
+ readonly name: "exitOnly";
672
840
  }];
673
841
  readonly name: "offer";
674
842
  }, {
@@ -697,8 +865,6 @@ declare const MorphoV2: readonly [{
697
865
  readonly type: "uint256";
698
866
  }, {
699
867
  readonly type: "uint256";
700
- }, {
701
- readonly type: "uint256";
702
868
  }];
703
869
  }, {
704
870
  readonly name: "toId";
@@ -717,6 +883,9 @@ declare const MorphoV2: readonly [{
717
883
  }, {
718
884
  readonly type: "uint256";
719
885
  readonly name: "lltv";
886
+ }, {
887
+ readonly type: "uint256";
888
+ readonly name: "maxLif";
720
889
  }, {
721
890
  readonly type: "address";
722
891
  readonly name: "oracle";
@@ -727,19 +896,19 @@ declare const MorphoV2: readonly [{
727
896
  readonly name: "maturity";
728
897
  }, {
729
898
  readonly type: "uint256";
730
- readonly name: "minCollatValue";
899
+ readonly name: "rcfThreshold";
731
900
  }];
732
901
  readonly name: "obligation";
733
902
  }];
734
903
  readonly outputs: readonly [{
735
- readonly type: "bytes20";
904
+ readonly type: "bytes32";
736
905
  }];
737
906
  }, {
738
907
  readonly name: "toObligation";
739
908
  readonly type: "function";
740
909
  readonly stateMutability: "view";
741
910
  readonly inputs: readonly [{
742
- readonly type: "bytes20";
911
+ readonly type: "bytes32";
743
912
  readonly name: "id";
744
913
  }];
745
914
  readonly outputs: readonly [{
@@ -755,6 +924,9 @@ declare const MorphoV2: readonly [{
755
924
  }, {
756
925
  readonly type: "uint256";
757
926
  readonly name: "lltv";
927
+ }, {
928
+ readonly type: "uint256";
929
+ readonly name: "maxLif";
758
930
  }, {
759
931
  readonly type: "address";
760
932
  readonly name: "oracle";
@@ -765,26 +937,15 @@ declare const MorphoV2: readonly [{
765
937
  readonly name: "maturity";
766
938
  }, {
767
939
  readonly type: "uint256";
768
- readonly name: "minCollatValue";
940
+ readonly name: "rcfThreshold";
769
941
  }];
770
942
  }];
771
- }, {
772
- readonly name: "totalShares";
773
- readonly type: "function";
774
- readonly stateMutability: "view";
775
- readonly inputs: readonly [{
776
- readonly type: "bytes20";
777
- readonly name: "id";
778
- }];
779
- readonly outputs: readonly [{
780
- readonly type: "uint256";
781
- }];
782
943
  }, {
783
944
  readonly name: "totalUnits";
784
945
  readonly type: "function";
785
946
  readonly stateMutability: "view";
786
947
  readonly inputs: readonly [{
787
- readonly type: "bytes20";
948
+ readonly type: "bytes32";
788
949
  readonly name: "id";
789
950
  }];
790
951
  readonly outputs: readonly [{
@@ -807,6 +968,9 @@ declare const MorphoV2: readonly [{
807
968
  }, {
808
969
  readonly type: "uint256";
809
970
  readonly name: "lltv";
971
+ }, {
972
+ readonly type: "uint256";
973
+ readonly name: "maxLif";
810
974
  }, {
811
975
  readonly type: "address";
812
976
  readonly name: "oracle";
@@ -817,19 +981,19 @@ declare const MorphoV2: readonly [{
817
981
  readonly name: "maturity";
818
982
  }, {
819
983
  readonly type: "uint256";
820
- readonly name: "minCollatValue";
984
+ readonly name: "rcfThreshold";
821
985
  }];
822
986
  readonly name: "obligation";
823
987
  }];
824
988
  readonly outputs: readonly [{
825
- readonly type: "bytes20";
989
+ readonly type: "bytes32";
826
990
  }];
827
991
  }, {
828
992
  readonly name: "tradingFee";
829
993
  readonly type: "function";
830
994
  readonly stateMutability: "view";
831
995
  readonly inputs: readonly [{
832
- readonly type: "bytes20";
996
+ readonly type: "bytes32";
833
997
  readonly name: "id";
834
998
  }, {
835
999
  readonly type: "uint256";
@@ -846,6 +1010,20 @@ declare const MorphoV2: readonly [{
846
1010
  readonly outputs: readonly [{
847
1011
  readonly type: "address";
848
1012
  }];
1013
+ }, {
1014
+ readonly name: "userLossIndex";
1015
+ readonly type: "function";
1016
+ readonly stateMutability: "view";
1017
+ readonly inputs: readonly [{
1018
+ readonly type: "bytes32";
1019
+ readonly name: "id";
1020
+ }, {
1021
+ readonly type: "address";
1022
+ readonly name: "user";
1023
+ }];
1024
+ readonly outputs: readonly [{
1025
+ readonly type: "uint128";
1026
+ }];
849
1027
  }, {
850
1028
  readonly name: "withdraw";
851
1029
  readonly type: "function";
@@ -863,6 +1041,9 @@ declare const MorphoV2: readonly [{
863
1041
  }, {
864
1042
  readonly type: "uint256";
865
1043
  readonly name: "lltv";
1044
+ }, {
1045
+ readonly type: "uint256";
1046
+ readonly name: "maxLif";
866
1047
  }, {
867
1048
  readonly type: "address";
868
1049
  readonly name: "oracle";
@@ -873,15 +1054,12 @@ declare const MorphoV2: readonly [{
873
1054
  readonly name: "maturity";
874
1055
  }, {
875
1056
  readonly type: "uint256";
876
- readonly name: "minCollatValue";
1057
+ readonly name: "rcfThreshold";
877
1058
  }];
878
1059
  readonly name: "obligation";
879
1060
  }, {
880
1061
  readonly type: "uint256";
881
- readonly name: "obligationUnits";
882
- }, {
883
- readonly type: "uint256";
884
- readonly name: "shares";
1062
+ readonly name: "units";
885
1063
  }, {
886
1064
  readonly type: "address";
887
1065
  readonly name: "onBehalf";
@@ -889,11 +1067,7 @@ declare const MorphoV2: readonly [{
889
1067
  readonly type: "address";
890
1068
  readonly name: "receiver";
891
1069
  }];
892
- readonly outputs: readonly [{
893
- readonly type: "uint256";
894
- }, {
895
- readonly type: "uint256";
896
- }];
1070
+ readonly outputs: readonly [];
897
1071
  }, {
898
1072
  readonly name: "withdrawCollateral";
899
1073
  readonly type: "function";
@@ -911,6 +1085,9 @@ declare const MorphoV2: readonly [{
911
1085
  }, {
912
1086
  readonly type: "uint256";
913
1087
  readonly name: "lltv";
1088
+ }, {
1089
+ readonly type: "uint256";
1090
+ readonly name: "maxLif";
914
1091
  }, {
915
1092
  readonly type: "address";
916
1093
  readonly name: "oracle";
@@ -921,7 +1098,7 @@ declare const MorphoV2: readonly [{
921
1098
  readonly name: "maturity";
922
1099
  }, {
923
1100
  readonly type: "uint256";
924
- readonly name: "minCollatValue";
1101
+ readonly name: "rcfThreshold";
925
1102
  }];
926
1103
  readonly name: "obligation";
927
1104
  }, {
@@ -943,7 +1120,7 @@ declare const MorphoV2: readonly [{
943
1120
  readonly type: "function";
944
1121
  readonly stateMutability: "view";
945
1122
  readonly inputs: readonly [{
946
- readonly type: "bytes20";
1123
+ readonly type: "bytes32";
947
1124
  readonly name: "id";
948
1125
  }];
949
1126
  readonly outputs: readonly [{
@@ -957,21 +1134,6 @@ declare const MorphoV2: readonly [{
957
1134
  readonly name: "owner";
958
1135
  readonly indexed: true;
959
1136
  }];
960
- }, {
961
- readonly name: "Consume";
962
- readonly type: "event";
963
- readonly inputs: readonly [{
964
- readonly type: "address";
965
- readonly name: "user";
966
- readonly indexed: true;
967
- }, {
968
- readonly type: "bytes32";
969
- readonly name: "group";
970
- readonly indexed: true;
971
- }, {
972
- readonly type: "uint256";
973
- readonly name: "amount";
974
- }];
975
1137
  }, {
976
1138
  readonly name: "FlashLoan";
977
1139
  readonly type: "event";
@@ -995,7 +1157,7 @@ declare const MorphoV2: readonly [{
995
1157
  readonly name: "caller";
996
1158
  readonly indexed: true;
997
1159
  }, {
998
- readonly type: "bytes20";
1160
+ readonly type: "bytes32";
999
1161
  readonly name: "id_";
1000
1162
  readonly indexed: true;
1001
1163
  }, {
@@ -1014,12 +1176,15 @@ declare const MorphoV2: readonly [{
1014
1176
  }, {
1015
1177
  readonly type: "uint256";
1016
1178
  readonly name: "badDebt";
1179
+ }, {
1180
+ readonly type: "uint256";
1181
+ readonly name: "latestLossIndex";
1017
1182
  }];
1018
1183
  }, {
1019
1184
  readonly name: "ObligationCreated";
1020
1185
  readonly type: "event";
1021
1186
  readonly inputs: readonly [{
1022
- readonly type: "bytes20";
1187
+ readonly type: "bytes32";
1023
1188
  readonly name: "id_";
1024
1189
  readonly indexed: true;
1025
1190
  }, {
@@ -1035,6 +1200,9 @@ declare const MorphoV2: readonly [{
1035
1200
  }, {
1036
1201
  readonly type: "uint256";
1037
1202
  readonly name: "lltv";
1203
+ }, {
1204
+ readonly type: "uint256";
1205
+ readonly name: "maxLif";
1038
1206
  }, {
1039
1207
  readonly type: "address";
1040
1208
  readonly name: "oracle";
@@ -1045,7 +1213,7 @@ declare const MorphoV2: readonly [{
1045
1213
  readonly name: "maturity";
1046
1214
  }, {
1047
1215
  readonly type: "uint256";
1048
- readonly name: "minCollatValue";
1216
+ readonly name: "rcfThreshold";
1049
1217
  }];
1050
1218
  readonly name: "obligation";
1051
1219
  }];
@@ -1057,16 +1225,35 @@ declare const MorphoV2: readonly [{
1057
1225
  readonly name: "caller";
1058
1226
  readonly indexed: true;
1059
1227
  }, {
1060
- readonly type: "bytes20";
1228
+ readonly type: "bytes32";
1061
1229
  readonly name: "id_";
1062
1230
  readonly indexed: true;
1063
1231
  }, {
1064
1232
  readonly type: "uint256";
1065
- readonly name: "obligationUnits";
1233
+ readonly name: "units";
1234
+ }, {
1235
+ readonly type: "address";
1236
+ readonly name: "onBehalf";
1237
+ readonly indexed: true;
1238
+ }];
1239
+ }, {
1240
+ readonly name: "SetConsumed";
1241
+ readonly type: "event";
1242
+ readonly inputs: readonly [{
1243
+ readonly type: "address";
1244
+ readonly name: "caller";
1245
+ readonly indexed: true;
1066
1246
  }, {
1067
1247
  readonly type: "address";
1068
1248
  readonly name: "onBehalf";
1069
1249
  readonly indexed: true;
1250
+ }, {
1251
+ readonly type: "bytes32";
1252
+ readonly name: "group";
1253
+ readonly indexed: true;
1254
+ }, {
1255
+ readonly type: "uint256";
1256
+ readonly name: "amount";
1070
1257
  }];
1071
1258
  }, {
1072
1259
  readonly name: "SetDefaultTradingFee";
@@ -1091,11 +1278,63 @@ declare const MorphoV2: readonly [{
1091
1278
  readonly name: "feeSetter";
1092
1279
  readonly indexed: true;
1093
1280
  }];
1281
+ }, {
1282
+ readonly name: "SetIsAuthorized";
1283
+ readonly type: "event";
1284
+ readonly inputs: readonly [{
1285
+ readonly type: "address";
1286
+ readonly name: "caller";
1287
+ readonly indexed: true;
1288
+ }, {
1289
+ readonly type: "address";
1290
+ readonly name: "onBehalf";
1291
+ readonly indexed: true;
1292
+ }, {
1293
+ readonly type: "address";
1294
+ readonly name: "authorized";
1295
+ readonly indexed: true;
1296
+ }, {
1297
+ readonly type: "bool";
1298
+ readonly name: "newIsAuthorized";
1299
+ }];
1300
+ }, {
1301
+ readonly name: "SetMaxCollateralPerUser";
1302
+ readonly type: "event";
1303
+ readonly inputs: readonly [{
1304
+ readonly type: "address";
1305
+ readonly name: "collateralToken";
1306
+ readonly indexed: true;
1307
+ }, {
1308
+ readonly type: "uint256";
1309
+ readonly name: "maxCollateralPerUser";
1310
+ }];
1311
+ }, {
1312
+ readonly name: "SetMaxTakeableAssets";
1313
+ readonly type: "event";
1314
+ readonly inputs: readonly [{
1315
+ readonly type: "address";
1316
+ readonly name: "loanToken";
1317
+ readonly indexed: true;
1318
+ }, {
1319
+ readonly type: "uint256";
1320
+ readonly name: "maxTakeableAssets";
1321
+ }];
1322
+ }, {
1323
+ readonly name: "SetMaxTotalUnits";
1324
+ readonly type: "event";
1325
+ readonly inputs: readonly [{
1326
+ readonly type: "address";
1327
+ readonly name: "loanToken";
1328
+ readonly indexed: true;
1329
+ }, {
1330
+ readonly type: "uint128";
1331
+ readonly name: "maxTotalUnits";
1332
+ }];
1094
1333
  }, {
1095
1334
  readonly name: "SetObligationTradingFee";
1096
1335
  readonly type: "event";
1097
1336
  readonly inputs: readonly [{
1098
- readonly type: "bytes20";
1337
+ readonly type: "bytes32";
1099
1338
  readonly name: "id_";
1100
1339
  readonly indexed: true;
1101
1340
  }, {
@@ -1127,12 +1366,37 @@ declare const MorphoV2: readonly [{
1127
1366
  readonly type: "event";
1128
1367
  readonly inputs: readonly [{
1129
1368
  readonly type: "address";
1130
- readonly name: "user";
1369
+ readonly name: "caller";
1370
+ readonly indexed: true;
1371
+ }, {
1372
+ readonly type: "address";
1373
+ readonly name: "onBehalf";
1131
1374
  readonly indexed: true;
1132
1375
  }, {
1133
1376
  readonly type: "bytes32";
1134
1377
  readonly name: "session";
1135
1378
  }];
1379
+ }, {
1380
+ readonly name: "Slash";
1381
+ readonly type: "event";
1382
+ readonly inputs: readonly [{
1383
+ readonly type: "address";
1384
+ readonly name: "caller";
1385
+ }, {
1386
+ readonly type: "bytes32";
1387
+ readonly name: "id_";
1388
+ readonly indexed: true;
1389
+ }, {
1390
+ readonly type: "address";
1391
+ readonly name: "user";
1392
+ readonly indexed: true;
1393
+ }, {
1394
+ readonly type: "uint256";
1395
+ readonly name: "credit";
1396
+ }, {
1397
+ readonly type: "uint256";
1398
+ readonly name: "latestLossIndex";
1399
+ }];
1136
1400
  }, {
1137
1401
  readonly name: "SupplyCollateral";
1138
1402
  readonly type: "event";
@@ -1140,7 +1404,7 @@ declare const MorphoV2: readonly [{
1140
1404
  readonly type: "address";
1141
1405
  readonly name: "caller";
1142
1406
  }, {
1143
- readonly type: "bytes20";
1407
+ readonly type: "bytes32";
1144
1408
  readonly name: "id_";
1145
1409
  readonly indexed: true;
1146
1410
  }, {
@@ -1162,7 +1426,7 @@ declare const MorphoV2: readonly [{
1162
1426
  readonly type: "address";
1163
1427
  readonly name: "caller";
1164
1428
  }, {
1165
- readonly type: "bytes20";
1429
+ readonly type: "bytes32";
1166
1430
  readonly name: "id_";
1167
1431
  readonly indexed: true;
1168
1432
  }, {
@@ -1184,16 +1448,7 @@ declare const MorphoV2: readonly [{
1184
1448
  readonly name: "sellerAssets";
1185
1449
  }, {
1186
1450
  readonly type: "uint256";
1187
- readonly name: "obligationUnits";
1188
- }, {
1189
- readonly type: "uint256";
1190
- readonly name: "obligationShares";
1191
- }, {
1192
- readonly type: "bool";
1193
- readonly name: "buyerIsLender";
1194
- }, {
1195
- readonly type: "bool";
1196
- readonly name: "sellerIsBorrower";
1451
+ readonly name: "units";
1197
1452
  }, {
1198
1453
  readonly type: "address";
1199
1454
  readonly name: "sellerReceiver";
@@ -1203,6 +1458,9 @@ declare const MorphoV2: readonly [{
1203
1458
  }, {
1204
1459
  readonly type: "uint256";
1205
1460
  readonly name: "consumed";
1461
+ }, {
1462
+ readonly type: "uint256";
1463
+ readonly name: "totalUnits";
1206
1464
  }];
1207
1465
  }, {
1208
1466
  readonly name: "Withdraw";
@@ -1211,15 +1469,12 @@ declare const MorphoV2: readonly [{
1211
1469
  readonly type: "address";
1212
1470
  readonly name: "caller";
1213
1471
  }, {
1214
- readonly type: "bytes20";
1472
+ readonly type: "bytes32";
1215
1473
  readonly name: "id_";
1216
1474
  readonly indexed: true;
1217
1475
  }, {
1218
1476
  readonly type: "uint256";
1219
- readonly name: "obligationUnits";
1220
- }, {
1221
- readonly type: "uint256";
1222
- readonly name: "shares";
1477
+ readonly name: "units";
1223
1478
  }, {
1224
1479
  readonly type: "address";
1225
1480
  readonly name: "onBehalf";
@@ -1236,7 +1491,7 @@ declare const MorphoV2: readonly [{
1236
1491
  readonly type: "address";
1237
1492
  readonly name: "caller";
1238
1493
  }, {
1239
- readonly type: "bytes20";
1494
+ readonly type: "bytes32";
1240
1495
  readonly name: "id_";
1241
1496
  readonly indexed: true;
1242
1497
  }, {
@@ -1429,7 +1684,7 @@ declare class ReorgError extends BaseError {
1429
1684
  constructor(blockNumber: number);
1430
1685
  }
1431
1686
  declare namespace Chain_d_exports {
1432
- export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name$1 as Name, UnrecoverableLogsResponseSizeError, chainIds, chainNames, chains$1 as chains, getChain, getWhitelistedChains, streamLogs };
1687
+ export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, UnrecoverableLogsResponseSizeError, chainIds, chainNames, chains$1 as chains, getChain, getWhitelistedChains, streamLogs };
1433
1688
  }
1434
1689
  type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
1435
1690
  morpho: ChainContract;
@@ -1444,7 +1699,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
1444
1699
  callbacks: Callback[];
1445
1700
  }>, "custom"> & {
1446
1701
  id: Id;
1447
- name: Name$1;
1702
+ name: Name;
1448
1703
  custom: {
1449
1704
  morpho: ChainContract;
1450
1705
  morphoBlue: ChainContract;
@@ -1464,13 +1719,13 @@ declare const ChainId: {
1464
1719
  readonly "ETHEREUM-VIRTUAL-TESTNET": 109111114;
1465
1720
  readonly ANVIL: 505050505;
1466
1721
  };
1467
- type Name$1 = Lowercase<keyof typeof ChainId>;
1468
- declare const chainNames: readonly Name$1[];
1469
- type Id = (typeof ChainId)[Uppercase<Name$1>];
1722
+ type Name = Lowercase<keyof typeof ChainId>;
1723
+ declare const chainNames: readonly Name[];
1724
+ type Id = (typeof ChainId)[Uppercase<Name>];
1470
1725
  declare const chainIds: readonly Id[];
1471
1726
  declare function getChain(chainId: Id): Chain$1 | undefined;
1472
1727
  declare const getWhitelistedChains: () => Chain$1[];
1473
- declare const chains$1: Record<Lowercase<Name$1>, Chain$1>;
1728
+ declare const chains$1: Record<Lowercase<Name>, Chain$1>;
1474
1729
  declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
1475
1730
  client: PublicClient;
1476
1731
  contractAddress?: Address;
@@ -1558,7 +1813,8 @@ declare namespace Collateral_d_exports {
1558
1813
  }
1559
1814
  type Collateral = {
1560
1815
  /** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
1561
- lltv: LLTV; /** Oracle contract used to price the collateral. */
1816
+ lltv: LLTV; /** Maximum Liquidation Incentive Factor for this collateral. */
1817
+ maxLif: bigint; /** Oracle contract used to price the collateral. */
1562
1818
  oracle: Address;
1563
1819
  };
1564
1820
  declare const abi$1: readonly [{
@@ -1567,6 +1823,9 @@ declare const abi$1: readonly [{
1567
1823
  }, {
1568
1824
  readonly type: "uint256";
1569
1825
  readonly name: "lltv";
1826
+ }, {
1827
+ readonly type: "uint256";
1828
+ readonly name: "maxLif";
1570
1829
  }, {
1571
1830
  readonly type: "address";
1572
1831
  readonly name: "oracle";
@@ -1575,17 +1834,20 @@ declare const CollateralSchema: z$1.ZodObject<{
1575
1834
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1576
1835
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1577
1836
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
1837
+ maxLif: z$1.ZodBigInt;
1578
1838
  }, z$1.core.$strip>;
1579
1839
  declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
1580
1840
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1581
1841
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1582
1842
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
1843
+ maxLif: z$1.ZodBigInt;
1583
1844
  }, z$1.core.$strip>>;
1584
1845
  declare const from$16: (parameters: from$16.Parameters) => from$16.ReturnType;
1585
1846
  declare namespace from$16 {
1586
1847
  type Parameters = {
1587
1848
  asset: Address;
1588
1849
  lltv: Options | bigint;
1850
+ maxLif: bigint;
1589
1851
  oracle: Address;
1590
1852
  };
1591
1853
  type ReturnType = Collateral;
@@ -1765,8 +2027,8 @@ declare namespace Obligation_d_exports {
1765
2027
  type Obligation$1 = {
1766
2028
  /** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1767
2029
  collaterals: Collateral[]; /** The maturity of the obligation. */
1768
- maturity: Maturity; /** Minimum collateral value (quoted in loan token) to maintain on collateral updates. */
1769
- minCollatValue: bigint;
2030
+ maturity: Maturity; /** Recovery-close-factor threshold in obligation units. */
2031
+ rcfThreshold: bigint;
1770
2032
  };
1771
2033
  declare const ObligationSchema: z$1.ZodObject<{
1772
2034
  loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1774,9 +2036,10 @@ declare const ObligationSchema: z$1.ZodObject<{
1774
2036
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1775
2037
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1776
2038
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
2039
+ maxLif: z$1.ZodBigInt;
1777
2040
  }, z$1.core.$strip>>;
1778
2041
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
1779
- minCollatValue: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
2042
+ rcfThreshold: z$1.ZodBigInt;
1780
2043
  }, z$1.core.$strip>;
1781
2044
  declare const abi: readonly [{
1782
2045
  readonly type: "address";
@@ -1790,6 +2053,9 @@ declare const abi: readonly [{
1790
2053
  }, {
1791
2054
  readonly type: "uint256";
1792
2055
  readonly name: "lltv";
2056
+ }, {
2057
+ readonly type: "uint256";
2058
+ readonly name: "maxLif";
1793
2059
  }, {
1794
2060
  readonly type: "address";
1795
2061
  readonly name: "oracle";
@@ -1799,7 +2065,7 @@ declare const abi: readonly [{
1799
2065
  readonly name: "maturity";
1800
2066
  }, {
1801
2067
  readonly type: "uint256";
1802
- readonly name: "minCollatValue";
2068
+ readonly name: "rcfThreshold";
1803
2069
  }];
1804
2070
  declare const tupleAbi: readonly [{
1805
2071
  readonly type: "tuple";
@@ -1815,6 +2081,9 @@ declare const tupleAbi: readonly [{
1815
2081
  }, {
1816
2082
  readonly type: "uint256";
1817
2083
  readonly name: "lltv";
2084
+ }, {
2085
+ readonly type: "uint256";
2086
+ readonly name: "maxLif";
1818
2087
  }, {
1819
2088
  readonly type: "address";
1820
2089
  readonly name: "oracle";
@@ -1824,7 +2093,7 @@ declare const tupleAbi: readonly [{
1824
2093
  readonly name: "maturity";
1825
2094
  }, {
1826
2095
  readonly type: "uint256";
1827
- readonly name: "minCollatValue";
2096
+ readonly name: "rcfThreshold";
1828
2097
  }];
1829
2098
  }];
1830
2099
  /**
@@ -1842,10 +2111,12 @@ declare const tupleAbi: readonly [{
1842
2111
  * Collateral.from({
1843
2112
  * asset: privateKeyToAccount(generatePrivateKey()).address,
1844
2113
  * oracle: privateKeyToAccount(generatePrivateKey()).address,
1845
- * lltv: 0.965
2114
+ * lltv: 0.965,
2115
+ * maxLif: 0n,
1846
2116
  * }),
1847
2117
  * ],
1848
2118
  * maturity: Maturity.from("end_of_next_quarter"),
2119
+ * rcfThreshold: 0n,
1849
2120
  * });
1850
2121
  * ```
1851
2122
  */
@@ -1854,8 +2125,8 @@ declare namespace from$14 {
1854
2125
  type Parameters = {
1855
2126
  /** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
1856
2127
  collaterals: from$16.Parameters[] | readonly from$16.Parameters[]; /** The maturity of the obligation. */
1857
- maturity: from$15.Parameters; /** Minimum collateral value (quoted in loan token). @default 0 */
1858
- minCollatValue?: bigint;
2128
+ maturity: from$15.Parameters; /** Recovery-close-factor threshold in obligation units. */
2129
+ rcfThreshold: bigint;
1859
2130
  };
1860
2131
  type ReturnType = Obligation$1;
1861
2132
  type ErrorType = InvalidObligationError;
@@ -1868,17 +2139,14 @@ declare namespace from$14 {
1868
2139
  */
1869
2140
  declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
1870
2141
  declare namespace fromSnakeCase$2 {
1871
- type SnakeCaseParameters = Omit<Obligation$1, "minCollatValue"> & {
1872
- minCollatValue?: bigint;
1873
- };
2142
+ type SnakeCaseParameters = Obligation$1;
1874
2143
  type Parameters = Snake<SnakeCaseParameters>;
1875
2144
  type ReturnType = Obligation$1;
1876
2145
  type ErrorType = InvalidObligationError;
1877
2146
  }
1878
2147
  /**
1879
2148
  * Calculates a canonical key for an obligation payload.
1880
- * The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity, minCollatValue)).
1881
- * If omitted, `minCollatValue` defaults to `0`.
2149
+ * The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity, rcfThreshold)).
1882
2150
  * @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
1883
2151
  * @param parameters - {@link key.Parameters}
1884
2152
  * @returns The obligation key as a 32-byte hex string. {@link key.ReturnType}
@@ -1897,10 +2165,11 @@ declare namespace key$1 {
1897
2165
  collaterals: {
1898
2166
  asset: Address;
1899
2167
  lltv: bigint;
2168
+ maxLif: bigint;
1900
2169
  oracle: Address;
1901
2170
  }[];
1902
2171
  maturity: number;
1903
- minCollatValue?: bigint;
2172
+ rcfThreshold: bigint;
1904
2173
  };
1905
2174
  type ReturnType = Hex;
1906
2175
  type ErrorType = CollateralsAreNotSortedError;
@@ -1927,7 +2196,6 @@ declare namespace random$2 {
1927
2196
  */
1928
2197
  declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
1929
2198
  declare namespace fromOffer$1 {
1930
- type Parameters = Offer;
1931
2199
  type ReturnType = Obligation$1;
1932
2200
  }
1933
2201
  declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
@@ -1961,11 +2229,10 @@ declare namespace creationCode {
1961
2229
  }
1962
2230
  /**
1963
2231
  * Computes the same id as `IdLib.toId` in Solidity using the CREATE2 preimage:
1964
- * `keccak256(0xff ++ morphoV2 ++ chainId ++ keccak256(creationCode))`,
1965
- * then truncates to the lower 20 bytes.
2232
+ * `keccak256(0xff ++ morphoV2 ++ chainId ++ keccak256(creationCode))`.
1966
2233
  *
1967
2234
  * @param parameters - {@link toId.Parameters}
1968
- * @returns The obligation id. {@link toId.ReturnType}
2235
+ * @returns The 32-byte obligation id. {@link toId.ReturnType}
1969
2236
  */
1970
2237
  declare function toId(parameters: toId.Parameters): toId.ReturnType;
1971
2238
  declare namespace toId {
@@ -2069,15 +2336,14 @@ declare function generateMarketLiquidityPoolId(parameters: {
2069
2336
  marketId: string;
2070
2337
  }): string;
2071
2338
  declare namespace Offer_d_exports {
2072
- export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, encode$1 as encode, from$13 as from, fromSnakeCase$1 as fromSnakeCase, hash, liquidateEvent, obligationId, random$1 as random, repayEvent, serialize, supplyCollateralEvent, takeEvent, toSnakeCase, withdrawCollateralEvent };
2339
+ export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, encode$1 as encode, from$13 as from, fromSnakeCase$1 as fromSnakeCase, hash, liquidateEvent, random$1 as random, repayEvent, serialize, supplyCollateralEvent, takeEvent, toSnakeCase, withdrawCollateralEvent };
2073
2340
  }
2074
2341
  type Offer = {
2075
- /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
2076
- readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
2077
- readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
2078
- readonly obligationShares: bigint; /** The offer tick. */
2342
+ /** The address that made the offer. */readonly maker: Address; /** The max units to trade. */
2343
+ readonly maxUnits: bigint; /** The offer tick. */
2079
2344
  readonly tick: number; /** The date at which all interests will be paid. */
2080
- readonly maturity: Maturity; /** The date at which the offer will expire. */
2345
+ readonly maturity: Maturity; /** Recovery-close-factor threshold in obligation units. */
2346
+ readonly rcfThreshold: bigint; /** The date at which the offer will expire. */
2081
2347
  readonly expiry: number; /** The date at which the offer will start. */
2082
2348
  readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
2083
2349
  readonly group: Hex; /** The session. Used for session-based offer management. */
@@ -2089,7 +2355,8 @@ type Offer = {
2089
2355
  readonly address: Address;
2090
2356
  readonly data: Hex;
2091
2357
  }; /** Receiver of loan token proceeds when maker is seller on `take()`. */
2092
- readonly receiverIfMakerIsSeller: Address;
2358
+ readonly receiverIfMakerIsSeller: Address; /** Whether this offer can only reduce existing positions, not create new ones. */
2359
+ readonly exitOnly: boolean;
2093
2360
  };
2094
2361
  declare enum Status {
2095
2362
  VALID = "VALID",
@@ -2102,11 +2369,10 @@ type Validation = {
2102
2369
  };
2103
2370
  declare const OfferSchema: () => z$1.ZodObject<{
2104
2371
  maker: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2105
- assets: z$1.ZodBigInt;
2106
- obligationUnits: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
2107
- obligationShares: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
2372
+ maxUnits: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
2108
2373
  tick: z$1.ZodCoercedNumber<unknown>;
2109
2374
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
2375
+ rcfThreshold: z$1.ZodBigInt;
2110
2376
  expiry: z$1.ZodNumber;
2111
2377
  start: z$1.ZodNumber;
2112
2378
  group: z$1.ZodPipe<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
@@ -2117,12 +2383,14 @@ declare const OfferSchema: () => z$1.ZodObject<{
2117
2383
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2118
2384
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2119
2385
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
2386
+ maxLif: z$1.ZodBigInt;
2120
2387
  }, z$1.core.$strip>>;
2121
2388
  callback: z$1.ZodObject<{
2122
2389
  address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2123
2390
  data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2124
2391
  }, z$1.core.$strip>;
2125
2392
  receiverIfMakerIsSeller: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2393
+ exitOnly: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
2126
2394
  }, z$1.core.$strip>;
2127
2395
  /**
2128
2396
  * Input type for creating offers. Accepts flexible group types that will be coerced to Hex.
@@ -2135,12 +2403,13 @@ declare const OfferSchema: () => z$1.ZodObject<{
2135
2403
  *
2136
2404
  * All values validated to be non-negative and within bytes32 range.
2137
2405
  */
2138
- type OfferInput = Compute<Omit<Offer, "group" | "session" | "obligationUnits" | "obligationShares" | "receiverIfMakerIsSeller"> & {
2406
+ type OfferInput = Compute<Omit<Offer, "group" | "session" | "maxUnits" | "rcfThreshold" | "receiverIfMakerIsSeller" | "exitOnly"> & {
2139
2407
  group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
2140
- session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
2141
- obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
2142
- obligationShares?: bigint; /** Optional: defaults to maker for backward compatibility. */
2143
- receiverIfMakerIsSeller?: Address;
2408
+ session?: Hex | bigint | number | string; /** Optional: defaults to 0n. */
2409
+ maxUnits?: bigint; /** Recovery-close-factor threshold in obligation units. */
2410
+ rcfThreshold: bigint; /** Optional: defaults to maker for backward compatibility. */
2411
+ receiverIfMakerIsSeller?: Address; /** Optional: defaults to false. */
2412
+ exitOnly?: boolean;
2144
2413
  }>;
2145
2414
  /**
2146
2415
  * Creates an offer from a plain object.
@@ -2177,11 +2446,10 @@ declare function toSnakeCase(offer: Offer): Snake<Offer>;
2177
2446
  */
2178
2447
  declare const serialize: (offer: Offer) => {
2179
2448
  maker: `0x${string}`;
2180
- assets: string;
2181
- obligationUnits: string;
2182
- obligationShares: string;
2449
+ maxUnits: string;
2183
2450
  tick: number;
2184
2451
  maturity: number;
2452
+ rcfThreshold: string;
2185
2453
  expiry: number;
2186
2454
  start: number;
2187
2455
  group: `0x${string}`;
@@ -2192,12 +2460,14 @@ declare const serialize: (offer: Offer) => {
2192
2460
  asset: `0x${string}`;
2193
2461
  oracle: `0x${string}`;
2194
2462
  lltv: string;
2463
+ maxLif: string;
2195
2464
  }[];
2196
2465
  callback: {
2197
2466
  address: `0x${string}`;
2198
2467
  data: `0x${string}`;
2199
2468
  };
2200
2469
  receiverIfMakerIsSeller: `0x${string}`;
2470
+ exitOnly: boolean;
2201
2471
  hash: `0x${string}`;
2202
2472
  };
2203
2473
  type RandomConfig = {
@@ -2205,11 +2475,10 @@ type RandomConfig = {
2205
2475
  collateralTokens?: Address[];
2206
2476
  assetsDecimals?: Record<Address, number>;
2207
2477
  buy?: boolean;
2208
- assets?: bigint;
2209
- obligationUnits?: bigint;
2210
- obligationShares?: bigint;
2478
+ maxUnits?: bigint;
2211
2479
  maker?: Address;
2212
2480
  maturity?: Maturity;
2481
+ rcfThreshold?: bigint;
2213
2482
  start?: number;
2214
2483
  expiry?: number;
2215
2484
  group?: Hex | bigint | number | string;
@@ -2221,6 +2490,7 @@ type RandomConfig = {
2221
2490
  };
2222
2491
  receiverIfMakerIsSeller?: Address;
2223
2492
  collaterals?: readonly Collateral[];
2493
+ exitOnly?: boolean;
2224
2494
  };
2225
2495
  /**
2226
2496
  * Generates a random Offer.
@@ -2237,21 +2507,6 @@ declare function random$1(config?: RandomConfig): Offer;
2237
2507
  * @returns 32-byte offer hash.
2238
2508
  */
2239
2509
  declare function hash(offer: Offer): Hex;
2240
- /**
2241
- * Calculates the onchain obligation id for an offer.
2242
- * The id is computed with {@link Id.toId}.
2243
- * @param offer - The offer to calculate the obligation id for.
2244
- * @param parameters - The chain context used by the onchain id function.
2245
- * @returns The obligation id as a 20-byte hex string.
2246
- */
2247
- declare function obligationId(offer: Offer, parameters: obligationId.Parameters): obligationId.ReturnType;
2248
- declare namespace obligationId {
2249
- type Parameters = {
2250
- chainId: Id;
2251
- morphoV2: Address;
2252
- };
2253
- type ReturnType = Hex;
2254
- }
2255
2510
  declare function encode$1(offer: Offer): `0x${string}`;
2256
2511
  declare function decode$1(data: Hex): Offer;
2257
2512
  type OfferConsumed = {
@@ -2275,9 +2530,9 @@ declare const takeEvent: {
2275
2530
  readonly internalType: "address";
2276
2531
  }, {
2277
2532
  readonly name: "id_";
2278
- readonly type: "bytes20";
2533
+ readonly type: "bytes32";
2279
2534
  readonly indexed: true;
2280
- readonly internalType: "bytes20";
2535
+ readonly internalType: "bytes32";
2281
2536
  }, {
2282
2537
  readonly name: "maker";
2283
2538
  readonly type: "address";
@@ -2304,25 +2559,10 @@ declare const takeEvent: {
2304
2559
  readonly indexed: false;
2305
2560
  readonly internalType: "uint256";
2306
2561
  }, {
2307
- readonly name: "obligationUnits";
2308
- readonly type: "uint256";
2309
- readonly indexed: false;
2310
- readonly internalType: "uint256";
2311
- }, {
2312
- readonly name: "obligationShares";
2562
+ readonly name: "units";
2313
2563
  readonly type: "uint256";
2314
2564
  readonly indexed: false;
2315
2565
  readonly internalType: "uint256";
2316
- }, {
2317
- readonly name: "buyerIsLender";
2318
- readonly type: "bool";
2319
- readonly indexed: false;
2320
- readonly internalType: "bool";
2321
- }, {
2322
- readonly name: "sellerIsBorrower";
2323
- readonly type: "bool";
2324
- readonly indexed: false;
2325
- readonly internalType: "bool";
2326
2566
  }, {
2327
2567
  readonly name: "sellerReceiver";
2328
2568
  readonly type: "address";
@@ -2338,17 +2578,27 @@ declare const takeEvent: {
2338
2578
  readonly type: "uint256";
2339
2579
  readonly indexed: false;
2340
2580
  readonly internalType: "uint256";
2581
+ }, {
2582
+ readonly name: "totalUnits";
2583
+ readonly type: "uint256";
2584
+ readonly indexed: false;
2585
+ readonly internalType: "uint256";
2341
2586
  }];
2342
2587
  readonly anonymous: false;
2343
2588
  };
2344
2589
  /**
2345
- * ABI for the Consume event emitted by the Obligation contract.
2590
+ * ABI for the SetConsumed event emitted by the Morpho V2 contract.
2346
2591
  */
2347
2592
  declare const consumedEvent: {
2348
2593
  readonly type: "event";
2349
- readonly name: "Consume";
2594
+ readonly name: "SetConsumed";
2350
2595
  readonly inputs: readonly [{
2351
- readonly name: "user";
2596
+ readonly name: "caller";
2597
+ readonly type: "address";
2598
+ readonly indexed: true;
2599
+ readonly internalType: "address";
2600
+ }, {
2601
+ readonly name: "onBehalf";
2352
2602
  readonly type: "address";
2353
2603
  readonly indexed: true;
2354
2604
  readonly internalType: "address";
@@ -2378,11 +2628,11 @@ declare const repayEvent: {
2378
2628
  readonly internalType: "address";
2379
2629
  }, {
2380
2630
  readonly name: "id_";
2381
- readonly type: "bytes20";
2631
+ readonly type: "bytes32";
2382
2632
  readonly indexed: true;
2383
- readonly internalType: "bytes20";
2633
+ readonly internalType: "bytes32";
2384
2634
  }, {
2385
- readonly name: "obligationUnits";
2635
+ readonly name: "units";
2386
2636
  readonly type: "uint256";
2387
2637
  readonly indexed: false;
2388
2638
  readonly internalType: "uint256";
@@ -2407,9 +2657,9 @@ declare const liquidateEvent: {
2407
2657
  readonly internalType: "address";
2408
2658
  }, {
2409
2659
  readonly name: "id_";
2410
- readonly type: "bytes20";
2660
+ readonly type: "bytes32";
2411
2661
  readonly indexed: true;
2412
- readonly internalType: "bytes20";
2662
+ readonly internalType: "bytes32";
2413
2663
  }, {
2414
2664
  readonly name: "collateralIndex";
2415
2665
  readonly type: "uint256";
@@ -2435,6 +2685,11 @@ declare const liquidateEvent: {
2435
2685
  readonly type: "uint256";
2436
2686
  readonly indexed: false;
2437
2687
  readonly internalType: "uint256";
2688
+ }, {
2689
+ readonly name: "latestLossIndex";
2690
+ readonly type: "uint256";
2691
+ readonly indexed: false;
2692
+ readonly internalType: "uint256";
2438
2693
  }];
2439
2694
  readonly anonymous: false;
2440
2695
  };
@@ -2451,9 +2706,9 @@ declare const supplyCollateralEvent: {
2451
2706
  readonly internalType: "address";
2452
2707
  }, {
2453
2708
  readonly name: "id_";
2454
- readonly type: "bytes20";
2709
+ readonly type: "bytes32";
2455
2710
  readonly indexed: true;
2456
- readonly internalType: "bytes20";
2711
+ readonly internalType: "bytes32";
2457
2712
  }, {
2458
2713
  readonly name: "collateral";
2459
2714
  readonly type: "address";
@@ -2485,9 +2740,9 @@ declare const withdrawCollateralEvent: {
2485
2740
  readonly internalType: "address";
2486
2741
  }, {
2487
2742
  readonly name: "id_";
2488
- readonly type: "bytes20";
2743
+ readonly type: "bytes32";
2489
2744
  readonly indexed: true;
2490
- readonly internalType: "bytes20";
2745
+ readonly internalType: "bytes32";
2491
2746
  }, {
2492
2747
  readonly name: "collateral";
2493
2748
  readonly type: "address";
@@ -2759,7 +3014,7 @@ declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
2759
3014
  constructor(error: z$1.ZodError | Error);
2760
3015
  }
2761
3016
  declare namespace Tick_d_exports {
2762
- export { InvalidPriceError, InvalidTickError, MAX_PRICE, TICK_RANGE, priceToTick, tickToPrice };
3017
+ export { InvalidPriceError, InvalidTickError, MAX_PRICE, TICK_RANGE, assetsToUnits, priceToTick, tickToPrice, unitsToAssets };
2763
3018
  }
2764
3019
  /** Tick domain supported by Morpho V2. */
2765
3020
  declare const TICK_RANGE = 990;
@@ -2785,6 +3040,31 @@ declare function priceToTick(price: bigint): number;
2785
3040
  declare namespace priceToTick {
2786
3041
  type ErrorType = InvalidPriceError;
2787
3042
  }
3043
+ /**
3044
+ * Converts units into maker-side assets using the raw tick price surface.
3045
+ * This is the public forward conversion used by the router for lot sizing and other maker-facing capacity math.
3046
+ * - `buy = true` -> `floor(units * price / WAD)`
3047
+ * - `buy = false` -> `ceil(units * price / WAD)`
3048
+ * @param units - The units to convert.
3049
+ * @param tick - The offer tick.
3050
+ * @param buy - Whether the maker side of the offer is buy (`true`) or sell (`false`).
3051
+ * @returns The equivalent amount in maker-side assets.
3052
+ */
3053
+ declare function unitsToAssets(units: bigint, tick: number, buy: boolean): bigint;
3054
+ /**
3055
+ * Converts a maker-side asset cap into a safe units cap using the raw tick price.
3056
+ * Buy offers use the max-safe inverse of `floor(units * price / WAD)`.
3057
+ * Sell offers use the max-safe inverse of `ceil(units * price / WAD)`.
3058
+ * The result is clamped to the remaining offer size because the asset cap may have been rounded before inversion.
3059
+ * Zero integer asset caps can still admit positive units on floor-rounded sub-WAD buy ticks, and tick=0 keeps the
3060
+ * whole remaining interval safe because the raw maker-asset surface stays at zero.
3061
+ * @param assets - The integer maker-side asset cap.
3062
+ * @param tick - The offer tick.
3063
+ * @param buy - Whether the maker side of the offer is buy (`true`) or sell (`false`).
3064
+ * @param remainingUnits - The maximum units still available on the offer.
3065
+ * @returns The greatest safe units amount under the maker-side raw-price surface.
3066
+ */
3067
+ declare function assetsToUnits(assets: bigint, tick: number, buy: boolean, remainingUnits: bigint): bigint;
2788
3068
  declare class InvalidTickError extends BaseError {
2789
3069
  readonly name = "Tick.InvalidTickError";
2790
3070
  constructor(tick: number);
@@ -2798,15 +3078,15 @@ declare namespace TradingFee_d_exports {
2798
3078
  }
2799
3079
  /**
2800
3080
  * Time breakpoints in seconds for piecewise linear fee interpolation.
2801
- * Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d.
3081
+ * Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d, 360d.
2802
3082
  */
2803
- declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n];
3083
+ declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n, 31104000n];
2804
3084
  /** WAD constant (1e18) for fee scaling. */
2805
3085
  declare const WAD: bigint;
2806
- /** Tuple type for the 6 fee values at each breakpoint. */
2807
- type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint];
3086
+ /** Tuple type for the 7 fee values at each breakpoint. */
3087
+ type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint, bigint];
2808
3088
  /**
2809
- * TradingFee represents a piecewise linear fee curve with 6 breakpoints.
3089
+ * TradingFee represents a piecewise linear fee curve with 7 breakpoints.
2810
3090
  * The internal storage mimics on-chain bitmap behavior but uses a struct for clarity.
2811
3091
  */
2812
3092
  type TradingFee = {
@@ -2814,12 +3094,12 @@ type TradingFee = {
2814
3094
  readonly _fees: Fees;
2815
3095
  } & Brand<"TradingFee">;
2816
3096
  /**
2817
- * Create a TradingFee from an activation flag and 6 fee values.
3097
+ * Create a TradingFee from an activation flag and 7 fee values.
2818
3098
  * @param activated - Whether the fee is active.
2819
- * @param fees - Tuple of 6 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d).
3099
+ * @param fees - Tuple of 7 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d, 360d).
2820
3100
  * @returns A new TradingFee instance.
2821
3101
  * @throws {@link InvalidFeeError} if any fee exceeds WAD (100%).
2822
- * @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 6 elements.
3102
+ * @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 7 elements.
2823
3103
  */
2824
3104
  declare function from$9(activated: boolean, fees: Fees): TradingFee;
2825
3105
  declare namespace from$9 {
@@ -2853,7 +3133,7 @@ declare function deactivate(tradingFee: TradingFee): TradingFee;
2853
3133
  /**
2854
3134
  * Get the fee values at each breakpoint.
2855
3135
  * @param tradingFee - The TradingFee instance.
2856
- * @returns The tuple of 6 fee values.
3136
+ * @returns The tuple of 7 fee values.
2857
3137
  */
2858
3138
  declare function getFees(tradingFee: TradingFee): Fees;
2859
3139
  /** Error thrown when a fee value is invalid (negative or exceeds WAD). */
@@ -2861,7 +3141,7 @@ declare class InvalidFeeError extends BaseError {
2861
3141
  readonly name = "TradingFee.InvalidFeeError";
2862
3142
  constructor(fee: bigint, index: number);
2863
3143
  }
2864
- /** Error thrown when fees array doesn't have exactly 6 elements. */
3144
+ /** Error thrown when fees array doesn't have exactly 7 elements. */
2865
3145
  declare class InvalidFeesLengthError extends BaseError {
2866
3146
  readonly name = "TradingFee.InvalidFeesLengthError";
2867
3147
  constructor(length: number);
@@ -2908,13 +3188,13 @@ declare namespace from$8 {
2908
3188
  type ReturnType = Transfer;
2909
3189
  }
2910
3190
  declare namespace Tree_d_exports {
2911
- export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs, signatureDomain, signatureTypes };
3191
+ export { DecodeError, EncodeError, MAX_COMPRESSED_OFFERS_BYTES, MAX_DECOMPRESSED_OFFERS_BYTES, MAX_OFFERS_PER_TREE, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs, signatureDomain, signatureTypes };
2912
3192
  }
2913
3193
  /**
2914
3194
  * A merkle tree of offers built from offer hashes.
2915
3195
  * Constructed via {@link from}. The tree root can be signed for onchain broadcast.
2916
3196
  */
2917
- type Tree = Compute<StandardMerkleTree<[Hex]> & {
3197
+ type Tree = Compute<SimpleMerkleTree & {
2918
3198
  /** The offers in the tree. */offers: Offer[]; /** The root of the tree. */
2919
3199
  root: Hex;
2920
3200
  }>;
@@ -2922,7 +3202,10 @@ type Proof = {
2922
3202
  /** The offer that the proof is for. */offer: Offer; /** The merkle proof path for the offer. */
2923
3203
  path: Hex[];
2924
3204
  };
2925
- declare const VERSION$1 = 1;
3205
+ declare const VERSION$1 = 2;
3206
+ declare const MAX_COMPRESSED_OFFERS_BYTES = 1000000;
3207
+ declare const MAX_DECOMPRESSED_OFFERS_BYTES = 4000000;
3208
+ declare const MAX_OFFERS_PER_TREE = 100;
2926
3209
  type SignatureDomain = {
2927
3210
  /** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
2928
3211
  verifyingContract: Address;
@@ -2952,11 +3235,10 @@ declare const signatureTypes: {
2952
3235
  * Builds a Merkle tree from a list of offers.
2953
3236
  *
2954
3237
  * Leaves are the offer `hash` values as `bytes32` and are deterministically
2955
- * ordered following the StandardMerkleTree leaf ordering so that the resulting
2956
- * root is stable regardless of the input order.
3238
+ * ordered so that the resulting root is stable regardless of the input order.
2957
3239
  *
2958
3240
  * @param offers - Offers to include in the tree.
2959
- * @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
3241
+ * @returns A `SimpleMerkleTree` of offer hashes representing the offers.
2960
3242
  * @throws {TreeError} If tree building fails due to offer inconsistencies.
2961
3243
  */
2962
3244
  declare const from$7: (offers: Offer[]) => Tree;
@@ -2964,7 +3246,7 @@ declare const from$7: (offers: Offer[]) => Tree;
2964
3246
  * Generates merkle proofs for all offers in a tree.
2965
3247
  *
2966
3248
  * Each proof allows independent verification that an offer is included in the tree
2967
- * without requiring the full tree. Proofs are ordered by StandardMerkleTree leaf ordering.
3249
+ * without requiring the full tree.
2968
3250
  *
2969
3251
  * @param tree - The {@link Tree} to generate proofs for.
2970
3252
  * @returns Array of proofs - {@link Proof}
@@ -3045,10 +3327,11 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
3045
3327
  * Returns the tree with separately validated signature and recovered signer address.
3046
3328
  *
3047
3329
  * Validation order:
3048
- * 1. Version check
3330
+ * 1. Version and static size checks
3049
3331
  * 2. Signature verification (fail-fast, before decompression)
3050
- * 3. Decompression (only if signature valid)
3051
- * 4. Root verification (computed from offers vs embedded root)
3332
+ * 3. Streaming decompression with byte cap
3333
+ * 4. JSON array + offer count checks
3334
+ * 5. Root verification (computed from offers vs embedded root)
3052
3335
  *
3053
3336
  * @example
3054
3337
  * ```typescript
@@ -3098,30 +3381,28 @@ declare class SignatureDomainError extends BaseError {
3098
3381
  constructor(reason: string);
3099
3382
  }
3100
3383
  //#endregion
3101
- //#region src/indexer/collectors/Collector.d.ts
3102
- declare const names: readonly ["offers", "morpho_v2", "positions", "prices"];
3103
- type Name = (typeof names)[number];
3104
- /** A general collector interface. */
3105
- type Collector<name extends Name = Name, client extends PublicClient<Transport, Chain$1> = PublicClient<Transport, Chain$1>> = {
3106
- /** The name of the collector. */readonly name: name; /** The chain the collector is running on. */
3107
- readonly chain: client["chain"]; /** The public client used to query chain head. */
3108
- readonly client: client; /** The database connection for collector metadata. */
3109
- readonly db: Database; /** The normal polling interval (ms) for this collector. */
3110
- readonly interval: number;
3111
- /** Start collecting data from external sources.
3112
- * @yields The last block number processed by the collector.
3113
- */
3114
- collect: () => AsyncGenerator<number, void, void>;
3115
- };
3384
+ //#region src/indexer/collectors/contracts.d.ts
3385
+ /**
3386
+ * Canonical collector names handled by the indexer runtime.
3387
+ */
3388
+ declare const collectorNames: readonly ["offers", "morpho_v2", "positions", "prices"];
3389
+ /**
3390
+ * Canonical collector name type.
3391
+ */
3392
+ type CollectorName = (typeof collectorNames)[number];
3116
3393
  //#endregion
3117
3394
  //#region src/database/domains/Blocks.d.ts
3118
3395
  type ChainState = {
3119
- chainId: Id;
3120
- blockNumber: number;
3121
- epoch: bigint;
3396
+ /** Chain identifier. */chainId: Id; /** Latest canonical block number persisted for this chain. */
3397
+ blockNumber: number; /** Current chain epoch fencing token. */
3398
+ epoch: bigint; /** Serialized canonical checkpoint ring used by minimal runtime restart hydration. */
3399
+ checkpoints: string; /** Canonical tip hash corresponding to `blockNumber` when available. */
3400
+ tipHash: string | null; /** Latest finalized block number persisted for deep reorg recovery. */
3401
+ finalizedBlockNumber: number | null; /** Finalized block hash corresponding to `finalizedBlockNumber` when available. */
3402
+ finalizedBlockHash: string | null;
3122
3403
  };
3123
3404
  type CollectorState = {
3124
- collectorName: Name;
3405
+ collectorName: CollectorName;
3125
3406
  chainId: Id;
3126
3407
  blockNumber: number;
3127
3408
  epoch: bigint;
@@ -3132,17 +3413,35 @@ type ChainSnapshot = ChainState & {
3132
3413
  type CollectorSnapshot = CollectorState & {
3133
3414
  updatedAt: Date;
3134
3415
  };
3135
- type InitParameters = {
3416
+ type InitChainParameters = {
3136
3417
  chainId: Id;
3137
- collectorName: Name;
3138
3418
  };
3139
- type AdvanceChainParameters = {
3419
+ type InitCollectorParameters = {
3140
3420
  chainId: Id;
3141
- blockNumber: number;
3142
- epoch: bigint;
3421
+ collectorName: CollectorName;
3422
+ };
3423
+ type Init = {
3424
+ (parameters: InitChainParameters): Promise<{
3425
+ chain: ChainState;
3426
+ }>;
3427
+ (parameters: InitCollectorParameters): Promise<{
3428
+ chain: ChainState;
3429
+ collector: CollectorState;
3430
+ }>;
3431
+ };
3432
+ type AdvanceChainParameters = {
3433
+ /** Chain identifier. */chainId: Id; /** Latest canonical block number. */
3434
+ blockNumber: number; /** Current chain epoch fencing token. */
3435
+ epoch: bigint; /** Optional serialized checkpoint ring; defaults to preserving the current value. */
3436
+ checkpoints?: string; /** Optional canonical tip hash; defaults to preserving the current value. */
3437
+ tipHash?: string | null; /** Optional finalized block number; defaults to preserving the current value. */
3438
+ finalizedBlockNumber?: number | null; /** Optional finalized block hash; defaults to preserving the current value. */
3439
+ finalizedBlockHash?: string | null; /** Optional CAS epoch guard for stale-writer rejection. */
3440
+ expectedEpoch?: bigint; /** Optional CAS tip-hash guard for stale-writer rejection. */
3441
+ expectedTipHash?: string | null;
3143
3442
  };
3144
3443
  type AdvanceCollectorParameters = {
3145
- collectorName: Name;
3444
+ collectorName: CollectorName;
3146
3445
  chainId: Id;
3147
3446
  blockNumber: number;
3148
3447
  epoch: bigint;
@@ -3151,17 +3450,14 @@ type HandleReorgParameters = {
3151
3450
  chainId: Id;
3152
3451
  blockNumber: number;
3153
3452
  epoch: bigint;
3154
- collectorNames?: Name[];
3453
+ collectorNames?: CollectorName[];
3155
3454
  };
3156
3455
  type BlocksDomain = {
3157
- /** Initialize and return chain + collector state, seeding rows when missing. */init: (parameters: InitParameters) => Promise<{
3158
- chain: ChainState;
3159
- collector: CollectorState;
3160
- }>; /** Return chain state, failing if it has not been initialized yet. */
3456
+ /** Initialize chain state, and optionally collector state, seeding rows when missing. */init: Init; /** Return chain state, failing if it has not been initialized yet. */
3161
3457
  getChain: (chainId: Id) => Promise<ChainState>; /** Return collector state, failing if it has not been initialized yet. */
3162
3458
  getCollector: (parameters: {
3163
3459
  chainId: Id;
3164
- collectorName: Name;
3460
+ collectorName: CollectorName;
3165
3461
  }) => Promise<CollectorState>; /** Return chain state rows, optionally filtered by chain id. */
3166
3462
  getChains: (parameters?: {
3167
3463
  chainId?: Id;
@@ -3174,7 +3470,7 @@ type BlocksDomain = {
3174
3470
  handleReorg: (parameters: HandleReorgParameters) => Promise<void>;
3175
3471
  };
3176
3472
  declare namespace Logger_d_exports {
3177
- export { LogContext, LogEntry, LogFn, LogLevel, LogLevelValues, Logger, defaultLogger, getLogger, runWithLogContext, runWithLogger, silentLogger };
3473
+ export { LogContext, LogEntry, LogFn, LogLevel, LogLevelValues, Logger, defaultLogger, getLogger, isLogFnEnabled, runWithLogContext, runWithLogger, silentLogger };
3178
3474
  }
3179
3475
  declare const LogLevelValues: readonly ["trace", "debug", "info", "warn", "error", "fatal", "silent"];
3180
3476
  type LogLevel = (typeof LogLevelValues)[number];
@@ -3193,6 +3489,12 @@ type Logger = {
3193
3489
  };
3194
3490
  declare function defaultLogger(minLevel?: LogLevel, pretty?: boolean): Logger;
3195
3491
  declare function silentLogger(): Logger;
3492
+ /**
3493
+ * Check whether a log function is configured to emit entries.
3494
+ * @param logFn - Logger method to inspect.
3495
+ * @returns `true` when the function is enabled.
3496
+ */
3497
+ declare function isLogFnEnabled(logFn: LogFn): boolean;
3196
3498
  declare function runWithLogger<T>(logger: Logger, fn: () => Promise<T>): Promise<T>;
3197
3499
  /**
3198
3500
  * Run a function with additional context fields attached to every log entry emitted via {@link getLogger}.
@@ -3217,11 +3519,10 @@ type Row = {
3217
3519
  hash: Hex;
3218
3520
  obligationId: Hex;
3219
3521
  maker: Address;
3220
- assets: bigint;
3221
- obligationUnits: bigint;
3222
- obligationShares: bigint;
3522
+ maxUnits: bigint;
3223
3523
  tick: number;
3224
3524
  maturity: Maturity;
3525
+ rcfThreshold: bigint;
3225
3526
  expiry: number;
3226
3527
  start: number;
3227
3528
  group: Hex;
@@ -3235,10 +3536,14 @@ type Row = {
3235
3536
  data: Hex;
3236
3537
  };
3237
3538
  receiverIfMakerIsSeller: Address;
3539
+ exitOnly: boolean;
3238
3540
  consumed: bigint;
3239
3541
  available: bigint;
3240
3542
  takeable: bigint;
3241
3543
  blockNumber: number;
3544
+ root?: Hex;
3545
+ signature?: Hex;
3546
+ proof?: Hex[];
3242
3547
  };
3243
3548
  type OfferReference$1 = {
3244
3549
  hash: Hex;
@@ -3295,7 +3600,7 @@ declare namespace get$5 {
3295
3600
  };
3296
3601
  type Level = {
3297
3602
  /** The offer tick for this level */tick: number; /** Sum of takeable amounts at this tick */
3298
- assets: bigint; /** Number of offers at this tick */
3603
+ maxUnits: bigint; /** Number of offers at this tick */
3299
3604
  count: number;
3300
3605
  };
3301
3606
  type ReturnType = {
@@ -3308,7 +3613,8 @@ declare namespace getOffers$2 {
3308
3613
  /** The side of the offer. */side: "buy" | "sell"; /** The obligationId of the offer. */
3309
3614
  obligationId: Hex; /** Cursor string returned by a previous call, for pagination */
3310
3615
  cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
3311
- limit?: number;
3616
+ limit?: number; /** When true, exclude offers whose truncated takeable assets are 0. */
3617
+ requirePositiveTakeableAssets?: boolean;
3312
3618
  };
3313
3619
  type ReturnType = {
3314
3620
  rows: Row[];
@@ -3333,8 +3639,12 @@ type CallbacksDomain = {
3333
3639
  /**
3334
3640
  * Upsert callbacks and their offer associations.
3335
3641
  * @param inputs - Callback associations grouped by offer hash. {@link OfferCallbacks}
3642
+ * @returns Row counts affected in `callbacks` and `offers_callbacks`.
3336
3643
  */
3337
- upsert: (inputs: OfferCallbacks[]) => Promise<void>;
3644
+ upsert: (inputs: OfferCallbacks[]) => Promise<{
3645
+ callbacksInserted: number;
3646
+ offersCallbacksInserted: number;
3647
+ }>;
3338
3648
  /**
3339
3649
  * Delete callback associations by offer hashes.
3340
3650
  * @param parameters - Offer hashes to delete. {@link DeleteParameters}
@@ -3357,7 +3667,10 @@ type Event = {
3357
3667
  blockNumber: number;
3358
3668
  };
3359
3669
  type ConsumedDomain = {
3360
- /** Create new consumed events. */create: (parameters: Event[]) => Promise<void>; /** Delete multiple consumed events by chain and block number greater than or equal to the given value. */
3670
+ /** Create new consumed events. */create: (parameters: Event[]) => Promise<{
3671
+ groupsInserted: number;
3672
+ consumedEventsInserted: number;
3673
+ }>; /** Delete multiple consumed events by chain and block number greater than or equal to the given value. */
3361
3674
  delete: (parameters: {
3362
3675
  chainId: Id;
3363
3676
  blockNumberGte: number;
@@ -3381,8 +3694,9 @@ type GroupsDomain = {
3381
3694
  /**
3382
3695
  * Insert groups (insert-only).
3383
3696
  * @param groups - Groups to insert. {@link GroupInput}
3697
+ * @returns Number of group rows inserted.
3384
3698
  */
3385
- create: (groups: GroupInput[]) => Promise<void>;
3699
+ create: (groups: GroupInput[]) => Promise<number>;
3386
3700
  /**
3387
3701
  * Check which groups already exist in the database.
3388
3702
  * @param groups - Group keys to check. {@link GroupKey}
@@ -3408,8 +3722,9 @@ type LotsDomain = {
3408
3722
  * For each (position, group), keeps only the biggest offer by assets.
3409
3723
  * If lot exists and new offer is bigger, grows the lot and shifts higher lots.
3410
3724
  * Automatically upserts lots_positions bridge rows before inserting lots.
3725
+ * @returns Inserted row counts for `lots_positions` and `lots`.
3411
3726
  */
3412
- create: (parameters: create$6.Parameters) => Promise<void>;
3727
+ create: (parameters: create$6.Parameters) => Promise<create$6.ReturnType>;
3413
3728
  /**
3414
3729
  * Get lots with optional filtering.
3415
3730
  */
@@ -3426,7 +3741,10 @@ declare namespace create$6 {
3426
3741
  size: bigint;
3427
3742
  };
3428
3743
  type Parameters = OfferLotInfo[];
3429
- type ReturnType = undefined;
3744
+ type ReturnType = {
3745
+ lotsPositionsInserted: number;
3746
+ lotsInserted: number;
3747
+ };
3430
3748
  }
3431
3749
  declare namespace get$4 {
3432
3750
  type Parameters = {
@@ -3445,8 +3763,9 @@ type ObligationsDomain = {
3445
3763
  /**
3446
3764
  * Insert obligations and their onchain obligation id keys (insert-only).
3447
3765
  * @param obligations - Obligations to insert.
3766
+ * @returns Inserted row counts by table.
3448
3767
  */
3449
- create: (obligations: create$5.Input[]) => Promise<void>;
3768
+ create: (obligations: create$5.Input[]) => Promise<create$5.ReturnType>;
3450
3769
  /**
3451
3770
  * Get active obligations with optional chain filters.
3452
3771
  * @param parameters - Optional chain filters.
@@ -3469,6 +3788,11 @@ declare namespace create$5 {
3469
3788
  morphoV2: Address;
3470
3789
  obligation: Obligation$1;
3471
3790
  };
3791
+ type ReturnType = {
3792
+ obligationsInserted: number;
3793
+ obligationIdKeysInserted: number;
3794
+ obligationCollateralsInserted: number;
3795
+ };
3472
3796
  }
3473
3797
  declare namespace get$3 {
3474
3798
  type Output = {
@@ -3515,11 +3839,12 @@ type OraclesDomain = {
3515
3839
  chainId: Id;
3516
3840
  }) => Promise<Oracle[]>;
3517
3841
  /**
3518
- * Upsert oracles
3842
+ * Upsert oracles.
3519
3843
  *
3520
- * @param oracles - Array of oracles to upsert
3844
+ * @param oracles - Array of oracles to upsert.
3845
+ * @returns Number of oracle rows affected by the upsert.
3521
3846
  */
3522
- upsert: (oracles: Oracle[]) => Promise<void>;
3847
+ upsert: (oracles: Oracle[]) => Promise<number>;
3523
3848
  };
3524
3849
  //#endregion
3525
3850
  //#region src/database/domains/Positions.d.ts
@@ -3956,15 +4281,85 @@ type ClientConfig = {
3956
4281
  * @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
3957
4282
  */
3958
4283
  declare function createHttpClient(config: ClientConfig): GatekeeperClient;
4284
+ //#endregion
4285
+ //#region src/indexer/engine/operation.d.ts
4286
+ /**
4287
+ * Chain view snapshot returned by the chain sync coroutine.
4288
+ */
4289
+ type ChainView = {
4290
+ /** Current observed head. */head: number; /** Canonical target for collectors this tick. */
4291
+ target: number; /** Canonical epoch after sync/reorg handling. */
4292
+ epoch: number; /** Rewind point when a reorg is detected. */
4293
+ rewindTo?: number;
4294
+ };
4295
+ //#endregion
4296
+ //#region src/indexer/engine/runtime.d.ts
4297
+ /**
4298
+ * Minimal runtime API.
4299
+ *
4300
+ * Role:
4301
+ * - run one deterministic indexing tick end-to-end;
4302
+ * - own chain sync, reorg reconciliation, and collector stepping order;
4303
+ * - centralize retry/backoff and pending-op resume semantics.
4304
+ */
4305
+ type Runtime = {
4306
+ /**
4307
+ * Execute one deterministic runtime tick.
4308
+ * Runs chain sync, applies any reorg rewinds, and advances each collector once.
4309
+ */
4310
+ tick: () => Promise<ChainView>;
4311
+ /**
4312
+ * Return the runtime-recommended wait time before the next tick.
4313
+ *
4314
+ * This captures collector-specific sleep scheduling and is clamped by `heartbeatMs`
4315
+ * when configured.
4316
+ */
4317
+ nextWakeInMs: () => number;
4318
+ };
4319
+ //#endregion
4320
+ //#region src/indexer/Observer.d.ts
4321
+ type CommitEntityOperation = "inserted" | "upserted" | "deleted" | "ignored";
4322
+ type CommitAppliedStat = {
4323
+ collector: string;
4324
+ entity: string;
4325
+ operation: CommitEntityOperation;
4326
+ count: number;
4327
+ };
4328
+ type CommitAppliedDbRowOperation = "inserted" | "upserted" | "deleted";
4329
+ type CommitAppliedDbRowStat = {
4330
+ collector: string;
4331
+ table: string;
4332
+ operation: CommitAppliedDbRowOperation;
4333
+ count: number;
4334
+ };
4335
+ type RuntimeEventObserver$1 = (parameters: {
4336
+ event: string;
4337
+ fields?: Record<string, unknown>;
4338
+ }) => void;
4339
+ type CommitAppliedObserver$1 = (parameters: {
4340
+ collectors: string[];
4341
+ stats: CommitAppliedStat[];
4342
+ dbRows: CommitAppliedDbRowStat[];
4343
+ committedAtUnixMs: number;
4344
+ }) => void;
4345
+ type ChainObserver = {
4346
+ observeRuntime: (runtime: Runtime) => Runtime;
4347
+ onRuntimeEvent: RuntimeEventObserver$1;
4348
+ onCommitApplied: CommitAppliedObserver$1;
4349
+ };
3959
4350
  declare namespace Indexer_d_exports {
3960
- export { Indexer, IndexerConfig, create$3 as create, from$6 as from };
4351
+ export { CONNECTION_ERROR_ESCALATION_THRESHOLD, CommitAppliedObserver, CreateParameters$1 as CreateParameters, Indexer, IndexerConfig, RuntimeConfig, RuntimeEventObserver, RuntimeObserver, buildRuntime, create$3 as create, from$6 as from };
3961
4352
  }
4353
+ declare const CONNECTION_ERROR_ESCALATION_THRESHOLD = 20;
3962
4354
  type Indexer = {
3963
4355
  start: () => () => void;
3964
4356
  next: () => Promise<void>;
3965
4357
  return: () => Promise<void>;
3966
4358
  };
3967
- type IndexerConfig<client extends PublicClient<Transport, Chain$1, Account | undefined>> = {
4359
+ type RuntimeEventObserver = RuntimeEventObserver$1;
4360
+ type CommitAppliedObserver = CommitAppliedObserver$1;
4361
+ type RuntimeObserver = Pick<ChainObserver, "observeRuntime" | "onRuntimeEvent" | "onCommitApplied">;
4362
+ type RuntimeConfig<client extends PublicClient<Transport, Chain$1, Account | undefined>> = {
3968
4363
  client: client;
3969
4364
  db: Database;
3970
4365
  gatekeeper: GatekeeperClient;
@@ -3973,20 +4368,51 @@ type IndexerConfig<client extends PublicClient<Transport, Chain$1, Account | und
3973
4368
  maxBlockNumber?: number;
3974
4369
  blockWindow?: number;
3975
4370
  retryAttempts?: number;
3976
- retryDelayMs?: number;
4371
+ retryDelayMs?: number; /** Maximum concurrent read/execute operations issued by the runtime. */
4372
+ maxParallelRpc?: number; /** Maximum concurrent runtime commits (chain + collector applies). */
4373
+ maxParallelCommits?: number; /** Adapter pending-resolution budget per commit. */
4374
+ maxPendingResolutionsPerCommit?: number; /** Pending item age threshold (blocks) before ignore eligibility. */
4375
+ pendingIgnoreAfterBlocks?: number; /** Pending item attempt threshold before ignore eligibility. */
4376
+ pendingIgnoreAfterAttempts?: number;
3977
4377
  };
3978
- declare function from$6<client extends PublicClient<Transport, Chain$1, Account | undefined>>(config: IndexerConfig<client>): Indexer;
3979
- declare function create$3<client extends PublicClient<Transport, Chain$1, Account | undefined>>(params: {
3980
- collectors: Collector[];
4378
+ type IndexerConfig<client extends PublicClient<Transport, Chain$1, Account | undefined>> = RuntimeConfig<client> & {
4379
+ /**
4380
+ * Runtime tick burst count per `next()` call.
4381
+ * Defaults to `2` to reduce catch-up latency while preserving backward behavior.
4382
+ */
4383
+ ticksPerNext?: number; /** Optional runtime observer hook for tick and runtime-event monitoring. */
4384
+ observer?: RuntimeObserver;
4385
+ };
4386
+ type CreateParameters$1<client extends PublicClient<Transport, Chain$1, Account | undefined>> = {
3981
4387
  client: client;
3982
- }): Indexer;
4388
+ runtime: Runtime;
4389
+ ticksPerNext?: number;
4390
+ };
4391
+ /**
4392
+ * Build one indexer runtime for a chain configuration.
4393
+ * @param config - Runtime configuration.
4394
+ * @returns Initialized runtime.
4395
+ */
4396
+ declare function buildRuntime<client extends PublicClient<Transport, Chain$1, Account | undefined>>(config: RuntimeConfig<client>): Runtime;
4397
+ /**
4398
+ * Build and start an indexer host for one chain.
4399
+ * @param config - Indexer configuration.
4400
+ * @returns Indexer host.
4401
+ */
4402
+ declare function from$6<client extends PublicClient<Transport, Chain$1, Account | undefined>>(config: IndexerConfig<client>): Indexer;
4403
+ /**
4404
+ * Create an indexer host around a prepared runtime.
4405
+ * @param parameters - Indexer host dependencies.
4406
+ * @returns Indexer host.
4407
+ */
4408
+ declare function create$3<client extends PublicClient<Transport, Chain$1, Account | undefined>>(parameters: CreateParameters$1<client>): Indexer;
3983
4409
  declare namespace Health_d_exports {
3984
4410
  export { ChainHealth$1 as ChainHealth, CollectorHealth$1 as CollectorHealth, CollectorHealthStatus, HealthService, HealthServiceParameters, MissingCollector, RouterHealth, RouterStatus, create$2 as create };
3985
4411
  }
3986
4412
  type CollectorHealthStatus = "live" | "lagging" | "unknown";
3987
4413
  type RouterStatus = "live" | "syncing";
3988
4414
  type CollectorHealth$1 = {
3989
- name: Name;
4415
+ name: CollectorName;
3990
4416
  chainId: Id;
3991
4417
  blockNumber: number | null;
3992
4418
  updatedAt: string | null;
@@ -4004,7 +4430,7 @@ type ChainHealth$1 = {
4004
4430
  };
4005
4431
  type MissingCollector = {
4006
4432
  chainId: Id;
4007
- name: Name;
4433
+ name: CollectorName;
4008
4434
  };
4009
4435
  type RouterHealth = {
4010
4436
  status: RouterStatus;
@@ -4021,7 +4447,8 @@ type HealthService = {
4021
4447
  type HealthServiceParameters = {
4022
4448
  db: Database; /** Maximum number of blocks a collector can lag behind its chain before being considered lagging. */
4023
4449
  maxAllowedLag?: number; /** Map of chainId to client for fetching remote block numbers. */
4024
- healthClients?: Map<Id, Client>; /** Chain registry for deriving expected initialization state. */
4450
+ healthClients?: Map<Id, Client>; /** Timeout guard for each remote head RPC call. */
4451
+ remoteBlockTimeoutMs?: number; /** Chain registry for deriving expected initialization state. */
4025
4452
  chainRegistry?: ChainRegistry;
4026
4453
  };
4027
4454
  type Snapshot = {
@@ -4037,45 +4464,44 @@ type Snapshot = {
4037
4464
  */
4038
4465
  declare function create$2(parameters: HealthServiceParameters): HealthService;
4039
4466
  //#endregion
4040
- //#region src/api/Api.d.ts
4041
- type RouterApi = {
4042
- serve: () => void;
4467
+ //#region src/observability/HttpRequestMetrics.d.ts
4468
+ /**
4469
+ * A completed HTTP request observation.
4470
+ */
4471
+ type Observation = {
4472
+ component: "api" | "gatekeeper";
4473
+ method: string;
4474
+ route: string;
4475
+ statusCode: number;
4476
+ durationMs: number;
4043
4477
  };
4044
- type ApiConfig = {
4045
- db: Database;
4046
- gatekeeper: GatekeeperClient;
4047
- port: number;
4048
- chainRegistry: ChainRegistry;
4049
- };
4050
- declare function from$5(config: ApiConfig): RouterApi;
4051
- type CreateParameters = {
4052
- db: Database;
4053
- gatekeeper: GatekeeperClient;
4054
- port: number;
4055
- chainRegistry: ChainRegistry;
4056
- };
4057
- declare function create$1(params: CreateParameters): RouterApi;
4058
4478
  /**
4059
- * Create the router API Hono app with all routes and middleware configured.
4060
- * @param parameters - API construction parameters.
4061
- * @returns Configured Hono app instance.
4479
+ * HTTP request metrics collector.
4062
4480
  */
4063
- declare function createApp(parameters: CreateParameters): Hono;
4481
+ type HttpRequestMetrics = {
4482
+ observe: (observation: Observation) => void;
4483
+ render: () => Promise<string>;
4484
+ };
4485
+ //#endregion
4486
+ //#region src/observability/SyncMetrics.d.ts
4487
+ type MetricsService = {
4488
+ getPrometheusMetrics: () => Promise<string>;
4489
+ };
4064
4490
  declare namespace BookResponse_d_exports {
4065
- export { BookLevelResponse, from$4 as from };
4491
+ export { BookLevelResponse, from$5 as from };
4066
4492
  }
4067
4493
  type BookLevelResponse = {
4068
4494
  tick: number;
4069
4495
  price: string;
4070
- assets: string;
4496
+ max_units: string;
4071
4497
  count: number;
4072
4498
  };
4073
4499
  type Input$1 = {
4074
4500
  tick: number;
4075
- assets: bigint;
4501
+ maxUnits: bigint;
4076
4502
  count: number;
4077
4503
  };
4078
- declare function from$4(level: Input$1): BookLevelResponse;
4504
+ declare function from$5(level: Input$1): BookLevelResponse;
4079
4505
  //#endregion
4080
4506
  //#region src/api/Schema/health.d.ts
4081
4507
  declare const CollectorHealth: z.ZodObject<{
@@ -4790,7 +5216,7 @@ interface components {
4790
5216
  * @example 500000000000000000
4791
5217
  */
4792
5218
  price: string; /** @example 369216000000000000000000 */
4793
- assets: string; /** @example 5 */
5219
+ max_units: string; /** @example 5 */
4794
5220
  count: number;
4795
5221
  };
4796
5222
  BadRequestResponse: {
@@ -4908,16 +5334,16 @@ interface components {
4908
5334
  * {
4909
5335
  * "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
4910
5336
  * "lltv": "860000000000000000",
5337
+ * "max_lif": "0",
4911
5338
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
4912
5339
  * }
4913
5340
  * ],
4914
- * "maturity": 1761922799
5341
+ * "maturity": 1761922799,
5342
+ * "rcf_threshold": "0"
4915
5343
  * },
4916
5344
  * "buy": false,
4917
5345
  * "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
4918
- * "assets": "369216000000000000000000",
4919
- * "obligation_units": "0",
4920
- * "obligation_shares": "0",
5346
+ * "max_units": "369216000000000000000000",
4921
5347
  * "start": 1761922790,
4922
5348
  * "expiry": 1761922799,
4923
5349
  * "tick": 495,
@@ -4925,7 +5351,8 @@ interface components {
4925
5351
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
4926
5352
  * "callback": "0x0000000000000000000000000000000000000000",
4927
5353
  * "callback_data": "0x",
4928
- * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
5354
+ * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
5355
+ * "exit_only": false
4929
5356
  * },
4930
5357
  * "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
4931
5358
  * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf79",
@@ -4953,16 +5380,16 @@ interface components {
4953
5380
  * {
4954
5381
  * "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
4955
5382
  * "lltv": "860000000000000000",
5383
+ * "max_lif": "0",
4956
5384
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
4957
5385
  * }
4958
5386
  * ],
4959
- * "maturity": 1761922799
5387
+ * "maturity": 1761922799,
5388
+ * "rcf_threshold": "0"
4960
5389
  * },
4961
5390
  * "buy": false,
4962
5391
  * "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
4963
- * "assets": "369216000000000000000000",
4964
- * "obligation_units": "0",
4965
- * "obligation_shares": "0",
5392
+ * "max_units": "369216000000000000000000",
4966
5393
  * "start": 1761922790,
4967
5394
  * "expiry": 1761922799,
4968
5395
  * "tick": 495,
@@ -4970,7 +5397,8 @@ interface components {
4970
5397
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
4971
5398
  * "callback": "0x0000000000000000000000000000000000000000",
4972
5399
  * "callback_data": "0x",
4973
- * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
5400
+ * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
5401
+ * "exit_only": false
4974
5402
  * }
4975
5403
  */
4976
5404
  offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
@@ -4998,18 +5426,18 @@ interface components {
4998
5426
  * {
4999
5427
  * "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
5000
5428
  * "lltv": "860000000000000000",
5429
+ * "max_lif": "0",
5001
5430
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
5002
5431
  * }
5003
5432
  * ],
5004
- * "maturity": 1761922799
5433
+ * "maturity": 1761922799,
5434
+ * "rcf_threshold": "0"
5005
5435
  * }
5006
5436
  */
5007
5437
  obligation: components["schemas"]["ObligationOfferResponse"]; /** @example false */
5008
5438
  buy: boolean; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
5009
5439
  maker: string; /** @example 369216000000000000000000 */
5010
- assets: string; /** @example 0 */
5011
- obligation_units: string; /** @example 0 */
5012
- obligation_shares: string; /** @example 1761922790 */
5440
+ max_units: string; /** @example 1761922790 */
5013
5441
  start: number; /** @example 1761922799 */
5014
5442
  expiry: number; /** @example 495 */
5015
5443
  tick: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
@@ -5017,7 +5445,8 @@ interface components {
5017
5445
  session: string; /** @example 0x0000000000000000000000000000000000000000 */
5018
5446
  callback: string; /** @example 0x */
5019
5447
  callback_data: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
5020
- receiver_if_maker_is_seller: string;
5448
+ receiver_if_maker_is_seller: string; /** @example false */
5449
+ exit_only: boolean;
5021
5450
  };
5022
5451
  ObligationOfferResponse: {
5023
5452
  /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
@@ -5026,16 +5455,19 @@ interface components {
5026
5455
  * {
5027
5456
  * "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
5028
5457
  * "lltv": "860000000000000000",
5458
+ * "max_lif": "0",
5029
5459
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
5030
5460
  * }
5031
5461
  * ]
5032
5462
  */
5033
5463
  collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922799 */
5034
- maturity: number;
5464
+ maturity: number; /** @example 0 */
5465
+ rcf_threshold: string;
5035
5466
  };
5036
5467
  CollateralResponse: {
5037
5468
  /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */token: string; /** @example 860000000000000000 */
5038
- lltv: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
5469
+ lltv: string; /** @example 0 */
5470
+ max_lif: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
5039
5471
  oracle: string;
5040
5472
  };
5041
5473
  ObligationListResponse: {
@@ -5048,7 +5480,8 @@ interface components {
5048
5480
  chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
5049
5481
  loan_token: string;
5050
5482
  collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922800 */
5051
- maturity: number;
5483
+ maturity: number; /** @example 0 */
5484
+ rcf_threshold: string;
5052
5485
  ask: components["schemas"]["AskResponse"];
5053
5486
  bid: components["schemas"]["BidResponse"];
5054
5487
  };
@@ -5172,7 +5605,7 @@ interface components {
5172
5605
  * "chain_id": 1,
5173
5606
  * "contract": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
5174
5607
  * "user": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
5175
- * "obligation_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf79",
5608
+ * "obligation_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67",
5176
5609
  * "reserved": "200000000000000000000",
5177
5610
  * "block_number": 21345678
5178
5611
  * }
@@ -5186,7 +5619,7 @@ interface components {
5186
5619
  user: string;
5187
5620
  /**
5188
5621
  * @description Obligation id this reserved amount belongs to, or null if no lots exist.
5189
- * @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf79
5622
+ * @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
5190
5623
  */
5191
5624
  obligation_id: string | null; /** @example 200000000000000000000 */
5192
5625
  reserved: string; /** @example 21345678 */
@@ -5202,11 +5635,10 @@ interface components {
5202
5635
  };
5203
5636
  ValidateOfferRequest: {
5204
5637
  /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
5205
- assets: string; /** @example 0 */
5206
- obligation_units?: string; /** @example 0 */
5207
- obligation_shares?: string; /** @example 495 */
5638
+ max_units?: string; /** @example 495 */
5208
5639
  tick: number; /** @example 1761922799 */
5209
- maturity: number; /** @example 1761922799 */
5640
+ maturity: number; /** @example 0 */
5641
+ rcf_threshold: string; /** @example 1761922799 */
5210
5642
  expiry: number; /** @example 1761922790 */
5211
5643
  start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
5212
5644
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
@@ -5218,7 +5650,8 @@ interface components {
5218
5650
  * {
5219
5651
  * "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
5220
5652
  * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
5221
- * "lltv": "860000000000000000"
5653
+ * "lltv": "860000000000000000",
5654
+ * "max_lif": "0"
5222
5655
  * }
5223
5656
  * ]
5224
5657
  */
@@ -5230,12 +5663,14 @@ interface components {
5230
5663
  * }
5231
5664
  */
5232
5665
  callback: components["schemas"]["ValidateCallbackRequest"]; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
5233
- receiver_if_maker_is_seller: string;
5666
+ receiver_if_maker_is_seller: string; /** @example false */
5667
+ exit_only?: boolean;
5234
5668
  };
5235
5669
  ValidateCollateralRequest: {
5236
5670
  /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
5237
5671
  oracle: string; /** @example 860000000000000000 */
5238
- lltv: string;
5672
+ lltv: string; /** @example 0 */
5673
+ max_lif: string;
5239
5674
  };
5240
5675
  ValidateCallbackRequest: {
5241
5676
  /** @example 0x0000000000000000000000000000000000000000 */address: string; /** @example 0x */
@@ -5266,7 +5701,7 @@ interface components {
5266
5701
  pathItems: never;
5267
5702
  }
5268
5703
  declare namespace ObligationResponse_d_exports {
5269
- export { ObligationResponse, from$3 as from };
5704
+ export { ObligationResponse, from$4 as from };
5270
5705
  }
5271
5706
  type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
5272
5707
  /**
@@ -5277,20 +5712,19 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
5277
5712
  * @param chainId - The chain id used to compute `id`.
5278
5713
  * @returns The created `ObligationResponse`. {@link ObligationResponse}
5279
5714
  */
5280
- declare function from$3(obligation: Obligation$1, quote: Quote, chainId: Id): ObligationResponse;
5715
+ declare function from$4(obligation: Obligation$1, quote: Quote, chainId: Id): ObligationResponse;
5281
5716
  declare namespace OfferResponse_d_exports {
5282
- export { Input, OfferResponse, from$2 as from };
5717
+ export { Input, OfferResponse, from$3 as from };
5283
5718
  }
5284
5719
  type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
5285
5720
  type Input = Readonly<{
5286
5721
  hash: Hex;
5287
5722
  obligationId: Hex;
5288
5723
  maker: Address;
5289
- assets: bigint;
5290
- obligationUnits: bigint;
5291
- obligationShares: bigint;
5724
+ maxUnits: bigint;
5292
5725
  tick: number;
5293
5726
  maturity: number;
5727
+ rcfThreshold: bigint;
5294
5728
  expiry: number;
5295
5729
  start: number;
5296
5730
  group: Hex;
@@ -5301,6 +5735,7 @@ type Input = Readonly<{
5301
5735
  collaterals: Readonly<{
5302
5736
  asset: Address;
5303
5737
  lltv: bigint;
5738
+ maxLif: bigint;
5304
5739
  oracle: Address;
5305
5740
  }[]>;
5306
5741
  callback: {
@@ -5308,6 +5743,7 @@ type Input = Readonly<{
5308
5743
  data: Hex;
5309
5744
  };
5310
5745
  receiverIfMakerIsSeller: Address;
5746
+ exitOnly: boolean;
5311
5747
  root?: Hex | undefined;
5312
5748
  proof?: Hex[] | undefined;
5313
5749
  signature?: Hex | undefined;
@@ -5321,7 +5757,7 @@ type Input = Readonly<{
5321
5757
  * @param input - {@link Input}
5322
5758
  * @returns The created `OfferResponse`. {@link OfferResponse}
5323
5759
  */
5324
- declare function from$2(input: Input): OfferResponse;
5760
+ declare function from$3(input: Input): OfferResponse;
5325
5761
  //#endregion
5326
5762
  //#region src/api/Schema/openapi.d.ts
5327
5763
  declare class BooksController {
@@ -5353,7 +5789,7 @@ declare class UsersController {
5353
5789
  }
5354
5790
  declare const OpenApi: () => Promise<OpenAPIDocument>;
5355
5791
  declare namespace PositionResponse_d_exports {
5356
- export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
5792
+ export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$2 as from };
5357
5793
  }
5358
5794
  type PositionResponse = {
5359
5795
  chain_id: Id;
@@ -5369,7 +5805,7 @@ type PositionWithReserved$1 = getByUser.PositionWithReserved;
5369
5805
  * @param position - {@link PositionWithReserved}
5370
5806
  * @returns The created `PositionResponse`. {@link PositionResponse}
5371
5807
  */
5372
- declare function from$1(position: PositionWithReserved$1): PositionResponse;
5808
+ declare function from$2(position: PositionWithReserved$1): PositionResponse;
5373
5809
  //#endregion
5374
5810
  //#region src/api/Schema/requests.d.ts
5375
5811
  declare const schemas: {
@@ -5377,25 +5813,25 @@ declare const schemas: {
5377
5813
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
5378
5814
  0: "0";
5379
5815
  1: "1";
5380
- true: "true";
5381
5816
  false: "false";
5382
- }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
5817
+ true: "true";
5818
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
5383
5819
  }, z$1.core.$strip>;
5384
5820
  readonly get_health_collectors: z$1.ZodObject<{
5385
5821
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
5386
5822
  0: "0";
5387
5823
  1: "1";
5388
- true: "true";
5389
5824
  false: "false";
5390
- }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
5825
+ true: "true";
5826
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
5391
5827
  }, z$1.core.$strip>;
5392
5828
  readonly get_health_chains: z$1.ZodObject<{
5393
5829
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
5394
5830
  0: "0";
5395
5831
  1: "1";
5396
- true: "true";
5397
5832
  false: "false";
5398
- }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
5833
+ true: "true";
5834
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
5399
5835
  }, z$1.core.$strip>;
5400
5836
  readonly get_config_contracts: z$1.ZodObject<{
5401
5837
  cursor: z$1.ZodOptional<z$1.ZodString>;
@@ -5556,18 +5992,17 @@ declare function getDocsHtml(): Promise<string>;
5556
5992
  declare function getIntegratorDocsHtml(): Promise<string>;
5557
5993
  //#endregion
5558
5994
  //#region src/api/Controllers/getHealth.d.ts
5559
- declare function getHealth(query: unknown, db: Database, chainRegistry?: ChainRegistry): Promise<Payload<paths["/v1/health"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
5560
- declare function getHealthChains(query: unknown, db: Database, healthClients?: Map<Id, Client>, chainRegistry?: ChainRegistry): Promise<Payload<paths["/v1/health/chains"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
5561
- declare function getHealthCollectors(query: unknown, db: Database, chainRegistry?: ChainRegistry): Promise<Payload<paths["/v1/health/collectors"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
5995
+ declare function getHealth(query: unknown, healthService: HealthService): Promise<Payload<paths["/v1/health"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
5996
+ declare function getHealthChains(query: unknown, healthService: HealthService): Promise<Payload<paths["/v1/health/chains"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
5997
+ declare function getHealthCollectors(query: unknown, healthService: HealthService): Promise<Payload<paths["/v1/health/collectors"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
5562
5998
  //#endregion
5563
5999
  //#region src/api/Controllers/getMetrics.d.ts
5564
6000
  /**
5565
- * Get router synchronization metrics in Prometheus exposition format.
5566
- * @param db - Database instance. {@link Database.Database}
5567
- * @param chainRegistry - Optional chain registry used to scope expected chains.
6001
+ * Get router metrics in Prometheus exposition format.
6002
+ * @param metricsService - Metrics service instance. {@link Metrics.MetricsService}
5568
6003
  * @returns Prometheus exposition payload.
5569
6004
  */
5570
- declare function getMetrics(db: Database, chainRegistry?: ChainRegistry): Promise<string>;
6005
+ declare function getMetrics(metricsService: MetricsService): Promise<string>;
5571
6006
  //#endregion
5572
6007
  //#region src/api/Controllers/getObligation.d.ts
5573
6008
  declare function getObligation(params: object, db: Database): Promise<Payload<ObligationResponse>>;
@@ -5610,7 +6045,7 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
5610
6045
  */
5611
6046
  declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
5612
6047
  declare namespace Gatekeeper_d_exports {
5613
- export { Gatekeeper, Rules, RulesFactory, create };
6048
+ export { Gatekeeper, Rules, RulesFactory, create$1 as create };
5614
6049
  }
5615
6050
  type Rules = readonly Rule<Offer, string>[];
5616
6051
  type RulesFactory = (chainId: Id) => Rules;
@@ -5628,7 +6063,7 @@ type GatekeeperParameters = {
5628
6063
  * @param parameters - Gatekeeper parameters. {@link GatekeeperParameters}
5629
6064
  * @returns Gatekeeper instance. {@link Gatekeeper}
5630
6065
  */
5631
- declare function create(parameters: GatekeeperParameters): Gatekeeper;
6066
+ declare function create$1(parameters: GatekeeperParameters): Gatekeeper;
5632
6067
  //#endregion
5633
6068
  //#region src/api/Controllers/validateOffers.d.ts
5634
6069
  type ValidationIssue$1 = {
@@ -5648,8 +6083,74 @@ declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<V
5648
6083
  declare namespace index_d_exports$4 {
5649
6084
  export { CONFIG_CONTRACT_NAMES, ConfigContract, ConfigContractName, GetOffersQueryParams, ValidationIssue$1 as ValidationIssue, getBook, getConfigContracts, getConfigRules, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getIntegratorDocsHtml, getMetrics, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getOffersQuery, getSwaggerJson, getUserPositions, validateOffers };
5650
6085
  }
6086
+ //#endregion
6087
+ //#region src/api/Api.d.ts
6088
+ type RouterApi = {
6089
+ serve: () => ServerHandle;
6090
+ };
6091
+ type ServerHandle = {
6092
+ close: () => Promise<void>;
6093
+ };
6094
+ type ApiServices = {
6095
+ getOffers: (query: object) => ReturnType<typeof getOffers$1>;
6096
+ getObligations: (query: object) => ReturnType<typeof getObligations$1>;
6097
+ getObligation: (parameters: {
6098
+ obligation_id: string;
6099
+ }) => ReturnType<typeof getObligation>;
6100
+ getBook: (parameters: {
6101
+ obligation_id: string;
6102
+ side: string;
6103
+ cursor?: string;
6104
+ limit?: string;
6105
+ }) => ReturnType<typeof getBook>;
6106
+ validateOffers: GatekeeperClient["validate"];
6107
+ getUserPositions: (parameters: {
6108
+ user_address: string;
6109
+ cursor?: string;
6110
+ limit?: string;
6111
+ }) => ReturnType<typeof getUserPositions>;
6112
+ getHealth: (query: unknown) => ReturnType<typeof getHealth>;
6113
+ getHealthCollectors: (query: unknown) => ReturnType<typeof getHealthCollectors>;
6114
+ getHealthChains: (query: unknown) => ReturnType<typeof getHealthChains>;
6115
+ getMetrics: () => Promise<string>;
6116
+ getConfigContracts: (query: unknown) => ReturnType<typeof getConfigContracts>;
6117
+ getConfigRules: GatekeeperClient["getConfigRules"];
6118
+ observeHttpRequest: (observation: Observation) => void;
6119
+ };
6120
+ type CreateServicesParameters = {
6121
+ db: Database;
6122
+ gatekeeper: GatekeeperClient;
6123
+ chainRegistry: ChainRegistry;
6124
+ healthService: HealthService;
6125
+ metricsService: MetricsService;
6126
+ httpRequestMetrics: HttpRequestMetrics;
6127
+ };
6128
+ type ApiConfig = {
6129
+ services: ApiServices;
6130
+ port: number;
6131
+ };
6132
+ declare function from$1(config: ApiConfig): RouterApi;
6133
+ type CreateParameters = {
6134
+ services: ApiServices;
6135
+ port: number;
6136
+ };
6137
+ declare function create(params: CreateParameters): RouterApi;
6138
+ /**
6139
+ * Build router API endpoint services from infrastructure dependencies.
6140
+ * @param parameters - Router API dependencies.
6141
+ * @returns Endpoint service handlers consumed by {@link createApp}.
6142
+ */
6143
+ declare function createServices(parameters: CreateServicesParameters): ApiServices;
6144
+ /**
6145
+ * Create the router API Hono app with all routes and middleware configured.
6146
+ * @param parameters - API construction parameters.
6147
+ * @returns Configured Hono app instance.
6148
+ */
6149
+ declare function createApp(parameters: {
6150
+ services: ApiServices;
6151
+ }): Hono;
5651
6152
  declare namespace RouterApi_d_exports {
5652
- export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, UsersController, ValidateController, create$1 as create, createApp, from$5 as from, parse, safeParse };
6153
+ export { ApiConfig, ApiServices, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, index_d_exports$4 as Controllers, CreateServicesParameters, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, ServerHandle, UsersController, ValidateController, create, createApp, createServices, from$1 as from, parse, safeParse };
5653
6154
  }
5654
6155
  declare namespace Client_d_exports$1 {
5655
6156
  export { Client$3 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
@@ -5785,7 +6286,7 @@ declare class HttpGetApiFailedError extends BaseError {
5785
6286
  }
5786
6287
  //#endregion
5787
6288
  //#region src/database/drizzle/VERSION.d.ts
5788
- declare const VERSION: "router_v1.13";
6289
+ declare const VERSION: "router_v1.16";
5789
6290
  //#endregion
5790
6291
  //#region src/database/drizzle/schema.d.ts
5791
6292
  declare enum EnumTableName {
@@ -5803,6 +6304,7 @@ declare enum EnumTableName {
5803
6304
  VALIDATIONS = "validations",
5804
6305
  COLLECTORS = "collectors",
5805
6306
  CHAINS = "chains",
6307
+ PENDING_LINKS = "pending_links",
5806
6308
  LOTS = "lots",
5807
6309
  LOTS_POSITIONS = "lots_positions",
5808
6310
  OFFSETS = "offsets",
@@ -5810,12 +6312,12 @@ declare enum EnumTableName {
5810
6312
  MERKLE_PATHS = "merkle_paths"
5811
6313
  }
5812
6314
  declare const TABLE_NAMES: readonly EnumTableName[];
5813
- declare const VERSIONED_TABLE_NAMES: ("\"router_v1.13\".\"obligations\"" | "\"router_v1.13\".\"obligation_id_keys\"" | "\"router_v1.13\".\"groups\"" | "\"router_v1.13\".\"consumed_events\"" | "\"router_v1.13\".\"obligation_collaterals_v2\"" | "\"router_v1.13\".\"oracles\"" | "\"router_v1.13\".\"offers\"" | "\"router_v1.13\".\"offers_callbacks\"" | "\"router_v1.13\".\"callbacks\"" | "\"router_v1.13\".\"positions\"" | "\"router_v1.13\".\"transfers\"" | "\"router_v1.13\".\"validations\"" | "\"router_v1.13\".\"collectors\"" | "\"router_v1.13\".\"chains\"" | "\"router_v1.13\".\"lots\"" | "\"router_v1.13\".\"lots_positions\"" | "\"router_v1.13\".\"offsets\"" | "\"router_v1.13\".\"trees\"" | "\"router_v1.13\".\"merkle_paths\"")[];
6315
+ declare const VERSIONED_TABLE_NAMES: ("\"router_v1.16\".\"obligations\"" | "\"router_v1.16\".\"obligation_id_keys\"" | "\"router_v1.16\".\"groups\"" | "\"router_v1.16\".\"consumed_events\"" | "\"router_v1.16\".\"obligation_collaterals_v2\"" | "\"router_v1.16\".\"oracles\"" | "\"router_v1.16\".\"offers\"" | "\"router_v1.16\".\"offers_callbacks\"" | "\"router_v1.16\".\"callbacks\"" | "\"router_v1.16\".\"positions\"" | "\"router_v1.16\".\"transfers\"" | "\"router_v1.16\".\"validations\"" | "\"router_v1.16\".\"collectors\"" | "\"router_v1.16\".\"chains\"" | "\"router_v1.16\".\"pending_links\"" | "\"router_v1.16\".\"lots\"" | "\"router_v1.16\".\"lots_positions\"" | "\"router_v1.16\".\"offsets\"" | "\"router_v1.16\".\"trees\"" | "\"router_v1.16\".\"merkle_paths\"")[];
5814
6316
  type TableName = (typeof TABLE_NAMES)[number];
5815
6317
  type VersionedTableName = `"${typeof VERSION}"."${TableName}"`;
5816
6318
  declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5817
6319
  name: EnumTableName.OBLIGATIONS;
5818
- schema: "router_v1.13";
6320
+ schema: "router_v1.16";
5819
6321
  columns: {
5820
6322
  obligationKey: drizzle_orm_pg_core0.PgColumn<{
5821
6323
  name: "obligation_key";
@@ -5872,12 +6374,29 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5872
6374
  identity: undefined;
5873
6375
  generated: undefined;
5874
6376
  }, {}, {}>;
6377
+ rcfThreshold: drizzle_orm_pg_core0.PgColumn<{
6378
+ name: "rcf_threshold";
6379
+ tableName: EnumTableName.OBLIGATIONS;
6380
+ dataType: "string";
6381
+ columnType: "PgNumeric";
6382
+ data: string;
6383
+ driverParam: string;
6384
+ notNull: true;
6385
+ hasDefault: false;
6386
+ isPrimaryKey: false;
6387
+ isAutoincrement: false;
6388
+ hasRuntimeDefault: false;
6389
+ enumValues: undefined;
6390
+ baseColumn: never;
6391
+ identity: undefined;
6392
+ generated: undefined;
6393
+ }, {}, {}>;
5875
6394
  };
5876
6395
  dialect: "pg";
5877
6396
  }>;
5878
6397
  declare const obligationIdKeys: drizzle_orm_pg_core0.PgTableWithColumns<{
5879
6398
  name: EnumTableName.OBLIGATION_ID_KEYS;
5880
- schema: "router_v1.13";
6399
+ schema: "router_v1.16";
5881
6400
  columns: {
5882
6401
  obligationId: drizzle_orm_pg_core0.PgColumn<{
5883
6402
  name: "obligation_id";
@@ -5896,7 +6415,7 @@ declare const obligationIdKeys: drizzle_orm_pg_core0.PgTableWithColumns<{
5896
6415
  identity: undefined;
5897
6416
  generated: undefined;
5898
6417
  }, {}, {
5899
- length: 42;
6418
+ length: 66;
5900
6419
  }>;
5901
6420
  obligationKey: drizzle_orm_pg_core0.PgColumn<{
5902
6421
  name: "obligation_key";
@@ -5960,7 +6479,7 @@ declare const obligationIdKeys: drizzle_orm_pg_core0.PgTableWithColumns<{
5960
6479
  }>;
5961
6480
  declare const groups: drizzle_orm_pg_core0.PgTableWithColumns<{
5962
6481
  name: EnumTableName.GROUPS;
5963
- schema: "router_v1.13";
6482
+ schema: "router_v1.16";
5964
6483
  columns: {
5965
6484
  chainId: drizzle_orm_pg_core0.PgColumn<{
5966
6485
  name: "chain_id";
@@ -6075,7 +6594,7 @@ declare const groups: drizzle_orm_pg_core0.PgTableWithColumns<{
6075
6594
  }>;
6076
6595
  declare const consumedEvents: drizzle_orm_pg_core0.PgTableWithColumns<{
6077
6596
  name: EnumTableName.CONSUMED_EVENTS;
6078
- schema: "router_v1.13";
6597
+ schema: "router_v1.16";
6079
6598
  columns: {
6080
6599
  eventId: drizzle_orm_pg_core0.PgColumn<{
6081
6600
  name: "event_id";
@@ -6209,7 +6728,7 @@ declare const consumedEvents: drizzle_orm_pg_core0.PgTableWithColumns<{
6209
6728
  }>;
6210
6729
  declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
6211
6730
  name: EnumTableName.OBLIGATION_COLLATERALS_V2;
6212
- schema: "router_v1.13";
6731
+ schema: "router_v1.16";
6213
6732
  columns: {
6214
6733
  obligationKey: drizzle_orm_pg_core0.PgColumn<{
6215
6734
  name: "obligation_key";
@@ -6285,6 +6804,23 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
6285
6804
  identity: undefined;
6286
6805
  generated: undefined;
6287
6806
  }, {}, {}>;
6807
+ maxLif: drizzle_orm_pg_core0.PgColumn<{
6808
+ name: "max_lif";
6809
+ tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
6810
+ dataType: "bigint";
6811
+ columnType: "PgBigInt64";
6812
+ data: bigint;
6813
+ driverParam: string;
6814
+ notNull: true;
6815
+ hasDefault: false;
6816
+ isPrimaryKey: false;
6817
+ isAutoincrement: false;
6818
+ hasRuntimeDefault: false;
6819
+ enumValues: undefined;
6820
+ baseColumn: never;
6821
+ identity: undefined;
6822
+ generated: undefined;
6823
+ }, {}, {}>;
6288
6824
  collateralIndex: drizzle_orm_pg_core0.PgColumn<{
6289
6825
  name: "collateral_index";
6290
6826
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
@@ -6324,7 +6860,7 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
6324
6860
  }>;
6325
6861
  declare const oracles: drizzle_orm_pg_core0.PgTableWithColumns<{
6326
6862
  name: EnumTableName.ORACLES;
6327
- schema: "router_v1.13";
6863
+ schema: "router_v1.16";
6328
6864
  columns: {
6329
6865
  chainId: drizzle_orm_pg_core0.PgColumn<{
6330
6866
  name: "chain_id";
@@ -6420,7 +6956,7 @@ declare const oracles: drizzle_orm_pg_core0.PgTableWithColumns<{
6420
6956
  }>;
6421
6957
  declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
6422
6958
  name: EnumTableName.OFFERS;
6423
- schema: "router_v1.13";
6959
+ schema: "router_v1.16";
6424
6960
  columns: {
6425
6961
  hash: drizzle_orm_pg_core0.PgColumn<{
6426
6962
  name: "hash";
@@ -6458,44 +6994,10 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
6458
6994
  identity: undefined;
6459
6995
  generated: undefined;
6460
6996
  }, {}, {
6461
- length: 42;
6997
+ length: 66;
6462
6998
  }>;
6463
- assets: drizzle_orm_pg_core0.PgColumn<{
6464
- name: "assets";
6465
- tableName: EnumTableName.OFFERS;
6466
- dataType: "string";
6467
- columnType: "PgNumeric";
6468
- data: string;
6469
- driverParam: string;
6470
- notNull: true;
6471
- hasDefault: false;
6472
- isPrimaryKey: false;
6473
- isAutoincrement: false;
6474
- hasRuntimeDefault: false;
6475
- enumValues: undefined;
6476
- baseColumn: never;
6477
- identity: undefined;
6478
- generated: undefined;
6479
- }, {}, {}>;
6480
- obligationUnits: drizzle_orm_pg_core0.PgColumn<{
6481
- name: "obligation_units";
6482
- tableName: EnumTableName.OFFERS;
6483
- dataType: "string";
6484
- columnType: "PgNumeric";
6485
- data: string;
6486
- driverParam: string;
6487
- notNull: true;
6488
- hasDefault: true;
6489
- isPrimaryKey: false;
6490
- isAutoincrement: false;
6491
- hasRuntimeDefault: false;
6492
- enumValues: undefined;
6493
- baseColumn: never;
6494
- identity: undefined;
6495
- generated: undefined;
6496
- }, {}, {}>;
6497
- obligationShares: drizzle_orm_pg_core0.PgColumn<{
6498
- name: "obligation_shares";
6999
+ maxUnits: drizzle_orm_pg_core0.PgColumn<{
7000
+ name: "max_units";
6499
7001
  tableName: EnumTableName.OFFERS;
6500
7002
  dataType: "string";
6501
7003
  columnType: "PgNumeric";
@@ -6727,6 +7229,23 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
6727
7229
  }, {}, {
6728
7230
  length: 42;
6729
7231
  }>;
7232
+ exitOnly: drizzle_orm_pg_core0.PgColumn<{
7233
+ name: "exit_only";
7234
+ tableName: EnumTableName.OFFERS;
7235
+ dataType: "boolean";
7236
+ columnType: "PgBoolean";
7237
+ data: boolean;
7238
+ driverParam: boolean;
7239
+ notNull: true;
7240
+ hasDefault: true;
7241
+ isPrimaryKey: false;
7242
+ isAutoincrement: false;
7243
+ hasRuntimeDefault: false;
7244
+ enumValues: undefined;
7245
+ baseColumn: never;
7246
+ identity: undefined;
7247
+ generated: undefined;
7248
+ }, {}, {}>;
6730
7249
  blockNumber: drizzle_orm_pg_core0.PgColumn<{
6731
7250
  name: "block_number";
6732
7251
  tableName: EnumTableName.OFFERS;
@@ -6766,7 +7285,7 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
6766
7285
  }>;
6767
7286
  declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6768
7287
  name: EnumTableName.OFFERS_CALLBACKS;
6769
- schema: "router_v1.13";
7288
+ schema: "router_v1.16";
6770
7289
  columns: {
6771
7290
  offerHash: drizzle_orm_pg_core0.PgColumn<{
6772
7291
  name: "offer_hash";
@@ -6804,7 +7323,7 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6804
7323
  identity: undefined;
6805
7324
  generated: undefined;
6806
7325
  }, {}, {
6807
- length: 42;
7326
+ length: 66;
6808
7327
  }>;
6809
7328
  callbackId: drizzle_orm_pg_core0.PgColumn<{
6810
7329
  name: "callback_id";
@@ -6831,7 +7350,7 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6831
7350
  declare const CallbackTypes: drizzle_orm_pg_core0.PgEnum<[CallbackType, ...CallbackType[]]>;
6832
7351
  declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6833
7352
  name: EnumTableName.CALLBACKS;
6834
- schema: "router_v1.13";
7353
+ schema: "router_v1.16";
6835
7354
  columns: {
6836
7355
  id: drizzle_orm_pg_core0.PgColumn<{
6837
7356
  name: "id";
@@ -6948,7 +7467,7 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6948
7467
  }>;
6949
7468
  declare const lotsPositions: drizzle_orm_pg_core0.PgTableWithColumns<{
6950
7469
  name: EnumTableName.LOTS_POSITIONS;
6951
- schema: "router_v1.13";
7470
+ schema: "router_v1.16";
6952
7471
  columns: {
6953
7472
  chainId: drizzle_orm_pg_core0.PgColumn<{
6954
7473
  name: "chain_id";
@@ -7029,7 +7548,7 @@ declare const lotsPositions: drizzle_orm_pg_core0.PgTableWithColumns<{
7029
7548
  }>;
7030
7549
  declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
7031
7550
  name: EnumTableName.LOTS;
7032
- schema: "router_v1.13";
7551
+ schema: "router_v1.16";
7033
7552
  columns: {
7034
7553
  chainId: drizzle_orm_pg_core0.PgColumn<{
7035
7554
  name: "chain_id";
@@ -7124,7 +7643,7 @@ declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
7124
7643
  identity: undefined;
7125
7644
  generated: undefined;
7126
7645
  }, {}, {
7127
- length: 42;
7646
+ length: 66;
7128
7647
  }>;
7129
7648
  lower: drizzle_orm_pg_core0.PgColumn<{
7130
7649
  name: "lower";
@@ -7165,7 +7684,7 @@ declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
7165
7684
  }>;
7166
7685
  declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
7167
7686
  name: EnumTableName.OFFSETS;
7168
- schema: "router_v1.13";
7687
+ schema: "router_v1.16";
7169
7688
  columns: {
7170
7689
  chainId: drizzle_orm_pg_core0.PgColumn<{
7171
7690
  name: "chain_id";
@@ -7260,7 +7779,7 @@ declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
7260
7779
  identity: undefined;
7261
7780
  generated: undefined;
7262
7781
  }, {}, {
7263
- length: 42;
7782
+ length: 66;
7264
7783
  }>;
7265
7784
  value: drizzle_orm_pg_core0.PgColumn<{
7266
7785
  name: "value";
@@ -7285,7 +7804,7 @@ declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
7285
7804
  declare const PositionTypes: drizzle_orm_pg_core0.PgEnum<[Type, ...Type[]]>;
7286
7805
  declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
7287
7806
  name: "position_types";
7288
- schema: "router_v1.13";
7807
+ schema: "router_v1.16";
7289
7808
  columns: {
7290
7809
  id: drizzle_orm_pg_core0.PgColumn<{
7291
7810
  name: "id";
@@ -7326,7 +7845,7 @@ declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
7326
7845
  }>;
7327
7846
  declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
7328
7847
  name: EnumTableName.POSITIONS;
7329
- schema: "router_v1.13";
7848
+ schema: "router_v1.16";
7330
7849
  columns: {
7331
7850
  chainId: drizzle_orm_pg_core0.PgColumn<{
7332
7851
  name: "chain_id";
@@ -7477,7 +7996,7 @@ declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
7477
7996
  }>;
7478
7997
  declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
7479
7998
  name: EnumTableName.TRANSFERS;
7480
- schema: "router_v1.13";
7999
+ schema: "router_v1.16";
7481
8000
  columns: {
7482
8001
  eventId: drizzle_orm_pg_core0.PgColumn<{
7483
8002
  name: "event_id";
@@ -7599,7 +8118,422 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
7599
8118
  data: number;
7600
8119
  driverParam: string | number;
7601
8120
  notNull: true;
7602
- hasDefault: false;
8121
+ hasDefault: false;
8122
+ isPrimaryKey: false;
8123
+ isAutoincrement: false;
8124
+ hasRuntimeDefault: false;
8125
+ enumValues: undefined;
8126
+ baseColumn: never;
8127
+ identity: undefined;
8128
+ generated: undefined;
8129
+ }, {}, {}>;
8130
+ asset: drizzle_orm_pg_core0.PgColumn<{
8131
+ name: "asset";
8132
+ tableName: EnumTableName.TRANSFERS;
8133
+ dataType: "string";
8134
+ columnType: "PgVarchar";
8135
+ data: string;
8136
+ driverParam: string;
8137
+ notNull: true;
8138
+ hasDefault: false;
8139
+ isPrimaryKey: false;
8140
+ isAutoincrement: false;
8141
+ hasRuntimeDefault: false;
8142
+ enumValues: [string, ...string[]];
8143
+ baseColumn: never;
8144
+ identity: undefined;
8145
+ generated: undefined;
8146
+ }, {}, {
8147
+ length: 42;
8148
+ }>;
8149
+ blockNumber: drizzle_orm_pg_core0.PgColumn<{
8150
+ name: "block_number";
8151
+ tableName: EnumTableName.TRANSFERS;
8152
+ dataType: "number";
8153
+ columnType: "PgBigInt53";
8154
+ data: number;
8155
+ driverParam: string | number;
8156
+ notNull: true;
8157
+ hasDefault: false;
8158
+ isPrimaryKey: false;
8159
+ isAutoincrement: false;
8160
+ hasRuntimeDefault: false;
8161
+ enumValues: undefined;
8162
+ baseColumn: never;
8163
+ identity: undefined;
8164
+ generated: undefined;
8165
+ }, {}, {}>;
8166
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
8167
+ name: "created_at";
8168
+ tableName: EnumTableName.TRANSFERS;
8169
+ dataType: "date";
8170
+ columnType: "PgTimestamp";
8171
+ data: Date;
8172
+ driverParam: string;
8173
+ notNull: true;
8174
+ hasDefault: true;
8175
+ isPrimaryKey: false;
8176
+ isAutoincrement: false;
8177
+ hasRuntimeDefault: false;
8178
+ enumValues: undefined;
8179
+ baseColumn: never;
8180
+ identity: undefined;
8181
+ generated: undefined;
8182
+ }, {}, {}>;
8183
+ };
8184
+ dialect: "pg";
8185
+ }>;
8186
+ declare const StatusCode: drizzle_orm_pg_core0.PgEnum<[Status, ...Status[]]>;
8187
+ declare const status: drizzle_orm_pg_core0.PgTableWithColumns<{
8188
+ name: "status";
8189
+ schema: "router_v1.16";
8190
+ columns: {
8191
+ id: drizzle_orm_pg_core0.PgColumn<{
8192
+ name: "id";
8193
+ tableName: "status";
8194
+ dataType: "number";
8195
+ columnType: "PgSerial";
8196
+ data: number;
8197
+ driverParam: number;
8198
+ notNull: true;
8199
+ hasDefault: true;
8200
+ isPrimaryKey: true;
8201
+ isAutoincrement: false;
8202
+ hasRuntimeDefault: false;
8203
+ enumValues: undefined;
8204
+ baseColumn: never;
8205
+ identity: undefined;
8206
+ generated: undefined;
8207
+ }, {}, {}>;
8208
+ code: drizzle_orm_pg_core0.PgColumn<{
8209
+ name: "code";
8210
+ tableName: "status";
8211
+ dataType: "string";
8212
+ columnType: "PgEnumColumn";
8213
+ data: Status;
8214
+ driverParam: string;
8215
+ notNull: false;
8216
+ hasDefault: false;
8217
+ isPrimaryKey: false;
8218
+ isAutoincrement: false;
8219
+ hasRuntimeDefault: false;
8220
+ enumValues: [Status, ...Status[]];
8221
+ baseColumn: never;
8222
+ identity: undefined;
8223
+ generated: undefined;
8224
+ }, {}, {}>;
8225
+ };
8226
+ dialect: "pg";
8227
+ }>;
8228
+ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
8229
+ name: "validations";
8230
+ schema: "router_v1.16";
8231
+ columns: {
8232
+ offerHash: drizzle_orm_pg_core0.PgColumn<{
8233
+ name: "offer_hash";
8234
+ tableName: "validations";
8235
+ dataType: "string";
8236
+ columnType: "PgVarchar";
8237
+ data: string;
8238
+ driverParam: string;
8239
+ notNull: true;
8240
+ hasDefault: false;
8241
+ isPrimaryKey: false;
8242
+ isAutoincrement: false;
8243
+ hasRuntimeDefault: false;
8244
+ enumValues: [string, ...string[]];
8245
+ baseColumn: never;
8246
+ identity: undefined;
8247
+ generated: undefined;
8248
+ }, {}, {
8249
+ length: 66;
8250
+ }>;
8251
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
8252
+ name: "obligation_id";
8253
+ tableName: "validations";
8254
+ dataType: "string";
8255
+ columnType: "PgVarchar";
8256
+ data: string;
8257
+ driverParam: string;
8258
+ notNull: true;
8259
+ hasDefault: false;
8260
+ isPrimaryKey: false;
8261
+ isAutoincrement: false;
8262
+ hasRuntimeDefault: false;
8263
+ enumValues: [string, ...string[]];
8264
+ baseColumn: never;
8265
+ identity: undefined;
8266
+ generated: undefined;
8267
+ }, {}, {
8268
+ length: 66;
8269
+ }>;
8270
+ statusId: drizzle_orm_pg_core0.PgColumn<{
8271
+ name: "status_id";
8272
+ tableName: "validations";
8273
+ dataType: "number";
8274
+ columnType: "PgInteger";
8275
+ data: number;
8276
+ driverParam: string | number;
8277
+ notNull: true;
8278
+ hasDefault: false;
8279
+ isPrimaryKey: false;
8280
+ isAutoincrement: false;
8281
+ hasRuntimeDefault: false;
8282
+ enumValues: undefined;
8283
+ baseColumn: never;
8284
+ identity: undefined;
8285
+ generated: undefined;
8286
+ }, {}, {}>;
8287
+ updatedAt: drizzle_orm_pg_core0.PgColumn<{
8288
+ name: "updated_at";
8289
+ tableName: "validations";
8290
+ dataType: "date";
8291
+ columnType: "PgTimestamp";
8292
+ data: Date;
8293
+ driverParam: string;
8294
+ notNull: true;
8295
+ hasDefault: true;
8296
+ isPrimaryKey: false;
8297
+ isAutoincrement: false;
8298
+ hasRuntimeDefault: false;
8299
+ enumValues: undefined;
8300
+ baseColumn: never;
8301
+ identity: undefined;
8302
+ generated: undefined;
8303
+ }, {}, {}>;
8304
+ };
8305
+ dialect: "pg";
8306
+ }>;
8307
+ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
8308
+ name: EnumTableName.COLLECTORS;
8309
+ schema: "router_v1.16";
8310
+ columns: {
8311
+ chainId: drizzle_orm_pg_core0.PgColumn<{
8312
+ name: "chain_id";
8313
+ tableName: EnumTableName.COLLECTORS;
8314
+ dataType: "number";
8315
+ columnType: "PgBigInt53";
8316
+ data: Id;
8317
+ driverParam: string | number;
8318
+ notNull: true;
8319
+ hasDefault: false;
8320
+ isPrimaryKey: false;
8321
+ isAutoincrement: false;
8322
+ hasRuntimeDefault: false;
8323
+ enumValues: undefined;
8324
+ baseColumn: never;
8325
+ identity: undefined;
8326
+ generated: undefined;
8327
+ }, {}, {
8328
+ $type: Id;
8329
+ }>;
8330
+ name: drizzle_orm_pg_core0.PgColumn<{
8331
+ name: "name";
8332
+ tableName: EnumTableName.COLLECTORS;
8333
+ dataType: "string";
8334
+ columnType: "PgText";
8335
+ data: "morpho_v2" | "offers" | "positions" | "prices";
8336
+ driverParam: string;
8337
+ notNull: true;
8338
+ hasDefault: false;
8339
+ isPrimaryKey: false;
8340
+ isAutoincrement: false;
8341
+ hasRuntimeDefault: false;
8342
+ enumValues: [string, ...string[]];
8343
+ baseColumn: never;
8344
+ identity: undefined;
8345
+ generated: undefined;
8346
+ }, {}, {
8347
+ $type: "morpho_v2" | "offers" | "positions" | "prices";
8348
+ }>;
8349
+ blockNumber: drizzle_orm_pg_core0.PgColumn<{
8350
+ name: "block_number";
8351
+ tableName: EnumTableName.COLLECTORS;
8352
+ dataType: "number";
8353
+ columnType: "PgBigInt53";
8354
+ data: number;
8355
+ driverParam: string | number;
8356
+ notNull: true;
8357
+ hasDefault: false;
8358
+ isPrimaryKey: false;
8359
+ isAutoincrement: false;
8360
+ hasRuntimeDefault: false;
8361
+ enumValues: undefined;
8362
+ baseColumn: never;
8363
+ identity: undefined;
8364
+ generated: undefined;
8365
+ }, {}, {}>;
8366
+ epoch: drizzle_orm_pg_core0.PgColumn<{
8367
+ name: "epoch";
8368
+ tableName: EnumTableName.COLLECTORS;
8369
+ dataType: "string";
8370
+ columnType: "PgNumeric";
8371
+ data: string;
8372
+ driverParam: string;
8373
+ notNull: true;
8374
+ hasDefault: true;
8375
+ isPrimaryKey: false;
8376
+ isAutoincrement: false;
8377
+ hasRuntimeDefault: false;
8378
+ enumValues: undefined;
8379
+ baseColumn: never;
8380
+ identity: undefined;
8381
+ generated: undefined;
8382
+ }, {}, {}>;
8383
+ updatedAt: drizzle_orm_pg_core0.PgColumn<{
8384
+ name: "updated_at";
8385
+ tableName: EnumTableName.COLLECTORS;
8386
+ dataType: "date";
8387
+ columnType: "PgTimestamp";
8388
+ data: Date;
8389
+ driverParam: string;
8390
+ notNull: true;
8391
+ hasDefault: true;
8392
+ isPrimaryKey: false;
8393
+ isAutoincrement: false;
8394
+ hasRuntimeDefault: false;
8395
+ enumValues: undefined;
8396
+ baseColumn: never;
8397
+ identity: undefined;
8398
+ generated: undefined;
8399
+ }, {}, {}>;
8400
+ };
8401
+ dialect: "pg";
8402
+ }>;
8403
+ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
8404
+ name: EnumTableName.CHAINS;
8405
+ schema: "router_v1.16";
8406
+ columns: {
8407
+ chainId: drizzle_orm_pg_core0.PgColumn<{
8408
+ name: "chain_id";
8409
+ tableName: EnumTableName.CHAINS;
8410
+ dataType: "number";
8411
+ columnType: "PgBigInt53";
8412
+ data: Id;
8413
+ driverParam: string | number;
8414
+ notNull: true;
8415
+ hasDefault: false;
8416
+ isPrimaryKey: false;
8417
+ isAutoincrement: false;
8418
+ hasRuntimeDefault: false;
8419
+ enumValues: undefined;
8420
+ baseColumn: never;
8421
+ identity: undefined;
8422
+ generated: undefined;
8423
+ }, {}, {
8424
+ $type: Id;
8425
+ }>;
8426
+ blockNumber: drizzle_orm_pg_core0.PgColumn<{
8427
+ name: "block_number";
8428
+ tableName: EnumTableName.CHAINS;
8429
+ dataType: "number";
8430
+ columnType: "PgBigInt53";
8431
+ data: number;
8432
+ driverParam: string | number;
8433
+ notNull: true;
8434
+ hasDefault: false;
8435
+ isPrimaryKey: false;
8436
+ isAutoincrement: false;
8437
+ hasRuntimeDefault: false;
8438
+ enumValues: undefined;
8439
+ baseColumn: never;
8440
+ identity: undefined;
8441
+ generated: undefined;
8442
+ }, {}, {}>;
8443
+ epoch: drizzle_orm_pg_core0.PgColumn<{
8444
+ name: "epoch";
8445
+ tableName: EnumTableName.CHAINS;
8446
+ dataType: "string";
8447
+ columnType: "PgNumeric";
8448
+ data: string;
8449
+ driverParam: string;
8450
+ notNull: true;
8451
+ hasDefault: true;
8452
+ isPrimaryKey: false;
8453
+ isAutoincrement: false;
8454
+ hasRuntimeDefault: false;
8455
+ enumValues: undefined;
8456
+ baseColumn: never;
8457
+ identity: undefined;
8458
+ generated: undefined;
8459
+ }, {}, {}>;
8460
+ checkpoints: drizzle_orm_pg_core0.PgColumn<{
8461
+ name: "checkpoints";
8462
+ tableName: EnumTableName.CHAINS;
8463
+ dataType: "string";
8464
+ columnType: "PgText";
8465
+ data: string;
8466
+ driverParam: string;
8467
+ notNull: true;
8468
+ hasDefault: true;
8469
+ isPrimaryKey: false;
8470
+ isAutoincrement: false;
8471
+ hasRuntimeDefault: false;
8472
+ enumValues: [string, ...string[]];
8473
+ baseColumn: never;
8474
+ identity: undefined;
8475
+ generated: undefined;
8476
+ }, {}, {}>;
8477
+ tipHash: drizzle_orm_pg_core0.PgColumn<{
8478
+ name: "tip_hash";
8479
+ tableName: EnumTableName.CHAINS;
8480
+ dataType: "string";
8481
+ columnType: "PgText";
8482
+ data: string;
8483
+ driverParam: string;
8484
+ notNull: false;
8485
+ hasDefault: false;
8486
+ isPrimaryKey: false;
8487
+ isAutoincrement: false;
8488
+ hasRuntimeDefault: false;
8489
+ enumValues: [string, ...string[]];
8490
+ baseColumn: never;
8491
+ identity: undefined;
8492
+ generated: undefined;
8493
+ }, {}, {}>;
8494
+ finalizedBlockNumber: drizzle_orm_pg_core0.PgColumn<{
8495
+ name: "finalized_block_number";
8496
+ tableName: EnumTableName.CHAINS;
8497
+ dataType: "number";
8498
+ columnType: "PgBigInt53";
8499
+ data: number;
8500
+ driverParam: string | number;
8501
+ notNull: false;
8502
+ hasDefault: false;
8503
+ isPrimaryKey: false;
8504
+ isAutoincrement: false;
8505
+ hasRuntimeDefault: false;
8506
+ enumValues: undefined;
8507
+ baseColumn: never;
8508
+ identity: undefined;
8509
+ generated: undefined;
8510
+ }, {}, {}>;
8511
+ finalizedBlockHash: drizzle_orm_pg_core0.PgColumn<{
8512
+ name: "finalized_block_hash";
8513
+ tableName: EnumTableName.CHAINS;
8514
+ dataType: "string";
8515
+ columnType: "PgText";
8516
+ data: string;
8517
+ driverParam: string;
8518
+ notNull: false;
8519
+ hasDefault: false;
8520
+ isPrimaryKey: false;
8521
+ isAutoincrement: false;
8522
+ hasRuntimeDefault: false;
8523
+ enumValues: [string, ...string[]];
8524
+ baseColumn: never;
8525
+ identity: undefined;
8526
+ generated: undefined;
8527
+ }, {}, {}>;
8528
+ updatedAt: drizzle_orm_pg_core0.PgColumn<{
8529
+ name: "updated_at";
8530
+ tableName: EnumTableName.CHAINS;
8531
+ dataType: "date";
8532
+ columnType: "PgTimestamp";
8533
+ data: Date;
8534
+ driverParam: string;
8535
+ notNull: true;
8536
+ hasDefault: true;
7603
8537
  isPrimaryKey: false;
7604
8538
  isAutoincrement: false;
7605
8539
  hasRuntimeDefault: false;
@@ -7608,16 +8542,23 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
7608
8542
  identity: undefined;
7609
8543
  generated: undefined;
7610
8544
  }, {}, {}>;
7611
- asset: drizzle_orm_pg_core0.PgColumn<{
7612
- name: "asset";
7613
- tableName: EnumTableName.TRANSFERS;
8545
+ };
8546
+ dialect: "pg";
8547
+ }>;
8548
+ declare const pendingLinks: drizzle_orm_pg_core0.PgTableWithColumns<{
8549
+ name: EnumTableName.PENDING_LINKS;
8550
+ schema: "router_v1.16";
8551
+ columns: {
8552
+ key: drizzle_orm_pg_core0.PgColumn<{
8553
+ name: "key";
8554
+ tableName: EnumTableName.PENDING_LINKS;
7614
8555
  dataType: "string";
7615
8556
  columnType: "PgVarchar";
7616
8557
  data: string;
7617
8558
  driverParam: string;
7618
8559
  notNull: true;
7619
8560
  hasDefault: false;
7620
- isPrimaryKey: false;
8561
+ isPrimaryKey: true;
7621
8562
  isAutoincrement: false;
7622
8563
  hasRuntimeDefault: false;
7623
8564
  enumValues: [string, ...string[]];
@@ -7625,94 +8566,64 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
7625
8566
  identity: undefined;
7626
8567
  generated: undefined;
7627
8568
  }, {}, {
7628
- length: 42;
8569
+ length: 191;
7629
8570
  }>;
7630
- blockNumber: drizzle_orm_pg_core0.PgColumn<{
7631
- name: "block_number";
7632
- tableName: EnumTableName.TRANSFERS;
7633
- dataType: "number";
7634
- columnType: "PgBigInt53";
7635
- data: number;
7636
- driverParam: string | number;
8571
+ type: drizzle_orm_pg_core0.PgColumn<{
8572
+ name: "type";
8573
+ tableName: EnumTableName.PENDING_LINKS;
8574
+ dataType: "string";
8575
+ columnType: "PgText";
8576
+ data: string;
8577
+ driverParam: string;
7637
8578
  notNull: true;
7638
8579
  hasDefault: false;
7639
8580
  isPrimaryKey: false;
7640
8581
  isAutoincrement: false;
7641
8582
  hasRuntimeDefault: false;
7642
- enumValues: undefined;
8583
+ enumValues: [string, ...string[]];
7643
8584
  baseColumn: never;
7644
8585
  identity: undefined;
7645
8586
  generated: undefined;
7646
8587
  }, {}, {}>;
7647
- createdAt: drizzle_orm_pg_core0.PgColumn<{
7648
- name: "created_at";
7649
- tableName: EnumTableName.TRANSFERS;
7650
- dataType: "date";
7651
- columnType: "PgTimestamp";
7652
- data: Date;
8588
+ status: drizzle_orm_pg_core0.PgColumn<{
8589
+ name: "status";
8590
+ tableName: EnumTableName.PENDING_LINKS;
8591
+ dataType: "string";
8592
+ columnType: "PgText";
8593
+ data: string;
7653
8594
  driverParam: string;
7654
8595
  notNull: true;
7655
- hasDefault: true;
8596
+ hasDefault: false;
7656
8597
  isPrimaryKey: false;
7657
8598
  isAutoincrement: false;
7658
8599
  hasRuntimeDefault: false;
7659
- enumValues: undefined;
8600
+ enumValues: [string, ...string[]];
7660
8601
  baseColumn: never;
7661
8602
  identity: undefined;
7662
8603
  generated: undefined;
7663
8604
  }, {}, {}>;
7664
- };
7665
- dialect: "pg";
7666
- }>;
7667
- declare const StatusCode: drizzle_orm_pg_core0.PgEnum<[Status, ...Status[]]>;
7668
- declare const status: drizzle_orm_pg_core0.PgTableWithColumns<{
7669
- name: "status";
7670
- schema: "router_v1.13";
7671
- columns: {
7672
- id: drizzle_orm_pg_core0.PgColumn<{
7673
- name: "id";
7674
- tableName: "status";
8605
+ chainId: drizzle_orm_pg_core0.PgColumn<{
8606
+ name: "chain_id";
8607
+ tableName: EnumTableName.PENDING_LINKS;
7675
8608
  dataType: "number";
7676
- columnType: "PgSerial";
7677
- data: number;
7678
- driverParam: number;
8609
+ columnType: "PgBigInt53";
8610
+ data: Id;
8611
+ driverParam: string | number;
7679
8612
  notNull: true;
7680
- hasDefault: true;
7681
- isPrimaryKey: true;
7682
- isAutoincrement: false;
7683
- hasRuntimeDefault: false;
7684
- enumValues: undefined;
7685
- baseColumn: never;
7686
- identity: undefined;
7687
- generated: undefined;
7688
- }, {}, {}>;
7689
- code: drizzle_orm_pg_core0.PgColumn<{
7690
- name: "code";
7691
- tableName: "status";
7692
- dataType: "string";
7693
- columnType: "PgEnumColumn";
7694
- data: Status;
7695
- driverParam: string;
7696
- notNull: false;
7697
8613
  hasDefault: false;
7698
8614
  isPrimaryKey: false;
7699
8615
  isAutoincrement: false;
7700
8616
  hasRuntimeDefault: false;
7701
- enumValues: [Status, ...Status[]];
8617
+ enumValues: undefined;
7702
8618
  baseColumn: never;
7703
8619
  identity: undefined;
7704
8620
  generated: undefined;
7705
- }, {}, {}>;
7706
- };
7707
- dialect: "pg";
7708
- }>;
7709
- declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
7710
- name: "validations";
7711
- schema: "router_v1.13";
7712
- columns: {
7713
- offerHash: drizzle_orm_pg_core0.PgColumn<{
7714
- name: "offer_hash";
7715
- tableName: "validations";
8621
+ }, {}, {
8622
+ $type: Id;
8623
+ }>;
8624
+ eventId: drizzle_orm_pg_core0.PgColumn<{
8625
+ name: "event_id";
8626
+ tableName: EnumTableName.PENDING_LINKS;
7716
8627
  dataType: "string";
7717
8628
  columnType: "PgVarchar";
7718
8629
  data: string;
@@ -7727,11 +8638,11 @@ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
7727
8638
  identity: undefined;
7728
8639
  generated: undefined;
7729
8640
  }, {}, {
7730
- length: 66;
8641
+ length: 128;
7731
8642
  }>;
7732
8643
  obligationId: drizzle_orm_pg_core0.PgColumn<{
7733
8644
  name: "obligation_id";
7734
- tableName: "validations";
8645
+ tableName: EnumTableName.PENDING_LINKS;
7735
8646
  dataType: "string";
7736
8647
  columnType: "PgVarchar";
7737
8648
  data: string;
@@ -7746,11 +8657,11 @@ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
7746
8657
  identity: undefined;
7747
8658
  generated: undefined;
7748
8659
  }, {}, {
7749
- length: 42;
8660
+ length: 66;
7750
8661
  }>;
7751
- statusId: drizzle_orm_pg_core0.PgColumn<{
7752
- name: "status_id";
7753
- tableName: "validations";
8662
+ collateralIndex: drizzle_orm_pg_core0.PgColumn<{
8663
+ name: "collateral_index";
8664
+ tableName: EnumTableName.PENDING_LINKS;
7754
8665
  dataType: "number";
7755
8666
  columnType: "PgInteger";
7756
8667
  data: number;
@@ -7765,71 +8676,45 @@ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
7765
8676
  identity: undefined;
7766
8677
  generated: undefined;
7767
8678
  }, {}, {}>;
7768
- updatedAt: drizzle_orm_pg_core0.PgColumn<{
7769
- name: "updated_at";
7770
- tableName: "validations";
7771
- dataType: "date";
7772
- columnType: "PgTimestamp";
7773
- data: Date;
8679
+ user: drizzle_orm_pg_core0.PgColumn<{
8680
+ name: "user";
8681
+ tableName: EnumTableName.PENDING_LINKS;
8682
+ dataType: "string";
8683
+ columnType: "PgVarchar";
8684
+ data: string;
7774
8685
  driverParam: string;
7775
8686
  notNull: true;
7776
- hasDefault: true;
7777
- isPrimaryKey: false;
7778
- isAutoincrement: false;
7779
- hasRuntimeDefault: false;
7780
- enumValues: undefined;
7781
- baseColumn: never;
7782
- identity: undefined;
7783
- generated: undefined;
7784
- }, {}, {}>;
7785
- };
7786
- dialect: "pg";
7787
- }>;
7788
- declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7789
- name: EnumTableName.COLLECTORS;
7790
- schema: "router_v1.13";
7791
- columns: {
7792
- chainId: drizzle_orm_pg_core0.PgColumn<{
7793
- name: "chain_id";
7794
- tableName: EnumTableName.COLLECTORS;
7795
- dataType: "number";
7796
- columnType: "PgBigInt53";
7797
- data: Id;
7798
- driverParam: string | number;
7799
- notNull: true;
7800
8687
  hasDefault: false;
7801
8688
  isPrimaryKey: false;
7802
8689
  isAutoincrement: false;
7803
8690
  hasRuntimeDefault: false;
7804
- enumValues: undefined;
8691
+ enumValues: [string, ...string[]];
7805
8692
  baseColumn: never;
7806
8693
  identity: undefined;
7807
8694
  generated: undefined;
7808
8695
  }, {}, {
7809
- $type: Id;
8696
+ length: 42;
7810
8697
  }>;
7811
- name: drizzle_orm_pg_core0.PgColumn<{
7812
- name: "name";
7813
- tableName: EnumTableName.COLLECTORS;
8698
+ amount: drizzle_orm_pg_core0.PgColumn<{
8699
+ name: "amount";
8700
+ tableName: EnumTableName.PENDING_LINKS;
7814
8701
  dataType: "string";
7815
- columnType: "PgText";
7816
- data: "morpho_v2" | "offers" | "positions" | "prices";
8702
+ columnType: "PgNumeric";
8703
+ data: string;
7817
8704
  driverParam: string;
7818
8705
  notNull: true;
7819
8706
  hasDefault: false;
7820
8707
  isPrimaryKey: false;
7821
8708
  isAutoincrement: false;
7822
8709
  hasRuntimeDefault: false;
7823
- enumValues: [string, ...string[]];
8710
+ enumValues: undefined;
7824
8711
  baseColumn: never;
7825
8712
  identity: undefined;
7826
8713
  generated: undefined;
7827
- }, {}, {
7828
- $type: "morpho_v2" | "offers" | "positions" | "prices";
7829
- }>;
8714
+ }, {}, {}>;
7830
8715
  blockNumber: drizzle_orm_pg_core0.PgColumn<{
7831
8716
  name: "block_number";
7832
- tableName: EnumTableName.COLLECTORS;
8717
+ tableName: EnumTableName.PENDING_LINKS;
7833
8718
  dataType: "number";
7834
8719
  columnType: "PgBigInt53";
7835
8720
  data: number;
@@ -7844,15 +8729,15 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7844
8729
  identity: undefined;
7845
8730
  generated: undefined;
7846
8731
  }, {}, {}>;
7847
- epoch: drizzle_orm_pg_core0.PgColumn<{
7848
- name: "epoch";
7849
- tableName: EnumTableName.COLLECTORS;
7850
- dataType: "string";
7851
- columnType: "PgNumeric";
7852
- data: string;
7853
- driverParam: string;
8732
+ firstSeenBlock: drizzle_orm_pg_core0.PgColumn<{
8733
+ name: "first_seen_block";
8734
+ tableName: EnumTableName.PENDING_LINKS;
8735
+ dataType: "number";
8736
+ columnType: "PgBigInt53";
8737
+ data: number;
8738
+ driverParam: string | number;
7854
8739
  notNull: true;
7855
- hasDefault: true;
8740
+ hasDefault: false;
7856
8741
  isPrimaryKey: false;
7857
8742
  isAutoincrement: false;
7858
8743
  hasRuntimeDefault: false;
@@ -7861,15 +8746,15 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7861
8746
  identity: undefined;
7862
8747
  generated: undefined;
7863
8748
  }, {}, {}>;
7864
- updatedAt: drizzle_orm_pg_core0.PgColumn<{
7865
- name: "updated_at";
7866
- tableName: EnumTableName.COLLECTORS;
7867
- dataType: "date";
7868
- columnType: "PgTimestamp";
7869
- data: Date;
7870
- driverParam: string;
7871
- notNull: true;
7872
- hasDefault: true;
8749
+ lastTriedBlock: drizzle_orm_pg_core0.PgColumn<{
8750
+ name: "last_tried_block";
8751
+ tableName: EnumTableName.PENDING_LINKS;
8752
+ dataType: "number";
8753
+ columnType: "PgBigInt53";
8754
+ data: number;
8755
+ driverParam: string | number;
8756
+ notNull: false;
8757
+ hasDefault: false;
7873
8758
  isPrimaryKey: false;
7874
8759
  isAutoincrement: false;
7875
8760
  hasRuntimeDefault: false;
@@ -7878,22 +8763,15 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7878
8763
  identity: undefined;
7879
8764
  generated: undefined;
7880
8765
  }, {}, {}>;
7881
- };
7882
- dialect: "pg";
7883
- }>;
7884
- declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
7885
- name: EnumTableName.CHAINS;
7886
- schema: "router_v1.13";
7887
- columns: {
7888
- chainId: drizzle_orm_pg_core0.PgColumn<{
7889
- name: "chain_id";
7890
- tableName: EnumTableName.CHAINS;
8766
+ attempts: drizzle_orm_pg_core0.PgColumn<{
8767
+ name: "attempts";
8768
+ tableName: EnumTableName.PENDING_LINKS;
7891
8769
  dataType: "number";
7892
- columnType: "PgBigInt53";
7893
- data: Id;
8770
+ columnType: "PgInteger";
8771
+ data: number;
7894
8772
  driverParam: string | number;
7895
8773
  notNull: true;
7896
- hasDefault: false;
8774
+ hasDefault: true;
7897
8775
  isPrimaryKey: false;
7898
8776
  isAutoincrement: false;
7899
8777
  hasRuntimeDefault: false;
@@ -7901,35 +8779,33 @@ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
7901
8779
  baseColumn: never;
7902
8780
  identity: undefined;
7903
8781
  generated: undefined;
7904
- }, {}, {
7905
- $type: Id;
7906
- }>;
7907
- blockNumber: drizzle_orm_pg_core0.PgColumn<{
7908
- name: "block_number";
7909
- tableName: EnumTableName.CHAINS;
7910
- dataType: "number";
7911
- columnType: "PgBigInt53";
7912
- data: number;
7913
- driverParam: string | number;
7914
- notNull: true;
8782
+ }, {}, {}>;
8783
+ ignoredReason: drizzle_orm_pg_core0.PgColumn<{
8784
+ name: "ignored_reason";
8785
+ tableName: EnumTableName.PENDING_LINKS;
8786
+ dataType: "string";
8787
+ columnType: "PgText";
8788
+ data: string;
8789
+ driverParam: string;
8790
+ notNull: false;
7915
8791
  hasDefault: false;
7916
8792
  isPrimaryKey: false;
7917
8793
  isAutoincrement: false;
7918
8794
  hasRuntimeDefault: false;
7919
- enumValues: undefined;
8795
+ enumValues: [string, ...string[]];
7920
8796
  baseColumn: never;
7921
8797
  identity: undefined;
7922
8798
  generated: undefined;
7923
8799
  }, {}, {}>;
7924
- epoch: drizzle_orm_pg_core0.PgColumn<{
7925
- name: "epoch";
7926
- tableName: EnumTableName.CHAINS;
7927
- dataType: "string";
7928
- columnType: "PgNumeric";
7929
- data: string;
8800
+ resolvedAt: drizzle_orm_pg_core0.PgColumn<{
8801
+ name: "resolved_at";
8802
+ tableName: EnumTableName.PENDING_LINKS;
8803
+ dataType: "date";
8804
+ columnType: "PgTimestamp";
8805
+ data: Date;
7930
8806
  driverParam: string;
7931
- notNull: true;
7932
- hasDefault: true;
8807
+ notNull: false;
8808
+ hasDefault: false;
7933
8809
  isPrimaryKey: false;
7934
8810
  isAutoincrement: false;
7935
8811
  hasRuntimeDefault: false;
@@ -7940,7 +8816,7 @@ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
7940
8816
  }, {}, {}>;
7941
8817
  updatedAt: drizzle_orm_pg_core0.PgColumn<{
7942
8818
  name: "updated_at";
7943
- tableName: EnumTableName.CHAINS;
8819
+ tableName: EnumTableName.PENDING_LINKS;
7944
8820
  dataType: "date";
7945
8821
  columnType: "PgTimestamp";
7946
8822
  data: Date;
@@ -7960,7 +8836,7 @@ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
7960
8836
  }>;
7961
8837
  declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
7962
8838
  name: EnumTableName.TREES;
7963
- schema: "router_v1.13";
8839
+ schema: "router_v1.16";
7964
8840
  columns: {
7965
8841
  root: drizzle_orm_pg_core0.PgColumn<{
7966
8842
  name: "root";
@@ -8022,7 +8898,7 @@ declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
8022
8898
  }>;
8023
8899
  declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
8024
8900
  name: EnumTableName.MERKLE_PATHS;
8025
- schema: "router_v1.13";
8901
+ schema: "router_v1.16";
8026
8902
  columns: {
8027
8903
  offerHash: drizzle_orm_pg_core0.PgColumn<{
8028
8904
  name: "offer_hash";
@@ -8060,7 +8936,7 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
8060
8936
  identity: undefined;
8061
8937
  generated: undefined;
8062
8938
  }, {}, {
8063
- length: 42;
8939
+ length: 66;
8064
8940
  }>;
8065
8941
  treeRoot: drizzle_orm_pg_core0.PgColumn<{
8066
8942
  name: "tree_root";
@@ -8119,7 +8995,7 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
8119
8995
  dialect: "pg";
8120
8996
  }>;
8121
8997
  declare namespace index_d_exports$2 {
8122
- export { CallbackTypes, PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, lots, lotsPositions, merklePaths, obligationCollateralsV2, obligationIdKeys, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
8998
+ export { CallbackTypes, PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, lots, lotsPositions, merklePaths, obligationCollateralsV2, obligationIdKeys, obligations, offers, offersCallbacks, offsets, oracles, pendingLinks, positionTypes, positions, status, transfers, trees, validations };
8123
8999
  }
8124
9000
  //#endregion
8125
9001
  //#region src/gatekeeper/morphoRules.d.ts
@@ -8131,7 +9007,7 @@ declare const morphoRules: (parameters: {
8131
9007
  };
8132
9008
  }) => Rule<Offer, string>[];
8133
9009
  declare namespace Rules_d_exports {
8134
- export { amountMutualExclusivity, callback, collateralToken, groupConsistency, groupImmutability, loanToken, maturity, maxCollaterals, minDuration, oracle, sameMaker };
9010
+ export { amountNonZero, callback, collateralToken, groupConsistency, groupImmutability, loanToken, maturity, maxCollaterals, minDuration, oracle, sameMaker };
8135
9011
  }
8136
9012
  declare const maturity: ({
8137
9013
  maturities
@@ -8186,11 +9062,6 @@ declare const oracle: ({
8186
9062
  * This rule is signing-agnostic; signer verification is handled at the collector level.
8187
9063
  */
8188
9064
  declare const sameMaker: () => Rule<Offer, "mixed_maker">;
8189
- /**
8190
- * A validation rule that ensures mutual exclusivity of offer amount fields.
8191
- * At most one of (assets, obligationUnits, obligationShares) can be non-zero.
8192
- * Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
8193
- */
8194
9065
  /**
8195
9066
  * A validation rule that checks if the offer duration (expiry - start) meets a minimum threshold.
8196
9067
  * @param minSeconds - Minimum required duration in seconds.
@@ -8212,10 +9083,16 @@ declare const maxCollaterals: ({
8212
9083
  }: {
8213
9084
  max: number;
8214
9085
  }) => Rule<Offer, "max_collaterals">;
8215
- declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
9086
+ /**
9087
+ * A validation rule that checks if the offer's maxUnits is non-zero.
9088
+ * The contract requires a positive amount; this rule rejects early.
9089
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
9090
+ */
9091
+ declare const amountNonZero: () => Rule<Offer, "amount_non_zero">;
8216
9092
  /**
8217
9093
  * A batch validation rule that ensures all offers within the same group are consistent.
8218
- * All offers sharing the same group must have the same loan token, assets amount, and side (buy/sell).
9094
+ * All offers sharing the same group must have the same loan token, maxUnits,
9095
+ * and side (buy/sell). The contract tracks consumed per group and requires these to match.
8219
9096
  */
8220
9097
  declare const groupConsistency: () => Rule<Offer, "group_consistency">;
8221
9098
  /**
@@ -8397,6 +9274,20 @@ declare function lazy<T>(pollFn: (emit: (value: T) => void, {
8397
9274
  stop: () => void;
8398
9275
  }) => () => boolean): () => AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
8399
9276
  //#endregion
9277
+ //#region src/utils/mapWithConcurrency.d.ts
9278
+ /**
9279
+ * Map values with a bounded number of concurrent async workers.
9280
+ *
9281
+ * Result ordering always matches the input order.
9282
+ * @param parameters - Input values, concurrency limit, and async mapper.
9283
+ * @returns Mapped results in input order.
9284
+ */
9285
+ declare function mapWithConcurrency<value, result>(parameters: {
9286
+ values: value[];
9287
+ limit: number;
9288
+ run: (value: value, index: number) => Promise<result>;
9289
+ }): Promise<result[]>;
9290
+ //#endregion
8400
9291
  //#region src/utils/poll.d.ts
8401
9292
  /**
8402
9293
  * Polls a function at a specified interval.
@@ -8412,8 +9303,19 @@ declare function poll<data>(fn: ({
8412
9303
  interval: () => Promise<number>;
8413
9304
  }): () => boolean;
8414
9305
  declare namespace Random_d_exports {
8415
- export { address, bool, bytes, float, hex, int, seed, withSeed };
9306
+ export { SeededRng, address, bool, bytes, createRng, float, hex, int, seed, withSeed };
8416
9307
  }
9308
+ /** Isolated RNG instance with convenience methods. */
9309
+ interface SeededRng {
9310
+ float(): number;
9311
+ int(maxExclusive: number, min?: number): number;
9312
+ bool(probability?: number): boolean;
9313
+ }
9314
+ /**
9315
+ * Creates an isolated seeded RNG instance — safe for concurrent use.
9316
+ * @param seed - Seed string used to derive the initial RNG state.
9317
+ */
9318
+ declare function createRng(seed: string): SeededRng;
8417
9319
  /**
8418
9320
  * Runs a function with a deterministic RNG derived from the given seed.
8419
9321
  */
@@ -8455,10 +9357,19 @@ declare namespace time_d_exports {
8455
9357
  declare function now(): number;
8456
9358
  declare function max$1(): number;
8457
9359
  //#endregion
9360
+ //#region src/utils/trim.d.ts
9361
+ /**
9362
+ * Keep the last `keep` entries from an array.
9363
+ * @param array - Source array.
9364
+ * @param keep - Number of entries to keep.
9365
+ * @returns Trimmed copy.
9366
+ */
9367
+ declare const trimTail: <entry>(array: readonly entry[], keep: number) => entry[];
9368
+ //#endregion
8458
9369
  //#region src/utils/wait.d.ts
8459
9370
  declare function wait(time: number): Promise<unknown>;
8460
9371
  declare namespace index_d_exports$3 {
8461
- export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$2 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
9372
+ export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, mapWithConcurrency, max$2 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, trimTail, wait };
8462
9373
  }
8463
9374
  //#endregion
8464
9375
  export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, ConfigContractsController, ConfigRule, ConfigRulesController, ConfigRulesPayload, Database_d_exports as Database, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, Health_d_exports as Health, HealthController, Id_d_exports as Id, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, Oracle_d_exports as Oracle, Position_d_exports as Position, PositionResponse_d_exports as PositionResponse, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports$1 as RouterClient, RouterStatusResponse, Rules_d_exports as Rules, SuccessPayload, Tick_d_exports as Tick, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, UsersController, index_d_exports$3 as Utils, ValidateController, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules, parse, safeParse };