@morpho-dev/router 0.4.2 → 0.6.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/README.md +18 -5
- package/dist/chunk-Bo1DHCg-.mjs +18 -0
- package/dist/cli.js +5927 -4450
- package/dist/drizzle/migrations/0023_remove-block-number-for-collaterals.sql +1 -0
- package/dist/drizzle/migrations/meta/0023_snapshot.json +1436 -0
- package/dist/drizzle/migrations/meta/_journal.json +7 -0
- package/dist/index.browser.d.mts +875 -566
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +875 -566
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1441 -667
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +1421 -662
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +1149 -807
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +1148 -806
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +4666 -3264
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +4540 -3165
- package/dist/index.node.mjs.map +1 -1
- package/docs/integrator.md +7 -1
- package/package.json +6 -6
- package/dist/chunk-jass6xSI.mjs +0 -13
package/dist/index.browser.d.mts
CHANGED
|
@@ -13,14 +13,14 @@ import "pg";
|
|
|
13
13
|
|
|
14
14
|
//#region src/api/Schema/BookResponse.d.ts
|
|
15
15
|
declare namespace BookResponse_d_exports {
|
|
16
|
-
export { BookLevelResponse, from$
|
|
16
|
+
export { BookLevelResponse, from$15 as from };
|
|
17
17
|
}
|
|
18
18
|
type BookLevelResponse = {
|
|
19
19
|
price: string;
|
|
20
20
|
assets: string;
|
|
21
21
|
count: number;
|
|
22
22
|
};
|
|
23
|
-
declare function from$
|
|
23
|
+
declare function from$15(level: {
|
|
24
24
|
price: bigint;
|
|
25
25
|
assets: bigint;
|
|
26
26
|
count: number;
|
|
@@ -34,9 +34,9 @@ declare const CollectorHealth: z.ZodObject<{
|
|
|
34
34
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
35
35
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
36
36
|
status: z.ZodEnum<{
|
|
37
|
+
unknown: "unknown";
|
|
37
38
|
live: "live";
|
|
38
39
|
lagging: "lagging";
|
|
39
|
-
unknown: "unknown";
|
|
40
40
|
}>;
|
|
41
41
|
initialized: z.ZodBoolean;
|
|
42
42
|
}, z.core.$strip>;
|
|
@@ -47,9 +47,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
|
47
47
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
48
48
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
49
49
|
status: z.ZodEnum<{
|
|
50
|
+
unknown: "unknown";
|
|
50
51
|
live: "live";
|
|
51
52
|
lagging: "lagging";
|
|
52
|
-
unknown: "unknown";
|
|
53
53
|
}>;
|
|
54
54
|
initialized: z.ZodBoolean;
|
|
55
55
|
}, z.core.$strip>>;
|
|
@@ -344,19 +344,48 @@ declare const Morpho: readonly [{
|
|
|
344
344
|
}];
|
|
345
345
|
readonly stateMutability: "view";
|
|
346
346
|
}];
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/core/types.d.ts
|
|
349
|
+
/** Combines members of an intersection into a readable type. */
|
|
350
|
+
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
351
|
+
declare const BrandTypeId: unique symbol;
|
|
352
|
+
type Brand<in out ID extends string | symbol> = {
|
|
353
|
+
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
354
|
+
};
|
|
347
355
|
declare namespace Callback_d_exports {
|
|
348
|
-
export { BuyVaultV1CallbackData,
|
|
356
|
+
export { BuyERC20Data, BuyVaultV1CallbackData, Callback, CallbackPosition, SellERC20CallbackData, Type$1 as Type, decode$2 as decode, decodeBuyERC20, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$2 as encode, encodeBuyERC20, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
349
357
|
}
|
|
350
|
-
|
|
358
|
+
/** A position decoded from callback data. */
|
|
359
|
+
type CallbackPosition = {
|
|
360
|
+
/** The ERC20 token contract address. */contract: Address; /** The maximum amount available from this position. */
|
|
361
|
+
amount: bigint;
|
|
362
|
+
};
|
|
363
|
+
type Callback = {
|
|
364
|
+
type: Type$1.BuyWithEmptyCallback;
|
|
365
|
+
} | (({
|
|
366
|
+
/** The address of the callback contract. */address: Address; /** The ABI-encoded callback data. */
|
|
367
|
+
data: Hex;
|
|
368
|
+
} & {
|
|
369
|
+
type: Type$1.BuyERC20; /** The decoded callback inputs. */
|
|
370
|
+
inputs: {
|
|
371
|
+
/** The ERC20 positions available for the callback. */positions: CallbackPosition[];
|
|
372
|
+
};
|
|
373
|
+
}) & Brand<"Callback">);
|
|
374
|
+
declare enum Type$1 {
|
|
351
375
|
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
376
|
+
BuyERC20 = "buy_erc20",
|
|
352
377
|
BuyVaultV1Callback = "buy_vault_v1_callback",
|
|
353
|
-
SellERC20Callback = "sell_erc20_callback"
|
|
378
|
+
SellERC20Callback = "sell_erc20_callback"
|
|
354
379
|
}
|
|
355
380
|
declare const isEmptyCallback: (offer: Offer) => boolean;
|
|
356
|
-
declare function decode$2(type:
|
|
381
|
+
declare function decode$2(type: Type$1, data: Hex): {
|
|
357
382
|
contract: Address;
|
|
358
383
|
amount: bigint;
|
|
359
384
|
}[];
|
|
385
|
+
type BuyERC20Data = {
|
|
386
|
+
tokens: Address[];
|
|
387
|
+
amounts: bigint[];
|
|
388
|
+
};
|
|
360
389
|
type BuyVaultV1CallbackData = {
|
|
361
390
|
vaults: Address[];
|
|
362
391
|
amounts: bigint[];
|
|
@@ -365,8 +394,28 @@ type SellERC20CallbackData = {
|
|
|
365
394
|
collaterals: Address[];
|
|
366
395
|
amounts: bigint[];
|
|
367
396
|
};
|
|
368
|
-
declare function encode$2(type:
|
|
369
|
-
declare function encode$2(type:
|
|
397
|
+
declare function encode$2(type: Type$1.BuyERC20, data: BuyERC20Data): Hex;
|
|
398
|
+
declare function encode$2(type: Type$1.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
|
|
399
|
+
declare function encode$2(type: Type$1.SellERC20Callback, data: SellERC20CallbackData): Hex;
|
|
400
|
+
/**
|
|
401
|
+
* Decodes BuyERC20 callback data into positions.
|
|
402
|
+
* @param data - The ABI-encoded callback data containing token addresses and amounts.
|
|
403
|
+
* @returns Array of positions with contract address and amount.
|
|
404
|
+
* @throws If data is empty, malformed, or arrays have mismatched lengths.
|
|
405
|
+
*/
|
|
406
|
+
declare function decodeBuyERC20(data: Hex): Array<{
|
|
407
|
+
contract: Address;
|
|
408
|
+
amount: bigint;
|
|
409
|
+
}>;
|
|
410
|
+
/**
|
|
411
|
+
* Encodes BuyERC20 callback parameters into ABI-encoded data.
|
|
412
|
+
* @param parameters - The tokens and amounts to encode.
|
|
413
|
+
* @returns ABI-encoded hex string.
|
|
414
|
+
*/
|
|
415
|
+
declare function encodeBuyERC20(parameters: {
|
|
416
|
+
tokens: Address[];
|
|
417
|
+
amounts: bigint[];
|
|
418
|
+
}): Hex;
|
|
370
419
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
371
420
|
contract: Address;
|
|
372
421
|
amount: bigint;
|
|
@@ -428,6 +477,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
|
428
477
|
v1_1: ChainContract;
|
|
429
478
|
};
|
|
430
479
|
};
|
|
480
|
+
callbacks: Callback[];
|
|
431
481
|
}>, "custom"> & {
|
|
432
482
|
id: Id;
|
|
433
483
|
name: Name;
|
|
@@ -441,6 +491,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
|
441
491
|
v1_1: ChainContract;
|
|
442
492
|
};
|
|
443
493
|
};
|
|
494
|
+
callbacks: Callback[];
|
|
444
495
|
};
|
|
445
496
|
}>;
|
|
446
497
|
declare const ChainId: {
|
|
@@ -494,17 +545,14 @@ type ChainRegistry = {
|
|
|
494
545
|
getById: (chainId: Id) => Chain$1 | undefined;
|
|
495
546
|
list: () => Chain$1[];
|
|
496
547
|
};
|
|
548
|
+
/**
|
|
549
|
+
* Creates a chain registry from a list of chains.
|
|
550
|
+
* @param chains - Array of chain objects to register.
|
|
551
|
+
* @returns A registry for looking up chains by ID. {@link ChainRegistry}
|
|
552
|
+
*/
|
|
497
553
|
declare function create$1(chains: Chain$1[]): ChainRegistry;
|
|
498
|
-
//#endregion
|
|
499
|
-
//#region src/core/types.d.ts
|
|
500
|
-
/** Combines members of an intersection into a readable type. */
|
|
501
|
-
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
502
|
-
declare const BrandTypeId: unique symbol;
|
|
503
|
-
type Brand<in out ID extends string | symbol> = {
|
|
504
|
-
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
505
|
-
};
|
|
506
554
|
declare namespace LLTV_d_exports {
|
|
507
|
-
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$
|
|
555
|
+
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$14 as from };
|
|
508
556
|
}
|
|
509
557
|
type LLTV = bigint & Brand<"LLTV">;
|
|
510
558
|
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
@@ -514,8 +562,8 @@ type Options = (typeof Options)[number];
|
|
|
514
562
|
* @param lltv - The LLTV option or the scaled LLTV.
|
|
515
563
|
* @returns The LLTV.
|
|
516
564
|
*/
|
|
517
|
-
declare function from$
|
|
518
|
-
declare namespace from$
|
|
565
|
+
declare function from$14(lltv: Options | bigint): LLTV;
|
|
566
|
+
declare namespace from$14 {
|
|
519
567
|
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
520
568
|
}
|
|
521
569
|
declare class InvalidOptionError$1 extends BaseError {
|
|
@@ -528,14 +576,11 @@ declare class InvalidLLTVError extends BaseError {
|
|
|
528
576
|
}
|
|
529
577
|
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
530
578
|
declare namespace Collateral_d_exports {
|
|
531
|
-
export { Collateral, CollateralSchema, CollateralsSchema, from$
|
|
579
|
+
export { Collateral, CollateralSchema, CollateralsSchema, from$13 as from, random$3 as random };
|
|
532
580
|
}
|
|
533
581
|
type Collateral = {
|
|
534
|
-
/** Asset being used as collateral. */
|
|
535
|
-
|
|
536
|
-
/** Liquidation Loan-to-Value of the collateral. */
|
|
537
|
-
lltv: LLTV;
|
|
538
|
-
/** Oracle contract used to price the collateral. */
|
|
582
|
+
/** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
|
|
583
|
+
lltv: LLTV; /** Oracle contract used to price the collateral. */
|
|
539
584
|
oracle: Address;
|
|
540
585
|
};
|
|
541
586
|
declare const CollateralSchema: z$1.ZodObject<{
|
|
@@ -548,8 +593,8 @@ declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
|
548
593
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
549
594
|
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
550
595
|
}, z$1.core.$strip>>;
|
|
551
|
-
declare const from$
|
|
552
|
-
declare namespace from$
|
|
596
|
+
declare const from$13: (parameters: from$13.Parameters) => from$13.ReturnType;
|
|
597
|
+
declare namespace from$13 {
|
|
553
598
|
type Parameters = {
|
|
554
599
|
asset: Address;
|
|
555
600
|
lltv: Options | bigint;
|
|
@@ -587,8 +632,7 @@ declare namespace ERC4626_d_exports {
|
|
|
587
632
|
declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
|
|
588
633
|
declare namespace decimalsOffset {
|
|
589
634
|
type Parameters = {
|
|
590
|
-
/** The number of decimals of the underlying asset. */
|
|
591
|
-
underlyingDecimals: number;
|
|
635
|
+
/** The number of decimals of the underlying asset. */underlyingDecimals: number;
|
|
592
636
|
};
|
|
593
637
|
type ReturnType = number;
|
|
594
638
|
}
|
|
@@ -607,11 +651,8 @@ declare namespace decimalsOffset {
|
|
|
607
651
|
declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
|
|
608
652
|
declare namespace convertToAssets {
|
|
609
653
|
type Parameters = {
|
|
610
|
-
/** The amount of shares to convert. */
|
|
611
|
-
|
|
612
|
-
/** Total amount of assets in the vault. */
|
|
613
|
-
totalAssets: bigint;
|
|
614
|
-
/** Total amount of shares in the vault. */
|
|
654
|
+
/** The amount of shares to convert. */shares: bigint; /** Total amount of assets in the vault. */
|
|
655
|
+
totalAssets: bigint; /** Total amount of shares in the vault. */
|
|
615
656
|
totalSupply: bigint;
|
|
616
657
|
/**
|
|
617
658
|
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
@@ -638,11 +679,8 @@ declare namespace convertToAssets {
|
|
|
638
679
|
declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
|
|
639
680
|
declare namespace convertToShares {
|
|
640
681
|
type Parameters = {
|
|
641
|
-
/** The amount of assets to convert. */
|
|
642
|
-
|
|
643
|
-
/** Total amount of assets in the vault. */
|
|
644
|
-
totalAssets: bigint;
|
|
645
|
-
/** Total amount of shares in the vault. */
|
|
682
|
+
/** The amount of assets to convert. */assets: bigint; /** Total amount of assets in the vault. */
|
|
683
|
+
totalAssets: bigint; /** Total amount of shares in the vault. */
|
|
646
684
|
totalSupply: bigint;
|
|
647
685
|
/**
|
|
648
686
|
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
@@ -778,7 +816,7 @@ declare function generateMarketLiquidityPoolId(parameters: {
|
|
|
778
816
|
marketId: string;
|
|
779
817
|
}): string;
|
|
780
818
|
declare namespace Maturity_d_exports {
|
|
781
|
-
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$
|
|
819
|
+
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$12 as from };
|
|
782
820
|
}
|
|
783
821
|
/**
|
|
784
822
|
* Maturity is a number that represents a date in seconds.
|
|
@@ -791,7 +829,7 @@ declare enum MaturityType {
|
|
|
791
829
|
EndOfMonth = "end_of_month",
|
|
792
830
|
EndOfNextMonth = "end_of_next_month",
|
|
793
831
|
EndOfQuarter = "end_of_quarter",
|
|
794
|
-
EndOfNextQuarter = "end_of_next_quarter"
|
|
832
|
+
EndOfNextQuarter = "end_of_next_quarter"
|
|
795
833
|
}
|
|
796
834
|
declare const MaturityOptions: {
|
|
797
835
|
readonly end_of_week: () => Maturity;
|
|
@@ -808,8 +846,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
|
|
|
808
846
|
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
809
847
|
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
810
848
|
*/
|
|
811
|
-
declare function from$
|
|
812
|
-
declare namespace from$
|
|
849
|
+
declare function from$12(ts: from$12.Parameters): Maturity;
|
|
850
|
+
declare namespace from$12 {
|
|
813
851
|
type Parameters = number | MaturityOptions;
|
|
814
852
|
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
815
853
|
}
|
|
@@ -853,16 +891,12 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
853
891
|
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
854
892
|
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
855
893
|
declare namespace Obligation_d_exports {
|
|
856
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$
|
|
894
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
857
895
|
}
|
|
858
896
|
type Obligation = {
|
|
859
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
860
|
-
|
|
861
|
-
/** The
|
|
862
|
-
loanToken: Address;
|
|
863
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
864
|
-
collaterals: Collateral[];
|
|
865
|
-
/** The maturity of the obligation. */
|
|
897
|
+
/** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
|
|
898
|
+
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
899
|
+
collaterals: Collateral[]; /** The maturity of the obligation. */
|
|
866
900
|
maturity: Maturity;
|
|
867
901
|
};
|
|
868
902
|
declare const ObligationSchema: z$1.ZodObject<{
|
|
@@ -898,17 +932,13 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
898
932
|
* });
|
|
899
933
|
* ```
|
|
900
934
|
*/
|
|
901
|
-
declare function from$
|
|
902
|
-
declare namespace from$
|
|
935
|
+
declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
|
|
936
|
+
declare namespace from$11 {
|
|
903
937
|
type Parameters = {
|
|
904
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
909
|
-
collaterals: from$12.Parameters[] | readonly from$12.Parameters[];
|
|
910
|
-
/** The maturity of the obligation. */
|
|
911
|
-
maturity: from$11.Parameters;
|
|
938
|
+
/** The chain id where the liquidity for this obligation is located. */chainId: number; /** The token that is being borrowed for this obligation. */
|
|
939
|
+
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
940
|
+
collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
|
|
941
|
+
maturity: from$12.Parameters;
|
|
912
942
|
};
|
|
913
943
|
type ReturnType = Obligation;
|
|
914
944
|
type ErrorType = InvalidObligationError;
|
|
@@ -969,6 +999,18 @@ declare function random$2(): random$2.ReturnType;
|
|
|
969
999
|
declare namespace random$2 {
|
|
970
1000
|
type ReturnType = Obligation;
|
|
971
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Creates an obligation from an offer.
|
|
1004
|
+
* @constructor
|
|
1005
|
+
*
|
|
1006
|
+
* @param offer - The offer to create the obligation from.
|
|
1007
|
+
* @returns The created obligation. {@link fromOffer.ReturnType}
|
|
1008
|
+
*/
|
|
1009
|
+
declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
|
|
1010
|
+
declare namespace fromOffer$1 {
|
|
1011
|
+
type Parameters = Offer;
|
|
1012
|
+
type ReturnType = Obligation;
|
|
1013
|
+
}
|
|
972
1014
|
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
973
1015
|
readonly name = "Obligation.InvalidObligationError";
|
|
974
1016
|
constructor(error: z$1.ZodError | Error);
|
|
@@ -978,38 +1020,23 @@ declare class CollateralsAreNotSortedError extends BaseError {
|
|
|
978
1020
|
constructor();
|
|
979
1021
|
}
|
|
980
1022
|
declare namespace Offer_d_exports {
|
|
981
|
-
export {
|
|
1023
|
+
export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, toSnakeCase, types };
|
|
982
1024
|
}
|
|
983
1025
|
type Offer = {
|
|
984
|
-
/** The address that made the offer. */
|
|
985
|
-
readonly
|
|
986
|
-
/** The
|
|
987
|
-
readonly
|
|
988
|
-
|
|
989
|
-
readonly
|
|
990
|
-
|
|
991
|
-
readonly
|
|
992
|
-
/** The
|
|
993
|
-
readonly
|
|
994
|
-
/** The
|
|
995
|
-
readonly
|
|
996
|
-
/** The
|
|
997
|
-
readonly
|
|
998
|
-
/** The date at which the offer will start. */
|
|
999
|
-
readonly start: number;
|
|
1000
|
-
/** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
1001
|
-
readonly group: Hex;
|
|
1002
|
-
/** The session. Used for session-based offer management. */
|
|
1003
|
-
readonly session: Hex;
|
|
1004
|
-
/** The side of the offer. `true` for buy, `false` for sell. */
|
|
1005
|
-
readonly buy: boolean;
|
|
1006
|
-
/** The chain id where the liquidity for this offer is located. */
|
|
1007
|
-
readonly chainId: Id;
|
|
1008
|
-
/** The token that is being borrowed. */
|
|
1009
|
-
readonly loanToken: Address;
|
|
1010
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
1011
|
-
readonly collaterals: readonly Collateral[];
|
|
1012
|
-
/** The optional callback data to retrieve the maker funds. */
|
|
1026
|
+
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
1027
|
+
readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
|
|
1028
|
+
readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
|
|
1029
|
+
readonly obligationShares: bigint; /** The price (18 decimals). */
|
|
1030
|
+
readonly price: bigint; /** The date at which all interests will be paid. */
|
|
1031
|
+
readonly maturity: Maturity; /** The date at which the offer will expire. */
|
|
1032
|
+
readonly expiry: number; /** The date at which the offer will start. */
|
|
1033
|
+
readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
1034
|
+
readonly group: Hex; /** The session. Used for session-based offer management. */
|
|
1035
|
+
readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
|
|
1036
|
+
readonly buy: boolean; /** The chain id where the liquidity for this offer is located. */
|
|
1037
|
+
readonly chainId: Id; /** The token that is being borrowed. */
|
|
1038
|
+
readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1039
|
+
readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
|
|
1013
1040
|
readonly callback: {
|
|
1014
1041
|
readonly address: Address;
|
|
1015
1042
|
readonly data: Hex;
|
|
@@ -1017,7 +1044,7 @@ type Offer = {
|
|
|
1017
1044
|
};
|
|
1018
1045
|
declare enum Status {
|
|
1019
1046
|
VALID = "VALID",
|
|
1020
|
-
SIMULATION_ERROR = "SIMULATION_ERROR"
|
|
1047
|
+
SIMULATION_ERROR = "SIMULATION_ERROR"
|
|
1021
1048
|
}
|
|
1022
1049
|
type Validation = {
|
|
1023
1050
|
offerHash: Hex;
|
|
@@ -1060,12 +1087,9 @@ declare const OfferSchema: () => z$1.ZodObject<{
|
|
|
1060
1087
|
*/
|
|
1061
1088
|
type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares"> & {
|
|
1062
1089
|
chainId: number;
|
|
1063
|
-
group: Hex | bigint | number | string;
|
|
1064
|
-
/** Optional: defaults to
|
|
1065
|
-
|
|
1066
|
-
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
1067
|
-
obligationUnits?: bigint;
|
|
1068
|
-
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
1090
|
+
group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
|
|
1091
|
+
session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
1092
|
+
obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
1069
1093
|
obligationShares?: bigint;
|
|
1070
1094
|
}>;
|
|
1071
1095
|
/**
|
|
@@ -1074,8 +1098,8 @@ type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligat
|
|
|
1074
1098
|
* @param input - The offer to create.
|
|
1075
1099
|
* @returns The created offer.
|
|
1076
1100
|
*/
|
|
1077
|
-
declare function from$
|
|
1078
|
-
declare namespace from$
|
|
1101
|
+
declare function from$10(input: OfferInput): Offer;
|
|
1102
|
+
declare namespace from$10 {
|
|
1079
1103
|
type ErrorType = InvalidOfferError;
|
|
1080
1104
|
}
|
|
1081
1105
|
/**
|
|
@@ -1235,15 +1259,6 @@ declare const types: {
|
|
|
1235
1259
|
readonly type: "bytes";
|
|
1236
1260
|
}];
|
|
1237
1261
|
};
|
|
1238
|
-
/**
|
|
1239
|
-
* Signs an array of offers.
|
|
1240
|
-
* @throws {Error} If the wallet account is not set.
|
|
1241
|
-
* @param offers - The offers to sign.
|
|
1242
|
-
* @param wallet - The wallet to sign the offers with.
|
|
1243
|
-
* @returns The signed offers.
|
|
1244
|
-
*/
|
|
1245
|
-
declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
|
|
1246
|
-
declare function signatureMsg(offers: Offer[]): Hex;
|
|
1247
1262
|
declare function hash(offer: Offer): Hex;
|
|
1248
1263
|
/**
|
|
1249
1264
|
* Calculates the obligation id for an offer based on the smart contract's Obligation struct.
|
|
@@ -1301,24 +1316,16 @@ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
|
1301
1316
|
*/
|
|
1302
1317
|
get formattedMessage(): string;
|
|
1303
1318
|
}
|
|
1304
|
-
declare class AccountNotSetError extends BaseError {
|
|
1305
|
-
readonly name = "Offer.AccountNotSetError";
|
|
1306
|
-
constructor();
|
|
1307
|
-
}
|
|
1308
1319
|
declare namespace Oracle_d_exports {
|
|
1309
|
-
export { Conversion, Oracle, from$
|
|
1320
|
+
export { Conversion, Oracle, from$9 as from, fromCollateral, fromOffer, fromOffers };
|
|
1310
1321
|
}
|
|
1311
1322
|
/**
|
|
1312
1323
|
* An oracle contract that provides price information for assets.
|
|
1313
1324
|
*/
|
|
1314
1325
|
type Oracle = {
|
|
1315
|
-
/** The chain id where the oracle is deployed. */
|
|
1316
|
-
readonly
|
|
1317
|
-
/** The
|
|
1318
|
-
readonly address: Address;
|
|
1319
|
-
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1320
|
-
readonly price: bigint | null;
|
|
1321
|
-
/** The block number at which the price was fetched. */
|
|
1326
|
+
/** The chain id where the oracle is deployed. */readonly chainId: Id; /** The address of the oracle contract. */
|
|
1327
|
+
readonly address: Address; /** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1328
|
+
readonly price: bigint | null; /** The block number at which the price was fetched. */
|
|
1322
1329
|
readonly blockNumber: number;
|
|
1323
1330
|
};
|
|
1324
1331
|
/**
|
|
@@ -1326,8 +1333,8 @@ type Oracle = {
|
|
|
1326
1333
|
* @param data - The data to create the oracle from.
|
|
1327
1334
|
* @returns The created oracle.
|
|
1328
1335
|
*/
|
|
1329
|
-
declare function from$
|
|
1330
|
-
declare namespace from$
|
|
1336
|
+
declare function from$9(data: from$9.Parameters): from$9.ReturnType;
|
|
1337
|
+
declare namespace from$9 {
|
|
1331
1338
|
type Parameters = {
|
|
1332
1339
|
chainId: Id;
|
|
1333
1340
|
address: Address;
|
|
@@ -1336,6 +1343,55 @@ declare namespace from$8 {
|
|
|
1336
1343
|
};
|
|
1337
1344
|
type ReturnType = Oracle;
|
|
1338
1345
|
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Creates an oracle from a collateral.
|
|
1348
|
+
* @constructor
|
|
1349
|
+
*
|
|
1350
|
+
* @param parameters - {@link fromCollateral.Parameters}
|
|
1351
|
+
* @returns The created oracle. {@link fromCollateral.ReturnType}
|
|
1352
|
+
*/
|
|
1353
|
+
declare function fromCollateral(parameters: fromCollateral.Parameters): fromCollateral.ReturnType;
|
|
1354
|
+
declare namespace fromCollateral {
|
|
1355
|
+
type Parameters = {
|
|
1356
|
+
chainId: Id;
|
|
1357
|
+
collateral: Collateral;
|
|
1358
|
+
blockNumber: number;
|
|
1359
|
+
price?: bigint | null;
|
|
1360
|
+
};
|
|
1361
|
+
type ReturnType = Oracle;
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Creates oracles from a single offer.
|
|
1365
|
+
* @constructor
|
|
1366
|
+
*
|
|
1367
|
+
* @param parameters - {@link fromOffer.Parameters}
|
|
1368
|
+
* @returns The created oracles. {@link fromOffer.ReturnType}
|
|
1369
|
+
*/
|
|
1370
|
+
declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
|
|
1371
|
+
declare namespace fromOffer {
|
|
1372
|
+
type Parameters = {
|
|
1373
|
+
offer: Offer;
|
|
1374
|
+
blockNumber: number;
|
|
1375
|
+
price?: bigint | null;
|
|
1376
|
+
};
|
|
1377
|
+
type ReturnType = Oracle[];
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Creates oracles from a list of offers.
|
|
1381
|
+
* @constructor
|
|
1382
|
+
*
|
|
1383
|
+
* @param parameters - {@link fromOffers.Parameters}
|
|
1384
|
+
* @returns The created oracles. {@link fromOffers.ReturnType}
|
|
1385
|
+
*/
|
|
1386
|
+
declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
|
|
1387
|
+
declare namespace fromOffers {
|
|
1388
|
+
type Parameters = {
|
|
1389
|
+
offers: Offer[];
|
|
1390
|
+
blockNumber: number;
|
|
1391
|
+
price?: bigint | null;
|
|
1392
|
+
};
|
|
1393
|
+
type ReturnType = Oracle[];
|
|
1394
|
+
}
|
|
1339
1395
|
/**
|
|
1340
1396
|
* Conversion utilities for converting between collateral and loan token amounts
|
|
1341
1397
|
* using oracle prices and LLTV
|
|
@@ -1368,33 +1424,28 @@ declare namespace Conversion {
|
|
|
1368
1424
|
}): bigint;
|
|
1369
1425
|
}
|
|
1370
1426
|
declare namespace Position_d_exports {
|
|
1371
|
-
export { Position, Type, from$
|
|
1427
|
+
export { Position, Type, from$8 as from };
|
|
1372
1428
|
}
|
|
1373
1429
|
type Position = {
|
|
1374
|
-
/** The chain id. */
|
|
1375
|
-
chainId: Id;
|
|
1430
|
+
/** The chain id. */chainId: Id;
|
|
1376
1431
|
/** The contract address from which the position is called.
|
|
1377
1432
|
* While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
|
|
1378
1433
|
* For example, when depositing into a vault, we would specify the vault contract address as the contract not the underlying vault's ERC20 token address.
|
|
1379
1434
|
*/
|
|
1380
|
-
contract: Address;
|
|
1381
|
-
/** The
|
|
1382
|
-
|
|
1383
|
-
/** The type of position. */
|
|
1384
|
-
type: Type;
|
|
1385
|
-
/** The balance of the position. */
|
|
1435
|
+
contract: Address; /** The user address. */
|
|
1436
|
+
user: Address; /** The type of position. */
|
|
1437
|
+
type: Type; /** The balance of the position. */
|
|
1386
1438
|
balance?: bigint;
|
|
1387
1439
|
/** The underlying asset of the position.
|
|
1388
1440
|
* For ERC20 positions, this equals the contract address.
|
|
1389
1441
|
* For vault positions, this is the vault's underlying asset.
|
|
1390
1442
|
*/
|
|
1391
|
-
asset?: Address;
|
|
1392
|
-
/** The block number at which the position was last updated. */
|
|
1443
|
+
asset?: Address; /** The block number at which the position was last updated. */
|
|
1393
1444
|
blockNumber: number;
|
|
1394
1445
|
};
|
|
1395
1446
|
declare enum Type {
|
|
1396
1447
|
ERC20 = "erc20",
|
|
1397
|
-
VAULT_V1 = "vault_v1"
|
|
1448
|
+
VAULT_V1 = "vault_v1"
|
|
1398
1449
|
}
|
|
1399
1450
|
/**
|
|
1400
1451
|
* @constructor
|
|
@@ -1402,8 +1453,8 @@ declare enum Type {
|
|
|
1402
1453
|
* @param parameters - {@link from.Parameters}
|
|
1403
1454
|
* @returns The created Position. {@link from.ReturnType}
|
|
1404
1455
|
*/
|
|
1405
|
-
declare function from$
|
|
1406
|
-
declare namespace from$
|
|
1456
|
+
declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
|
|
1457
|
+
declare namespace from$8 {
|
|
1407
1458
|
type Parameters = {
|
|
1408
1459
|
chainId: Id;
|
|
1409
1460
|
contract: Address;
|
|
@@ -1416,18 +1467,15 @@ declare namespace from$7 {
|
|
|
1416
1467
|
type ReturnType = Position;
|
|
1417
1468
|
}
|
|
1418
1469
|
declare namespace Quote_d_exports {
|
|
1419
|
-
export { InvalidQuoteError, Quote, QuoteSchema, from$
|
|
1470
|
+
export { InvalidQuoteError, Quote, QuoteSchema, from$7 as from, fromSnakeCase, random };
|
|
1420
1471
|
}
|
|
1421
1472
|
type Quote = {
|
|
1422
|
-
/** The obligation id. */
|
|
1423
|
-
obligationId: Hex;
|
|
1473
|
+
/** The obligation id. */obligationId: Hex;
|
|
1424
1474
|
ask: {
|
|
1425
|
-
/** The ask price for the obligation. (18 decimals). */
|
|
1426
|
-
price: bigint;
|
|
1475
|
+
/** The ask price for the obligation. (18 decimals). */price: bigint;
|
|
1427
1476
|
};
|
|
1428
1477
|
bid: {
|
|
1429
|
-
/** The bid price for the obligation. (18 decimals). */
|
|
1430
|
-
price: bigint;
|
|
1478
|
+
/** The bid price for the obligation. (18 decimals). */price: bigint;
|
|
1431
1479
|
};
|
|
1432
1480
|
};
|
|
1433
1481
|
declare const QuoteSchema: z$1.ZodObject<{
|
|
@@ -1451,8 +1499,8 @@ declare const QuoteSchema: z$1.ZodObject<{
|
|
|
1451
1499
|
* const quote = Quote.from({ obligationId: "0x123", ask: { price: 100n }, bid: { price: 100n } });
|
|
1452
1500
|
* ```
|
|
1453
1501
|
*/
|
|
1454
|
-
declare function from$
|
|
1455
|
-
declare namespace from$
|
|
1502
|
+
declare function from$7(parameters: from$7.Parameters): from$7.ReturnType;
|
|
1503
|
+
declare namespace from$7 {
|
|
1456
1504
|
type Parameters = Quote;
|
|
1457
1505
|
type ReturnType = Quote;
|
|
1458
1506
|
type ErrorType = InvalidQuoteError;
|
|
@@ -1467,7 +1515,7 @@ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.R
|
|
|
1467
1515
|
declare namespace fromSnakeCase {
|
|
1468
1516
|
type Parameters = Snake<Quote>;
|
|
1469
1517
|
type ReturnType = Quote;
|
|
1470
|
-
type ErrorType = from$
|
|
1518
|
+
type ErrorType = from$7.ErrorType;
|
|
1471
1519
|
}
|
|
1472
1520
|
/**
|
|
1473
1521
|
* Generates a random quote.
|
|
@@ -1482,12 +1530,85 @@ declare function random(): random.ReturnType;
|
|
|
1482
1530
|
declare namespace random {
|
|
1483
1531
|
type Parameters = never;
|
|
1484
1532
|
type ReturnType = Quote;
|
|
1485
|
-
type ErrorType = from$
|
|
1533
|
+
type ErrorType = from$7.ErrorType;
|
|
1486
1534
|
}
|
|
1487
1535
|
declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
|
|
1488
1536
|
readonly name = "Quote.InvalidQuoteError";
|
|
1489
1537
|
constructor(error: z$1.ZodError | Error);
|
|
1490
1538
|
}
|
|
1539
|
+
declare namespace TradingFee_d_exports {
|
|
1540
|
+
export { BREAKPOINTS, Fees, InvalidFeeError, InvalidFeesLengthError, TradingFee, WAD, activate, compute, deactivate, from$6 as from, getFees, isActivated };
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Time breakpoints in seconds for piecewise linear fee interpolation.
|
|
1544
|
+
* Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d.
|
|
1545
|
+
*/
|
|
1546
|
+
declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n];
|
|
1547
|
+
/** WAD constant (1e18) for fee scaling. */
|
|
1548
|
+
declare const WAD: bigint;
|
|
1549
|
+
/** Tuple type for the 6 fee values at each breakpoint. */
|
|
1550
|
+
type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint];
|
|
1551
|
+
/**
|
|
1552
|
+
* TradingFee represents a piecewise linear fee curve with 6 breakpoints.
|
|
1553
|
+
* The internal storage mimics on-chain bitmap behavior but uses a struct for clarity.
|
|
1554
|
+
*/
|
|
1555
|
+
type TradingFee = {
|
|
1556
|
+
readonly _activated: boolean;
|
|
1557
|
+
readonly _fees: Fees;
|
|
1558
|
+
} & Brand<"TradingFee">;
|
|
1559
|
+
/**
|
|
1560
|
+
* Create a TradingFee from an activation flag and 6 fee values.
|
|
1561
|
+
* @param activated - Whether the fee is active.
|
|
1562
|
+
* @param fees - Tuple of 6 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d).
|
|
1563
|
+
* @returns A new TradingFee instance.
|
|
1564
|
+
* @throws {@link InvalidFeeError} if any fee exceeds WAD (100%).
|
|
1565
|
+
* @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 6 elements.
|
|
1566
|
+
*/
|
|
1567
|
+
declare function from$6(activated: boolean, fees: Fees): TradingFee;
|
|
1568
|
+
declare namespace from$6 {
|
|
1569
|
+
type ErrorType = InvalidFeeError | InvalidFeesLengthError;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Compute the trading fee for a given time to maturity using piecewise linear interpolation.
|
|
1573
|
+
* @param tradingFee - The TradingFee instance.
|
|
1574
|
+
* @param timeToMaturity - Time to maturity in seconds.
|
|
1575
|
+
* @returns The interpolated fee in WAD. Returns 0n if not activated.
|
|
1576
|
+
*/
|
|
1577
|
+
declare function compute(tradingFee: TradingFee, timeToMaturity: number): bigint;
|
|
1578
|
+
/**
|
|
1579
|
+
* Check if the trading fee is activated.
|
|
1580
|
+
* @param tradingFee - The TradingFee instance.
|
|
1581
|
+
* @returns True if activated, false otherwise.
|
|
1582
|
+
*/
|
|
1583
|
+
declare function isActivated(tradingFee: TradingFee): boolean;
|
|
1584
|
+
/**
|
|
1585
|
+
* Create a new TradingFee with activation enabled.
|
|
1586
|
+
* @param tradingFee - The TradingFee instance.
|
|
1587
|
+
* @returns A new TradingFee with activated set to true.
|
|
1588
|
+
*/
|
|
1589
|
+
declare function activate(tradingFee: TradingFee): TradingFee;
|
|
1590
|
+
/**
|
|
1591
|
+
* Create a new TradingFee with activation disabled.
|
|
1592
|
+
* @param tradingFee - The TradingFee instance.
|
|
1593
|
+
* @returns A new TradingFee with activated set to false.
|
|
1594
|
+
*/
|
|
1595
|
+
declare function deactivate(tradingFee: TradingFee): TradingFee;
|
|
1596
|
+
/**
|
|
1597
|
+
* Get the fee values at each breakpoint.
|
|
1598
|
+
* @param tradingFee - The TradingFee instance.
|
|
1599
|
+
* @returns The tuple of 6 fee values.
|
|
1600
|
+
*/
|
|
1601
|
+
declare function getFees(tradingFee: TradingFee): Fees;
|
|
1602
|
+
/** Error thrown when a fee value is invalid (negative or exceeds WAD). */
|
|
1603
|
+
declare class InvalidFeeError extends BaseError {
|
|
1604
|
+
readonly name = "TradingFee.InvalidFeeError";
|
|
1605
|
+
constructor(fee: bigint, index: number);
|
|
1606
|
+
}
|
|
1607
|
+
/** Error thrown when fees array doesn't have exactly 6 elements. */
|
|
1608
|
+
declare class InvalidFeesLengthError extends BaseError {
|
|
1609
|
+
readonly name = "TradingFee.InvalidFeesLengthError";
|
|
1610
|
+
constructor(length: number);
|
|
1611
|
+
}
|
|
1491
1612
|
declare namespace Transfer_d_exports {
|
|
1492
1613
|
export { Transfer, from$5 as from };
|
|
1493
1614
|
}
|
|
@@ -1526,25 +1647,46 @@ declare namespace from$5 {
|
|
|
1526
1647
|
type ReturnType = Transfer;
|
|
1527
1648
|
}
|
|
1528
1649
|
declare namespace Tree_d_exports {
|
|
1529
|
-
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs };
|
|
1650
|
+
export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs, signatureDomain, signatureTypes };
|
|
1530
1651
|
}
|
|
1531
1652
|
/**
|
|
1532
1653
|
* A merkle tree of offers built from offer hashes.
|
|
1533
1654
|
* Constructed via {@link from}. The tree root can be signed for onchain broadcast.
|
|
1534
1655
|
*/
|
|
1535
1656
|
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
1536
|
-
/** The offers in the tree. */
|
|
1537
|
-
offers: Offer[];
|
|
1538
|
-
/** The root of the tree. */
|
|
1657
|
+
/** The offers in the tree. */offers: Offer[]; /** The root of the tree. */
|
|
1539
1658
|
root: Hex;
|
|
1540
1659
|
}>;
|
|
1541
1660
|
type Proof = {
|
|
1542
|
-
/** The offer that the proof is for. */
|
|
1543
|
-
offer: Offer;
|
|
1544
|
-
/** The merkle proof path for the offer. */
|
|
1661
|
+
/** The offer that the proof is for. */offer: Offer; /** The merkle proof path for the offer. */
|
|
1545
1662
|
path: Hex[];
|
|
1546
1663
|
};
|
|
1547
1664
|
declare const VERSION = 1;
|
|
1665
|
+
type SignatureDomain = {
|
|
1666
|
+
/** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
|
|
1667
|
+
verifyingContract: Address;
|
|
1668
|
+
};
|
|
1669
|
+
/** Normalized Root signature domain (BigInt chain id, lowercase address). */
|
|
1670
|
+
type NormalizedSignatureDomain = {
|
|
1671
|
+
chainId: bigint;
|
|
1672
|
+
verifyingContract: Address;
|
|
1673
|
+
};
|
|
1674
|
+
/**
|
|
1675
|
+
* EIP-712 types for signing the tree root (Root(bytes32 root)).
|
|
1676
|
+
*/
|
|
1677
|
+
declare const signatureTypes: {
|
|
1678
|
+
readonly EIP712Domain: readonly [{
|
|
1679
|
+
readonly name: "chainId";
|
|
1680
|
+
readonly type: "uint256";
|
|
1681
|
+
}, {
|
|
1682
|
+
readonly name: "verifyingContract";
|
|
1683
|
+
readonly type: "address";
|
|
1684
|
+
}];
|
|
1685
|
+
readonly Root: readonly [{
|
|
1686
|
+
readonly name: "root";
|
|
1687
|
+
readonly type: "bytes32";
|
|
1688
|
+
}];
|
|
1689
|
+
};
|
|
1548
1690
|
/**
|
|
1549
1691
|
* Builds a Merkle tree from a list of offers.
|
|
1550
1692
|
*
|
|
@@ -1567,6 +1709,11 @@ declare const from$4: (offers: Offer[]) => Tree;
|
|
|
1567
1709
|
* @returns Array of proofs - {@link Proof}
|
|
1568
1710
|
*/
|
|
1569
1711
|
declare const proofs: (tree: Tree) => Proof[];
|
|
1712
|
+
/**
|
|
1713
|
+
* Normalizes a Root signature domain (BigInt chain id, lowercase address).
|
|
1714
|
+
* @throws {SignatureDomainError} When the domain is invalid.
|
|
1715
|
+
*/
|
|
1716
|
+
declare const signatureDomain: (domain: SignatureDomain) => NormalizedSignatureDomain;
|
|
1570
1717
|
/**
|
|
1571
1718
|
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1572
1719
|
*
|
|
@@ -1574,15 +1721,21 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1574
1721
|
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1575
1722
|
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1576
1723
|
* - `{root}`: 32-byte merkle root
|
|
1577
|
-
* - `{signature}`: 65-byte EIP-
|
|
1724
|
+
* - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
|
|
1578
1725
|
*
|
|
1579
1726
|
* Validates signature authenticity and root integrity before encoding.
|
|
1580
1727
|
*
|
|
1581
1728
|
* @example
|
|
1582
1729
|
* ```typescript
|
|
1583
1730
|
* const tree = Tree.from(offers);
|
|
1584
|
-
* const signature = await wallet.
|
|
1585
|
-
*
|
|
1731
|
+
* const signature = await wallet.signTypedData({
|
|
1732
|
+
* account: wallet.account,
|
|
1733
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1734
|
+
* types: Tree.signatureTypes,
|
|
1735
|
+
* primaryType: "Root",
|
|
1736
|
+
* message: { root: tree.root },
|
|
1737
|
+
* });
|
|
1738
|
+
* const calldata = await Tree.encode(tree, signature, { chainId, verifyingContract });
|
|
1586
1739
|
* await broadcast(calldata);
|
|
1587
1740
|
* ```
|
|
1588
1741
|
*
|
|
@@ -1592,16 +1745,23 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1592
1745
|
* const tree = Tree.from(offers);
|
|
1593
1746
|
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1594
1747
|
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1595
|
-
* const signature = await wallet.
|
|
1748
|
+
* const signature = await wallet.signTypedData({
|
|
1749
|
+
* account: wallet.account,
|
|
1750
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1751
|
+
* types: Tree.signatureTypes,
|
|
1752
|
+
* primaryType: "Root",
|
|
1753
|
+
* message: { root: tree.root },
|
|
1754
|
+
* });
|
|
1596
1755
|
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1597
1756
|
* ```
|
|
1598
1757
|
*
|
|
1599
1758
|
* @param tree - Merkle tree of offers
|
|
1600
|
-
* @param signature - EIP-
|
|
1759
|
+
* @param signature - EIP-712 signature over Root(bytes32 root)
|
|
1760
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1601
1761
|
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1602
1762
|
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1603
1763
|
*/
|
|
1604
|
-
declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1764
|
+
declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
|
|
1605
1765
|
/**
|
|
1606
1766
|
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1607
1767
|
*
|
|
@@ -1631,15 +1791,16 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
|
1631
1791
|
*
|
|
1632
1792
|
* @example
|
|
1633
1793
|
* ```typescript
|
|
1634
|
-
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1794
|
+
* const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
|
|
1635
1795
|
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1636
1796
|
* ```
|
|
1637
1797
|
*
|
|
1638
1798
|
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1799
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1639
1800
|
* @returns Validated tree, signature, and recovered signer address
|
|
1640
1801
|
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1641
1802
|
*/
|
|
1642
|
-
declare const decode: (encoded: Hex) => Promise<{
|
|
1803
|
+
declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
|
|
1643
1804
|
tree: Tree;
|
|
1644
1805
|
signature: Hex;
|
|
1645
1806
|
signer: Address;
|
|
@@ -1668,13 +1829,19 @@ declare class DecodeError extends BaseError {
|
|
|
1668
1829
|
name: string;
|
|
1669
1830
|
constructor(reason: string);
|
|
1670
1831
|
}
|
|
1832
|
+
/**
|
|
1833
|
+
* Error thrown when an invalid signature domain is supplied.
|
|
1834
|
+
*/
|
|
1835
|
+
declare class SignatureDomainError extends BaseError {
|
|
1836
|
+
name: string;
|
|
1837
|
+
constructor(reason: string);
|
|
1838
|
+
}
|
|
1671
1839
|
//#endregion
|
|
1672
1840
|
//#region src/api/Schema/generated/swagger.d.ts
|
|
1673
1841
|
/**
|
|
1674
1842
|
* This file was auto-generated by openapi-typescript.
|
|
1675
1843
|
* Do not make direct changes to the file.
|
|
1676
1844
|
*/
|
|
1677
|
-
|
|
1678
1845
|
interface paths {
|
|
1679
1846
|
"/v1/books/{obligationId}/{side}": {
|
|
1680
1847
|
parameters: {
|
|
@@ -1718,16 +1885,14 @@ interface paths {
|
|
|
1718
1885
|
};
|
|
1719
1886
|
requestBody?: never;
|
|
1720
1887
|
responses: {
|
|
1721
|
-
/** @description Success */
|
|
1722
|
-
200: {
|
|
1888
|
+
/** @description Success */200: {
|
|
1723
1889
|
headers: {
|
|
1724
1890
|
[name: string]: unknown;
|
|
1725
1891
|
};
|
|
1726
1892
|
content: {
|
|
1727
1893
|
"application/json": components["schemas"]["BookListResponse"];
|
|
1728
1894
|
};
|
|
1729
|
-
};
|
|
1730
|
-
/** @description Bad Request */
|
|
1895
|
+
}; /** @description Bad Request */
|
|
1731
1896
|
400: {
|
|
1732
1897
|
headers: {
|
|
1733
1898
|
[name: string]: unknown;
|
|
@@ -1746,7 +1911,7 @@ interface paths {
|
|
|
1746
1911
|
patch?: never;
|
|
1747
1912
|
trace?: never;
|
|
1748
1913
|
};
|
|
1749
|
-
"/v1/config": {
|
|
1914
|
+
"/v1/config/contracts": {
|
|
1750
1915
|
parameters: {
|
|
1751
1916
|
query?: never;
|
|
1752
1917
|
header?: never;
|
|
@@ -1754,25 +1919,99 @@ interface paths {
|
|
|
1754
1919
|
cookie?: never;
|
|
1755
1920
|
};
|
|
1756
1921
|
/**
|
|
1757
|
-
* Get
|
|
1758
|
-
* @description Returns
|
|
1922
|
+
* Get indexer contract configuration
|
|
1923
|
+
* @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
|
|
1759
1924
|
*/
|
|
1760
1925
|
get: {
|
|
1761
1926
|
parameters: {
|
|
1762
|
-
query?:
|
|
1927
|
+
query?: {
|
|
1928
|
+
/**
|
|
1929
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1930
|
+
* @example 1,8453
|
|
1931
|
+
*/
|
|
1932
|
+
chains?: number[];
|
|
1933
|
+
/**
|
|
1934
|
+
* @description Maximum number of contracts to return (max 1000).
|
|
1935
|
+
* @example 1000
|
|
1936
|
+
*/
|
|
1937
|
+
limit?: number;
|
|
1938
|
+
/**
|
|
1939
|
+
* @description Pagination cursor in chain_id:address format (lowercase address).
|
|
1940
|
+
* @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
|
|
1941
|
+
*/
|
|
1942
|
+
cursor?: string;
|
|
1943
|
+
};
|
|
1944
|
+
header?: never;
|
|
1945
|
+
path?: never;
|
|
1946
|
+
cookie?: never;
|
|
1947
|
+
};
|
|
1948
|
+
requestBody?: never;
|
|
1949
|
+
responses: {
|
|
1950
|
+
/** @description Success */200: {
|
|
1951
|
+
headers: {
|
|
1952
|
+
[name: string]: unknown;
|
|
1953
|
+
};
|
|
1954
|
+
content: {
|
|
1955
|
+
"application/json": components["schemas"]["ConfigContractsSuccessResponse"];
|
|
1956
|
+
};
|
|
1957
|
+
};
|
|
1958
|
+
};
|
|
1959
|
+
};
|
|
1960
|
+
put?: never;
|
|
1961
|
+
post?: never;
|
|
1962
|
+
delete?: never;
|
|
1963
|
+
options?: never;
|
|
1964
|
+
head?: never;
|
|
1965
|
+
patch?: never;
|
|
1966
|
+
trace?: never;
|
|
1967
|
+
};
|
|
1968
|
+
"/v1/config/rules": {
|
|
1969
|
+
parameters: {
|
|
1970
|
+
query?: never;
|
|
1971
|
+
header?: never;
|
|
1972
|
+
path?: never;
|
|
1973
|
+
cookie?: never;
|
|
1974
|
+
};
|
|
1975
|
+
/**
|
|
1976
|
+
* Get config rules
|
|
1977
|
+
* @description Returns configured rules for supported chains.
|
|
1978
|
+
*/
|
|
1979
|
+
get: {
|
|
1980
|
+
parameters: {
|
|
1981
|
+
query?: {
|
|
1982
|
+
/**
|
|
1983
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1984
|
+
* @example 1,8453
|
|
1985
|
+
*/
|
|
1986
|
+
chains?: number[];
|
|
1987
|
+
/**
|
|
1988
|
+
* @description Filter by rule types (comma-separated).
|
|
1989
|
+
* @example maturity,loan_token
|
|
1990
|
+
*/
|
|
1991
|
+
types?: string[];
|
|
1992
|
+
/**
|
|
1993
|
+
* @description Maximum number of rules to return (max 1000).
|
|
1994
|
+
* @example 100
|
|
1995
|
+
*/
|
|
1996
|
+
limit?: number;
|
|
1997
|
+
/**
|
|
1998
|
+
* @description Pagination cursor in type:chain_id:<value> format.
|
|
1999
|
+
* @example maturity:1:1730415600:end_of_next_month
|
|
2000
|
+
*/
|
|
2001
|
+
cursor?: string;
|
|
2002
|
+
};
|
|
1763
2003
|
header?: never;
|
|
1764
2004
|
path?: never;
|
|
1765
2005
|
cookie?: never;
|
|
1766
2006
|
};
|
|
1767
2007
|
requestBody?: never;
|
|
1768
2008
|
responses: {
|
|
1769
|
-
/** @description Success */
|
|
1770
|
-
200: {
|
|
2009
|
+
/** @description Success */200: {
|
|
1771
2010
|
headers: {
|
|
1772
2011
|
[name: string]: unknown;
|
|
1773
2012
|
};
|
|
1774
2013
|
content: {
|
|
1775
|
-
"application/json": components["schemas"]["
|
|
2014
|
+
"application/json": components["schemas"]["ConfigRulesSuccessResponse"];
|
|
1776
2015
|
};
|
|
1777
2016
|
};
|
|
1778
2017
|
};
|
|
@@ -1831,16 +2070,14 @@ interface paths {
|
|
|
1831
2070
|
};
|
|
1832
2071
|
requestBody?: never;
|
|
1833
2072
|
responses: {
|
|
1834
|
-
/** @description Success */
|
|
1835
|
-
200: {
|
|
2073
|
+
/** @description Success */200: {
|
|
1836
2074
|
headers: {
|
|
1837
2075
|
[name: string]: unknown;
|
|
1838
2076
|
};
|
|
1839
2077
|
content: {
|
|
1840
2078
|
"application/json": components["schemas"]["OfferListResponse"];
|
|
1841
2079
|
};
|
|
1842
|
-
};
|
|
1843
|
-
/** @description Bad Request */
|
|
2080
|
+
}; /** @description Bad Request */
|
|
1844
2081
|
400: {
|
|
1845
2082
|
headers: {
|
|
1846
2083
|
[name: string]: unknown;
|
|
@@ -1874,25 +2111,25 @@ interface paths {
|
|
|
1874
2111
|
parameters: {
|
|
1875
2112
|
query?: {
|
|
1876
2113
|
/**
|
|
1877
|
-
* @description Filter by exact maturity
|
|
1878
|
-
* @example 1761922800
|
|
2114
|
+
* @description Filter by exact maturity timestamps (comma-separated, unix seconds).
|
|
2115
|
+
* @example 1761922800,1764524800
|
|
1879
2116
|
*/
|
|
1880
|
-
|
|
2117
|
+
maturities?: number[];
|
|
1881
2118
|
/**
|
|
1882
|
-
* @description Filter by collateral
|
|
1883
|
-
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
2119
|
+
* @description Filter by collateral tokens (comma-separated, matches any collateral).
|
|
2120
|
+
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751,0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
1884
2121
|
*/
|
|
1885
|
-
|
|
2122
|
+
collateral_tokens?: string[];
|
|
1886
2123
|
/**
|
|
1887
|
-
* @description Filter by loan token
|
|
1888
|
-
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
2124
|
+
* @description Filter by loan token addresses (comma-separated).
|
|
2125
|
+
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078,0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
1889
2126
|
*/
|
|
1890
|
-
|
|
2127
|
+
loan_tokens?: string[];
|
|
1891
2128
|
/**
|
|
1892
|
-
* @description Filter by chain
|
|
1893
|
-
* @example 1
|
|
2129
|
+
* @description Filter by chain IDs (comma-separated).
|
|
2130
|
+
* @example 1,8453
|
|
1894
2131
|
*/
|
|
1895
|
-
|
|
2132
|
+
chains?: number[];
|
|
1896
2133
|
/**
|
|
1897
2134
|
* @description Maximum number of obligations to return.
|
|
1898
2135
|
* @example 10
|
|
@@ -1910,16 +2147,14 @@ interface paths {
|
|
|
1910
2147
|
};
|
|
1911
2148
|
requestBody?: never;
|
|
1912
2149
|
responses: {
|
|
1913
|
-
/** @description Success */
|
|
1914
|
-
200: {
|
|
2150
|
+
/** @description Success */200: {
|
|
1915
2151
|
headers: {
|
|
1916
2152
|
[name: string]: unknown;
|
|
1917
2153
|
};
|
|
1918
2154
|
content: {
|
|
1919
2155
|
"application/json": components["schemas"]["ObligationListResponse"];
|
|
1920
2156
|
};
|
|
1921
|
-
};
|
|
1922
|
-
/** @description Bad Request */
|
|
2157
|
+
}; /** @description Bad Request */
|
|
1923
2158
|
400: {
|
|
1924
2159
|
headers: {
|
|
1925
2160
|
[name: string]: unknown;
|
|
@@ -1964,16 +2199,14 @@ interface paths {
|
|
|
1964
2199
|
};
|
|
1965
2200
|
requestBody?: never;
|
|
1966
2201
|
responses: {
|
|
1967
|
-
/** @description Success */
|
|
1968
|
-
200: {
|
|
2202
|
+
/** @description Success */200: {
|
|
1969
2203
|
headers: {
|
|
1970
2204
|
[name: string]: unknown;
|
|
1971
2205
|
};
|
|
1972
2206
|
content: {
|
|
1973
2207
|
"application/json": components["schemas"]["ObligationSingleSuccessResponse"];
|
|
1974
2208
|
};
|
|
1975
|
-
};
|
|
1976
|
-
/** @description Bad Request */
|
|
2209
|
+
}; /** @description Bad Request */
|
|
1977
2210
|
400: {
|
|
1978
2211
|
headers: {
|
|
1979
2212
|
[name: string]: unknown;
|
|
@@ -2018,8 +2251,7 @@ interface paths {
|
|
|
2018
2251
|
};
|
|
2019
2252
|
requestBody?: never;
|
|
2020
2253
|
responses: {
|
|
2021
|
-
/** @description Success */
|
|
2022
|
-
200: {
|
|
2254
|
+
/** @description Success */200: {
|
|
2023
2255
|
headers: {
|
|
2024
2256
|
[name: string]: unknown;
|
|
2025
2257
|
};
|
|
@@ -2063,8 +2295,7 @@ interface paths {
|
|
|
2063
2295
|
};
|
|
2064
2296
|
requestBody?: never;
|
|
2065
2297
|
responses: {
|
|
2066
|
-
/** @description Success */
|
|
2067
|
-
200: {
|
|
2298
|
+
/** @description Success */200: {
|
|
2068
2299
|
headers: {
|
|
2069
2300
|
[name: string]: unknown;
|
|
2070
2301
|
};
|
|
@@ -2108,8 +2339,7 @@ interface paths {
|
|
|
2108
2339
|
};
|
|
2109
2340
|
requestBody?: never;
|
|
2110
2341
|
responses: {
|
|
2111
|
-
/** @description Success */
|
|
2112
|
-
200: {
|
|
2342
|
+
/** @description Success */200: {
|
|
2113
2343
|
headers: {
|
|
2114
2344
|
[name: string]: unknown;
|
|
2115
2345
|
};
|
|
@@ -2164,16 +2394,14 @@ interface paths {
|
|
|
2164
2394
|
};
|
|
2165
2395
|
requestBody?: never;
|
|
2166
2396
|
responses: {
|
|
2167
|
-
/** @description Success */
|
|
2168
|
-
200: {
|
|
2397
|
+
/** @description Success */200: {
|
|
2169
2398
|
headers: {
|
|
2170
2399
|
[name: string]: unknown;
|
|
2171
2400
|
};
|
|
2172
2401
|
content: {
|
|
2173
2402
|
"application/json": components["schemas"]["PositionListResponse"];
|
|
2174
2403
|
};
|
|
2175
|
-
};
|
|
2176
|
-
/** @description Bad Request */
|
|
2404
|
+
}; /** @description Bad Request */
|
|
2177
2405
|
400: {
|
|
2178
2406
|
headers: {
|
|
2179
2407
|
[name: string]: unknown;
|
|
@@ -2204,15 +2432,6 @@ interface paths {
|
|
|
2204
2432
|
/**
|
|
2205
2433
|
* Validate offers
|
|
2206
2434
|
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
2207
|
-
*
|
|
2208
|
-
* **Available validation rules:**
|
|
2209
|
-
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
2210
|
-
* - **mixed_maker**: Validates that all offers in a batch have the same maker address
|
|
2211
|
-
* - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
|
|
2212
|
-
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
2213
|
-
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
2214
|
-
* - **callback**: Validates callbacks: buy empty callback is allowed; sell offers must use a non-empty callback; non-empty callbacks must target one of [0x3333333333333333333333333333333333333333, 0x4444444444444444444444444444444444444444, 0x1111111111111111111111111111111111111111, 0x2222222222222222222222222222222222222222]
|
|
2215
|
-
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
|
|
2216
2435
|
*/
|
|
2217
2436
|
post: {
|
|
2218
2437
|
parameters: {
|
|
@@ -2227,16 +2446,64 @@ interface paths {
|
|
|
2227
2446
|
};
|
|
2228
2447
|
};
|
|
2229
2448
|
responses: {
|
|
2230
|
-
/** @description Success */
|
|
2231
|
-
200: {
|
|
2449
|
+
/** @description Success */200: {
|
|
2232
2450
|
headers: {
|
|
2233
2451
|
[name: string]: unknown;
|
|
2234
2452
|
};
|
|
2235
2453
|
content: {
|
|
2236
2454
|
"application/json": components["schemas"]["ValidationSuccessResponse"];
|
|
2237
2455
|
};
|
|
2456
|
+
}; /** @description Bad Request */
|
|
2457
|
+
400: {
|
|
2458
|
+
headers: {
|
|
2459
|
+
[name: string]: unknown;
|
|
2460
|
+
};
|
|
2461
|
+
content: {
|
|
2462
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
2463
|
+
};
|
|
2464
|
+
};
|
|
2465
|
+
};
|
|
2466
|
+
};
|
|
2467
|
+
delete?: never;
|
|
2468
|
+
options?: never;
|
|
2469
|
+
head?: never;
|
|
2470
|
+
patch?: never;
|
|
2471
|
+
trace?: never;
|
|
2472
|
+
};
|
|
2473
|
+
"/v1/callbacks": {
|
|
2474
|
+
parameters: {
|
|
2475
|
+
query?: never;
|
|
2476
|
+
header?: never;
|
|
2477
|
+
path?: never;
|
|
2478
|
+
cookie?: never;
|
|
2479
|
+
};
|
|
2480
|
+
get?: never;
|
|
2481
|
+
put?: never;
|
|
2482
|
+
/**
|
|
2483
|
+
* Resolve callback types
|
|
2484
|
+
* @description Returns callback types for callback addresses grouped by chain.
|
|
2485
|
+
*/
|
|
2486
|
+
post: {
|
|
2487
|
+
parameters: {
|
|
2488
|
+
query?: never;
|
|
2489
|
+
header?: never;
|
|
2490
|
+
path?: never;
|
|
2491
|
+
cookie?: never;
|
|
2492
|
+
};
|
|
2493
|
+
requestBody?: {
|
|
2494
|
+
content: {
|
|
2495
|
+
"application/json": components["schemas"]["CallbackTypesRequest"];
|
|
2238
2496
|
};
|
|
2239
|
-
|
|
2497
|
+
};
|
|
2498
|
+
responses: {
|
|
2499
|
+
/** @description Success */200: {
|
|
2500
|
+
headers: {
|
|
2501
|
+
[name: string]: unknown;
|
|
2502
|
+
};
|
|
2503
|
+
content: {
|
|
2504
|
+
"application/json": components["schemas"]["CallbackTypesSuccessResponse"];
|
|
2505
|
+
};
|
|
2506
|
+
}; /** @description Bad Request */
|
|
2240
2507
|
400: {
|
|
2241
2508
|
headers: {
|
|
2242
2509
|
[name: string]: unknown;
|
|
@@ -2257,22 +2524,16 @@ interface paths {
|
|
|
2257
2524
|
interface components {
|
|
2258
2525
|
schemas: {
|
|
2259
2526
|
BookListResponse: {
|
|
2260
|
-
meta: components["schemas"]["Meta"];
|
|
2261
|
-
/** @
|
|
2262
|
-
cursor: string | null;
|
|
2263
|
-
/** @description Aggregated book levels grouped by computed price. */
|
|
2527
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2528
|
+
cursor: string | null; /** @description Aggregated book levels grouped by computed price. */
|
|
2264
2529
|
data: components["schemas"]["BookLevelResponse"][];
|
|
2265
2530
|
};
|
|
2266
2531
|
Meta: {
|
|
2267
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2268
|
-
timestamp: string;
|
|
2532
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string;
|
|
2269
2533
|
};
|
|
2270
2534
|
BookLevelResponse: {
|
|
2271
|
-
/** @example 2750000000000000000 */
|
|
2272
|
-
|
|
2273
|
-
/** @example 369216000000000000000000 */
|
|
2274
|
-
assets: string;
|
|
2275
|
-
/** @example 5 */
|
|
2535
|
+
/** @example 2750000000000000000 */price: string; /** @example 369216000000000000000000 */
|
|
2536
|
+
assets: string; /** @example 5 */
|
|
2276
2537
|
count: number;
|
|
2277
2538
|
};
|
|
2278
2539
|
BadRequestResponse: {
|
|
@@ -2284,8 +2545,7 @@ interface components {
|
|
|
2284
2545
|
* @example VALIDATION_ERROR
|
|
2285
2546
|
* @enum {string}
|
|
2286
2547
|
*/
|
|
2287
|
-
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
|
|
2288
|
-
/** @example Limit must be greater than 0. */
|
|
2548
|
+
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST"; /** @example Limit must be greater than 0. */
|
|
2289
2549
|
message: string;
|
|
2290
2550
|
/**
|
|
2291
2551
|
* @example [
|
|
@@ -2297,59 +2557,81 @@ interface components {
|
|
|
2297
2557
|
*/
|
|
2298
2558
|
details: Record<string, never>;
|
|
2299
2559
|
};
|
|
2300
|
-
|
|
2301
|
-
meta: components["schemas"]["Meta"];
|
|
2302
|
-
/** @example null */
|
|
2560
|
+
ConfigContractsSuccessResponse: {
|
|
2561
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2303
2562
|
cursor: string | null;
|
|
2304
2563
|
/**
|
|
2305
|
-
* @description
|
|
2564
|
+
* @description Indexer contract configuration for all indexed chains.
|
|
2306
2565
|
* @example [
|
|
2307
2566
|
* {
|
|
2308
2567
|
* "chain_id": 505050505,
|
|
2309
|
-
* "
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
*
|
|
2315
|
-
*
|
|
2568
|
+
* "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
|
|
2569
|
+
* "name": "mempool"
|
|
2570
|
+
* },
|
|
2571
|
+
* {
|
|
2572
|
+
* "chain_id": 505050505,
|
|
2573
|
+
* "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
|
|
2574
|
+
* "name": "multicall"
|
|
2575
|
+
* },
|
|
2576
|
+
* {
|
|
2577
|
+
* "chain_id": 505050505,
|
|
2578
|
+
* "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
|
|
2579
|
+
* "name": "v2"
|
|
2316
2580
|
* }
|
|
2317
2581
|
* ]
|
|
2318
2582
|
*/
|
|
2319
|
-
data: components["schemas"]["
|
|
2583
|
+
data: components["schemas"]["ConfigContractResponse"][];
|
|
2320
2584
|
};
|
|
2321
|
-
|
|
2322
|
-
/** @example 505050505 */
|
|
2323
|
-
|
|
2324
|
-
contracts: components["schemas"]["ConfigContractsResponse"];
|
|
2585
|
+
ConfigContractResponse: {
|
|
2586
|
+
/** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
2587
|
+
address: string;
|
|
2325
2588
|
/**
|
|
2326
|
-
* @
|
|
2327
|
-
* @
|
|
2328
|
-
* "end_of_month": 1738335600,
|
|
2329
|
-
* "end_of_next_month": 1740754800
|
|
2330
|
-
* }
|
|
2589
|
+
* @example mempool
|
|
2590
|
+
* @enum {string}
|
|
2331
2591
|
*/
|
|
2332
|
-
|
|
2333
|
-
};
|
|
2334
|
-
ConfigContractsResponse: {
|
|
2335
|
-
/** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
2336
|
-
mempool: string;
|
|
2592
|
+
name: "mempool" | "multicall" | "v2";
|
|
2337
2593
|
};
|
|
2338
|
-
|
|
2339
|
-
/**
|
|
2340
|
-
|
|
2341
|
-
* @example 1738335600
|
|
2342
|
-
*/
|
|
2343
|
-
end_of_month: number;
|
|
2594
|
+
ConfigRulesSuccessResponse: {
|
|
2595
|
+
meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
|
|
2596
|
+
cursor: string | null;
|
|
2344
2597
|
/**
|
|
2345
|
-
* @description
|
|
2346
|
-
* @example
|
|
2598
|
+
* @description Configured rules returned by the router API.
|
|
2599
|
+
* @example [
|
|
2600
|
+
* {
|
|
2601
|
+
* "type": "maturity",
|
|
2602
|
+
* "chain_id": 1,
|
|
2603
|
+
* "name": "end_of_next_month",
|
|
2604
|
+
* "timestamp": 1730415600
|
|
2605
|
+
* },
|
|
2606
|
+
* {
|
|
2607
|
+
* "type": "callback",
|
|
2608
|
+
* "chain_id": 1,
|
|
2609
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2610
|
+
* "callback_type": "sell_erc20_callback"
|
|
2611
|
+
* },
|
|
2612
|
+
* {
|
|
2613
|
+
* "type": "loan_token",
|
|
2614
|
+
* "chain_id": 1,
|
|
2615
|
+
* "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
2616
|
+
* }
|
|
2617
|
+
* ]
|
|
2347
2618
|
*/
|
|
2348
|
-
|
|
2619
|
+
data: components["schemas"]["ConfigRulesRuleResponse"][];
|
|
2620
|
+
};
|
|
2621
|
+
ConfigRulesMeta: {
|
|
2622
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
|
|
2623
|
+
checksum: string;
|
|
2624
|
+
};
|
|
2625
|
+
ConfigRulesRuleResponse: {
|
|
2626
|
+
/** @example maturity */type: string; /** @example 1 */
|
|
2627
|
+
chain_id: number; /** @example end_of_next_month */
|
|
2628
|
+
name?: string; /** @example 1730415600 */
|
|
2629
|
+
timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
|
|
2630
|
+
address?: string; /** @example sell_erc20_callback */
|
|
2631
|
+
callback_type?: string;
|
|
2349
2632
|
};
|
|
2350
2633
|
OfferListResponse: {
|
|
2351
|
-
meta: components["schemas"]["Meta"];
|
|
2352
|
-
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2634
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2353
2635
|
cursor: string | null;
|
|
2354
2636
|
/**
|
|
2355
2637
|
* @description Offers matching the provided filters.
|
|
@@ -2425,20 +2707,13 @@ interface components {
|
|
|
2425
2707
|
* "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2426
2708
|
* }
|
|
2427
2709
|
*/
|
|
2428
|
-
offer: components["schemas"]["OfferDataResponse"];
|
|
2429
|
-
/** @example
|
|
2430
|
-
|
|
2431
|
-
/** @example
|
|
2432
|
-
|
|
2433
|
-
/** @example
|
|
2434
|
-
|
|
2435
|
-
/** @example 0 */
|
|
2436
|
-
consumed: string;
|
|
2437
|
-
/** @example 369216000000000000000000 */
|
|
2438
|
-
takeable: string;
|
|
2439
|
-
/** @example 2942933377146801 */
|
|
2440
|
-
block_number: number;
|
|
2441
|
-
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2710
|
+
offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
2711
|
+
offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2712
|
+
obligation_id: string; /** @example 1 */
|
|
2713
|
+
chain_id: number; /** @example 0 */
|
|
2714
|
+
consumed: string; /** @example 369216000000000000000000 */
|
|
2715
|
+
takeable: string; /** @example 2942933377146801 */
|
|
2716
|
+
block_number: number; /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2442
2717
|
root: string | null;
|
|
2443
2718
|
/**
|
|
2444
2719
|
* @example [
|
|
@@ -2446,8 +2721,7 @@ interface components {
|
|
|
2446
2721
|
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2447
2722
|
* ]
|
|
2448
2723
|
*/
|
|
2449
|
-
proof: string[] | null;
|
|
2450
|
-
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2724
|
+
proof: string[] | null; /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2451
2725
|
signature: string | null;
|
|
2452
2726
|
};
|
|
2453
2727
|
OfferDataResponse: {
|
|
@@ -2464,35 +2738,22 @@ interface components {
|
|
|
2464
2738
|
* "maturity": 1761922799
|
|
2465
2739
|
* }
|
|
2466
2740
|
*/
|
|
2467
|
-
obligation: components["schemas"]["ObligationOfferResponse"];
|
|
2468
|
-
/** @example
|
|
2469
|
-
|
|
2470
|
-
/** @example
|
|
2471
|
-
|
|
2472
|
-
/** @example
|
|
2473
|
-
|
|
2474
|
-
/** @example
|
|
2475
|
-
|
|
2476
|
-
/** @example
|
|
2477
|
-
|
|
2478
|
-
/** @example
|
|
2479
|
-
start: number;
|
|
2480
|
-
/** @example 1761922799 */
|
|
2481
|
-
expiry: number;
|
|
2482
|
-
/** @example 2750000000000000000 */
|
|
2483
|
-
price: string;
|
|
2484
|
-
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2485
|
-
group: string;
|
|
2486
|
-
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2487
|
-
session: string;
|
|
2488
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2489
|
-
callback: string;
|
|
2490
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2741
|
+
obligation: components["schemas"]["ObligationOfferResponse"]; /** @example false */
|
|
2742
|
+
buy: boolean; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2743
|
+
maker: string; /** @example 369216000000000000000000 */
|
|
2744
|
+
assets: string; /** @example 0 */
|
|
2745
|
+
obligation_units: string; /** @example 0 */
|
|
2746
|
+
obligation_shares: string; /** @example 1761922790 */
|
|
2747
|
+
start: number; /** @example 1761922799 */
|
|
2748
|
+
expiry: number; /** @example 2750000000000000000 */
|
|
2749
|
+
price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2750
|
+
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2751
|
+
session: string; /** @example 0x1111111111111111111111111111111111111111 */
|
|
2752
|
+
callback: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2491
2753
|
callback_data: string;
|
|
2492
2754
|
};
|
|
2493
2755
|
ObligationOfferResponse: {
|
|
2494
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2495
|
-
loan_token: string;
|
|
2756
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
|
|
2496
2757
|
/**
|
|
2497
2758
|
* @example [
|
|
2498
2759
|
* {
|
|
@@ -2502,51 +2763,37 @@ interface components {
|
|
|
2502
2763
|
* }
|
|
2503
2764
|
* ]
|
|
2504
2765
|
*/
|
|
2505
|
-
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2506
|
-
/** @example 1761922799 */
|
|
2766
|
+
collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922799 */
|
|
2507
2767
|
maturity: number;
|
|
2508
2768
|
};
|
|
2509
2769
|
CollateralResponse: {
|
|
2510
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2511
|
-
|
|
2512
|
-
/** @example 860000000000000000 */
|
|
2513
|
-
lltv: string;
|
|
2514
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2770
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */token: string; /** @example 860000000000000000 */
|
|
2771
|
+
lltv: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2515
2772
|
oracle: string;
|
|
2516
2773
|
};
|
|
2517
2774
|
ObligationListResponse: {
|
|
2518
|
-
meta: components["schemas"]["Meta"];
|
|
2519
|
-
/** @
|
|
2520
|
-
cursor: string | null;
|
|
2521
|
-
/** @description List of obligations with takable offers. */
|
|
2775
|
+
meta: components["schemas"]["Meta"]; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2776
|
+
cursor: string | null; /** @description List of obligations with takable offers. */
|
|
2522
2777
|
data: components["schemas"]["ObligationResponse"][];
|
|
2523
2778
|
};
|
|
2524
2779
|
ObligationResponse: {
|
|
2525
|
-
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
|
|
2526
|
-
|
|
2527
|
-
/** @example 1 */
|
|
2528
|
-
chain_id: number;
|
|
2529
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2780
|
+
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */id: string; /** @example 1 */
|
|
2781
|
+
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2530
2782
|
loan_token: string;
|
|
2531
|
-
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2532
|
-
/** @example 1761922800 */
|
|
2783
|
+
collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922800 */
|
|
2533
2784
|
maturity: number;
|
|
2534
2785
|
ask: components["schemas"]["AskResponse"];
|
|
2535
2786
|
bid: components["schemas"]["BidResponse"];
|
|
2536
2787
|
};
|
|
2537
2788
|
AskResponse: {
|
|
2538
|
-
/** @example 1000000000000000000 */
|
|
2539
|
-
price: string;
|
|
2789
|
+
/** @example 1000000000000000000 */price: string;
|
|
2540
2790
|
};
|
|
2541
2791
|
BidResponse: {
|
|
2542
|
-
/** @example 1000000000000000000 */
|
|
2543
|
-
price: string;
|
|
2792
|
+
/** @example 1000000000000000000 */price: string;
|
|
2544
2793
|
};
|
|
2545
2794
|
ObligationSingleSuccessResponse: {
|
|
2546
|
-
meta: components["schemas"]["Meta"];
|
|
2547
|
-
/** @
|
|
2548
|
-
cursor: string | null;
|
|
2549
|
-
/** @description Obligation details. */
|
|
2795
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2796
|
+
cursor: string | null; /** @description Obligation details. */
|
|
2550
2797
|
data: components["schemas"]["ObligationResponse"];
|
|
2551
2798
|
};
|
|
2552
2799
|
RouterStatusSuccessResponse: {
|
|
@@ -2567,8 +2814,7 @@ interface components {
|
|
|
2567
2814
|
* @example live
|
|
2568
2815
|
* @enum {string}
|
|
2569
2816
|
*/
|
|
2570
|
-
status: "live" | "syncing";
|
|
2571
|
-
/** @example true */
|
|
2817
|
+
status: "live" | "syncing"; /** @example true */
|
|
2572
2818
|
initialized: boolean;
|
|
2573
2819
|
/**
|
|
2574
2820
|
* @description Configured chain ids missing initialization rows.
|
|
@@ -2582,9 +2828,7 @@ interface components {
|
|
|
2582
2828
|
missing_collectors: components["schemas"]["MissingCollectorResponse"][];
|
|
2583
2829
|
};
|
|
2584
2830
|
MissingCollectorResponse: {
|
|
2585
|
-
/** @example 1 */
|
|
2586
|
-
chain_id: number;
|
|
2587
|
-
/** @example offers */
|
|
2831
|
+
/** @example 1 */chain_id: number; /** @example offers */
|
|
2588
2832
|
name: string;
|
|
2589
2833
|
};
|
|
2590
2834
|
CollectorsHealthSuccessResponse: {
|
|
@@ -2606,22 +2850,16 @@ interface components {
|
|
|
2606
2850
|
data: components["schemas"]["CollectorHealthResponse"][];
|
|
2607
2851
|
};
|
|
2608
2852
|
CollectorHealthResponse: {
|
|
2609
|
-
/** @example offers */
|
|
2610
|
-
|
|
2611
|
-
/** @example
|
|
2612
|
-
|
|
2613
|
-
/** @example 21345678 */
|
|
2614
|
-
block_number: number | null;
|
|
2615
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2616
|
-
updated_at: string | null;
|
|
2617
|
-
/** @example 0 */
|
|
2853
|
+
/** @example offers */name: string; /** @example 1 */
|
|
2854
|
+
chain_id: number; /** @example 21345678 */
|
|
2855
|
+
block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
|
|
2856
|
+
updated_at: string | null; /** @example 0 */
|
|
2618
2857
|
lag: number | null;
|
|
2619
2858
|
/**
|
|
2620
2859
|
* @example live
|
|
2621
2860
|
* @enum {string}
|
|
2622
2861
|
*/
|
|
2623
|
-
status: "live" | "lagging" | "unknown";
|
|
2624
|
-
/** @example true */
|
|
2862
|
+
status: "live" | "lagging" | "unknown"; /** @example true */
|
|
2625
2863
|
initialized: boolean;
|
|
2626
2864
|
};
|
|
2627
2865
|
ChainsHealthSuccessResponse: {
|
|
@@ -2641,20 +2879,14 @@ interface components {
|
|
|
2641
2879
|
data: components["schemas"]["ChainHealthResponse"][];
|
|
2642
2880
|
};
|
|
2643
2881
|
ChainHealthResponse: {
|
|
2644
|
-
/** @example 1 */
|
|
2645
|
-
|
|
2646
|
-
/** @example
|
|
2647
|
-
|
|
2648
|
-
/** @example 21345690 */
|
|
2649
|
-
remote_block_number: number | null;
|
|
2650
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2651
|
-
updated_at: string | null;
|
|
2652
|
-
/** @example true */
|
|
2882
|
+
/** @example 1 */chain_id: number; /** @example 21345678 */
|
|
2883
|
+
local_block_number: number | null; /** @example 21345690 */
|
|
2884
|
+
remote_block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
|
|
2885
|
+
updated_at: string | null; /** @example true */
|
|
2653
2886
|
initialized: boolean;
|
|
2654
2887
|
};
|
|
2655
2888
|
PositionListResponse: {
|
|
2656
|
-
meta: components["schemas"]["Meta"];
|
|
2657
|
-
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2889
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2658
2890
|
cursor: string | null;
|
|
2659
2891
|
/**
|
|
2660
2892
|
* @description User positions with reserved balances from active offers.
|
|
@@ -2671,47 +2903,28 @@ interface components {
|
|
|
2671
2903
|
data: components["schemas"]["PositionListItemResponse"][];
|
|
2672
2904
|
};
|
|
2673
2905
|
PositionListItemResponse: {
|
|
2674
|
-
/** @example 1 */
|
|
2675
|
-
|
|
2676
|
-
/** @example
|
|
2677
|
-
|
|
2678
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2679
|
-
user: string;
|
|
2680
|
-
/** @example 200000000000000000000 */
|
|
2681
|
-
reserved: string;
|
|
2682
|
-
/** @example 21345678 */
|
|
2906
|
+
/** @example 1 */chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2907
|
+
contract: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2908
|
+
user: string; /** @example 200000000000000000000 */
|
|
2909
|
+
reserved: string; /** @example 21345678 */
|
|
2683
2910
|
block_number: number;
|
|
2684
2911
|
};
|
|
2685
2912
|
ValidateOffersRequest: {
|
|
2686
|
-
/** @description Array of offers in snake_case format. Required, non-empty. */
|
|
2687
|
-
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2913
|
+
/** @description Array of offers in snake_case format. Required, non-empty. */offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2688
2914
|
};
|
|
2689
2915
|
ValidateOfferRequest: {
|
|
2690
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2691
|
-
|
|
2692
|
-
/** @example
|
|
2693
|
-
|
|
2694
|
-
/** @example
|
|
2695
|
-
|
|
2696
|
-
/** @example
|
|
2697
|
-
|
|
2698
|
-
/** @example
|
|
2699
|
-
|
|
2700
|
-
/** @example
|
|
2701
|
-
|
|
2702
|
-
/** @example 1761922799 */
|
|
2703
|
-
expiry: number;
|
|
2704
|
-
/** @example 1761922790 */
|
|
2705
|
-
start: number;
|
|
2706
|
-
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2707
|
-
group: string;
|
|
2708
|
-
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2709
|
-
session: string;
|
|
2710
|
-
/** @example false */
|
|
2711
|
-
buy: boolean;
|
|
2712
|
-
/** @example 1 */
|
|
2713
|
-
chain_id: number;
|
|
2714
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2916
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
|
|
2917
|
+
assets: string; /** @example 0 */
|
|
2918
|
+
obligation_units?: string; /** @example 0 */
|
|
2919
|
+
obligation_shares?: string; /** @example 2750000000000000000 */
|
|
2920
|
+
price: string; /** @example 1761922799 */
|
|
2921
|
+
maturity: number; /** @example 1761922799 */
|
|
2922
|
+
expiry: number; /** @example 1761922790 */
|
|
2923
|
+
start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2924
|
+
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2925
|
+
session: string; /** @example false */
|
|
2926
|
+
buy: boolean; /** @example 1 */
|
|
2927
|
+
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2715
2928
|
loan_token: string;
|
|
2716
2929
|
/**
|
|
2717
2930
|
* @example [
|
|
@@ -2732,24 +2945,17 @@ interface components {
|
|
|
2732
2945
|
callback: components["schemas"]["ValidateCallbackRequest"];
|
|
2733
2946
|
};
|
|
2734
2947
|
ValidateCollateralRequest: {
|
|
2735
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2736
|
-
|
|
2737
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2738
|
-
oracle: string;
|
|
2739
|
-
/** @example 860000000000000000 */
|
|
2948
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2949
|
+
oracle: string; /** @example 860000000000000000 */
|
|
2740
2950
|
lltv: string;
|
|
2741
2951
|
};
|
|
2742
2952
|
ValidateCallbackRequest: {
|
|
2743
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2744
|
-
address: string;
|
|
2745
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2953
|
+
/** @example 0x1111111111111111111111111111111111111111 */address: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2746
2954
|
data: string;
|
|
2747
2955
|
};
|
|
2748
2956
|
ValidationSuccessResponse: {
|
|
2749
|
-
meta: components["schemas"]["Meta"];
|
|
2750
|
-
/** @
|
|
2751
|
-
cursor: string | null;
|
|
2752
|
-
/** @description Payload and root for client-side signing. */
|
|
2957
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2958
|
+
cursor: string | null; /** @description Payload and root for client-side signing. */
|
|
2753
2959
|
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
2754
2960
|
};
|
|
2755
2961
|
ValidationSuccessDataResponse: {
|
|
@@ -2764,6 +2970,84 @@ interface components {
|
|
|
2764
2970
|
*/
|
|
2765
2971
|
root: string;
|
|
2766
2972
|
};
|
|
2973
|
+
CallbackTypesRequest: {
|
|
2974
|
+
/**
|
|
2975
|
+
* @example [
|
|
2976
|
+
* {
|
|
2977
|
+
* "chain_id": 1,
|
|
2978
|
+
* "addresses": [
|
|
2979
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2980
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2981
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2982
|
+
* ]
|
|
2983
|
+
* }
|
|
2984
|
+
* ]
|
|
2985
|
+
*/
|
|
2986
|
+
callbacks: components["schemas"]["CallbackTypesChainRequest"][];
|
|
2987
|
+
};
|
|
2988
|
+
CallbackTypesChainRequest: {
|
|
2989
|
+
/** @example 1 */chain_id: number;
|
|
2990
|
+
/**
|
|
2991
|
+
* @example [
|
|
2992
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2993
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2994
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2995
|
+
* ]
|
|
2996
|
+
*/
|
|
2997
|
+
addresses: string[];
|
|
2998
|
+
};
|
|
2999
|
+
CallbackTypesSuccessResponse: {
|
|
3000
|
+
meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
|
|
3001
|
+
cursor: string | null;
|
|
3002
|
+
/**
|
|
3003
|
+
* @description Callback types grouped by chain.
|
|
3004
|
+
* @example [
|
|
3005
|
+
* {
|
|
3006
|
+
* "chain_id": 1,
|
|
3007
|
+
* "sell_erc20_callback": [
|
|
3008
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3009
|
+
* ],
|
|
3010
|
+
* "buy_erc20": [
|
|
3011
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3012
|
+
* ],
|
|
3013
|
+
* "buy_vault_v1_callback": [
|
|
3014
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3015
|
+
* ],
|
|
3016
|
+
* "not_supported": [
|
|
3017
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3018
|
+
* ]
|
|
3019
|
+
* }
|
|
3020
|
+
* ]
|
|
3021
|
+
*/
|
|
3022
|
+
data: components["schemas"]["CallbackTypesChainResponse"][];
|
|
3023
|
+
};
|
|
3024
|
+
CallbackTypesChainResponse: {
|
|
3025
|
+
/** @example 1 */chain_id: number;
|
|
3026
|
+
/**
|
|
3027
|
+
* @example [
|
|
3028
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3029
|
+
* ]
|
|
3030
|
+
*/
|
|
3031
|
+
buy_vault_v1_callback?: string[];
|
|
3032
|
+
/**
|
|
3033
|
+
* @example [
|
|
3034
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3035
|
+
* ]
|
|
3036
|
+
*/
|
|
3037
|
+
sell_erc20_callback?: string[];
|
|
3038
|
+
/**
|
|
3039
|
+
* @example [
|
|
3040
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3041
|
+
* ]
|
|
3042
|
+
*/
|
|
3043
|
+
buy_erc20?: string[];
|
|
3044
|
+
/**
|
|
3045
|
+
* @example [
|
|
3046
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3047
|
+
* ]
|
|
3048
|
+
*/
|
|
3049
|
+
not_supported: string[];
|
|
3050
|
+
};
|
|
2767
3051
|
};
|
|
2768
3052
|
responses: never;
|
|
2769
3053
|
parameters: never;
|
|
@@ -2832,6 +3116,9 @@ declare class BooksController {
|
|
|
2832
3116
|
declare class ValidateController {
|
|
2833
3117
|
validateOffers(): Promise<void>;
|
|
2834
3118
|
}
|
|
3119
|
+
declare class CallbacksController {
|
|
3120
|
+
resolveCallbackTypes(): Promise<void>;
|
|
3121
|
+
}
|
|
2835
3122
|
declare class OffersController {
|
|
2836
3123
|
getOffers(): Promise<void>;
|
|
2837
3124
|
}
|
|
@@ -2840,8 +3127,11 @@ declare class HealthController {
|
|
|
2840
3127
|
getCollectorsHealth(): Promise<void>;
|
|
2841
3128
|
getChainsHealth(): Promise<void>;
|
|
2842
3129
|
}
|
|
2843
|
-
declare class
|
|
2844
|
-
|
|
3130
|
+
declare class ConfigContractsController {
|
|
3131
|
+
getConfigContracts(): Promise<void>;
|
|
3132
|
+
}
|
|
3133
|
+
declare class ConfigRulesController {
|
|
3134
|
+
getConfigRules(): Promise<void>;
|
|
2845
3135
|
}
|
|
2846
3136
|
declare class ObligationsController {
|
|
2847
3137
|
getObligations(): Promise<void>;
|
|
@@ -2850,33 +3140,22 @@ declare class ObligationsController {
|
|
|
2850
3140
|
declare class UsersController {
|
|
2851
3141
|
getUserPositions(): Promise<void>;
|
|
2852
3142
|
}
|
|
2853
|
-
|
|
2854
|
-
name: string;
|
|
2855
|
-
description: string;
|
|
2856
|
-
};
|
|
2857
|
-
type OpenApiOptions = {
|
|
2858
|
-
rules?: RuleInfo[];
|
|
2859
|
-
};
|
|
2860
|
-
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
3143
|
+
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
2861
3144
|
//#endregion
|
|
2862
3145
|
//#region src/database/domains/Positions.d.ts
|
|
2863
3146
|
type PaginationParams = {
|
|
2864
|
-
/** Cursor string returned by a previous call, for pagination */
|
|
2865
|
-
cursor?: string;
|
|
2866
|
-
/** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
3147
|
+
/** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
2867
3148
|
limit?: number;
|
|
2868
3149
|
};
|
|
2869
3150
|
declare namespace getByUser {
|
|
2870
3151
|
type Parameters = PaginationParams & {
|
|
2871
|
-
/** The user address to get positions for. */
|
|
2872
|
-
user: Address;
|
|
3152
|
+
/** The user address to get positions for. */user: Address;
|
|
2873
3153
|
};
|
|
2874
3154
|
type PositionWithReserved = {
|
|
2875
3155
|
chainId: Id;
|
|
2876
3156
|
contract: Address;
|
|
2877
3157
|
user: Address;
|
|
2878
|
-
blockNumber: number;
|
|
2879
|
-
/** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
3158
|
+
blockNumber: number; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
2880
3159
|
reserved: bigint;
|
|
2881
3160
|
};
|
|
2882
3161
|
type ReturnType = {
|
|
@@ -2928,6 +3207,21 @@ declare const schemas: {
|
|
|
2928
3207
|
false: "false";
|
|
2929
3208
|
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
2930
3209
|
}, z$1.core.$strip>;
|
|
3210
|
+
readonly get_config_contracts: z$1.ZodObject<{
|
|
3211
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3212
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3213
|
+
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>>>>>;
|
|
3214
|
+
}, z$1.core.$strip>;
|
|
3215
|
+
readonly get_config_rules: z$1.ZodObject<{
|
|
3216
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3217
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3218
|
+
types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
|
|
3219
|
+
maturity: "maturity";
|
|
3220
|
+
callback: "callback";
|
|
3221
|
+
loan_token: "loan_token";
|
|
3222
|
+
}>>>>;
|
|
3223
|
+
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>>>>>;
|
|
3224
|
+
}, z$1.core.$strip>;
|
|
2931
3225
|
readonly get_offers: z$1.ZodObject<{
|
|
2932
3226
|
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2933
3227
|
buy: "buy";
|
|
@@ -2940,10 +3234,10 @@ declare const schemas: {
|
|
|
2940
3234
|
}, z$1.core.$strip>;
|
|
2941
3235
|
readonly get_obligations: z$1.ZodObject<{
|
|
2942
3236
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
3237
|
+
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>>>>>;
|
|
3238
|
+
loan_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
|
|
3239
|
+
collateral_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
|
|
3240
|
+
maturities: 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>>>>>;
|
|
2947
3241
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2948
3242
|
}, z$1.core.$strip>;
|
|
2949
3243
|
readonly get_obligation: z$1.ZodObject<{
|
|
@@ -2961,6 +3255,12 @@ declare const schemas: {
|
|
|
2961
3255
|
readonly validate_offers: z$1.ZodObject<{
|
|
2962
3256
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
2963
3257
|
}, z$1.core.$strict>;
|
|
3258
|
+
readonly callback_types: z$1.ZodObject<{
|
|
3259
|
+
callbacks: z$1.ZodArray<z$1.ZodObject<{
|
|
3260
|
+
chain_id: z$1.ZodNumber;
|
|
3261
|
+
addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3262
|
+
}, z$1.core.$strict>>;
|
|
3263
|
+
}, z$1.core.$strict>;
|
|
2964
3264
|
readonly get_user_positions: z$1.ZodObject<{
|
|
2965
3265
|
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2966
3266
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -2971,15 +3271,13 @@ type Action = keyof typeof schemas;
|
|
|
2971
3271
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2972
3272
|
declare function safeParse<A extends Action>(action: A, query: unknown, error?: z$1.core.$ZodErrorMap<z$1.core.$ZodIssue>): z$1.ZodSafeParseResult<z$1.infer<(typeof schemas)[A]>>;
|
|
2973
3273
|
declare namespace index_d_exports$1 {
|
|
2974
|
-
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse,
|
|
3274
|
+
export { BookResponse_d_exports as BookResponse, BooksController, CallbacksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, UsersController, ValidateController, parse, safeParse };
|
|
2975
3275
|
}
|
|
2976
|
-
declare namespace Client_d_exports {
|
|
3276
|
+
declare namespace Client_d_exports$1 {
|
|
2977
3277
|
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
2978
3278
|
}
|
|
2979
3279
|
type RouterClientConfig = {
|
|
2980
|
-
/** The URL of the router. */
|
|
2981
|
-
readonly url: URL;
|
|
2982
|
-
/** The default headers to use for each request. */
|
|
3280
|
+
/** The URL of the router. */readonly url: URL; /** The default headers to use for each request. */
|
|
2983
3281
|
readonly headers: Headers;
|
|
2984
3282
|
};
|
|
2985
3283
|
type Client$2 = Compute<RouterClientConfig & {
|
|
@@ -3016,10 +3314,8 @@ type ConnectOptions = {
|
|
|
3016
3314
|
/** The URL of the router to interact with.
|
|
3017
3315
|
* @default "https://router.morpho.dev"
|
|
3018
3316
|
*/
|
|
3019
|
-
url?: string;
|
|
3020
|
-
/** The
|
|
3021
|
-
apiKey?: string;
|
|
3022
|
-
/** The default headers to use for each request. */
|
|
3317
|
+
url?: string; /** The API key to use for the router API. */
|
|
3318
|
+
apiKey?: string; /** The default headers to use for each request. */
|
|
3023
3319
|
headers?: Headers;
|
|
3024
3320
|
};
|
|
3025
3321
|
/**
|
|
@@ -3042,13 +3338,9 @@ declare namespace connect$1 {
|
|
|
3042
3338
|
declare function getOffers(apiClient: Client<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
3043
3339
|
declare namespace getOffers {
|
|
3044
3340
|
type Parameters = {
|
|
3045
|
-
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
3046
|
-
|
|
3047
|
-
/**
|
|
3048
|
-
obligationId: Hex;
|
|
3049
|
-
/** Pagination cursor in base64url-encoded format */
|
|
3050
|
-
cursor?: string;
|
|
3051
|
-
/** Maximum number of offers to return. @default 20 */
|
|
3341
|
+
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */side: "buy" | "sell"; /** The offers obligation id */
|
|
3342
|
+
obligationId: Hex; /** Pagination cursor in base64url-encoded format */
|
|
3343
|
+
cursor?: string; /** Maximum number of offers to return. @default 20 */
|
|
3052
3344
|
limit?: number;
|
|
3053
3345
|
};
|
|
3054
3346
|
type ReturnType = {
|
|
@@ -3058,14 +3350,10 @@ declare namespace getOffers {
|
|
|
3058
3350
|
consumed: bigint;
|
|
3059
3351
|
takeable: bigint;
|
|
3060
3352
|
} & {
|
|
3061
|
-
/** 32-byte merkle root. */
|
|
3062
|
-
|
|
3063
|
-
/** Sibling hashes for the merkle proof. */
|
|
3064
|
-
proof?: Hex[];
|
|
3065
|
-
/** Offer signature from the Merkle tree. */
|
|
3353
|
+
/** 32-byte merkle root. */root?: Hex; /** Sibling hashes for the merkle proof. */
|
|
3354
|
+
proof?: Hex[]; /** Offer signature from the Merkle tree. */
|
|
3066
3355
|
signature?: Hex;
|
|
3067
|
-
}>[];
|
|
3068
|
-
/** The pagination cursor. */
|
|
3356
|
+
}>[]; /** The pagination cursor. */
|
|
3069
3357
|
cursor: string | null;
|
|
3070
3358
|
};
|
|
3071
3359
|
type ErrorType = GetApiErrorType;
|
|
@@ -3073,25 +3361,17 @@ declare namespace getOffers {
|
|
|
3073
3361
|
declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
3074
3362
|
declare namespace getObligations {
|
|
3075
3363
|
type Parameters = {
|
|
3076
|
-
/** Pagination cursor is a 32-byte hex string. */
|
|
3077
|
-
|
|
3078
|
-
/**
|
|
3079
|
-
|
|
3080
|
-
/** Filter by
|
|
3081
|
-
|
|
3082
|
-
/** Filter by loan token address. */
|
|
3083
|
-
loanToken?: Address;
|
|
3084
|
-
/** Filter by collateral token (matches any collateral in the obligation). */
|
|
3085
|
-
collateralToken?: Address;
|
|
3086
|
-
/** Filter by exact maturity timestamp (unix seconds). */
|
|
3087
|
-
maturity?: number;
|
|
3364
|
+
/** Pagination cursor is a 32-byte hex string. */cursor?: Hex; /** Maximum number of obligations to return. @default 20 */
|
|
3365
|
+
limit?: number; /** Filter by chain IDs (comma-separated). */
|
|
3366
|
+
chainIds?: number[]; /** Filter by loan token addresses (comma-separated). */
|
|
3367
|
+
loanTokens?: Address[]; /** Filter by collateral tokens (comma-separated, matches any collateral). */
|
|
3368
|
+
collateralTokens?: Address[]; /** Filter by exact maturity timestamps (comma-separated, unix seconds). */
|
|
3369
|
+
maturities?: number[];
|
|
3088
3370
|
};
|
|
3089
3371
|
type ReturnType = {
|
|
3090
3372
|
obligations: Compute<{
|
|
3091
|
-
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
3092
|
-
|
|
3093
|
-
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
3094
|
-
/** The pagination cursor. */
|
|
3373
|
+
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/id: () => Hex;
|
|
3374
|
+
} & Obligation & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
|
|
3095
3375
|
cursor: string | null;
|
|
3096
3376
|
};
|
|
3097
3377
|
type ErrorType = GetApiErrorType;
|
|
@@ -3127,20 +3407,20 @@ declare namespace Gate_d_exports {
|
|
|
3127
3407
|
/**
|
|
3128
3408
|
* A validation rule.
|
|
3129
3409
|
*/
|
|
3130
|
-
type Rule<T, Name
|
|
3410
|
+
type Rule<T, Name extends string = string> = {
|
|
3131
3411
|
kind: "single";
|
|
3132
|
-
name: Name
|
|
3412
|
+
name: Name;
|
|
3133
3413
|
description: string;
|
|
3134
|
-
run: Single<T, Name
|
|
3414
|
+
run: Single<T, Name>;
|
|
3135
3415
|
} | {
|
|
3136
3416
|
kind: "batch";
|
|
3137
|
-
name: Name
|
|
3417
|
+
name: Name;
|
|
3138
3418
|
description: string;
|
|
3139
|
-
run: Batch<T, Name
|
|
3419
|
+
run: Batch<T, Name>;
|
|
3140
3420
|
};
|
|
3141
|
-
type RuleNames<Rules
|
|
3421
|
+
type RuleNames<Rules extends readonly {
|
|
3142
3422
|
name: string;
|
|
3143
|
-
}[]> = Rules
|
|
3423
|
+
}[]> = Rules[number]["name"];
|
|
3144
3424
|
/**
|
|
3145
3425
|
* A single item validation rule.
|
|
3146
3426
|
* @param item - The item to validate.
|
|
@@ -3160,7 +3440,7 @@ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<
|
|
|
3160
3440
|
* @param run - The function that validates the rule.
|
|
3161
3441
|
* @returns The created rule.
|
|
3162
3442
|
*/
|
|
3163
|
-
declare function single<Name
|
|
3443
|
+
declare function single<Name extends string, T>(name: Name, description: string, run: Single<T, Name>): Rule<T, Name>;
|
|
3164
3444
|
/**
|
|
3165
3445
|
* Create a validation rule iterating over a batch of items at a time.
|
|
3166
3446
|
* @param name - The name of the rule.
|
|
@@ -3168,95 +3448,134 @@ declare function single<Name$1 extends string, T>(name: Name$1, description: str
|
|
|
3168
3448
|
* @param run - The function that validates the rule.
|
|
3169
3449
|
* @returns The created rule.
|
|
3170
3450
|
*/
|
|
3171
|
-
declare function batch$1<Name
|
|
3451
|
+
declare function batch$1<Name extends string, T>(name: Name, description: string, run: Batch<T, Name>): Rule<T, Name>;
|
|
3172
3452
|
/**
|
|
3173
3453
|
* A validation issue.
|
|
3174
3454
|
*/
|
|
3175
3455
|
type Issue<T, RuleName extends string = string> = {
|
|
3176
|
-
/** The name of the rule that caused the issue. */
|
|
3177
|
-
|
|
3178
|
-
/** The message of the issue. */
|
|
3179
|
-
message: string;
|
|
3180
|
-
/** The item that was not valid. */
|
|
3456
|
+
/** The name of the rule that caused the issue. */ruleName: RuleName; /** The message of the issue. */
|
|
3457
|
+
message: string; /** The item that was not valid. */
|
|
3181
3458
|
item: T;
|
|
3182
3459
|
};
|
|
3183
3460
|
/**
|
|
3184
3461
|
* The result of a validation.
|
|
3185
3462
|
*/
|
|
3186
3463
|
type Result<T, RuleName extends string = string> = {
|
|
3187
|
-
/** The items that were valid. */
|
|
3188
|
-
valid: T[];
|
|
3189
|
-
/** The reports of the failed validations. */
|
|
3464
|
+
/** The items that were valid. */valid: T[]; /** The reports of the failed validations. */
|
|
3190
3465
|
issues: Issue<T, RuleName>[];
|
|
3191
3466
|
};
|
|
3192
|
-
declare function run<T, Name
|
|
3467
|
+
declare function run<T, Name extends string, Rules extends readonly Rule<T, Name>[]>(parameters: {
|
|
3193
3468
|
items: T[];
|
|
3194
|
-
rules: Rules
|
|
3469
|
+
rules: Rules;
|
|
3195
3470
|
chunkSize?: number;
|
|
3196
|
-
}): Promise<Result<T, RuleNames<Rules
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
type
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
type CallbackConfig = {
|
|
3205
|
-
type: CallbackType.BuyVaultV1Callback;
|
|
3206
|
-
addresses: Address[];
|
|
3207
|
-
vaultFactories: Address[];
|
|
3471
|
+
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
3472
|
+
//#endregion
|
|
3473
|
+
//#region src/gatekeeper/types.d.ts
|
|
3474
|
+
type ConfigRule = {
|
|
3475
|
+
type: "maturity";
|
|
3476
|
+
chain_id: Id;
|
|
3477
|
+
name: MaturityType;
|
|
3478
|
+
timestamp: Maturity;
|
|
3208
3479
|
} | {
|
|
3209
|
-
type:
|
|
3210
|
-
|
|
3480
|
+
type: "callback";
|
|
3481
|
+
chain_id: Id;
|
|
3482
|
+
address: Address;
|
|
3483
|
+
callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
|
|
3211
3484
|
} | {
|
|
3212
|
-
type:
|
|
3485
|
+
type: "loan_token";
|
|
3486
|
+
chain_id: Id;
|
|
3487
|
+
address: Address;
|
|
3488
|
+
};
|
|
3489
|
+
type ValidationIssue = {
|
|
3490
|
+
index: number;
|
|
3491
|
+
rule: string;
|
|
3492
|
+
message: string;
|
|
3493
|
+
};
|
|
3494
|
+
type ValidateOffersSuccess = {
|
|
3495
|
+
payload: Hex;
|
|
3496
|
+
root: Hex;
|
|
3497
|
+
};
|
|
3498
|
+
type ValidateOffersIssues = {
|
|
3499
|
+
issues: ValidationIssue[];
|
|
3500
|
+
};
|
|
3501
|
+
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
3502
|
+
type CallbackType = Type$1 | "not_supported";
|
|
3503
|
+
type CallbackTypesRequest = {
|
|
3504
|
+
callbacks: Array<{
|
|
3505
|
+
chain_id: Id;
|
|
3506
|
+
addresses: Address[];
|
|
3507
|
+
}>;
|
|
3508
|
+
};
|
|
3509
|
+
type CallbackTypesResponse = Array<{
|
|
3510
|
+
chain_id: Id;
|
|
3511
|
+
} & Partial<Record<CallbackType, Address[]>>>;
|
|
3512
|
+
type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
|
|
3513
|
+
type SuccessPayload<T> = {
|
|
3514
|
+
meta: {
|
|
3515
|
+
timestamp: string;
|
|
3516
|
+
checksum?: string;
|
|
3517
|
+
};
|
|
3518
|
+
cursor: string | null;
|
|
3519
|
+
data: T;
|
|
3520
|
+
};
|
|
3521
|
+
type ErrorPayload = {
|
|
3522
|
+
meta: {
|
|
3523
|
+
timestamp: string;
|
|
3524
|
+
checksum?: string;
|
|
3525
|
+
};
|
|
3526
|
+
error: {
|
|
3527
|
+
code: string;
|
|
3528
|
+
message: string;
|
|
3529
|
+
details?: unknown;
|
|
3530
|
+
};
|
|
3531
|
+
};
|
|
3532
|
+
declare namespace Client_d_exports {
|
|
3533
|
+
export { ClientConfig, GatekeeperClient, createHttpClient };
|
|
3534
|
+
}
|
|
3535
|
+
type GatekeeperClient = {
|
|
3536
|
+
/** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
|
|
3537
|
+
statusCode: number;
|
|
3538
|
+
body: unknown;
|
|
3539
|
+
}>; /** Get configured rules for supported chains. */
|
|
3540
|
+
getConfigRules: (query?: {
|
|
3541
|
+
cursor?: string;
|
|
3542
|
+
limit?: number | string;
|
|
3543
|
+
types?: Array<ConfigRule["type"]> | ConfigRule["type"];
|
|
3544
|
+
}) => Promise<{
|
|
3545
|
+
statusCode: number;
|
|
3546
|
+
body: ConfigRulesPayload;
|
|
3547
|
+
}>; /** Validate offers and return decision results. */
|
|
3548
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
|
|
3549
|
+
getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
|
|
3550
|
+
baseUrl: string;
|
|
3551
|
+
};
|
|
3552
|
+
type ClientConfig = {
|
|
3553
|
+
baseUrl: string;
|
|
3554
|
+
timeoutMs?: number;
|
|
3555
|
+
fetchFn?: typeof fetch;
|
|
3556
|
+
originSecret?: string;
|
|
3213
3557
|
};
|
|
3214
|
-
declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
3215
|
-
type: CallbackType.BuyVaultV1Callback;
|
|
3216
|
-
}> | undefined;
|
|
3217
|
-
declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
3218
|
-
type: CallbackType.SellERC20Callback;
|
|
3219
|
-
}> | undefined;
|
|
3220
|
-
declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
3221
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
3222
|
-
}> | undefined;
|
|
3223
|
-
declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
|
|
3224
|
-
/**
|
|
3225
|
-
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
3226
|
-
* Skips the empty callback type as it does not carry addresses.
|
|
3227
|
-
*
|
|
3228
|
-
* @param chain - Chain name for which to infer the callback type
|
|
3229
|
-
* @param address - Callback contract address
|
|
3230
|
-
* @returns The callback type when found, otherwise undefined
|
|
3231
|
-
*/
|
|
3232
|
-
declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
|
|
3233
|
-
/**
|
|
3234
|
-
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
3235
|
-
* @param chain - Chain name for which to read the validation configuration
|
|
3236
|
-
* @param type - Callback type to retrieve
|
|
3237
|
-
* @returns The matching callback addresses or an empty array if not configured
|
|
3238
|
-
*/
|
|
3239
|
-
declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
|
|
3240
3558
|
/**
|
|
3241
|
-
*
|
|
3242
|
-
*
|
|
3243
|
-
* @
|
|
3244
|
-
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
3559
|
+
* Create an HTTP client for a gatekeeper service.
|
|
3560
|
+
* @param config - Gatekeeper client configuration. {@link ClientConfig}
|
|
3561
|
+
* @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
|
|
3245
3562
|
*/
|
|
3246
|
-
declare
|
|
3247
|
-
declare const assets: Record<string, Address[]>;
|
|
3248
|
-
declare const configs: Record<Name, GateConfig>;
|
|
3563
|
+
declare function createHttpClient(config: ClientConfig): GatekeeperClient;
|
|
3249
3564
|
declare namespace Gatekeeper_d_exports {
|
|
3250
3565
|
export { Gatekeeper, Rules, create };
|
|
3251
3566
|
}
|
|
3252
3567
|
type Rules = readonly Rule<Offer, string>[];
|
|
3253
3568
|
type Gatekeeper = {
|
|
3254
|
-
rules: Rules;
|
|
3255
3569
|
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
3256
3570
|
};
|
|
3257
3571
|
type GatekeeperParameters = {
|
|
3258
3572
|
rules: Rules;
|
|
3259
3573
|
};
|
|
3574
|
+
/**
|
|
3575
|
+
* Create a gatekeeper instance with the provided rules.
|
|
3576
|
+
* @param parameters - Gatekeeper parameters. {@link GatekeeperParameters}
|
|
3577
|
+
* @returns Gatekeeper instance. {@link Gatekeeper}
|
|
3578
|
+
*/
|
|
3260
3579
|
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
3261
3580
|
//#endregion
|
|
3262
3581
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
@@ -3288,7 +3607,7 @@ declare const callback: ({
|
|
|
3288
3607
|
callbacks,
|
|
3289
3608
|
allowedAddresses
|
|
3290
3609
|
}: {
|
|
3291
|
-
callbacks:
|
|
3610
|
+
callbacks: Type$1[];
|
|
3292
3611
|
allowedAddresses: Address[];
|
|
3293
3612
|
}) => Rule<Offer, "callback">;
|
|
3294
3613
|
/**
|
|
@@ -3318,11 +3637,9 @@ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusiv
|
|
|
3318
3637
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
3319
3638
|
declare namespace from {
|
|
3320
3639
|
type Parameters = {
|
|
3321
|
-
/** The viem client to use. */
|
|
3322
|
-
|
|
3323
|
-
/** The mempool
|
|
3324
|
-
mempoolAddress: Address;
|
|
3325
|
-
/** The block window to use for the mempool. Defaults to 100. */
|
|
3640
|
+
/** The viem client to use. */client: WalletClient; /** The mempool address. */
|
|
3641
|
+
mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
|
|
3642
|
+
morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
|
|
3326
3643
|
blockWindow?: number;
|
|
3327
3644
|
};
|
|
3328
3645
|
type ReturnType = Client$1;
|
|
@@ -3333,18 +3650,12 @@ declare namespace MempoolClient_d_exports {
|
|
|
3333
3650
|
}
|
|
3334
3651
|
type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
|
|
3335
3652
|
type GetParameters = {
|
|
3336
|
-
/** The block number to get offers from. */
|
|
3337
|
-
|
|
3338
|
-
/** The
|
|
3339
|
-
|
|
3340
|
-
/** The loan asset to get offers from. */
|
|
3341
|
-
loanToken?: string;
|
|
3342
|
-
/** The order to get offers. Defaults to "desc". */
|
|
3343
|
-
order?: "asc" | "desc";
|
|
3344
|
-
/** The options to get offers from. */
|
|
3653
|
+
/** The block number to get offers from. */blockNumberGte?: number; /** The block number to get offers to. */
|
|
3654
|
+
blockNumberLte?: number; /** The loan asset to get offers from. */
|
|
3655
|
+
loanToken?: string; /** The order to get offers. Defaults to "desc". */
|
|
3656
|
+
order?: "asc" | "desc"; /** The options to get offers from. */
|
|
3345
3657
|
options?: {
|
|
3346
|
-
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
|
|
3347
|
-
maxBatchSize?: number;
|
|
3658
|
+
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */maxBatchSize?: number;
|
|
3348
3659
|
};
|
|
3349
3660
|
};
|
|
3350
3661
|
/**
|
|
@@ -3355,11 +3666,9 @@ type Client$1 = {
|
|
|
3355
3666
|
* Add an offer to the mempool.
|
|
3356
3667
|
* @returns The created offer with its hash.
|
|
3357
3668
|
*/
|
|
3358
|
-
add: (parameters: AddParameters) => Promise<Hex>;
|
|
3359
|
-
/** Get offers from the mempool. */
|
|
3669
|
+
add: (parameters: AddParameters) => Promise<Hex>; /** Get offers from the mempool. */
|
|
3360
3670
|
get: (parameters?: GetParameters) => AsyncGenerator<{
|
|
3361
|
-
offers: Offer[];
|
|
3362
|
-
/** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
3671
|
+
offers: Offer[]; /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
3363
3672
|
blockNumber: number;
|
|
3364
3673
|
}>;
|
|
3365
3674
|
/**
|
|
@@ -3515,5 +3824,5 @@ declare namespace index_d_exports$2 {
|
|
|
3515
3824
|
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$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
|
|
3516
3825
|
}
|
|
3517
3826
|
//#endregion
|
|
3518
|
-
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, ERC4626_d_exports as ERC4626, Errors_d_exports as Errors, Format_d_exports as Format,
|
|
3827
|
+
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, CallbackType, CallbackTypesRequest, CallbackTypesResponse, 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, 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 };
|
|
3519
3828
|
//# sourceMappingURL=index.browser.d.mts.map
|