@morpho-dev/router 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +5926 -3770
- package/dist/drizzle/migrations/0027_debt-to-transfers.sql +239 -0
- package/dist/drizzle/migrations/0028_obligation_id_and_keys.sql +247 -0
- package/dist/drizzle/migrations/0029_collateral-positions.sql +248 -0
- package/dist/drizzle/migrations/0030_remove_chain_id_from_offer.sql +37 -0
- package/dist/drizzle/migrations/0031_sell-takeable-reindex.sql +254 -0
- package/dist/drizzle/migrations/0032_callback-type.sql +3 -0
- package/dist/drizzle/migrations/0033_obligation-id-bytes20.sql +255 -0
- package/dist/drizzle/migrations/meta/0027_snapshot.json +1581 -0
- package/dist/drizzle/migrations/meta/0028_snapshot.json +1632 -0
- package/dist/drizzle/migrations/meta/0029_snapshot.json +1619 -0
- package/dist/drizzle/migrations/meta/0030_snapshot.json +1652 -0
- package/dist/drizzle/migrations/meta/0031_snapshot.json +1652 -0
- package/dist/drizzle/migrations/meta/0033_snapshot.json +1658 -0
- package/dist/drizzle/migrations/meta/_journal.json +49 -0
- package/dist/evm/bytecode/morpho.txt +1 -1
- package/dist/index.browser.d.mts +820 -449
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.mjs +4913 -4195
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +1248 -534
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.mjs +3803 -1842
- package/dist/index.node.mjs.map +1 -1
- package/dist/register-otel-hook.js +7 -0
- package/package.json +32 -28
- package/dist/index.browser.d.ts +0 -4822
- package/dist/index.browser.d.ts.map +0 -1
- package/dist/index.browser.js +0 -5705
- package/dist/index.browser.js.map +0 -1
- package/dist/index.node.d.ts +0 -7752
- package/dist/index.node.d.ts.map +0 -1
- package/dist/index.node.js +0 -11633
- package/dist/index.node.js.map +0 -1
package/dist/index.browser.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
import { AbiEvent, Address, ChainContract, ChainFormatters, GetLogsReturnType, Hex, MulticallParameters, PublicClient, Transport, WalletClient } from "viem";
|
|
3
|
-
import { Chain } from "viem/chains";
|
|
4
|
-
import * as z$1 from "zod";
|
|
5
|
-
import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
|
|
6
2
|
import "reflect-metadata";
|
|
7
3
|
import { OpenAPIDocument } from "openapi-metadata";
|
|
4
|
+
import * as z$1 from "zod";
|
|
8
5
|
import { Client } from "openapi-fetch";
|
|
6
|
+
import { AbiEvent, Address, ChainContract, ChainFormatters, GetLogsReturnType, Hex, MulticallParameters, PublicClient, Transport, WalletClient } from "viem";
|
|
7
|
+
import { Chain } from "viem/chains";
|
|
8
|
+
import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
|
|
9
9
|
import "@electric-sql/pglite";
|
|
10
10
|
import "drizzle-orm/node-postgres";
|
|
11
11
|
import "drizzle-orm/pglite";
|
|
@@ -36,9 +36,9 @@ declare const CollectorHealth: z.ZodObject<{
|
|
|
36
36
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
37
37
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
38
38
|
status: z.ZodEnum<{
|
|
39
|
+
unknown: "unknown";
|
|
39
40
|
live: "live";
|
|
40
41
|
lagging: "lagging";
|
|
41
|
-
unknown: "unknown";
|
|
42
42
|
}>;
|
|
43
43
|
initialized: z.ZodBoolean;
|
|
44
44
|
}, z.core.$strip>;
|
|
@@ -49,9 +49,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
|
49
49
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
50
50
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
51
51
|
status: z.ZodEnum<{
|
|
52
|
+
unknown: "unknown";
|
|
52
53
|
live: "live";
|
|
53
54
|
lagging: "lagging";
|
|
54
|
-
unknown: "unknown";
|
|
55
55
|
}>;
|
|
56
56
|
initialized: z.ZodBoolean;
|
|
57
57
|
}, z.core.$strip>>;
|
|
@@ -233,17 +233,17 @@ declare const MorphoV2: readonly [{
|
|
|
233
233
|
readonly type: "function";
|
|
234
234
|
readonly stateMutability: "view";
|
|
235
235
|
readonly inputs: readonly [{
|
|
236
|
-
readonly type: "
|
|
236
|
+
readonly type: "bytes20";
|
|
237
237
|
readonly name: "id";
|
|
238
238
|
}, {
|
|
239
239
|
readonly type: "address";
|
|
240
240
|
readonly name: "user";
|
|
241
241
|
}, {
|
|
242
|
-
readonly type: "
|
|
243
|
-
readonly name: "
|
|
242
|
+
readonly type: "uint256";
|
|
243
|
+
readonly name: "collateralIndex";
|
|
244
244
|
}];
|
|
245
245
|
readonly outputs: readonly [{
|
|
246
|
-
readonly type: "
|
|
246
|
+
readonly type: "uint128";
|
|
247
247
|
}];
|
|
248
248
|
}, {
|
|
249
249
|
readonly name: "consume";
|
|
@@ -276,7 +276,7 @@ declare const MorphoV2: readonly [{
|
|
|
276
276
|
readonly type: "function";
|
|
277
277
|
readonly stateMutability: "view";
|
|
278
278
|
readonly inputs: readonly [{
|
|
279
|
-
readonly type: "
|
|
279
|
+
readonly type: "bytes20";
|
|
280
280
|
readonly name: "id";
|
|
281
281
|
}, {
|
|
282
282
|
readonly type: "address";
|
|
@@ -312,7 +312,7 @@ declare const MorphoV2: readonly [{
|
|
|
312
312
|
readonly type: "function";
|
|
313
313
|
readonly stateMutability: "view";
|
|
314
314
|
readonly inputs: readonly [{
|
|
315
|
-
readonly type: "
|
|
315
|
+
readonly type: "bytes20";
|
|
316
316
|
readonly name: "id";
|
|
317
317
|
}];
|
|
318
318
|
readonly outputs: readonly [{
|
|
@@ -361,10 +361,13 @@ declare const MorphoV2: readonly [{
|
|
|
361
361
|
}, {
|
|
362
362
|
readonly type: "uint256";
|
|
363
363
|
readonly name: "maturity";
|
|
364
|
+
}, {
|
|
365
|
+
readonly type: "uint256";
|
|
366
|
+
readonly name: "minCollatValue";
|
|
364
367
|
}];
|
|
365
368
|
readonly name: "obligation";
|
|
366
369
|
}, {
|
|
367
|
-
readonly type: "
|
|
370
|
+
readonly type: "bytes20";
|
|
368
371
|
readonly name: "id";
|
|
369
372
|
}, {
|
|
370
373
|
readonly type: "address";
|
|
@@ -398,21 +401,20 @@ declare const MorphoV2: readonly [{
|
|
|
398
401
|
}, {
|
|
399
402
|
readonly type: "uint256";
|
|
400
403
|
readonly name: "maturity";
|
|
401
|
-
}];
|
|
402
|
-
readonly name: "obligation";
|
|
403
|
-
}, {
|
|
404
|
-
readonly type: "tuple[]";
|
|
405
|
-
readonly components: readonly [{
|
|
406
|
-
readonly type: "uint256";
|
|
407
|
-
readonly name: "collateralIndex";
|
|
408
404
|
}, {
|
|
409
405
|
readonly type: "uint256";
|
|
410
|
-
readonly name: "
|
|
411
|
-
}, {
|
|
412
|
-
readonly type: "uint256";
|
|
413
|
-
readonly name: "seized";
|
|
406
|
+
readonly name: "minCollatValue";
|
|
414
407
|
}];
|
|
415
|
-
readonly name: "
|
|
408
|
+
readonly name: "obligation";
|
|
409
|
+
}, {
|
|
410
|
+
readonly type: "uint256";
|
|
411
|
+
readonly name: "collateralIndex";
|
|
412
|
+
}, {
|
|
413
|
+
readonly type: "uint256";
|
|
414
|
+
readonly name: "seizedAssets";
|
|
415
|
+
}, {
|
|
416
|
+
readonly type: "uint256";
|
|
417
|
+
readonly name: "repaidUnits";
|
|
416
418
|
}, {
|
|
417
419
|
readonly type: "address";
|
|
418
420
|
readonly name: "borrower";
|
|
@@ -421,17 +423,9 @@ declare const MorphoV2: readonly [{
|
|
|
421
423
|
readonly name: "data";
|
|
422
424
|
}];
|
|
423
425
|
readonly outputs: readonly [{
|
|
424
|
-
readonly type: "
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
readonly name: "collateralIndex";
|
|
428
|
-
}, {
|
|
429
|
-
readonly type: "uint256";
|
|
430
|
-
readonly name: "repaid";
|
|
431
|
-
}, {
|
|
432
|
-
readonly type: "uint256";
|
|
433
|
-
readonly name: "seized";
|
|
434
|
-
}];
|
|
426
|
+
readonly type: "uint256";
|
|
427
|
+
}, {
|
|
428
|
+
readonly type: "uint256";
|
|
435
429
|
}];
|
|
436
430
|
}, {
|
|
437
431
|
readonly name: "multicall";
|
|
@@ -447,7 +441,7 @@ declare const MorphoV2: readonly [{
|
|
|
447
441
|
readonly type: "function";
|
|
448
442
|
readonly stateMutability: "view";
|
|
449
443
|
readonly inputs: readonly [{
|
|
450
|
-
readonly type: "
|
|
444
|
+
readonly type: "bytes20";
|
|
451
445
|
readonly name: "id";
|
|
452
446
|
}];
|
|
453
447
|
readonly outputs: readonly [{
|
|
@@ -458,7 +452,7 @@ declare const MorphoV2: readonly [{
|
|
|
458
452
|
readonly type: "function";
|
|
459
453
|
readonly stateMutability: "view";
|
|
460
454
|
readonly inputs: readonly [{
|
|
461
|
-
readonly type: "
|
|
455
|
+
readonly type: "bytes20";
|
|
462
456
|
readonly name: "id";
|
|
463
457
|
}];
|
|
464
458
|
readonly outputs: readonly [{
|
|
@@ -473,6 +467,9 @@ declare const MorphoV2: readonly [{
|
|
|
473
467
|
}, {
|
|
474
468
|
readonly type: "bool";
|
|
475
469
|
readonly name: "created";
|
|
470
|
+
}, {
|
|
471
|
+
readonly type: "uint16[6]";
|
|
472
|
+
readonly name: "fees";
|
|
476
473
|
}];
|
|
477
474
|
}, {
|
|
478
475
|
readonly name: "owner";
|
|
@@ -507,6 +504,9 @@ declare const MorphoV2: readonly [{
|
|
|
507
504
|
}, {
|
|
508
505
|
readonly type: "uint256";
|
|
509
506
|
readonly name: "maturity";
|
|
507
|
+
}, {
|
|
508
|
+
readonly type: "uint256";
|
|
509
|
+
readonly name: "minCollatValue";
|
|
510
510
|
}];
|
|
511
511
|
readonly name: "obligation";
|
|
512
512
|
}, {
|
|
@@ -557,7 +557,7 @@ declare const MorphoV2: readonly [{
|
|
|
557
557
|
readonly type: "function";
|
|
558
558
|
readonly stateMutability: "nonpayable";
|
|
559
559
|
readonly inputs: readonly [{
|
|
560
|
-
readonly type: "
|
|
560
|
+
readonly type: "bytes20";
|
|
561
561
|
readonly name: "id";
|
|
562
562
|
}, {
|
|
563
563
|
readonly type: "uint256";
|
|
@@ -590,7 +590,7 @@ declare const MorphoV2: readonly [{
|
|
|
590
590
|
readonly type: "function";
|
|
591
591
|
readonly stateMutability: "view";
|
|
592
592
|
readonly inputs: readonly [{
|
|
593
|
-
readonly type: "
|
|
593
|
+
readonly type: "bytes20";
|
|
594
594
|
readonly name: "id";
|
|
595
595
|
}, {
|
|
596
596
|
readonly type: "address";
|
|
@@ -630,11 +630,14 @@ declare const MorphoV2: readonly [{
|
|
|
630
630
|
}, {
|
|
631
631
|
readonly type: "uint256";
|
|
632
632
|
readonly name: "maturity";
|
|
633
|
+
}, {
|
|
634
|
+
readonly type: "uint256";
|
|
635
|
+
readonly name: "minCollatValue";
|
|
633
636
|
}];
|
|
634
637
|
readonly name: "obligation";
|
|
635
638
|
}, {
|
|
636
|
-
readonly type: "
|
|
637
|
-
readonly name: "
|
|
639
|
+
readonly type: "uint256";
|
|
640
|
+
readonly name: "collateralIndex";
|
|
638
641
|
}, {
|
|
639
642
|
readonly type: "uint256";
|
|
640
643
|
readonly name: "assets";
|
|
@@ -694,6 +697,9 @@ declare const MorphoV2: readonly [{
|
|
|
694
697
|
}, {
|
|
695
698
|
readonly type: "uint256";
|
|
696
699
|
readonly name: "maturity";
|
|
700
|
+
}, {
|
|
701
|
+
readonly type: "uint256";
|
|
702
|
+
readonly name: "minCollatValue";
|
|
697
703
|
}];
|
|
698
704
|
readonly name: "obligation";
|
|
699
705
|
}, {
|
|
@@ -766,12 +772,80 @@ declare const MorphoV2: readonly [{
|
|
|
766
772
|
}, {
|
|
767
773
|
readonly type: "uint256";
|
|
768
774
|
}];
|
|
775
|
+
}, {
|
|
776
|
+
readonly name: "toId";
|
|
777
|
+
readonly type: "function";
|
|
778
|
+
readonly stateMutability: "view";
|
|
779
|
+
readonly inputs: readonly [{
|
|
780
|
+
readonly type: "tuple";
|
|
781
|
+
readonly components: readonly [{
|
|
782
|
+
readonly type: "address";
|
|
783
|
+
readonly name: "loanToken";
|
|
784
|
+
}, {
|
|
785
|
+
readonly type: "tuple[]";
|
|
786
|
+
readonly components: readonly [{
|
|
787
|
+
readonly type: "address";
|
|
788
|
+
readonly name: "token";
|
|
789
|
+
}, {
|
|
790
|
+
readonly type: "uint256";
|
|
791
|
+
readonly name: "lltv";
|
|
792
|
+
}, {
|
|
793
|
+
readonly type: "address";
|
|
794
|
+
readonly name: "oracle";
|
|
795
|
+
}];
|
|
796
|
+
readonly name: "collaterals";
|
|
797
|
+
}, {
|
|
798
|
+
readonly type: "uint256";
|
|
799
|
+
readonly name: "maturity";
|
|
800
|
+
}, {
|
|
801
|
+
readonly type: "uint256";
|
|
802
|
+
readonly name: "minCollatValue";
|
|
803
|
+
}];
|
|
804
|
+
readonly name: "obligation";
|
|
805
|
+
}];
|
|
806
|
+
readonly outputs: readonly [{
|
|
807
|
+
readonly type: "bytes20";
|
|
808
|
+
}];
|
|
809
|
+
}, {
|
|
810
|
+
readonly name: "toObligation";
|
|
811
|
+
readonly type: "function";
|
|
812
|
+
readonly stateMutability: "view";
|
|
813
|
+
readonly inputs: readonly [{
|
|
814
|
+
readonly type: "bytes20";
|
|
815
|
+
readonly name: "id";
|
|
816
|
+
}];
|
|
817
|
+
readonly outputs: readonly [{
|
|
818
|
+
readonly type: "tuple";
|
|
819
|
+
readonly components: readonly [{
|
|
820
|
+
readonly type: "address";
|
|
821
|
+
readonly name: "loanToken";
|
|
822
|
+
}, {
|
|
823
|
+
readonly type: "tuple[]";
|
|
824
|
+
readonly components: readonly [{
|
|
825
|
+
readonly type: "address";
|
|
826
|
+
readonly name: "token";
|
|
827
|
+
}, {
|
|
828
|
+
readonly type: "uint256";
|
|
829
|
+
readonly name: "lltv";
|
|
830
|
+
}, {
|
|
831
|
+
readonly type: "address";
|
|
832
|
+
readonly name: "oracle";
|
|
833
|
+
}];
|
|
834
|
+
readonly name: "collaterals";
|
|
835
|
+
}, {
|
|
836
|
+
readonly type: "uint256";
|
|
837
|
+
readonly name: "maturity";
|
|
838
|
+
}, {
|
|
839
|
+
readonly type: "uint256";
|
|
840
|
+
readonly name: "minCollatValue";
|
|
841
|
+
}];
|
|
842
|
+
}];
|
|
769
843
|
}, {
|
|
770
844
|
readonly name: "totalShares";
|
|
771
845
|
readonly type: "function";
|
|
772
846
|
readonly stateMutability: "view";
|
|
773
847
|
readonly inputs: readonly [{
|
|
774
|
-
readonly type: "
|
|
848
|
+
readonly type: "bytes20";
|
|
775
849
|
readonly name: "id";
|
|
776
850
|
}];
|
|
777
851
|
readonly outputs: readonly [{
|
|
@@ -782,7 +856,7 @@ declare const MorphoV2: readonly [{
|
|
|
782
856
|
readonly type: "function";
|
|
783
857
|
readonly stateMutability: "view";
|
|
784
858
|
readonly inputs: readonly [{
|
|
785
|
-
readonly type: "
|
|
859
|
+
readonly type: "bytes20";
|
|
786
860
|
readonly name: "id";
|
|
787
861
|
}];
|
|
788
862
|
readonly outputs: readonly [{
|
|
@@ -813,18 +887,21 @@ declare const MorphoV2: readonly [{
|
|
|
813
887
|
}, {
|
|
814
888
|
readonly type: "uint256";
|
|
815
889
|
readonly name: "maturity";
|
|
890
|
+
}, {
|
|
891
|
+
readonly type: "uint256";
|
|
892
|
+
readonly name: "minCollatValue";
|
|
816
893
|
}];
|
|
817
894
|
readonly name: "obligation";
|
|
818
895
|
}];
|
|
819
896
|
readonly outputs: readonly [{
|
|
820
|
-
readonly type: "
|
|
897
|
+
readonly type: "bytes20";
|
|
821
898
|
}];
|
|
822
899
|
}, {
|
|
823
900
|
readonly name: "tradingFee";
|
|
824
901
|
readonly type: "function";
|
|
825
902
|
readonly stateMutability: "view";
|
|
826
903
|
readonly inputs: readonly [{
|
|
827
|
-
readonly type: "
|
|
904
|
+
readonly type: "bytes20";
|
|
828
905
|
readonly name: "id";
|
|
829
906
|
}, {
|
|
830
907
|
readonly type: "uint256";
|
|
@@ -866,6 +943,9 @@ declare const MorphoV2: readonly [{
|
|
|
866
943
|
}, {
|
|
867
944
|
readonly type: "uint256";
|
|
868
945
|
readonly name: "maturity";
|
|
946
|
+
}, {
|
|
947
|
+
readonly type: "uint256";
|
|
948
|
+
readonly name: "minCollatValue";
|
|
869
949
|
}];
|
|
870
950
|
readonly name: "obligation";
|
|
871
951
|
}, {
|
|
@@ -911,11 +991,14 @@ declare const MorphoV2: readonly [{
|
|
|
911
991
|
}, {
|
|
912
992
|
readonly type: "uint256";
|
|
913
993
|
readonly name: "maturity";
|
|
994
|
+
}, {
|
|
995
|
+
readonly type: "uint256";
|
|
996
|
+
readonly name: "minCollatValue";
|
|
914
997
|
}];
|
|
915
998
|
readonly name: "obligation";
|
|
916
999
|
}, {
|
|
917
|
-
readonly type: "
|
|
918
|
-
readonly name: "
|
|
1000
|
+
readonly type: "uint256";
|
|
1001
|
+
readonly name: "collateralIndex";
|
|
919
1002
|
}, {
|
|
920
1003
|
readonly type: "uint256";
|
|
921
1004
|
readonly name: "assets";
|
|
@@ -932,7 +1015,7 @@ declare const MorphoV2: readonly [{
|
|
|
932
1015
|
readonly type: "function";
|
|
933
1016
|
readonly stateMutability: "view";
|
|
934
1017
|
readonly inputs: readonly [{
|
|
935
|
-
readonly type: "
|
|
1018
|
+
readonly type: "bytes20";
|
|
936
1019
|
readonly name: "id";
|
|
937
1020
|
}];
|
|
938
1021
|
readonly outputs: readonly [{
|
|
@@ -984,29 +1067,22 @@ declare const MorphoV2: readonly [{
|
|
|
984
1067
|
readonly name: "caller";
|
|
985
1068
|
readonly indexed: true;
|
|
986
1069
|
}, {
|
|
987
|
-
readonly type: "
|
|
988
|
-
readonly name: "
|
|
1070
|
+
readonly type: "bytes20";
|
|
1071
|
+
readonly name: "id_";
|
|
989
1072
|
readonly indexed: true;
|
|
990
1073
|
}, {
|
|
991
|
-
readonly type: "
|
|
992
|
-
readonly
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
readonly type: "uint256";
|
|
1000
|
-
readonly name: "seized";
|
|
1001
|
-
}];
|
|
1002
|
-
readonly name: "seizures";
|
|
1074
|
+
readonly type: "uint256";
|
|
1075
|
+
readonly name: "collateralIndex";
|
|
1076
|
+
}, {
|
|
1077
|
+
readonly type: "uint256";
|
|
1078
|
+
readonly name: "seizedAssets";
|
|
1079
|
+
}, {
|
|
1080
|
+
readonly type: "uint256";
|
|
1081
|
+
readonly name: "repaidUnits";
|
|
1003
1082
|
}, {
|
|
1004
1083
|
readonly type: "address";
|
|
1005
1084
|
readonly name: "borrower";
|
|
1006
1085
|
readonly indexed: true;
|
|
1007
|
-
}, {
|
|
1008
|
-
readonly type: "uint256";
|
|
1009
|
-
readonly name: "totalRepaid";
|
|
1010
1086
|
}, {
|
|
1011
1087
|
readonly type: "uint256";
|
|
1012
1088
|
readonly name: "badDebt";
|
|
@@ -1015,8 +1091,8 @@ declare const MorphoV2: readonly [{
|
|
|
1015
1091
|
readonly name: "ObligationCreated";
|
|
1016
1092
|
readonly type: "event";
|
|
1017
1093
|
readonly inputs: readonly [{
|
|
1018
|
-
readonly type: "
|
|
1019
|
-
readonly name: "
|
|
1094
|
+
readonly type: "bytes20";
|
|
1095
|
+
readonly name: "id_";
|
|
1020
1096
|
readonly indexed: true;
|
|
1021
1097
|
}, {
|
|
1022
1098
|
readonly type: "tuple";
|
|
@@ -1039,6 +1115,9 @@ declare const MorphoV2: readonly [{
|
|
|
1039
1115
|
}, {
|
|
1040
1116
|
readonly type: "uint256";
|
|
1041
1117
|
readonly name: "maturity";
|
|
1118
|
+
}, {
|
|
1119
|
+
readonly type: "uint256";
|
|
1120
|
+
readonly name: "minCollatValue";
|
|
1042
1121
|
}];
|
|
1043
1122
|
readonly name: "obligation";
|
|
1044
1123
|
}];
|
|
@@ -1050,8 +1129,8 @@ declare const MorphoV2: readonly [{
|
|
|
1050
1129
|
readonly name: "caller";
|
|
1051
1130
|
readonly indexed: true;
|
|
1052
1131
|
}, {
|
|
1053
|
-
readonly type: "
|
|
1054
|
-
readonly name: "
|
|
1132
|
+
readonly type: "bytes20";
|
|
1133
|
+
readonly name: "id_";
|
|
1055
1134
|
readonly indexed: true;
|
|
1056
1135
|
}, {
|
|
1057
1136
|
readonly type: "uint256";
|
|
@@ -1088,8 +1167,8 @@ declare const MorphoV2: readonly [{
|
|
|
1088
1167
|
readonly name: "SetObligationTradingFee";
|
|
1089
1168
|
readonly type: "event";
|
|
1090
1169
|
readonly inputs: readonly [{
|
|
1091
|
-
readonly type: "
|
|
1092
|
-
readonly name: "
|
|
1170
|
+
readonly type: "bytes20";
|
|
1171
|
+
readonly name: "id_";
|
|
1093
1172
|
readonly indexed: true;
|
|
1094
1173
|
}, {
|
|
1095
1174
|
readonly type: "uint256";
|
|
@@ -1133,8 +1212,8 @@ declare const MorphoV2: readonly [{
|
|
|
1133
1212
|
readonly type: "address";
|
|
1134
1213
|
readonly name: "caller";
|
|
1135
1214
|
}, {
|
|
1136
|
-
readonly type: "
|
|
1137
|
-
readonly name: "
|
|
1215
|
+
readonly type: "bytes20";
|
|
1216
|
+
readonly name: "id_";
|
|
1138
1217
|
readonly indexed: true;
|
|
1139
1218
|
}, {
|
|
1140
1219
|
readonly type: "address";
|
|
@@ -1155,8 +1234,8 @@ declare const MorphoV2: readonly [{
|
|
|
1155
1234
|
readonly type: "address";
|
|
1156
1235
|
readonly name: "caller";
|
|
1157
1236
|
}, {
|
|
1158
|
-
readonly type: "
|
|
1159
|
-
readonly name: "
|
|
1237
|
+
readonly type: "bytes20";
|
|
1238
|
+
readonly name: "id_";
|
|
1160
1239
|
readonly indexed: true;
|
|
1161
1240
|
}, {
|
|
1162
1241
|
readonly type: "address";
|
|
@@ -1204,8 +1283,8 @@ declare const MorphoV2: readonly [{
|
|
|
1204
1283
|
readonly type: "address";
|
|
1205
1284
|
readonly name: "caller";
|
|
1206
1285
|
}, {
|
|
1207
|
-
readonly type: "
|
|
1208
|
-
readonly name: "
|
|
1286
|
+
readonly type: "bytes20";
|
|
1287
|
+
readonly name: "id_";
|
|
1209
1288
|
readonly indexed: true;
|
|
1210
1289
|
}, {
|
|
1211
1290
|
readonly type: "uint256";
|
|
@@ -1229,8 +1308,8 @@ declare const MorphoV2: readonly [{
|
|
|
1229
1308
|
readonly type: "address";
|
|
1230
1309
|
readonly name: "caller";
|
|
1231
1310
|
}, {
|
|
1232
|
-
readonly type: "
|
|
1233
|
-
readonly name: "
|
|
1311
|
+
readonly type: "bytes20";
|
|
1312
|
+
readonly name: "id_";
|
|
1234
1313
|
readonly indexed: true;
|
|
1235
1314
|
}, {
|
|
1236
1315
|
readonly type: "address";
|
|
@@ -1374,7 +1453,7 @@ declare const Morpho: readonly [{
|
|
|
1374
1453
|
readonly stateMutability: "view";
|
|
1375
1454
|
}];
|
|
1376
1455
|
declare namespace Callback_d_exports {
|
|
1377
|
-
export { Callback, Type$1 as Type, isEmptyCallback };
|
|
1456
|
+
export { Callback, CallbackType, Type$1 as Type, isEmptyCallback };
|
|
1378
1457
|
}
|
|
1379
1458
|
type Callback = {
|
|
1380
1459
|
type: Type$1.BuyWithEmptyCallback;
|
|
@@ -1385,6 +1464,9 @@ declare enum Type$1 {
|
|
|
1385
1464
|
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
1386
1465
|
SellWithEmptyCallback = "sell_with_empty_callback"
|
|
1387
1466
|
}
|
|
1467
|
+
declare enum CallbackType {
|
|
1468
|
+
Empty = "empty"
|
|
1469
|
+
}
|
|
1388
1470
|
declare const isEmptyCallback: (offer: Offer) => boolean;
|
|
1389
1471
|
declare namespace Errors_d_exports {
|
|
1390
1472
|
export { BaseError, GlobalErrorType, ReorgError };
|
|
@@ -1419,7 +1501,7 @@ declare class ReorgError extends BaseError {
|
|
|
1419
1501
|
constructor(blockNumber: number);
|
|
1420
1502
|
}
|
|
1421
1503
|
declare namespace Chain_d_exports {
|
|
1422
|
-
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains
|
|
1504
|
+
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, UnrecoverableLogsResponseSizeError, chainIds, chainNames, chains, getChain, getWhitelistedChains, streamLogs };
|
|
1423
1505
|
}
|
|
1424
1506
|
type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
1425
1507
|
morpho: ChainContract;
|
|
@@ -1460,7 +1542,7 @@ type Id = (typeof ChainId)[Uppercase<Name>];
|
|
|
1460
1542
|
declare const chainIds: readonly Id[];
|
|
1461
1543
|
declare function getChain(chainId: Id): Chain$1 | undefined;
|
|
1462
1544
|
declare const getWhitelistedChains: () => Chain$1[];
|
|
1463
|
-
declare const chains
|
|
1545
|
+
declare const chains: Record<Lowercase<Name>, Chain$1>;
|
|
1464
1546
|
declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
|
|
1465
1547
|
client: PublicClient;
|
|
1466
1548
|
contractAddress?: Address;
|
|
@@ -1478,6 +1560,8 @@ declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(p
|
|
|
1478
1560
|
}, void, void>;
|
|
1479
1561
|
declare class InvalidBlockRangeError extends BaseError {
|
|
1480
1562
|
name: string;
|
|
1563
|
+
readonly fromBlock: bigint;
|
|
1564
|
+
readonly toBlock: bigint;
|
|
1481
1565
|
constructor(fromBlock: bigint, toBlock: bigint);
|
|
1482
1566
|
}
|
|
1483
1567
|
declare class InvalidBlockWindowError extends BaseError {
|
|
@@ -1492,6 +1576,10 @@ declare class MissingBlockNumberError extends BaseError {
|
|
|
1492
1576
|
name: string;
|
|
1493
1577
|
constructor();
|
|
1494
1578
|
}
|
|
1579
|
+
declare class UnrecoverableLogsResponseSizeError extends BaseError<Error> {
|
|
1580
|
+
name: string;
|
|
1581
|
+
constructor(blockNumber: bigint, cause?: unknown);
|
|
1582
|
+
}
|
|
1495
1583
|
declare namespace ChainRegistry_d_exports {
|
|
1496
1584
|
export { ChainRegistry, create$1 as create };
|
|
1497
1585
|
}
|
|
@@ -1538,13 +1626,23 @@ declare class InvalidLLTVError extends BaseError {
|
|
|
1538
1626
|
}
|
|
1539
1627
|
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1540
1628
|
declare namespace Collateral_d_exports {
|
|
1541
|
-
export { Collateral, CollateralSchema, CollateralsSchema, from$13 as from, random$3 as random };
|
|
1629
|
+
export { Collateral, CollateralSchema, CollateralsSchema, abi$1 as abi, from$13 as from, random$3 as random };
|
|
1542
1630
|
}
|
|
1543
1631
|
type Collateral = {
|
|
1544
1632
|
/** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
|
|
1545
1633
|
lltv: LLTV; /** Oracle contract used to price the collateral. */
|
|
1546
1634
|
oracle: Address;
|
|
1547
1635
|
};
|
|
1636
|
+
declare const abi$1: readonly [{
|
|
1637
|
+
readonly type: "address";
|
|
1638
|
+
readonly name: "token";
|
|
1639
|
+
}, {
|
|
1640
|
+
readonly type: "uint256";
|
|
1641
|
+
readonly name: "lltv";
|
|
1642
|
+
}, {
|
|
1643
|
+
readonly type: "address";
|
|
1644
|
+
readonly name: "oracle";
|
|
1645
|
+
}];
|
|
1548
1646
|
declare const CollateralSchema: z$1.ZodObject<{
|
|
1549
1647
|
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1550
1648
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
@@ -1658,132 +1756,63 @@ declare class DenominatorIsZeroError extends BaseError {
|
|
|
1658
1756
|
readonly name = "ERC4626.DenominatorIsZeroError";
|
|
1659
1757
|
constructor();
|
|
1660
1758
|
}
|
|
1661
|
-
declare namespace
|
|
1662
|
-
export {
|
|
1759
|
+
declare namespace Format_d_exports {
|
|
1760
|
+
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
1663
1761
|
}
|
|
1762
|
+
/** The snake case representation of a type with bigint values stringified. */
|
|
1763
|
+
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
1764
|
+
/** Make arrays/tuples and object props mutable, deeply. */
|
|
1765
|
+
type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
|
|
1766
|
+
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
1767
|
+
type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
|
|
1768
|
+
/** Key remapping that also preserves branded primitives. */
|
|
1769
|
+
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
|
|
1770
|
+
type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
|
|
1664
1771
|
/**
|
|
1665
|
-
*
|
|
1772
|
+
* Formats object keys to snake case.
|
|
1773
|
+
* Preserves ethereum addresses as is.
|
|
1774
|
+
* Converts ethereum addresses to checksummed if used as values.
|
|
1775
|
+
* Stringifies bigint values to strings.
|
|
1666
1776
|
*/
|
|
1667
|
-
|
|
1668
|
-
id: string;
|
|
1669
|
-
amount: bigint;
|
|
1670
|
-
};
|
|
1777
|
+
declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
1671
1778
|
/**
|
|
1672
|
-
*
|
|
1779
|
+
* Formats a snake case object to its camel case type.
|
|
1780
|
+
* Preserves ethereum addresses as is.
|
|
1781
|
+
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
1782
|
+
* @warning Does not unstringify bigint values.
|
|
1673
1783
|
*/
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
}
|
|
1784
|
+
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
1785
|
+
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
1786
|
+
declare namespace Maturity_d_exports {
|
|
1787
|
+
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$12 as from };
|
|
1788
|
+
}
|
|
1679
1789
|
/**
|
|
1680
|
-
*
|
|
1790
|
+
* Maturity is a number that represents a date in seconds.
|
|
1681
1791
|
*/
|
|
1682
|
-
type
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1792
|
+
type Maturity = number & Brand<"Maturity">;
|
|
1793
|
+
declare const MaturitySchema: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1794
|
+
declare enum MaturityType {
|
|
1795
|
+
EndOfWeek = "end_of_week",
|
|
1796
|
+
EndOfNextWeek = "end_of_next_week",
|
|
1797
|
+
EndOfMonth = "end_of_month",
|
|
1798
|
+
EndOfNextMonth = "end_of_next_month",
|
|
1799
|
+
EndOfQuarter = "end_of_quarter",
|
|
1800
|
+
EndOfNextQuarter = "end_of_next_quarter"
|
|
1801
|
+
}
|
|
1802
|
+
declare const MaturityOptions: {
|
|
1803
|
+
readonly end_of_week: () => Maturity;
|
|
1804
|
+
readonly end_of_next_week: () => Maturity;
|
|
1805
|
+
readonly end_of_month: () => Maturity;
|
|
1806
|
+
readonly end_of_next_month: () => Maturity;
|
|
1807
|
+
readonly end_of_quarter: () => Maturity;
|
|
1808
|
+
readonly end_of_next_quarter: () => Maturity;
|
|
1690
1809
|
};
|
|
1810
|
+
type MaturityOptions = keyof typeof MaturityOptions;
|
|
1691
1811
|
/**
|
|
1692
|
-
*
|
|
1693
|
-
* @
|
|
1694
|
-
* @
|
|
1695
|
-
* @
|
|
1696
|
-
* @returns Maximum debt capacity
|
|
1697
|
-
*/
|
|
1698
|
-
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
1699
|
-
/**
|
|
1700
|
-
* Generate pool ID for balance pools.
|
|
1701
|
-
*/
|
|
1702
|
-
declare function generateBalancePoolId(parameters: {
|
|
1703
|
-
user: Address;
|
|
1704
|
-
chainId: Id;
|
|
1705
|
-
token: Address;
|
|
1706
|
-
}): string;
|
|
1707
|
-
/**
|
|
1708
|
-
* Generate pool ID for allowance pools.
|
|
1709
|
-
*/
|
|
1710
|
-
declare function generateAllowancePoolId(parameters: {
|
|
1711
|
-
user: Address;
|
|
1712
|
-
chainId: Id;
|
|
1713
|
-
token: Address;
|
|
1714
|
-
}): string;
|
|
1715
|
-
/**
|
|
1716
|
-
* Generate pool ID for obligation collateral pools.
|
|
1717
|
-
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
1718
|
-
* These pools are shared across all offers with the same obligation.
|
|
1719
|
-
*/
|
|
1720
|
-
declare function generateObligationCollateralPoolId(parameters: {
|
|
1721
|
-
user: Address;
|
|
1722
|
-
chainId: Id;
|
|
1723
|
-
obligationId: Hex;
|
|
1724
|
-
token: Address;
|
|
1725
|
-
}): string;
|
|
1726
|
-
/**
|
|
1727
|
-
* Generate pool ID for debt pools.
|
|
1728
|
-
*/
|
|
1729
|
-
declare function generateDebtPoolId(parameters: {
|
|
1730
|
-
user: Address;
|
|
1731
|
-
chainId: Id;
|
|
1732
|
-
obligationId: Hex;
|
|
1733
|
-
}): string;
|
|
1734
|
-
/**
|
|
1735
|
-
* Generate pool ID for user position in a vault.
|
|
1736
|
-
*/
|
|
1737
|
-
declare function generateUserVaultPositionPoolId(parameters: {
|
|
1738
|
-
user: Address;
|
|
1739
|
-
chainId: Id;
|
|
1740
|
-
vault: Address;
|
|
1741
|
-
}): string;
|
|
1742
|
-
/**
|
|
1743
|
-
* Generate pool ID for vault position in a market.
|
|
1744
|
-
*/
|
|
1745
|
-
declare function generateVaultPositionPoolId(parameters: {
|
|
1746
|
-
vault: Address;
|
|
1747
|
-
chainId: Id;
|
|
1748
|
-
marketId: string;
|
|
1749
|
-
}): string;
|
|
1750
|
-
/**
|
|
1751
|
-
* Generate pool ID for market total liquidity.
|
|
1752
|
-
*/
|
|
1753
|
-
declare function generateMarketLiquidityPoolId(parameters: {
|
|
1754
|
-
chainId: Id;
|
|
1755
|
-
marketId: string;
|
|
1756
|
-
}): string;
|
|
1757
|
-
declare namespace Maturity_d_exports {
|
|
1758
|
-
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$12 as from };
|
|
1759
|
-
}
|
|
1760
|
-
/**
|
|
1761
|
-
* Maturity is a number that represents a date in seconds.
|
|
1762
|
-
*/
|
|
1763
|
-
type Maturity = number & Brand<"Maturity">;
|
|
1764
|
-
declare const MaturitySchema: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1765
|
-
declare enum MaturityType {
|
|
1766
|
-
EndOfWeek = "end_of_week",
|
|
1767
|
-
EndOfNextWeek = "end_of_next_week",
|
|
1768
|
-
EndOfMonth = "end_of_month",
|
|
1769
|
-
EndOfNextMonth = "end_of_next_month",
|
|
1770
|
-
EndOfQuarter = "end_of_quarter",
|
|
1771
|
-
EndOfNextQuarter = "end_of_next_quarter"
|
|
1772
|
-
}
|
|
1773
|
-
declare const MaturityOptions: {
|
|
1774
|
-
readonly end_of_week: () => Maturity;
|
|
1775
|
-
readonly end_of_next_week: () => Maturity;
|
|
1776
|
-
readonly end_of_month: () => Maturity;
|
|
1777
|
-
readonly end_of_next_month: () => Maturity;
|
|
1778
|
-
readonly end_of_quarter: () => Maturity;
|
|
1779
|
-
readonly end_of_next_quarter: () => Maturity;
|
|
1780
|
-
};
|
|
1781
|
-
type MaturityOptions = keyof typeof MaturityOptions;
|
|
1782
|
-
/**
|
|
1783
|
-
* Creates a maturity from a timestamp in seconds or a maturity option.
|
|
1784
|
-
* @throws {InvalidFormatError} If the maturity is in milliseconds.
|
|
1785
|
-
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
1786
|
-
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
1812
|
+
* Creates a maturity from a timestamp in seconds or a maturity option.
|
|
1813
|
+
* @throws {InvalidFormatError} If the maturity is in milliseconds.
|
|
1814
|
+
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
1815
|
+
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
1787
1816
|
*/
|
|
1788
1817
|
declare function from$12(ts: from$12.Parameters): Maturity;
|
|
1789
1818
|
declare namespace from$12 {
|
|
@@ -1802,44 +1831,16 @@ declare class InvalidOptionError extends BaseError {
|
|
|
1802
1831
|
readonly name = "Maturity.InvalidOptionError";
|
|
1803
1832
|
constructor(input: string);
|
|
1804
1833
|
}
|
|
1805
|
-
declare namespace Format_d_exports {
|
|
1806
|
-
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
1807
|
-
}
|
|
1808
|
-
/** The snake case representation of a type with bigint values stringified. */
|
|
1809
|
-
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
1810
|
-
/** Make arrays/tuples and object props mutable, deeply. */
|
|
1811
|
-
type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
|
|
1812
|
-
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
1813
|
-
type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
|
|
1814
|
-
/** Key remapping that also preserves branded primitives. */
|
|
1815
|
-
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
|
|
1816
|
-
type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
|
|
1817
|
-
/**
|
|
1818
|
-
* Formats object keys to snake case.
|
|
1819
|
-
* Preserves ethereum addresses as is.
|
|
1820
|
-
* Converts ethereum addresses to checksummed if used as values.
|
|
1821
|
-
* Stringifies bigint values to strings.
|
|
1822
|
-
*/
|
|
1823
|
-
declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
1824
|
-
/**
|
|
1825
|
-
* Formats a snake case object to its camel case type.
|
|
1826
|
-
* Preserves ethereum addresses as is.
|
|
1827
|
-
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
1828
|
-
* @warning Does not unstringify bigint values.
|
|
1829
|
-
*/
|
|
1830
|
-
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
1831
|
-
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
1832
1834
|
declare namespace Obligation_d_exports {
|
|
1833
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase,
|
|
1835
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation$1 as Obligation, ObligationSchema, abi, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, key$1 as key, random$2 as random, tupleAbi };
|
|
1834
1836
|
}
|
|
1835
|
-
type Obligation = {
|
|
1836
|
-
/** The
|
|
1837
|
-
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1837
|
+
type Obligation$1 = {
|
|
1838
|
+
/** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1838
1839
|
collaterals: Collateral[]; /** The maturity of the obligation. */
|
|
1839
|
-
maturity: Maturity;
|
|
1840
|
+
maturity: Maturity; /** Minimum collateral value (quoted in loan token) to maintain on collateral updates. */
|
|
1841
|
+
minCollatValue: bigint;
|
|
1840
1842
|
};
|
|
1841
1843
|
declare const ObligationSchema: z$1.ZodObject<{
|
|
1842
|
-
chainId: z$1.ZodNumber;
|
|
1843
1844
|
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1844
1845
|
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1845
1846
|
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
@@ -1847,7 +1848,57 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
1847
1848
|
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1848
1849
|
}, z$1.core.$strip>>;
|
|
1849
1850
|
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1851
|
+
minCollatValue: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
|
|
1850
1852
|
}, z$1.core.$strip>;
|
|
1853
|
+
declare const abi: readonly [{
|
|
1854
|
+
readonly type: "address";
|
|
1855
|
+
readonly name: "loanToken";
|
|
1856
|
+
}, {
|
|
1857
|
+
readonly type: "tuple[]";
|
|
1858
|
+
readonly name: "collaterals";
|
|
1859
|
+
readonly components: readonly [{
|
|
1860
|
+
readonly type: "address";
|
|
1861
|
+
readonly name: "token";
|
|
1862
|
+
}, {
|
|
1863
|
+
readonly type: "uint256";
|
|
1864
|
+
readonly name: "lltv";
|
|
1865
|
+
}, {
|
|
1866
|
+
readonly type: "address";
|
|
1867
|
+
readonly name: "oracle";
|
|
1868
|
+
}];
|
|
1869
|
+
}, {
|
|
1870
|
+
readonly type: "uint256";
|
|
1871
|
+
readonly name: "maturity";
|
|
1872
|
+
}, {
|
|
1873
|
+
readonly type: "uint256";
|
|
1874
|
+
readonly name: "minCollatValue";
|
|
1875
|
+
}];
|
|
1876
|
+
declare const tupleAbi: readonly [{
|
|
1877
|
+
readonly type: "tuple";
|
|
1878
|
+
readonly components: readonly [{
|
|
1879
|
+
readonly type: "address";
|
|
1880
|
+
readonly name: "loanToken";
|
|
1881
|
+
}, {
|
|
1882
|
+
readonly type: "tuple[]";
|
|
1883
|
+
readonly name: "collaterals";
|
|
1884
|
+
readonly components: readonly [{
|
|
1885
|
+
readonly type: "address";
|
|
1886
|
+
readonly name: "token";
|
|
1887
|
+
}, {
|
|
1888
|
+
readonly type: "uint256";
|
|
1889
|
+
readonly name: "lltv";
|
|
1890
|
+
}, {
|
|
1891
|
+
readonly type: "address";
|
|
1892
|
+
readonly name: "oracle";
|
|
1893
|
+
}];
|
|
1894
|
+
}, {
|
|
1895
|
+
readonly type: "uint256";
|
|
1896
|
+
readonly name: "maturity";
|
|
1897
|
+
}, {
|
|
1898
|
+
readonly type: "uint256";
|
|
1899
|
+
readonly name: "minCollatValue";
|
|
1900
|
+
}];
|
|
1901
|
+
}];
|
|
1851
1902
|
/**
|
|
1852
1903
|
* Creates an obligation from the given parameters.
|
|
1853
1904
|
* @constructor
|
|
@@ -1858,7 +1909,6 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
1858
1909
|
* @example
|
|
1859
1910
|
* ```ts
|
|
1860
1911
|
* const obligation = Obligation.from({
|
|
1861
|
-
* chainId: 1,
|
|
1862
1912
|
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
1863
1913
|
* collaterals: [
|
|
1864
1914
|
* Collateral.from({
|
|
@@ -1874,12 +1924,12 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
1874
1924
|
declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
|
|
1875
1925
|
declare namespace from$11 {
|
|
1876
1926
|
type Parameters = {
|
|
1877
|
-
/** The
|
|
1878
|
-
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1927
|
+
/** 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. */
|
|
1879
1928
|
collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
|
|
1880
|
-
maturity: from$12.Parameters;
|
|
1929
|
+
maturity: from$12.Parameters; /** Minimum collateral value (quoted in loan token). @default 0 */
|
|
1930
|
+
minCollatValue?: bigint;
|
|
1881
1931
|
};
|
|
1882
|
-
type ReturnType = Obligation;
|
|
1932
|
+
type ReturnType = Obligation$1;
|
|
1883
1933
|
type ErrorType = InvalidObligationError;
|
|
1884
1934
|
}
|
|
1885
1935
|
/**
|
|
@@ -1890,30 +1940,31 @@ declare namespace from$11 {
|
|
|
1890
1940
|
*/
|
|
1891
1941
|
declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
|
|
1892
1942
|
declare namespace fromSnakeCase$2 {
|
|
1893
|
-
type
|
|
1894
|
-
|
|
1895
|
-
}
|
|
1896
|
-
type
|
|
1943
|
+
type SnakeCaseParameters = Omit<Obligation$1, "minCollatValue"> & {
|
|
1944
|
+
minCollatValue?: bigint;
|
|
1945
|
+
};
|
|
1946
|
+
type Parameters = Snake<SnakeCaseParameters>;
|
|
1947
|
+
type ReturnType = Obligation$1;
|
|
1897
1948
|
type ErrorType = InvalidObligationError;
|
|
1898
1949
|
}
|
|
1899
1950
|
/**
|
|
1900
|
-
* Calculates
|
|
1901
|
-
* The
|
|
1951
|
+
* Calculates a canonical key for an obligation payload.
|
|
1952
|
+
* The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity, minCollatValue)).
|
|
1953
|
+
* If omitted, `minCollatValue` defaults to `0`.
|
|
1902
1954
|
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
1903
|
-
* @param parameters - {@link
|
|
1904
|
-
* @returns The obligation
|
|
1955
|
+
* @param parameters - {@link key.Parameters}
|
|
1956
|
+
* @returns The obligation key as a 32-byte hex string. {@link key.ReturnType}
|
|
1905
1957
|
*
|
|
1906
1958
|
* @example
|
|
1907
1959
|
* ```ts
|
|
1908
1960
|
* const obligation = Obligation.random();
|
|
1909
|
-
* const
|
|
1910
|
-
* console.log(
|
|
1961
|
+
* const key = Obligation.key(obligation);
|
|
1962
|
+
* console.log(key); // 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1911
1963
|
* ```
|
|
1912
1964
|
*/
|
|
1913
|
-
declare function
|
|
1914
|
-
declare namespace
|
|
1965
|
+
declare function key$1(parameters: key$1.Parameters): key$1.ReturnType;
|
|
1966
|
+
declare namespace key$1 {
|
|
1915
1967
|
type Parameters = {
|
|
1916
|
-
chainId: number;
|
|
1917
1968
|
loanToken: Address;
|
|
1918
1969
|
collaterals: {
|
|
1919
1970
|
asset: Address;
|
|
@@ -1921,6 +1972,7 @@ declare namespace id {
|
|
|
1921
1972
|
oracle: Address;
|
|
1922
1973
|
}[];
|
|
1923
1974
|
maturity: number;
|
|
1975
|
+
minCollatValue?: bigint;
|
|
1924
1976
|
};
|
|
1925
1977
|
type ReturnType = Hex;
|
|
1926
1978
|
type ErrorType = CollateralsAreNotSortedError;
|
|
@@ -1936,7 +1988,7 @@ declare namespace id {
|
|
|
1936
1988
|
*/
|
|
1937
1989
|
declare function random$2(): random$2.ReturnType;
|
|
1938
1990
|
declare namespace random$2 {
|
|
1939
|
-
type ReturnType = Obligation;
|
|
1991
|
+
type ReturnType = Obligation$1;
|
|
1940
1992
|
}
|
|
1941
1993
|
/**
|
|
1942
1994
|
* Creates an obligation from an offer.
|
|
@@ -1948,7 +2000,7 @@ declare namespace random$2 {
|
|
|
1948
2000
|
declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
|
|
1949
2001
|
declare namespace fromOffer$1 {
|
|
1950
2002
|
type Parameters = Offer;
|
|
1951
|
-
type ReturnType = Obligation;
|
|
2003
|
+
type ReturnType = Obligation$1;
|
|
1952
2004
|
}
|
|
1953
2005
|
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
1954
2006
|
readonly name = "Obligation.InvalidObligationError";
|
|
@@ -1958,8 +2010,138 @@ declare class CollateralsAreNotSortedError extends BaseError {
|
|
|
1958
2010
|
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
1959
2011
|
constructor();
|
|
1960
2012
|
}
|
|
2013
|
+
declare namespace Id_d_exports {
|
|
2014
|
+
export { Obligation, creationCode, toId };
|
|
2015
|
+
}
|
|
2016
|
+
type Obligation = Obligation$1;
|
|
2017
|
+
/**
|
|
2018
|
+
* Builds the same creation code as `IdLib.creationCode` in Solidity.
|
|
2019
|
+
*
|
|
2020
|
+
* Layout: `prefix (11 bytes) + abi.encode(obligation)`.
|
|
2021
|
+
*
|
|
2022
|
+
* @param parameters - {@link creationCode.Parameters}
|
|
2023
|
+
* @returns The CREATE2 init code bytes. {@link creationCode.ReturnType}
|
|
2024
|
+
*/
|
|
2025
|
+
declare function creationCode(parameters: creationCode.Parameters): creationCode.ReturnType;
|
|
2026
|
+
declare namespace creationCode {
|
|
2027
|
+
type Parameters = {
|
|
2028
|
+
obligation: Obligation;
|
|
2029
|
+
chainId: Id;
|
|
2030
|
+
morphoV2: Address;
|
|
2031
|
+
};
|
|
2032
|
+
type ReturnType = Hex;
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Computes the same id as `IdLib.toId` in Solidity using the CREATE2 preimage:
|
|
2036
|
+
* `keccak256(0xff ++ morphoV2 ++ chainId ++ keccak256(creationCode))`,
|
|
2037
|
+
* then truncates to the lower 20 bytes.
|
|
2038
|
+
*
|
|
2039
|
+
* @param parameters - {@link toId.Parameters}
|
|
2040
|
+
* @returns The obligation id. {@link toId.ReturnType}
|
|
2041
|
+
*/
|
|
2042
|
+
declare function toId(parameters: toId.Parameters): toId.ReturnType;
|
|
2043
|
+
declare namespace toId {
|
|
2044
|
+
type Parameters = creationCode.Parameters;
|
|
2045
|
+
type ReturnType = Hex;
|
|
2046
|
+
}
|
|
2047
|
+
declare namespace Liquidity_d_exports {
|
|
2048
|
+
export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
|
|
2049
|
+
}
|
|
2050
|
+
/**
|
|
2051
|
+
* Represents a liquidity pool with a unique ID and amount.
|
|
2052
|
+
*/
|
|
2053
|
+
type LiquidityPool = {
|
|
2054
|
+
id: string;
|
|
2055
|
+
amount: bigint;
|
|
2056
|
+
};
|
|
2057
|
+
/**
|
|
2058
|
+
* Represents a hierarchical relationship between two liquidity pools.
|
|
2059
|
+
*/
|
|
2060
|
+
type LiquidityLink = {
|
|
2061
|
+
parentPoolId: string;
|
|
2062
|
+
childPoolId: string;
|
|
2063
|
+
priority: number;
|
|
2064
|
+
};
|
|
2065
|
+
/**
|
|
2066
|
+
* Represents the connection between an offer and its liquidity pools.
|
|
2067
|
+
*/
|
|
2068
|
+
type OfferLiquidityPool = {
|
|
2069
|
+
offerHash: Hex;
|
|
2070
|
+
poolId: string;
|
|
2071
|
+
/**
|
|
2072
|
+
* The available capacity/liquidity from this pool for this offer.
|
|
2073
|
+
* Matches allowance amount from pool below.
|
|
2074
|
+
*/
|
|
2075
|
+
amount: bigint;
|
|
2076
|
+
};
|
|
2077
|
+
/**
|
|
2078
|
+
* Calculate maximum debt capacity from collateral amount.
|
|
2079
|
+
* @param amount - Collateral amount
|
|
2080
|
+
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
2081
|
+
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
2082
|
+
* @returns Maximum debt capacity
|
|
2083
|
+
*/
|
|
2084
|
+
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
2085
|
+
/**
|
|
2086
|
+
* Generate pool ID for balance pools.
|
|
2087
|
+
*/
|
|
2088
|
+
declare function generateBalancePoolId(parameters: {
|
|
2089
|
+
user: Address;
|
|
2090
|
+
chainId: Id;
|
|
2091
|
+
token: Address;
|
|
2092
|
+
}): string;
|
|
2093
|
+
/**
|
|
2094
|
+
* Generate pool ID for allowance pools.
|
|
2095
|
+
*/
|
|
2096
|
+
declare function generateAllowancePoolId(parameters: {
|
|
2097
|
+
user: Address;
|
|
2098
|
+
chainId: Id;
|
|
2099
|
+
token: Address;
|
|
2100
|
+
}): string;
|
|
2101
|
+
/**
|
|
2102
|
+
* Generate pool ID for obligation collateral pools.
|
|
2103
|
+
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
2104
|
+
* These pools are shared across all offers with the same obligation.
|
|
2105
|
+
*/
|
|
2106
|
+
declare function generateObligationCollateralPoolId(parameters: {
|
|
2107
|
+
user: Address;
|
|
2108
|
+
chainId: Id;
|
|
2109
|
+
obligationId: Hex;
|
|
2110
|
+
token: Address;
|
|
2111
|
+
}): string;
|
|
2112
|
+
/**
|
|
2113
|
+
* Generate pool ID for debt pools.
|
|
2114
|
+
*/
|
|
2115
|
+
declare function generateDebtPoolId(parameters: {
|
|
2116
|
+
user: Address;
|
|
2117
|
+
chainId: Id;
|
|
2118
|
+
obligationId: Hex;
|
|
2119
|
+
}): string;
|
|
2120
|
+
/**
|
|
2121
|
+
* Generate pool ID for user position in a vault.
|
|
2122
|
+
*/
|
|
2123
|
+
declare function generateUserVaultPositionPoolId(parameters: {
|
|
2124
|
+
user: Address;
|
|
2125
|
+
chainId: Id;
|
|
2126
|
+
vault: Address;
|
|
2127
|
+
}): string;
|
|
2128
|
+
/**
|
|
2129
|
+
* Generate pool ID for vault position in a market.
|
|
2130
|
+
*/
|
|
2131
|
+
declare function generateVaultPositionPoolId(parameters: {
|
|
2132
|
+
vault: Address;
|
|
2133
|
+
chainId: Id;
|
|
2134
|
+
marketId: string;
|
|
2135
|
+
}): string;
|
|
2136
|
+
/**
|
|
2137
|
+
* Generate pool ID for market total liquidity.
|
|
2138
|
+
*/
|
|
2139
|
+
declare function generateMarketLiquidityPoolId(parameters: {
|
|
2140
|
+
chainId: Id;
|
|
2141
|
+
marketId: string;
|
|
2142
|
+
}): string;
|
|
1961
2143
|
declare namespace Offer_d_exports {
|
|
1962
|
-
export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode,
|
|
2144
|
+
export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, liquidateEvent, obligationId, random$1 as random, repayEvent, serialize, supplyCollateralEvent, takeEvent, toSnakeCase, withdrawCollateralEvent };
|
|
1963
2145
|
}
|
|
1964
2146
|
type Offer = {
|
|
1965
2147
|
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
@@ -1972,8 +2154,7 @@ type Offer = {
|
|
|
1972
2154
|
readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
1973
2155
|
readonly group: Hex; /** The session. Used for session-based offer management. */
|
|
1974
2156
|
readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
|
|
1975
|
-
readonly buy: boolean; /** The
|
|
1976
|
-
readonly chainId: Id; /** The token that is being borrowed. */
|
|
2157
|
+
readonly buy: boolean; /** The token that is being borrowed. */
|
|
1977
2158
|
readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1978
2159
|
readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
|
|
1979
2160
|
readonly callback: {
|
|
@@ -1988,6 +2169,7 @@ declare enum Status {
|
|
|
1988
2169
|
}
|
|
1989
2170
|
type Validation = {
|
|
1990
2171
|
offerHash: Hex;
|
|
2172
|
+
obligationId: Hex;
|
|
1991
2173
|
status: Status;
|
|
1992
2174
|
};
|
|
1993
2175
|
declare const OfferSchema: () => z$1.ZodObject<{
|
|
@@ -2002,7 +2184,6 @@ declare const OfferSchema: () => z$1.ZodObject<{
|
|
|
2002
2184
|
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>>;
|
|
2003
2185
|
session: z$1.ZodPipe<z$1.ZodDefault<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>>>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
|
|
2004
2186
|
buy: z$1.ZodBoolean;
|
|
2005
|
-
chainId: z$1.ZodNumber;
|
|
2006
2187
|
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2007
2188
|
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
2008
2189
|
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
@@ -2026,8 +2207,7 @@ declare const OfferSchema: () => z$1.ZodObject<{
|
|
|
2026
2207
|
*
|
|
2027
2208
|
* All values validated to be non-negative and within bytes32 range.
|
|
2028
2209
|
*/
|
|
2029
|
-
type OfferInput = Compute<Omit<Offer, "
|
|
2030
|
-
chainId: number;
|
|
2210
|
+
type OfferInput = Compute<Omit<Offer, "group" | "session" | "obligationUnits" | "obligationShares" | "receiverIfMakerIsSeller"> & {
|
|
2031
2211
|
group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
|
|
2032
2212
|
session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
2033
2213
|
obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
@@ -2067,153 +2247,83 @@ declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
|
2067
2247
|
* @param offer - Offer to serialize
|
|
2068
2248
|
* @returns JSON-serializable offer object
|
|
2069
2249
|
*/
|
|
2070
|
-
declare const serialize: (offer: Offer) => {
|
|
2071
|
-
maker: `0x${string}`;
|
|
2072
|
-
assets: string;
|
|
2073
|
-
obligationUnits: string;
|
|
2074
|
-
obligationShares: string;
|
|
2075
|
-
tick: number;
|
|
2076
|
-
maturity: number;
|
|
2077
|
-
expiry: number;
|
|
2078
|
-
start: number;
|
|
2079
|
-
group: `0x${string}`;
|
|
2080
|
-
session: `0x${string}`;
|
|
2081
|
-
buy: boolean;
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
receiverIfMakerIsSeller?: Address;
|
|
2117
|
-
collaterals?: readonly Collateral[];
|
|
2118
|
-
};
|
|
2119
|
-
/**
|
|
2120
|
-
* Generates a random Offer.
|
|
2121
|
-
* The returned Offer contains randomly generated values.
|
|
2122
|
-
* @warning The generated Offer should not be used for production usage.
|
|
2123
|
-
* @returns {Offer} A randomly generated Offer object.
|
|
2124
|
-
*/
|
|
2125
|
-
declare function random$1(config?: RandomConfig): Offer;
|
|
2126
|
-
/**
|
|
2127
|
-
* Creates an EIP-712 domain object.
|
|
2128
|
-
* @param chainId - The chain ID.
|
|
2129
|
-
* @returns The EIP-712 domain object.
|
|
2130
|
-
*/
|
|
2131
|
-
declare const domain: (chainId: number) => {
|
|
2132
|
-
chainId: bigint;
|
|
2133
|
-
verifyingContract: "0x0000000000000000000000000000000000000000";
|
|
2134
|
-
};
|
|
2135
|
-
/**
|
|
2136
|
-
* The EIP-712 types for the offer.
|
|
2137
|
-
* @warning The ordering of the types should NEVER be changed. The offer hash is computed based on the order of the types.
|
|
2138
|
-
* @returns The EIP-712 types.
|
|
2139
|
-
*/
|
|
2140
|
-
declare const types: {
|
|
2141
|
-
readonly EIP712Domain: readonly [{
|
|
2142
|
-
readonly name: "chainId";
|
|
2143
|
-
readonly type: "uint256";
|
|
2144
|
-
}, {
|
|
2145
|
-
readonly name: "verifyingContract";
|
|
2146
|
-
readonly type: "address";
|
|
2147
|
-
}];
|
|
2148
|
-
readonly Offer: readonly [{
|
|
2149
|
-
readonly name: "maker";
|
|
2150
|
-
readonly type: "address";
|
|
2151
|
-
}, {
|
|
2152
|
-
readonly name: "assets";
|
|
2153
|
-
readonly type: "uint256";
|
|
2154
|
-
}, {
|
|
2155
|
-
readonly name: "obligationUnits";
|
|
2156
|
-
readonly type: "uint256";
|
|
2157
|
-
}, {
|
|
2158
|
-
readonly name: "obligationShares";
|
|
2159
|
-
readonly type: "uint256";
|
|
2160
|
-
}, {
|
|
2161
|
-
readonly name: "tick";
|
|
2162
|
-
readonly type: "uint256";
|
|
2163
|
-
}, {
|
|
2164
|
-
readonly name: "maturity";
|
|
2165
|
-
readonly type: "uint256";
|
|
2166
|
-
}, {
|
|
2167
|
-
readonly name: "expiry";
|
|
2168
|
-
readonly type: "uint256";
|
|
2169
|
-
}, {
|
|
2170
|
-
readonly name: "group";
|
|
2171
|
-
readonly type: "bytes32";
|
|
2172
|
-
}, {
|
|
2173
|
-
readonly name: "session";
|
|
2174
|
-
readonly type: "bytes32";
|
|
2175
|
-
}, {
|
|
2176
|
-
readonly name: "buy";
|
|
2177
|
-
readonly type: "bool";
|
|
2178
|
-
}, {
|
|
2179
|
-
readonly name: "loanToken";
|
|
2180
|
-
readonly type: "address";
|
|
2181
|
-
}, {
|
|
2182
|
-
readonly name: "collaterals";
|
|
2183
|
-
readonly type: "Collateral[]";
|
|
2184
|
-
}, {
|
|
2185
|
-
readonly name: "callback";
|
|
2186
|
-
readonly type: "Callback";
|
|
2187
|
-
}, {
|
|
2188
|
-
readonly name: "receiverIfMakerIsSeller";
|
|
2189
|
-
readonly type: "address";
|
|
2190
|
-
}];
|
|
2191
|
-
readonly Collateral: readonly [{
|
|
2192
|
-
readonly name: "asset";
|
|
2193
|
-
readonly type: "address";
|
|
2194
|
-
}, {
|
|
2195
|
-
readonly name: "oracle";
|
|
2196
|
-
readonly type: "address";
|
|
2197
|
-
}, {
|
|
2198
|
-
readonly name: "lltv";
|
|
2199
|
-
readonly type: "uint256";
|
|
2200
|
-
}];
|
|
2201
|
-
readonly Callback: readonly [{
|
|
2202
|
-
readonly name: "address";
|
|
2203
|
-
readonly type: "address";
|
|
2204
|
-
}, {
|
|
2205
|
-
readonly name: "data";
|
|
2206
|
-
readonly type: "bytes";
|
|
2207
|
-
}];
|
|
2250
|
+
declare const serialize: (offer: Offer) => {
|
|
2251
|
+
maker: `0x${string}`;
|
|
2252
|
+
assets: string;
|
|
2253
|
+
obligationUnits: string;
|
|
2254
|
+
obligationShares: string;
|
|
2255
|
+
tick: number;
|
|
2256
|
+
maturity: number;
|
|
2257
|
+
expiry: number;
|
|
2258
|
+
start: number;
|
|
2259
|
+
group: `0x${string}`;
|
|
2260
|
+
session: `0x${string}`;
|
|
2261
|
+
buy: boolean;
|
|
2262
|
+
loanToken: `0x${string}`;
|
|
2263
|
+
collaterals: {
|
|
2264
|
+
asset: `0x${string}`;
|
|
2265
|
+
oracle: `0x${string}`;
|
|
2266
|
+
lltv: string;
|
|
2267
|
+
}[];
|
|
2268
|
+
callback: {
|
|
2269
|
+
address: `0x${string}`;
|
|
2270
|
+
data: `0x${string}`;
|
|
2271
|
+
};
|
|
2272
|
+
receiverIfMakerIsSeller: `0x${string}`;
|
|
2273
|
+
hash: `0x${string}`;
|
|
2274
|
+
};
|
|
2275
|
+
type RandomConfig = {
|
|
2276
|
+
loanTokens?: Address[];
|
|
2277
|
+
collateralTokens?: Address[];
|
|
2278
|
+
assetsDecimals?: Record<Address, number>;
|
|
2279
|
+
buy?: boolean;
|
|
2280
|
+
assets?: bigint;
|
|
2281
|
+
obligationUnits?: bigint;
|
|
2282
|
+
obligationShares?: bigint;
|
|
2283
|
+
maker?: Address;
|
|
2284
|
+
maturity?: Maturity;
|
|
2285
|
+
start?: number;
|
|
2286
|
+
expiry?: number;
|
|
2287
|
+
group?: Hex | bigint | number | string;
|
|
2288
|
+
session?: Hex | bigint | number | string;
|
|
2289
|
+
tick?: number;
|
|
2290
|
+
callback?: {
|
|
2291
|
+
address: Address;
|
|
2292
|
+
data: Hex;
|
|
2293
|
+
};
|
|
2294
|
+
receiverIfMakerIsSeller?: Address;
|
|
2295
|
+
collaterals?: readonly Collateral[];
|
|
2208
2296
|
};
|
|
2297
|
+
/**
|
|
2298
|
+
* Generates a random Offer.
|
|
2299
|
+
* The returned Offer contains randomly generated values.
|
|
2300
|
+
* @warning The generated Offer should not be used for production usage.
|
|
2301
|
+
* @returns {Offer} A randomly generated Offer object.
|
|
2302
|
+
*/
|
|
2303
|
+
declare function random$1(config?: RandomConfig): Offer;
|
|
2304
|
+
/**
|
|
2305
|
+
* Computes the canonical chain-agnostic offer hash.
|
|
2306
|
+
* The hash is `keccak256(abi.encode(offer))` using {@link encode}.
|
|
2307
|
+
*
|
|
2308
|
+
* @param offer - Offer payload to hash.
|
|
2309
|
+
* @returns 32-byte offer hash.
|
|
2310
|
+
*/
|
|
2209
2311
|
declare function hash(offer: Offer): Hex;
|
|
2210
2312
|
/**
|
|
2211
|
-
* Calculates the obligation id for an offer
|
|
2212
|
-
* The id is computed
|
|
2313
|
+
* Calculates the onchain obligation id for an offer.
|
|
2314
|
+
* The id is computed with {@link Id.toId}.
|
|
2213
2315
|
* @param offer - The offer to calculate the obligation id for.
|
|
2214
|
-
* @
|
|
2316
|
+
* @param parameters - The chain context used by the onchain id function.
|
|
2317
|
+
* @returns The obligation id as a 20-byte hex string.
|
|
2215
2318
|
*/
|
|
2216
|
-
declare function obligationId(offer: Offer):
|
|
2319
|
+
declare function obligationId(offer: Offer, parameters: obligationId.Parameters): obligationId.ReturnType;
|
|
2320
|
+
declare namespace obligationId {
|
|
2321
|
+
type Parameters = {
|
|
2322
|
+
chainId: Id;
|
|
2323
|
+
morphoV2: Address;
|
|
2324
|
+
};
|
|
2325
|
+
type ReturnType = Hex;
|
|
2326
|
+
}
|
|
2217
2327
|
declare function encode$1(offer: Offer): `0x${string}`;
|
|
2218
2328
|
declare function decode$1(data: Hex): Offer;
|
|
2219
2329
|
type OfferConsumed = {
|
|
@@ -2236,10 +2346,10 @@ declare const takeEvent: {
|
|
|
2236
2346
|
readonly indexed: false;
|
|
2237
2347
|
readonly internalType: "address";
|
|
2238
2348
|
}, {
|
|
2239
|
-
readonly name: "
|
|
2240
|
-
readonly type: "
|
|
2349
|
+
readonly name: "id_";
|
|
2350
|
+
readonly type: "bytes20";
|
|
2241
2351
|
readonly indexed: true;
|
|
2242
|
-
readonly internalType: "
|
|
2352
|
+
readonly internalType: "bytes20";
|
|
2243
2353
|
}, {
|
|
2244
2354
|
readonly name: "maker";
|
|
2245
2355
|
readonly type: "address";
|
|
@@ -2327,6 +2437,152 @@ declare const consumedEvent: {
|
|
|
2327
2437
|
}];
|
|
2328
2438
|
readonly anonymous: false;
|
|
2329
2439
|
};
|
|
2440
|
+
/**
|
|
2441
|
+
* ABI for the Repay event emitted by the MorphoV2 contract.
|
|
2442
|
+
*/
|
|
2443
|
+
declare const repayEvent: {
|
|
2444
|
+
readonly type: "event";
|
|
2445
|
+
readonly name: "Repay";
|
|
2446
|
+
readonly inputs: readonly [{
|
|
2447
|
+
readonly name: "caller";
|
|
2448
|
+
readonly type: "address";
|
|
2449
|
+
readonly indexed: true;
|
|
2450
|
+
readonly internalType: "address";
|
|
2451
|
+
}, {
|
|
2452
|
+
readonly name: "id_";
|
|
2453
|
+
readonly type: "bytes20";
|
|
2454
|
+
readonly indexed: true;
|
|
2455
|
+
readonly internalType: "bytes20";
|
|
2456
|
+
}, {
|
|
2457
|
+
readonly name: "obligationUnits";
|
|
2458
|
+
readonly type: "uint256";
|
|
2459
|
+
readonly indexed: false;
|
|
2460
|
+
readonly internalType: "uint256";
|
|
2461
|
+
}, {
|
|
2462
|
+
readonly name: "onBehalf";
|
|
2463
|
+
readonly type: "address";
|
|
2464
|
+
readonly indexed: true;
|
|
2465
|
+
readonly internalType: "address";
|
|
2466
|
+
}];
|
|
2467
|
+
readonly anonymous: false;
|
|
2468
|
+
};
|
|
2469
|
+
/**
|
|
2470
|
+
* ABI for the Liquidate event emitted by the MorphoV2 contract.
|
|
2471
|
+
*/
|
|
2472
|
+
declare const liquidateEvent: {
|
|
2473
|
+
readonly type: "event";
|
|
2474
|
+
readonly name: "Liquidate";
|
|
2475
|
+
readonly inputs: readonly [{
|
|
2476
|
+
readonly name: "caller";
|
|
2477
|
+
readonly type: "address";
|
|
2478
|
+
readonly indexed: true;
|
|
2479
|
+
readonly internalType: "address";
|
|
2480
|
+
}, {
|
|
2481
|
+
readonly name: "id_";
|
|
2482
|
+
readonly type: "bytes20";
|
|
2483
|
+
readonly indexed: true;
|
|
2484
|
+
readonly internalType: "bytes20";
|
|
2485
|
+
}, {
|
|
2486
|
+
readonly name: "collateralIndex";
|
|
2487
|
+
readonly type: "uint256";
|
|
2488
|
+
readonly indexed: false;
|
|
2489
|
+
readonly internalType: "uint256";
|
|
2490
|
+
}, {
|
|
2491
|
+
readonly name: "seizedAssets";
|
|
2492
|
+
readonly type: "uint256";
|
|
2493
|
+
readonly indexed: false;
|
|
2494
|
+
readonly internalType: "uint256";
|
|
2495
|
+
}, {
|
|
2496
|
+
readonly name: "repaidUnits";
|
|
2497
|
+
readonly type: "uint256";
|
|
2498
|
+
readonly indexed: false;
|
|
2499
|
+
readonly internalType: "uint256";
|
|
2500
|
+
}, {
|
|
2501
|
+
readonly name: "borrower";
|
|
2502
|
+
readonly type: "address";
|
|
2503
|
+
readonly indexed: true;
|
|
2504
|
+
readonly internalType: "address";
|
|
2505
|
+
}, {
|
|
2506
|
+
readonly name: "badDebt";
|
|
2507
|
+
readonly type: "uint256";
|
|
2508
|
+
readonly indexed: false;
|
|
2509
|
+
readonly internalType: "uint256";
|
|
2510
|
+
}];
|
|
2511
|
+
readonly anonymous: false;
|
|
2512
|
+
};
|
|
2513
|
+
/**
|
|
2514
|
+
* ABI for the SupplyCollateral event emitted by the MorphoV2 contract.
|
|
2515
|
+
*/
|
|
2516
|
+
declare const supplyCollateralEvent: {
|
|
2517
|
+
readonly type: "event";
|
|
2518
|
+
readonly name: "SupplyCollateral";
|
|
2519
|
+
readonly inputs: readonly [{
|
|
2520
|
+
readonly name: "caller";
|
|
2521
|
+
readonly type: "address";
|
|
2522
|
+
readonly indexed: false;
|
|
2523
|
+
readonly internalType: "address";
|
|
2524
|
+
}, {
|
|
2525
|
+
readonly name: "id_";
|
|
2526
|
+
readonly type: "bytes20";
|
|
2527
|
+
readonly indexed: true;
|
|
2528
|
+
readonly internalType: "bytes20";
|
|
2529
|
+
}, {
|
|
2530
|
+
readonly name: "collateral";
|
|
2531
|
+
readonly type: "address";
|
|
2532
|
+
readonly indexed: true;
|
|
2533
|
+
readonly internalType: "address";
|
|
2534
|
+
}, {
|
|
2535
|
+
readonly name: "assets";
|
|
2536
|
+
readonly type: "uint256";
|
|
2537
|
+
readonly indexed: false;
|
|
2538
|
+
readonly internalType: "uint256";
|
|
2539
|
+
}, {
|
|
2540
|
+
readonly name: "onBehalf";
|
|
2541
|
+
readonly type: "address";
|
|
2542
|
+
readonly indexed: true;
|
|
2543
|
+
readonly internalType: "address";
|
|
2544
|
+
}];
|
|
2545
|
+
readonly anonymous: false;
|
|
2546
|
+
};
|
|
2547
|
+
/**
|
|
2548
|
+
* ABI for the WithdrawCollateral event emitted by the MorphoV2 contract.
|
|
2549
|
+
*/
|
|
2550
|
+
declare const withdrawCollateralEvent: {
|
|
2551
|
+
readonly type: "event";
|
|
2552
|
+
readonly name: "WithdrawCollateral";
|
|
2553
|
+
readonly inputs: readonly [{
|
|
2554
|
+
readonly name: "caller";
|
|
2555
|
+
readonly type: "address";
|
|
2556
|
+
readonly indexed: false;
|
|
2557
|
+
readonly internalType: "address";
|
|
2558
|
+
}, {
|
|
2559
|
+
readonly name: "id_";
|
|
2560
|
+
readonly type: "bytes20";
|
|
2561
|
+
readonly indexed: true;
|
|
2562
|
+
readonly internalType: "bytes20";
|
|
2563
|
+
}, {
|
|
2564
|
+
readonly name: "collateral";
|
|
2565
|
+
readonly type: "address";
|
|
2566
|
+
readonly indexed: true;
|
|
2567
|
+
readonly internalType: "address";
|
|
2568
|
+
}, {
|
|
2569
|
+
readonly name: "assets";
|
|
2570
|
+
readonly type: "uint256";
|
|
2571
|
+
readonly indexed: false;
|
|
2572
|
+
readonly internalType: "uint256";
|
|
2573
|
+
}, {
|
|
2574
|
+
readonly name: "onBehalf";
|
|
2575
|
+
readonly type: "address";
|
|
2576
|
+
readonly indexed: true;
|
|
2577
|
+
readonly internalType: "address";
|
|
2578
|
+
}, {
|
|
2579
|
+
readonly name: "receiver";
|
|
2580
|
+
readonly type: "address";
|
|
2581
|
+
readonly indexed: false;
|
|
2582
|
+
readonly internalType: "address";
|
|
2583
|
+
}];
|
|
2584
|
+
readonly anonymous: false;
|
|
2585
|
+
};
|
|
2330
2586
|
declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
2331
2587
|
readonly name = "Offer.InvalidOfferError";
|
|
2332
2588
|
constructor(error: z$1.ZodError | Error);
|
|
@@ -2396,6 +2652,7 @@ declare namespace fromCollateral {
|
|
|
2396
2652
|
declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
|
|
2397
2653
|
declare namespace fromOffer {
|
|
2398
2654
|
type Parameters = {
|
|
2655
|
+
chainId: Id;
|
|
2399
2656
|
offer: Offer;
|
|
2400
2657
|
blockNumber: number;
|
|
2401
2658
|
price?: bigint | null;
|
|
@@ -2412,6 +2669,7 @@ declare namespace fromOffer {
|
|
|
2412
2669
|
declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
|
|
2413
2670
|
declare namespace fromOffers {
|
|
2414
2671
|
type Parameters = {
|
|
2672
|
+
chainId: Id;
|
|
2415
2673
|
offers: Offer[];
|
|
2416
2674
|
blockNumber: number;
|
|
2417
2675
|
price?: bigint | null;
|
|
@@ -2450,7 +2708,7 @@ declare namespace Conversion {
|
|
|
2450
2708
|
}): bigint;
|
|
2451
2709
|
}
|
|
2452
2710
|
declare namespace Position_d_exports {
|
|
2453
|
-
export { Position, Type, from$8 as from };
|
|
2711
|
+
export { Position, Type, from$8 as from, positionTypeId };
|
|
2454
2712
|
}
|
|
2455
2713
|
type Position = {
|
|
2456
2714
|
/** The chain id. */chainId: Id;
|
|
@@ -2465,13 +2723,17 @@ type Position = {
|
|
|
2465
2723
|
/** The underlying asset of the position.
|
|
2466
2724
|
* For ERC20 positions, this equals the contract address.
|
|
2467
2725
|
* For vault positions, this is the vault's underlying asset.
|
|
2726
|
+
* For debt positions, this is the zero address (sentinel).
|
|
2727
|
+
* For collateral positions, this is the collateral token address.
|
|
2468
2728
|
*/
|
|
2469
|
-
asset
|
|
2729
|
+
asset: Address; /** The block number at which the position was last updated. */
|
|
2470
2730
|
blockNumber: number;
|
|
2471
2731
|
};
|
|
2472
2732
|
declare enum Type {
|
|
2473
2733
|
ERC20 = "erc20",
|
|
2474
|
-
VAULT_V1 = "vault_v1"
|
|
2734
|
+
VAULT_V1 = "vault_v1",
|
|
2735
|
+
DEBT_OF = "debtOf",
|
|
2736
|
+
COLLATERAL_OF = "collateralOf"
|
|
2475
2737
|
}
|
|
2476
2738
|
/**
|
|
2477
2739
|
* @constructor
|
|
@@ -2487,11 +2749,17 @@ declare namespace from$8 {
|
|
|
2487
2749
|
user: Address;
|
|
2488
2750
|
type: Type;
|
|
2489
2751
|
balance?: bigint;
|
|
2490
|
-
asset
|
|
2752
|
+
asset: Address;
|
|
2491
2753
|
blockNumber: number;
|
|
2492
2754
|
};
|
|
2493
2755
|
type ReturnType = Position;
|
|
2494
2756
|
}
|
|
2757
|
+
/**
|
|
2758
|
+
* Maps a {@link Type} enum value to its 1-based integer ID used in the database.
|
|
2759
|
+
* @param type - The position type.
|
|
2760
|
+
* @returns The 1-based integer ID.
|
|
2761
|
+
*/
|
|
2762
|
+
declare const positionTypeId: (type: Type) => number;
|
|
2495
2763
|
declare namespace Quote_d_exports {
|
|
2496
2764
|
export { InvalidQuoteError, Quote, QuoteInput, Side, from$7 as from, fromSnakeCase, random };
|
|
2497
2765
|
}
|
|
@@ -2680,6 +2948,8 @@ type Transfer = {
|
|
|
2680
2948
|
from: Address;
|
|
2681
2949
|
to: Address;
|
|
2682
2950
|
value: bigint;
|
|
2951
|
+
type: Type; /** The underlying asset of the transfer's position. */
|
|
2952
|
+
asset: Address;
|
|
2683
2953
|
blockNumber: number;
|
|
2684
2954
|
};
|
|
2685
2955
|
/**
|
|
@@ -2703,6 +2973,8 @@ declare namespace from$5 {
|
|
|
2703
2973
|
from: Address;
|
|
2704
2974
|
to: Address;
|
|
2705
2975
|
value: bigint;
|
|
2976
|
+
type: Type;
|
|
2977
|
+
asset: Address;
|
|
2706
2978
|
blockNumber: number;
|
|
2707
2979
|
};
|
|
2708
2980
|
type ReturnType = Transfer;
|
|
@@ -3692,7 +3964,7 @@ interface components {
|
|
|
3692
3964
|
* "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3693
3965
|
* },
|
|
3694
3966
|
* "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
|
|
3695
|
-
* "obligation_id": "
|
|
3967
|
+
* "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf79",
|
|
3696
3968
|
* "chain_id": 1,
|
|
3697
3969
|
* "consumed": "0",
|
|
3698
3970
|
* "takeable": "369216000000000000000000",
|
|
@@ -3738,7 +4010,7 @@ interface components {
|
|
|
3738
4010
|
* }
|
|
3739
4011
|
*/
|
|
3740
4012
|
offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
3741
|
-
offer_hash: string; /** @example
|
|
4013
|
+
offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf79 */
|
|
3742
4014
|
obligation_id: string; /** @example 1 */
|
|
3743
4015
|
chain_id: number; /** @example 0 */
|
|
3744
4016
|
consumed: string; /** @example 369216000000000000000000 */
|
|
@@ -3936,7 +4208,7 @@ interface components {
|
|
|
3936
4208
|
* "chain_id": 1,
|
|
3937
4209
|
* "contract": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
3938
4210
|
* "user": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
3939
|
-
* "obligation_id": "
|
|
4211
|
+
* "obligation_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf79",
|
|
3940
4212
|
* "reserved": "200000000000000000000",
|
|
3941
4213
|
* "block_number": 21345678
|
|
3942
4214
|
* }
|
|
@@ -3950,14 +4222,19 @@ interface components {
|
|
|
3950
4222
|
user: string;
|
|
3951
4223
|
/**
|
|
3952
4224
|
* @description Obligation id this reserved amount belongs to, or null if no lots exist.
|
|
3953
|
-
* @example
|
|
4225
|
+
* @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf79
|
|
3954
4226
|
*/
|
|
3955
4227
|
obligation_id: string | null; /** @example 200000000000000000000 */
|
|
3956
4228
|
reserved: string; /** @example 21345678 */
|
|
3957
4229
|
block_number: number;
|
|
3958
4230
|
};
|
|
3959
4231
|
ValidateOffersRequest: {
|
|
3960
|
-
/**
|
|
4232
|
+
/**
|
|
4233
|
+
* @description Chain id used for chain-scoped validation rules.
|
|
4234
|
+
* @example 1
|
|
4235
|
+
*/
|
|
4236
|
+
chain_id: number; /** @description Array of offers in snake_case format. Required, non-empty. */
|
|
4237
|
+
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
3961
4238
|
};
|
|
3962
4239
|
ValidateOfferRequest: {
|
|
3963
4240
|
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
|
|
@@ -3970,8 +4247,7 @@ interface components {
|
|
|
3970
4247
|
start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
3971
4248
|
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
3972
4249
|
session: string; /** @example false */
|
|
3973
|
-
buy: boolean; /** @example
|
|
3974
|
-
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
4250
|
+
buy: boolean; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
3975
4251
|
loan_token: string;
|
|
3976
4252
|
/**
|
|
3977
4253
|
* @example [
|
|
@@ -4034,15 +4310,17 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
|
|
|
4034
4310
|
* @constructor
|
|
4035
4311
|
* @param obligation - {@link Obligation}
|
|
4036
4312
|
* @param quote - {@link Quote}
|
|
4313
|
+
* @param chainId - The chain id used to compute `id`.
|
|
4037
4314
|
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
4038
4315
|
*/
|
|
4039
|
-
declare function from$3(obligation: Obligation, quote: Quote): ObligationResponse;
|
|
4316
|
+
declare function from$3(obligation: Obligation$1, quote: Quote, chainId: Id): ObligationResponse;
|
|
4040
4317
|
declare namespace OfferResponse_d_exports {
|
|
4041
4318
|
export { Input, OfferResponse, from$2 as from };
|
|
4042
4319
|
}
|
|
4043
4320
|
type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
4044
4321
|
type Input = Readonly<{
|
|
4045
4322
|
hash: Hex;
|
|
4323
|
+
obligationId: Hex;
|
|
4046
4324
|
maker: Address;
|
|
4047
4325
|
assets: bigint;
|
|
4048
4326
|
obligationUnits: bigint;
|
|
@@ -4111,6 +4389,33 @@ declare class UsersController {
|
|
|
4111
4389
|
}
|
|
4112
4390
|
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
4113
4391
|
//#endregion
|
|
4392
|
+
//#region src/database/domains/Groups.d.ts
|
|
4393
|
+
type GroupInput = {
|
|
4394
|
+
chainId: Id;
|
|
4395
|
+
maker: Address;
|
|
4396
|
+
group: Hex;
|
|
4397
|
+
blockNumber: number;
|
|
4398
|
+
consumed?: bigint;
|
|
4399
|
+
};
|
|
4400
|
+
type GroupKey = {
|
|
4401
|
+
chainId: Id;
|
|
4402
|
+
maker: Address;
|
|
4403
|
+
group: Hex;
|
|
4404
|
+
};
|
|
4405
|
+
type GroupsDomain = {
|
|
4406
|
+
/**
|
|
4407
|
+
* Insert groups (insert-only).
|
|
4408
|
+
* @param groups - Groups to insert. {@link GroupInput}
|
|
4409
|
+
*/
|
|
4410
|
+
create: (groups: GroupInput[]) => Promise<void>;
|
|
4411
|
+
/**
|
|
4412
|
+
* Check which groups already exist in the database.
|
|
4413
|
+
* @param groups - Group keys to check. {@link GroupKey}
|
|
4414
|
+
* @returns The subset of input groups that exist in the database.
|
|
4415
|
+
*/
|
|
4416
|
+
exists: (groups: GroupKey[]) => Promise<GroupKey[]>;
|
|
4417
|
+
};
|
|
4418
|
+
//#endregion
|
|
4114
4419
|
//#region src/database/domains/Positions.d.ts
|
|
4115
4420
|
type PaginationParams = {
|
|
4116
4421
|
/** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
@@ -4118,7 +4423,8 @@ type PaginationParams = {
|
|
|
4118
4423
|
};
|
|
4119
4424
|
declare namespace getByUser {
|
|
4120
4425
|
type Parameters = PaginationParams & {
|
|
4121
|
-
/** The user address to get positions for. */user: Address;
|
|
4426
|
+
/** The user address to get positions for. */user: Address; /** The type of position to get. Default is all types. */
|
|
4427
|
+
type?: Type;
|
|
4122
4428
|
};
|
|
4123
4429
|
type PositionWithReserved = {
|
|
4124
4430
|
chainId: Id;
|
|
@@ -4192,6 +4498,10 @@ declare const schemas: {
|
|
|
4192
4498
|
loan_token: "loan_token";
|
|
4193
4499
|
collateral_token: "collateral_token";
|
|
4194
4500
|
oracle: "oracle";
|
|
4501
|
+
group_consistency: "group_consistency";
|
|
4502
|
+
group_immutability: "group_immutability";
|
|
4503
|
+
max_collaterals: "max_collaterals";
|
|
4504
|
+
min_duration: "min_duration";
|
|
4195
4505
|
}>>>>;
|
|
4196
4506
|
chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
4197
4507
|
}, z$1.core.$strip>;
|
|
@@ -4239,6 +4549,7 @@ declare const schemas: {
|
|
|
4239
4549
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4240
4550
|
}, z$1.core.$strip>;
|
|
4241
4551
|
readonly validate_offers: z$1.ZodObject<{
|
|
4552
|
+
chain_id: z$1.ZodNumber;
|
|
4242
4553
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
4243
4554
|
}, z$1.core.$strict>;
|
|
4244
4555
|
readonly get_user_positions: z$1.ZodObject<{
|
|
@@ -4353,8 +4664,9 @@ declare namespace getObligations {
|
|
|
4353
4664
|
};
|
|
4354
4665
|
type ReturnType = {
|
|
4355
4666
|
obligations: Compute<{
|
|
4356
|
-
/** The obligation id
|
|
4357
|
-
|
|
4667
|
+
/** The obligation id returned by the API. */id: Hex; /** The chain id used to compute the obligation id. */
|
|
4668
|
+
chainId: Id;
|
|
4669
|
+
} & Obligation$1 & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
|
|
4358
4670
|
cursor: string | null;
|
|
4359
4671
|
};
|
|
4360
4672
|
type ErrorType = GetApiErrorType;
|
|
@@ -4476,6 +4788,22 @@ type ConfigRule = {
|
|
|
4476
4788
|
type: "oracle";
|
|
4477
4789
|
chain_id: Id;
|
|
4478
4790
|
address: Address;
|
|
4791
|
+
} | {
|
|
4792
|
+
type: "group_consistency";
|
|
4793
|
+
chain_id: Id;
|
|
4794
|
+
description: string;
|
|
4795
|
+
} | {
|
|
4796
|
+
type: "group_immutability";
|
|
4797
|
+
chain_id: Id;
|
|
4798
|
+
description: string;
|
|
4799
|
+
} | {
|
|
4800
|
+
type: "max_collaterals";
|
|
4801
|
+
chain_id: Id;
|
|
4802
|
+
max: number;
|
|
4803
|
+
} | {
|
|
4804
|
+
type: "min_duration";
|
|
4805
|
+
chain_id: Id;
|
|
4806
|
+
min_seconds: number;
|
|
4479
4807
|
};
|
|
4480
4808
|
type ValidationIssue = {
|
|
4481
4809
|
index: number;
|
|
@@ -4526,7 +4854,10 @@ type GatekeeperClient = {
|
|
|
4526
4854
|
statusCode: number;
|
|
4527
4855
|
body: ConfigRulesPayload;
|
|
4528
4856
|
}>; /** Validate offers and return decision results. */
|
|
4529
|
-
isAllowed: (
|
|
4857
|
+
isAllowed: (parameters: {
|
|
4858
|
+
offers: Offer[];
|
|
4859
|
+
chainId: number;
|
|
4860
|
+
}) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
|
|
4530
4861
|
baseUrl: string;
|
|
4531
4862
|
};
|
|
4532
4863
|
type ClientConfig = {
|
|
@@ -4542,14 +4873,18 @@ type ClientConfig = {
|
|
|
4542
4873
|
*/
|
|
4543
4874
|
declare function createHttpClient(config: ClientConfig): GatekeeperClient;
|
|
4544
4875
|
declare namespace Gatekeeper_d_exports {
|
|
4545
|
-
export { Gatekeeper, Rules, create };
|
|
4876
|
+
export { Gatekeeper, Rules, RulesFactory, create };
|
|
4546
4877
|
}
|
|
4547
4878
|
type Rules = readonly Rule<Offer, string>[];
|
|
4879
|
+
type RulesFactory = (chainId: Id) => Rules;
|
|
4548
4880
|
type Gatekeeper = {
|
|
4549
|
-
isAllowed: (
|
|
4881
|
+
isAllowed: (parameters: {
|
|
4882
|
+
offers: Offer[];
|
|
4883
|
+
chainId: Id;
|
|
4884
|
+
}) => Promise<Result<Offer, string>>;
|
|
4550
4885
|
};
|
|
4551
4886
|
type GatekeeperParameters = {
|
|
4552
|
-
rules:
|
|
4887
|
+
rules: RulesFactory;
|
|
4553
4888
|
};
|
|
4554
4889
|
/**
|
|
4555
4890
|
* Create a gatekeeper instance with the provided rules.
|
|
@@ -4559,25 +4894,16 @@ type GatekeeperParameters = {
|
|
|
4559
4894
|
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
4560
4895
|
//#endregion
|
|
4561
4896
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
4562
|
-
declare const morphoRules: (
|
|
4897
|
+
declare const morphoRules: (parameters: {
|
|
4898
|
+
chains: Chain$1[];
|
|
4899
|
+
chainId: Id;
|
|
4900
|
+
db?: {
|
|
4901
|
+
groups: GroupsDomain;
|
|
4902
|
+
};
|
|
4903
|
+
}) => Rule<Offer, string>[];
|
|
4563
4904
|
declare namespace Rules_d_exports {
|
|
4564
|
-
export {
|
|
4905
|
+
export { amountMutualExclusivity, callback, collateralToken, groupConsistency, groupImmutability, loanToken, maturity, maxCollaterals, minDuration, oracle, sameMaker };
|
|
4565
4906
|
}
|
|
4566
|
-
type ValidityParameters = {
|
|
4567
|
-
client: PublicClient<Transport, Chain$1>;
|
|
4568
|
-
};
|
|
4569
|
-
/**
|
|
4570
|
-
* set of rules to validate offers.
|
|
4571
|
-
*
|
|
4572
|
-
* @param _parameters - Validity parameters with chain and client
|
|
4573
|
-
* @returns Array of validation rules to evaluate against offers
|
|
4574
|
-
*/
|
|
4575
|
-
declare function validity(_parameters: ValidityParameters): Rule<Offer, "expiry">[];
|
|
4576
|
-
declare const chains: ({
|
|
4577
|
-
chains
|
|
4578
|
-
}: {
|
|
4579
|
-
chains: Chain$1[];
|
|
4580
|
-
}) => Rule<Offer, "chain_ids">;
|
|
4581
4907
|
declare const maturity: ({
|
|
4582
4908
|
maturities
|
|
4583
4909
|
}: {
|
|
@@ -4595,9 +4921,11 @@ declare const callback: ({
|
|
|
4595
4921
|
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4596
4922
|
*/
|
|
4597
4923
|
declare const loanToken: ({
|
|
4598
|
-
assetsByChainId
|
|
4924
|
+
assetsByChainId,
|
|
4925
|
+
chainId
|
|
4599
4926
|
}: {
|
|
4600
4927
|
assetsByChainId: Partial<Record<Id, Address[]>>;
|
|
4928
|
+
chainId: Id;
|
|
4601
4929
|
}) => Rule<Offer, "loan_token">;
|
|
4602
4930
|
/**
|
|
4603
4931
|
* A validation rule that checks if the offer's collateral tokens are allowed for its chain.
|
|
@@ -4605,9 +4933,11 @@ declare const loanToken: ({
|
|
|
4605
4933
|
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4606
4934
|
*/
|
|
4607
4935
|
declare const collateralToken: ({
|
|
4608
|
-
collateralAssetsByChainId
|
|
4936
|
+
collateralAssetsByChainId,
|
|
4937
|
+
chainId
|
|
4609
4938
|
}: {
|
|
4610
4939
|
collateralAssetsByChainId: Partial<Record<Id, Address[]>>;
|
|
4940
|
+
chainId: Id;
|
|
4611
4941
|
}) => Rule<Offer, "collateral_token">;
|
|
4612
4942
|
/**
|
|
4613
4943
|
* A validation rule that checks if the offer's oracle addresses are allowed for its chain.
|
|
@@ -4615,9 +4945,11 @@ declare const collateralToken: ({
|
|
|
4615
4945
|
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4616
4946
|
*/
|
|
4617
4947
|
declare const oracle: ({
|
|
4618
|
-
oraclesByChainId
|
|
4948
|
+
oraclesByChainId,
|
|
4949
|
+
chainId
|
|
4619
4950
|
}: {
|
|
4620
4951
|
oraclesByChainId: Partial<Record<Id, Address[]>>;
|
|
4952
|
+
chainId: Id;
|
|
4621
4953
|
}) => Rule<Offer, "oracle">;
|
|
4622
4954
|
/**
|
|
4623
4955
|
* A batch validation rule that ensures all offers in a tree have the same maker address.
|
|
@@ -4630,7 +4962,46 @@ declare const sameMaker: () => Rule<Offer, "mixed_maker">;
|
|
|
4630
4962
|
* At most one of (assets, obligationUnits, obligationShares) can be non-zero.
|
|
4631
4963
|
* Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
|
|
4632
4964
|
*/
|
|
4965
|
+
/**
|
|
4966
|
+
* A validation rule that checks if the offer duration (expiry - start) meets a minimum threshold.
|
|
4967
|
+
* @param minSeconds - Minimum required duration in seconds.
|
|
4968
|
+
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4969
|
+
*/
|
|
4970
|
+
declare const minDuration: ({
|
|
4971
|
+
minSeconds
|
|
4972
|
+
}: {
|
|
4973
|
+
minSeconds: number;
|
|
4974
|
+
}) => Rule<Offer, "min_duration">;
|
|
4975
|
+
/**
|
|
4976
|
+
* A validation rule that checks if an offer exceeds the maximum number of collaterals.
|
|
4977
|
+
* The contract enforces this limit; this rule rejects early to avoid on-chain reverts.
|
|
4978
|
+
* @param max - Maximum allowed collaterals per offer.
|
|
4979
|
+
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4980
|
+
*/
|
|
4981
|
+
declare const maxCollaterals: ({
|
|
4982
|
+
max
|
|
4983
|
+
}: {
|
|
4984
|
+
max: number;
|
|
4985
|
+
}) => Rule<Offer, "max_collaterals">;
|
|
4633
4986
|
declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
|
|
4987
|
+
/**
|
|
4988
|
+
* A batch validation rule that ensures all offers within the same group are consistent.
|
|
4989
|
+
* All offers sharing the same group must have the same loan token, assets amount, and side (buy/sell).
|
|
4990
|
+
*/
|
|
4991
|
+
declare const groupConsistency: () => Rule<Offer, "group_consistency">;
|
|
4992
|
+
/**
|
|
4993
|
+
* A batch validation rule that prevents adding offers to groups that already exist in the database.
|
|
4994
|
+
* Groups are immutable after creation — new offers cannot be added to an existing group.
|
|
4995
|
+
*/
|
|
4996
|
+
declare const groupImmutability: ({
|
|
4997
|
+
db,
|
|
4998
|
+
chainId
|
|
4999
|
+
}: {
|
|
5000
|
+
db: {
|
|
5001
|
+
groups: GroupsDomain;
|
|
5002
|
+
};
|
|
5003
|
+
chainId: Id;
|
|
5004
|
+
}) => Rule<Offer, "group_immutability">;
|
|
4634
5005
|
//#endregion
|
|
4635
5006
|
//#region src/mempool/MempoolEVMClient.d.ts
|
|
4636
5007
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
@@ -4692,7 +5063,7 @@ declare namespace connect {
|
|
|
4692
5063
|
}
|
|
4693
5064
|
//#endregion
|
|
4694
5065
|
//#region src/utils/BigMath.d.ts
|
|
4695
|
-
declare function max$
|
|
5066
|
+
declare function max$2(a: bigint, b: bigint): bigint;
|
|
4696
5067
|
declare function min(a: bigint, b: bigint): bigint;
|
|
4697
5068
|
/**
|
|
4698
5069
|
* Checks if at most one of the given values is non-zero.
|
|
@@ -4812,16 +5183,16 @@ declare function address(): Address;
|
|
|
4812
5183
|
//#region src/utils/retry.d.ts
|
|
4813
5184
|
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
4814
5185
|
declare namespace time_d_exports {
|
|
4815
|
-
export { max, now };
|
|
5186
|
+
export { max$1 as max, now };
|
|
4816
5187
|
}
|
|
4817
5188
|
declare function now(): number;
|
|
4818
|
-
declare function max(): number;
|
|
5189
|
+
declare function max$1(): number;
|
|
4819
5190
|
//#endregion
|
|
4820
5191
|
//#region src/utils/wait.d.ts
|
|
4821
5192
|
declare function wait(time: number): Promise<unknown>;
|
|
4822
5193
|
declare namespace index_d_exports$2 {
|
|
4823
|
-
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$
|
|
5194
|
+
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 };
|
|
4824
5195
|
}
|
|
4825
5196
|
//#endregion
|
|
4826
|
-
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ConfigRule, ConfigRulesPayload, 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, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports$1 as RouterClient, 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, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
|
|
5197
|
+
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ConfigRule, ConfigRulesPayload, 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, Id_d_exports as Id, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports$1 as RouterClient, 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, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
|
|
4827
5198
|
//# sourceMappingURL=index.browser.d.mts.map
|