@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.ts
CHANGED
|
@@ -8,14 +8,14 @@ import { Client } from "openapi-fetch";
|
|
|
8
8
|
|
|
9
9
|
//#region rolldown:runtime
|
|
10
10
|
declare namespace BookResponse_d_exports {
|
|
11
|
-
export { BookLevelResponse, from$
|
|
11
|
+
export { BookLevelResponse, from$15 as from };
|
|
12
12
|
}
|
|
13
13
|
type BookLevelResponse = {
|
|
14
14
|
price: string;
|
|
15
15
|
assets: string;
|
|
16
16
|
count: number;
|
|
17
17
|
};
|
|
18
|
-
declare function from$
|
|
18
|
+
declare function from$15(level: {
|
|
19
19
|
price: bigint;
|
|
20
20
|
assets: bigint;
|
|
21
21
|
count: number;
|
|
@@ -29,9 +29,9 @@ declare const CollectorHealth: z.ZodObject<{
|
|
|
29
29
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
30
30
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
31
31
|
status: z.ZodEnum<{
|
|
32
|
+
unknown: "unknown";
|
|
32
33
|
live: "live";
|
|
33
34
|
lagging: "lagging";
|
|
34
|
-
unknown: "unknown";
|
|
35
35
|
}>;
|
|
36
36
|
initialized: z.ZodBoolean;
|
|
37
37
|
}, z.core.$strip>;
|
|
@@ -42,9 +42,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
|
42
42
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
43
43
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
44
44
|
status: z.ZodEnum<{
|
|
45
|
+
unknown: "unknown";
|
|
45
46
|
live: "live";
|
|
46
47
|
lagging: "lagging";
|
|
47
|
-
unknown: "unknown";
|
|
48
48
|
}>;
|
|
49
49
|
initialized: z.ZodBoolean;
|
|
50
50
|
}, z.core.$strip>>;
|
|
@@ -339,19 +339,48 @@ declare const Morpho: readonly [{
|
|
|
339
339
|
}];
|
|
340
340
|
readonly stateMutability: "view";
|
|
341
341
|
}];
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/core/types.d.ts
|
|
344
|
+
/** Combines members of an intersection into a readable type. */
|
|
345
|
+
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
346
|
+
declare const BrandTypeId: unique symbol;
|
|
347
|
+
type Brand<in out ID extends string | symbol> = {
|
|
348
|
+
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
349
|
+
};
|
|
342
350
|
declare namespace Callback_d_exports {
|
|
343
|
-
export { BuyVaultV1CallbackData,
|
|
351
|
+
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 };
|
|
344
352
|
}
|
|
345
|
-
|
|
353
|
+
/** A position decoded from callback data. */
|
|
354
|
+
type CallbackPosition = {
|
|
355
|
+
/** The ERC20 token contract address. */contract: Address; /** The maximum amount available from this position. */
|
|
356
|
+
amount: bigint;
|
|
357
|
+
};
|
|
358
|
+
type Callback = {
|
|
359
|
+
type: Type$1.BuyWithEmptyCallback;
|
|
360
|
+
} | (({
|
|
361
|
+
/** The address of the callback contract. */address: Address; /** The ABI-encoded callback data. */
|
|
362
|
+
data: Hex;
|
|
363
|
+
} & {
|
|
364
|
+
type: Type$1.BuyERC20; /** The decoded callback inputs. */
|
|
365
|
+
inputs: {
|
|
366
|
+
/** The ERC20 positions available for the callback. */positions: CallbackPosition[];
|
|
367
|
+
};
|
|
368
|
+
}) & Brand<"Callback">);
|
|
369
|
+
declare enum Type$1 {
|
|
346
370
|
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
371
|
+
BuyERC20 = "buy_erc20",
|
|
347
372
|
BuyVaultV1Callback = "buy_vault_v1_callback",
|
|
348
|
-
SellERC20Callback = "sell_erc20_callback"
|
|
373
|
+
SellERC20Callback = "sell_erc20_callback"
|
|
349
374
|
}
|
|
350
375
|
declare const isEmptyCallback: (offer: Offer) => boolean;
|
|
351
|
-
declare function decode$2(type:
|
|
376
|
+
declare function decode$2(type: Type$1, data: Hex): {
|
|
352
377
|
contract: Address;
|
|
353
378
|
amount: bigint;
|
|
354
379
|
}[];
|
|
380
|
+
type BuyERC20Data = {
|
|
381
|
+
tokens: Address[];
|
|
382
|
+
amounts: bigint[];
|
|
383
|
+
};
|
|
355
384
|
type BuyVaultV1CallbackData = {
|
|
356
385
|
vaults: Address[];
|
|
357
386
|
amounts: bigint[];
|
|
@@ -360,8 +389,28 @@ type SellERC20CallbackData = {
|
|
|
360
389
|
collaterals: Address[];
|
|
361
390
|
amounts: bigint[];
|
|
362
391
|
};
|
|
363
|
-
declare function encode$2(type:
|
|
364
|
-
declare function encode$2(type:
|
|
392
|
+
declare function encode$2(type: Type$1.BuyERC20, data: BuyERC20Data): Hex;
|
|
393
|
+
declare function encode$2(type: Type$1.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
|
|
394
|
+
declare function encode$2(type: Type$1.SellERC20Callback, data: SellERC20CallbackData): Hex;
|
|
395
|
+
/**
|
|
396
|
+
* Decodes BuyERC20 callback data into positions.
|
|
397
|
+
* @param data - The ABI-encoded callback data containing token addresses and amounts.
|
|
398
|
+
* @returns Array of positions with contract address and amount.
|
|
399
|
+
* @throws If data is empty, malformed, or arrays have mismatched lengths.
|
|
400
|
+
*/
|
|
401
|
+
declare function decodeBuyERC20(data: Hex): Array<{
|
|
402
|
+
contract: Address;
|
|
403
|
+
amount: bigint;
|
|
404
|
+
}>;
|
|
405
|
+
/**
|
|
406
|
+
* Encodes BuyERC20 callback parameters into ABI-encoded data.
|
|
407
|
+
* @param parameters - The tokens and amounts to encode.
|
|
408
|
+
* @returns ABI-encoded hex string.
|
|
409
|
+
*/
|
|
410
|
+
declare function encodeBuyERC20(parameters: {
|
|
411
|
+
tokens: Address[];
|
|
412
|
+
amounts: bigint[];
|
|
413
|
+
}): Hex;
|
|
365
414
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
366
415
|
contract: Address;
|
|
367
416
|
amount: bigint;
|
|
@@ -423,6 +472,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
|
423
472
|
v1_1: ChainContract;
|
|
424
473
|
};
|
|
425
474
|
};
|
|
475
|
+
callbacks: Callback[];
|
|
426
476
|
}>, "custom"> & {
|
|
427
477
|
id: Id;
|
|
428
478
|
name: Name;
|
|
@@ -436,6 +486,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
|
436
486
|
v1_1: ChainContract;
|
|
437
487
|
};
|
|
438
488
|
};
|
|
489
|
+
callbacks: Callback[];
|
|
439
490
|
};
|
|
440
491
|
}>;
|
|
441
492
|
declare const ChainId: {
|
|
@@ -489,17 +540,14 @@ type ChainRegistry = {
|
|
|
489
540
|
getById: (chainId: Id) => Chain$1 | undefined;
|
|
490
541
|
list: () => Chain$1[];
|
|
491
542
|
};
|
|
543
|
+
/**
|
|
544
|
+
* Creates a chain registry from a list of chains.
|
|
545
|
+
* @param chains - Array of chain objects to register.
|
|
546
|
+
* @returns A registry for looking up chains by ID. {@link ChainRegistry}
|
|
547
|
+
*/
|
|
492
548
|
declare function create$1(chains: Chain$1[]): ChainRegistry;
|
|
493
|
-
//#endregion
|
|
494
|
-
//#region src/core/types.d.ts
|
|
495
|
-
/** Combines members of an intersection into a readable type. */
|
|
496
|
-
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
497
|
-
declare const BrandTypeId: unique symbol;
|
|
498
|
-
type Brand<in out ID extends string | symbol> = {
|
|
499
|
-
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
500
|
-
};
|
|
501
549
|
declare namespace LLTV_d_exports {
|
|
502
|
-
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$
|
|
550
|
+
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$14 as from };
|
|
503
551
|
}
|
|
504
552
|
type LLTV = bigint & Brand<"LLTV">;
|
|
505
553
|
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
@@ -509,8 +557,8 @@ type Options = (typeof Options)[number];
|
|
|
509
557
|
* @param lltv - The LLTV option or the scaled LLTV.
|
|
510
558
|
* @returns The LLTV.
|
|
511
559
|
*/
|
|
512
|
-
declare function from$
|
|
513
|
-
declare namespace from$
|
|
560
|
+
declare function from$14(lltv: Options | bigint): LLTV;
|
|
561
|
+
declare namespace from$14 {
|
|
514
562
|
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
515
563
|
}
|
|
516
564
|
declare class InvalidOptionError$1 extends BaseError {
|
|
@@ -523,14 +571,11 @@ declare class InvalidLLTVError extends BaseError {
|
|
|
523
571
|
}
|
|
524
572
|
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
525
573
|
declare namespace Collateral_d_exports {
|
|
526
|
-
export { Collateral, CollateralSchema, CollateralsSchema, from$
|
|
574
|
+
export { Collateral, CollateralSchema, CollateralsSchema, from$13 as from, random$3 as random };
|
|
527
575
|
}
|
|
528
576
|
type Collateral = {
|
|
529
|
-
/** Asset being used as collateral. */
|
|
530
|
-
|
|
531
|
-
/** Liquidation Loan-to-Value of the collateral. */
|
|
532
|
-
lltv: LLTV;
|
|
533
|
-
/** Oracle contract used to price the collateral. */
|
|
577
|
+
/** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
|
|
578
|
+
lltv: LLTV; /** Oracle contract used to price the collateral. */
|
|
534
579
|
oracle: Address;
|
|
535
580
|
};
|
|
536
581
|
declare const CollateralSchema: z$1.ZodObject<{
|
|
@@ -543,8 +588,8 @@ declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
|
543
588
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
544
589
|
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
545
590
|
}, z$1.core.$strip>>;
|
|
546
|
-
declare const from$
|
|
547
|
-
declare namespace from$
|
|
591
|
+
declare const from$13: (parameters: from$13.Parameters) => from$13.ReturnType;
|
|
592
|
+
declare namespace from$13 {
|
|
548
593
|
type Parameters = {
|
|
549
594
|
asset: Address;
|
|
550
595
|
lltv: Options | bigint;
|
|
@@ -582,8 +627,7 @@ declare namespace ERC4626_d_exports {
|
|
|
582
627
|
declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
|
|
583
628
|
declare namespace decimalsOffset {
|
|
584
629
|
type Parameters = {
|
|
585
|
-
/** The number of decimals of the underlying asset. */
|
|
586
|
-
underlyingDecimals: number;
|
|
630
|
+
/** The number of decimals of the underlying asset. */underlyingDecimals: number;
|
|
587
631
|
};
|
|
588
632
|
type ReturnType = number;
|
|
589
633
|
}
|
|
@@ -602,11 +646,8 @@ declare namespace decimalsOffset {
|
|
|
602
646
|
declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
|
|
603
647
|
declare namespace convertToAssets {
|
|
604
648
|
type Parameters = {
|
|
605
|
-
/** The amount of shares to convert. */
|
|
606
|
-
|
|
607
|
-
/** Total amount of assets in the vault. */
|
|
608
|
-
totalAssets: bigint;
|
|
609
|
-
/** Total amount of shares in the vault. */
|
|
649
|
+
/** The amount of shares to convert. */shares: bigint; /** Total amount of assets in the vault. */
|
|
650
|
+
totalAssets: bigint; /** Total amount of shares in the vault. */
|
|
610
651
|
totalSupply: bigint;
|
|
611
652
|
/**
|
|
612
653
|
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
@@ -633,11 +674,8 @@ declare namespace convertToAssets {
|
|
|
633
674
|
declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
|
|
634
675
|
declare namespace convertToShares {
|
|
635
676
|
type Parameters = {
|
|
636
|
-
/** The amount of assets to convert. */
|
|
637
|
-
|
|
638
|
-
/** Total amount of assets in the vault. */
|
|
639
|
-
totalAssets: bigint;
|
|
640
|
-
/** Total amount of shares in the vault. */
|
|
677
|
+
/** The amount of assets to convert. */assets: bigint; /** Total amount of assets in the vault. */
|
|
678
|
+
totalAssets: bigint; /** Total amount of shares in the vault. */
|
|
641
679
|
totalSupply: bigint;
|
|
642
680
|
/**
|
|
643
681
|
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
@@ -773,7 +811,7 @@ declare function generateMarketLiquidityPoolId(parameters: {
|
|
|
773
811
|
marketId: string;
|
|
774
812
|
}): string;
|
|
775
813
|
declare namespace Maturity_d_exports {
|
|
776
|
-
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$
|
|
814
|
+
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$12 as from };
|
|
777
815
|
}
|
|
778
816
|
/**
|
|
779
817
|
* Maturity is a number that represents a date in seconds.
|
|
@@ -786,7 +824,7 @@ declare enum MaturityType {
|
|
|
786
824
|
EndOfMonth = "end_of_month",
|
|
787
825
|
EndOfNextMonth = "end_of_next_month",
|
|
788
826
|
EndOfQuarter = "end_of_quarter",
|
|
789
|
-
EndOfNextQuarter = "end_of_next_quarter"
|
|
827
|
+
EndOfNextQuarter = "end_of_next_quarter"
|
|
790
828
|
}
|
|
791
829
|
declare const MaturityOptions: {
|
|
792
830
|
readonly end_of_week: () => Maturity;
|
|
@@ -803,8 +841,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
|
|
|
803
841
|
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
804
842
|
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
805
843
|
*/
|
|
806
|
-
declare function from$
|
|
807
|
-
declare namespace from$
|
|
844
|
+
declare function from$12(ts: from$12.Parameters): Maturity;
|
|
845
|
+
declare namespace from$12 {
|
|
808
846
|
type Parameters = number | MaturityOptions;
|
|
809
847
|
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
810
848
|
}
|
|
@@ -848,16 +886,12 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
848
886
|
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
849
887
|
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
850
888
|
declare namespace Obligation_d_exports {
|
|
851
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$
|
|
889
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
852
890
|
}
|
|
853
891
|
type Obligation = {
|
|
854
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
855
|
-
|
|
856
|
-
/** The
|
|
857
|
-
loanToken: Address;
|
|
858
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
859
|
-
collaterals: Collateral[];
|
|
860
|
-
/** The maturity of the obligation. */
|
|
892
|
+
/** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
|
|
893
|
+
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
894
|
+
collaterals: Collateral[]; /** The maturity of the obligation. */
|
|
861
895
|
maturity: Maturity;
|
|
862
896
|
};
|
|
863
897
|
declare const ObligationSchema: z$1.ZodObject<{
|
|
@@ -893,17 +927,13 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
893
927
|
* });
|
|
894
928
|
* ```
|
|
895
929
|
*/
|
|
896
|
-
declare function from$
|
|
897
|
-
declare namespace from$
|
|
930
|
+
declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
|
|
931
|
+
declare namespace from$11 {
|
|
898
932
|
type Parameters = {
|
|
899
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
904
|
-
collaterals: from$12.Parameters[] | readonly from$12.Parameters[];
|
|
905
|
-
/** The maturity of the obligation. */
|
|
906
|
-
maturity: from$11.Parameters;
|
|
933
|
+
/** The chain id where the liquidity for this obligation is located. */chainId: number; /** The token that is being borrowed for this obligation. */
|
|
934
|
+
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
935
|
+
collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
|
|
936
|
+
maturity: from$12.Parameters;
|
|
907
937
|
};
|
|
908
938
|
type ReturnType = Obligation;
|
|
909
939
|
type ErrorType = InvalidObligationError;
|
|
@@ -964,6 +994,18 @@ declare function random$2(): random$2.ReturnType;
|
|
|
964
994
|
declare namespace random$2 {
|
|
965
995
|
type ReturnType = Obligation;
|
|
966
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* Creates an obligation from an offer.
|
|
999
|
+
* @constructor
|
|
1000
|
+
*
|
|
1001
|
+
* @param offer - The offer to create the obligation from.
|
|
1002
|
+
* @returns The created obligation. {@link fromOffer.ReturnType}
|
|
1003
|
+
*/
|
|
1004
|
+
declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
|
|
1005
|
+
declare namespace fromOffer$1 {
|
|
1006
|
+
type Parameters = Offer;
|
|
1007
|
+
type ReturnType = Obligation;
|
|
1008
|
+
}
|
|
967
1009
|
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
968
1010
|
readonly name = "Obligation.InvalidObligationError";
|
|
969
1011
|
constructor(error: z$1.ZodError | Error);
|
|
@@ -973,38 +1015,23 @@ declare class CollateralsAreNotSortedError extends BaseError {
|
|
|
973
1015
|
constructor();
|
|
974
1016
|
}
|
|
975
1017
|
declare namespace Offer_d_exports {
|
|
976
|
-
export {
|
|
1018
|
+
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 };
|
|
977
1019
|
}
|
|
978
1020
|
type Offer = {
|
|
979
|
-
/** The address that made the offer. */
|
|
980
|
-
readonly
|
|
981
|
-
/** The
|
|
982
|
-
readonly
|
|
983
|
-
|
|
984
|
-
readonly
|
|
985
|
-
|
|
986
|
-
readonly
|
|
987
|
-
/** The
|
|
988
|
-
readonly
|
|
989
|
-
/** The
|
|
990
|
-
readonly
|
|
991
|
-
/** The
|
|
992
|
-
readonly
|
|
993
|
-
/** The date at which the offer will start. */
|
|
994
|
-
readonly start: number;
|
|
995
|
-
/** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
996
|
-
readonly group: Hex;
|
|
997
|
-
/** The session. Used for session-based offer management. */
|
|
998
|
-
readonly session: Hex;
|
|
999
|
-
/** The side of the offer. `true` for buy, `false` for sell. */
|
|
1000
|
-
readonly buy: boolean;
|
|
1001
|
-
/** The chain id where the liquidity for this offer is located. */
|
|
1002
|
-
readonly chainId: Id;
|
|
1003
|
-
/** The token that is being borrowed. */
|
|
1004
|
-
readonly loanToken: Address;
|
|
1005
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
1006
|
-
readonly collaterals: readonly Collateral[];
|
|
1007
|
-
/** The optional callback data to retrieve the maker funds. */
|
|
1021
|
+
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
1022
|
+
readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
|
|
1023
|
+
readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
|
|
1024
|
+
readonly obligationShares: bigint; /** The price (18 decimals). */
|
|
1025
|
+
readonly price: bigint; /** The date at which all interests will be paid. */
|
|
1026
|
+
readonly maturity: Maturity; /** The date at which the offer will expire. */
|
|
1027
|
+
readonly expiry: number; /** The date at which the offer will start. */
|
|
1028
|
+
readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
1029
|
+
readonly group: Hex; /** The session. Used for session-based offer management. */
|
|
1030
|
+
readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
|
|
1031
|
+
readonly buy: boolean; /** The chain id where the liquidity for this offer is located. */
|
|
1032
|
+
readonly chainId: Id; /** The token that is being borrowed. */
|
|
1033
|
+
readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1034
|
+
readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
|
|
1008
1035
|
readonly callback: {
|
|
1009
1036
|
readonly address: Address;
|
|
1010
1037
|
readonly data: Hex;
|
|
@@ -1012,7 +1039,7 @@ type Offer = {
|
|
|
1012
1039
|
};
|
|
1013
1040
|
declare enum Status {
|
|
1014
1041
|
VALID = "VALID",
|
|
1015
|
-
SIMULATION_ERROR = "SIMULATION_ERROR"
|
|
1042
|
+
SIMULATION_ERROR = "SIMULATION_ERROR"
|
|
1016
1043
|
}
|
|
1017
1044
|
type Validation = {
|
|
1018
1045
|
offerHash: Hex;
|
|
@@ -1055,12 +1082,9 @@ declare const OfferSchema: () => z$1.ZodObject<{
|
|
|
1055
1082
|
*/
|
|
1056
1083
|
type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares"> & {
|
|
1057
1084
|
chainId: number;
|
|
1058
|
-
group: Hex | bigint | number | string;
|
|
1059
|
-
/** Optional: defaults to
|
|
1060
|
-
|
|
1061
|
-
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
1062
|
-
obligationUnits?: bigint;
|
|
1063
|
-
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
1085
|
+
group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
|
|
1086
|
+
session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
1087
|
+
obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
1064
1088
|
obligationShares?: bigint;
|
|
1065
1089
|
}>;
|
|
1066
1090
|
/**
|
|
@@ -1069,8 +1093,8 @@ type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligat
|
|
|
1069
1093
|
* @param input - The offer to create.
|
|
1070
1094
|
* @returns The created offer.
|
|
1071
1095
|
*/
|
|
1072
|
-
declare function from$
|
|
1073
|
-
declare namespace from$
|
|
1096
|
+
declare function from$10(input: OfferInput): Offer;
|
|
1097
|
+
declare namespace from$10 {
|
|
1074
1098
|
type ErrorType = InvalidOfferError;
|
|
1075
1099
|
}
|
|
1076
1100
|
/**
|
|
@@ -1230,15 +1254,6 @@ declare const types: {
|
|
|
1230
1254
|
readonly type: "bytes";
|
|
1231
1255
|
}];
|
|
1232
1256
|
};
|
|
1233
|
-
/**
|
|
1234
|
-
* Signs an array of offers.
|
|
1235
|
-
* @throws {Error} If the wallet account is not set.
|
|
1236
|
-
* @param offers - The offers to sign.
|
|
1237
|
-
* @param wallet - The wallet to sign the offers with.
|
|
1238
|
-
* @returns The signed offers.
|
|
1239
|
-
*/
|
|
1240
|
-
declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
|
|
1241
|
-
declare function signatureMsg(offers: Offer[]): Hex;
|
|
1242
1257
|
declare function hash(offer: Offer): Hex;
|
|
1243
1258
|
/**
|
|
1244
1259
|
* Calculates the obligation id for an offer based on the smart contract's Obligation struct.
|
|
@@ -1296,24 +1311,16 @@ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
|
1296
1311
|
*/
|
|
1297
1312
|
get formattedMessage(): string;
|
|
1298
1313
|
}
|
|
1299
|
-
declare class AccountNotSetError extends BaseError {
|
|
1300
|
-
readonly name = "Offer.AccountNotSetError";
|
|
1301
|
-
constructor();
|
|
1302
|
-
}
|
|
1303
1314
|
declare namespace Oracle_d_exports {
|
|
1304
|
-
export { Conversion, Oracle, from$
|
|
1315
|
+
export { Conversion, Oracle, from$9 as from, fromCollateral, fromOffer, fromOffers };
|
|
1305
1316
|
}
|
|
1306
1317
|
/**
|
|
1307
1318
|
* An oracle contract that provides price information for assets.
|
|
1308
1319
|
*/
|
|
1309
1320
|
type Oracle = {
|
|
1310
|
-
/** The chain id where the oracle is deployed. */
|
|
1311
|
-
readonly
|
|
1312
|
-
/** The
|
|
1313
|
-
readonly address: Address;
|
|
1314
|
-
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1315
|
-
readonly price: bigint | null;
|
|
1316
|
-
/** The block number at which the price was fetched. */
|
|
1321
|
+
/** The chain id where the oracle is deployed. */readonly chainId: Id; /** The address of the oracle contract. */
|
|
1322
|
+
readonly address: Address; /** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1323
|
+
readonly price: bigint | null; /** The block number at which the price was fetched. */
|
|
1317
1324
|
readonly blockNumber: number;
|
|
1318
1325
|
};
|
|
1319
1326
|
/**
|
|
@@ -1321,8 +1328,8 @@ type Oracle = {
|
|
|
1321
1328
|
* @param data - The data to create the oracle from.
|
|
1322
1329
|
* @returns The created oracle.
|
|
1323
1330
|
*/
|
|
1324
|
-
declare function from$
|
|
1325
|
-
declare namespace from$
|
|
1331
|
+
declare function from$9(data: from$9.Parameters): from$9.ReturnType;
|
|
1332
|
+
declare namespace from$9 {
|
|
1326
1333
|
type Parameters = {
|
|
1327
1334
|
chainId: Id;
|
|
1328
1335
|
address: Address;
|
|
@@ -1331,6 +1338,55 @@ declare namespace from$8 {
|
|
|
1331
1338
|
};
|
|
1332
1339
|
type ReturnType = Oracle;
|
|
1333
1340
|
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Creates an oracle from a collateral.
|
|
1343
|
+
* @constructor
|
|
1344
|
+
*
|
|
1345
|
+
* @param parameters - {@link fromCollateral.Parameters}
|
|
1346
|
+
* @returns The created oracle. {@link fromCollateral.ReturnType}
|
|
1347
|
+
*/
|
|
1348
|
+
declare function fromCollateral(parameters: fromCollateral.Parameters): fromCollateral.ReturnType;
|
|
1349
|
+
declare namespace fromCollateral {
|
|
1350
|
+
type Parameters = {
|
|
1351
|
+
chainId: Id;
|
|
1352
|
+
collateral: Collateral;
|
|
1353
|
+
blockNumber: number;
|
|
1354
|
+
price?: bigint | null;
|
|
1355
|
+
};
|
|
1356
|
+
type ReturnType = Oracle;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Creates oracles from a single offer.
|
|
1360
|
+
* @constructor
|
|
1361
|
+
*
|
|
1362
|
+
* @param parameters - {@link fromOffer.Parameters}
|
|
1363
|
+
* @returns The created oracles. {@link fromOffer.ReturnType}
|
|
1364
|
+
*/
|
|
1365
|
+
declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
|
|
1366
|
+
declare namespace fromOffer {
|
|
1367
|
+
type Parameters = {
|
|
1368
|
+
offer: Offer;
|
|
1369
|
+
blockNumber: number;
|
|
1370
|
+
price?: bigint | null;
|
|
1371
|
+
};
|
|
1372
|
+
type ReturnType = Oracle[];
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Creates oracles from a list of offers.
|
|
1376
|
+
* @constructor
|
|
1377
|
+
*
|
|
1378
|
+
* @param parameters - {@link fromOffers.Parameters}
|
|
1379
|
+
* @returns The created oracles. {@link fromOffers.ReturnType}
|
|
1380
|
+
*/
|
|
1381
|
+
declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
|
|
1382
|
+
declare namespace fromOffers {
|
|
1383
|
+
type Parameters = {
|
|
1384
|
+
offers: Offer[];
|
|
1385
|
+
blockNumber: number;
|
|
1386
|
+
price?: bigint | null;
|
|
1387
|
+
};
|
|
1388
|
+
type ReturnType = Oracle[];
|
|
1389
|
+
}
|
|
1334
1390
|
/**
|
|
1335
1391
|
* Conversion utilities for converting between collateral and loan token amounts
|
|
1336
1392
|
* using oracle prices and LLTV
|
|
@@ -1363,33 +1419,28 @@ declare namespace Conversion {
|
|
|
1363
1419
|
}): bigint;
|
|
1364
1420
|
}
|
|
1365
1421
|
declare namespace Position_d_exports {
|
|
1366
|
-
export { Position, Type, from$
|
|
1422
|
+
export { Position, Type, from$8 as from };
|
|
1367
1423
|
}
|
|
1368
1424
|
type Position = {
|
|
1369
|
-
/** The chain id. */
|
|
1370
|
-
chainId: Id;
|
|
1425
|
+
/** The chain id. */chainId: Id;
|
|
1371
1426
|
/** The contract address from which the position is called.
|
|
1372
1427
|
* While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
|
|
1373
1428
|
* 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.
|
|
1374
1429
|
*/
|
|
1375
|
-
contract: Address;
|
|
1376
|
-
/** The
|
|
1377
|
-
|
|
1378
|
-
/** The type of position. */
|
|
1379
|
-
type: Type;
|
|
1380
|
-
/** The balance of the position. */
|
|
1430
|
+
contract: Address; /** The user address. */
|
|
1431
|
+
user: Address; /** The type of position. */
|
|
1432
|
+
type: Type; /** The balance of the position. */
|
|
1381
1433
|
balance?: bigint;
|
|
1382
1434
|
/** The underlying asset of the position.
|
|
1383
1435
|
* For ERC20 positions, this equals the contract address.
|
|
1384
1436
|
* For vault positions, this is the vault's underlying asset.
|
|
1385
1437
|
*/
|
|
1386
|
-
asset?: Address;
|
|
1387
|
-
/** The block number at which the position was last updated. */
|
|
1438
|
+
asset?: Address; /** The block number at which the position was last updated. */
|
|
1388
1439
|
blockNumber: number;
|
|
1389
1440
|
};
|
|
1390
1441
|
declare enum Type {
|
|
1391
1442
|
ERC20 = "erc20",
|
|
1392
|
-
VAULT_V1 = "vault_v1"
|
|
1443
|
+
VAULT_V1 = "vault_v1"
|
|
1393
1444
|
}
|
|
1394
1445
|
/**
|
|
1395
1446
|
* @constructor
|
|
@@ -1397,8 +1448,8 @@ declare enum Type {
|
|
|
1397
1448
|
* @param parameters - {@link from.Parameters}
|
|
1398
1449
|
* @returns The created Position. {@link from.ReturnType}
|
|
1399
1450
|
*/
|
|
1400
|
-
declare function from$
|
|
1401
|
-
declare namespace from$
|
|
1451
|
+
declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
|
|
1452
|
+
declare namespace from$8 {
|
|
1402
1453
|
type Parameters = {
|
|
1403
1454
|
chainId: Id;
|
|
1404
1455
|
contract: Address;
|
|
@@ -1411,18 +1462,15 @@ declare namespace from$7 {
|
|
|
1411
1462
|
type ReturnType = Position;
|
|
1412
1463
|
}
|
|
1413
1464
|
declare namespace Quote_d_exports {
|
|
1414
|
-
export { InvalidQuoteError, Quote, QuoteSchema, from$
|
|
1465
|
+
export { InvalidQuoteError, Quote, QuoteSchema, from$7 as from, fromSnakeCase, random };
|
|
1415
1466
|
}
|
|
1416
1467
|
type Quote = {
|
|
1417
|
-
/** The obligation id. */
|
|
1418
|
-
obligationId: Hex;
|
|
1468
|
+
/** The obligation id. */obligationId: Hex;
|
|
1419
1469
|
ask: {
|
|
1420
|
-
/** The ask price for the obligation. (18 decimals). */
|
|
1421
|
-
price: bigint;
|
|
1470
|
+
/** The ask price for the obligation. (18 decimals). */price: bigint;
|
|
1422
1471
|
};
|
|
1423
1472
|
bid: {
|
|
1424
|
-
/** The bid price for the obligation. (18 decimals). */
|
|
1425
|
-
price: bigint;
|
|
1473
|
+
/** The bid price for the obligation. (18 decimals). */price: bigint;
|
|
1426
1474
|
};
|
|
1427
1475
|
};
|
|
1428
1476
|
declare const QuoteSchema: z$1.ZodObject<{
|
|
@@ -1446,8 +1494,8 @@ declare const QuoteSchema: z$1.ZodObject<{
|
|
|
1446
1494
|
* const quote = Quote.from({ obligationId: "0x123", ask: { price: 100n }, bid: { price: 100n } });
|
|
1447
1495
|
* ```
|
|
1448
1496
|
*/
|
|
1449
|
-
declare function from$
|
|
1450
|
-
declare namespace from$
|
|
1497
|
+
declare function from$7(parameters: from$7.Parameters): from$7.ReturnType;
|
|
1498
|
+
declare namespace from$7 {
|
|
1451
1499
|
type Parameters = Quote;
|
|
1452
1500
|
type ReturnType = Quote;
|
|
1453
1501
|
type ErrorType = InvalidQuoteError;
|
|
@@ -1462,7 +1510,7 @@ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.R
|
|
|
1462
1510
|
declare namespace fromSnakeCase {
|
|
1463
1511
|
type Parameters = Snake<Quote>;
|
|
1464
1512
|
type ReturnType = Quote;
|
|
1465
|
-
type ErrorType = from$
|
|
1513
|
+
type ErrorType = from$7.ErrorType;
|
|
1466
1514
|
}
|
|
1467
1515
|
/**
|
|
1468
1516
|
* Generates a random quote.
|
|
@@ -1477,12 +1525,85 @@ declare function random(): random.ReturnType;
|
|
|
1477
1525
|
declare namespace random {
|
|
1478
1526
|
type Parameters = never;
|
|
1479
1527
|
type ReturnType = Quote;
|
|
1480
|
-
type ErrorType = from$
|
|
1528
|
+
type ErrorType = from$7.ErrorType;
|
|
1481
1529
|
}
|
|
1482
1530
|
declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
|
|
1483
1531
|
readonly name = "Quote.InvalidQuoteError";
|
|
1484
1532
|
constructor(error: z$1.ZodError | Error);
|
|
1485
1533
|
}
|
|
1534
|
+
declare namespace TradingFee_d_exports {
|
|
1535
|
+
export { BREAKPOINTS, Fees, InvalidFeeError, InvalidFeesLengthError, TradingFee, WAD, activate, compute, deactivate, from$6 as from, getFees, isActivated };
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Time breakpoints in seconds for piecewise linear fee interpolation.
|
|
1539
|
+
* Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d.
|
|
1540
|
+
*/
|
|
1541
|
+
declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n];
|
|
1542
|
+
/** WAD constant (1e18) for fee scaling. */
|
|
1543
|
+
declare const WAD: bigint;
|
|
1544
|
+
/** Tuple type for the 6 fee values at each breakpoint. */
|
|
1545
|
+
type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint];
|
|
1546
|
+
/**
|
|
1547
|
+
* TradingFee represents a piecewise linear fee curve with 6 breakpoints.
|
|
1548
|
+
* The internal storage mimics on-chain bitmap behavior but uses a struct for clarity.
|
|
1549
|
+
*/
|
|
1550
|
+
type TradingFee = {
|
|
1551
|
+
readonly _activated: boolean;
|
|
1552
|
+
readonly _fees: Fees;
|
|
1553
|
+
} & Brand<"TradingFee">;
|
|
1554
|
+
/**
|
|
1555
|
+
* Create a TradingFee from an activation flag and 6 fee values.
|
|
1556
|
+
* @param activated - Whether the fee is active.
|
|
1557
|
+
* @param fees - Tuple of 6 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d).
|
|
1558
|
+
* @returns A new TradingFee instance.
|
|
1559
|
+
* @throws {@link InvalidFeeError} if any fee exceeds WAD (100%).
|
|
1560
|
+
* @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 6 elements.
|
|
1561
|
+
*/
|
|
1562
|
+
declare function from$6(activated: boolean, fees: Fees): TradingFee;
|
|
1563
|
+
declare namespace from$6 {
|
|
1564
|
+
type ErrorType = InvalidFeeError | InvalidFeesLengthError;
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Compute the trading fee for a given time to maturity using piecewise linear interpolation.
|
|
1568
|
+
* @param tradingFee - The TradingFee instance.
|
|
1569
|
+
* @param timeToMaturity - Time to maturity in seconds.
|
|
1570
|
+
* @returns The interpolated fee in WAD. Returns 0n if not activated.
|
|
1571
|
+
*/
|
|
1572
|
+
declare function compute(tradingFee: TradingFee, timeToMaturity: number): bigint;
|
|
1573
|
+
/**
|
|
1574
|
+
* Check if the trading fee is activated.
|
|
1575
|
+
* @param tradingFee - The TradingFee instance.
|
|
1576
|
+
* @returns True if activated, false otherwise.
|
|
1577
|
+
*/
|
|
1578
|
+
declare function isActivated(tradingFee: TradingFee): boolean;
|
|
1579
|
+
/**
|
|
1580
|
+
* Create a new TradingFee with activation enabled.
|
|
1581
|
+
* @param tradingFee - The TradingFee instance.
|
|
1582
|
+
* @returns A new TradingFee with activated set to true.
|
|
1583
|
+
*/
|
|
1584
|
+
declare function activate(tradingFee: TradingFee): TradingFee;
|
|
1585
|
+
/**
|
|
1586
|
+
* Create a new TradingFee with activation disabled.
|
|
1587
|
+
* @param tradingFee - The TradingFee instance.
|
|
1588
|
+
* @returns A new TradingFee with activated set to false.
|
|
1589
|
+
*/
|
|
1590
|
+
declare function deactivate(tradingFee: TradingFee): TradingFee;
|
|
1591
|
+
/**
|
|
1592
|
+
* Get the fee values at each breakpoint.
|
|
1593
|
+
* @param tradingFee - The TradingFee instance.
|
|
1594
|
+
* @returns The tuple of 6 fee values.
|
|
1595
|
+
*/
|
|
1596
|
+
declare function getFees(tradingFee: TradingFee): Fees;
|
|
1597
|
+
/** Error thrown when a fee value is invalid (negative or exceeds WAD). */
|
|
1598
|
+
declare class InvalidFeeError extends BaseError {
|
|
1599
|
+
readonly name = "TradingFee.InvalidFeeError";
|
|
1600
|
+
constructor(fee: bigint, index: number);
|
|
1601
|
+
}
|
|
1602
|
+
/** Error thrown when fees array doesn't have exactly 6 elements. */
|
|
1603
|
+
declare class InvalidFeesLengthError extends BaseError {
|
|
1604
|
+
readonly name = "TradingFee.InvalidFeesLengthError";
|
|
1605
|
+
constructor(length: number);
|
|
1606
|
+
}
|
|
1486
1607
|
declare namespace Transfer_d_exports {
|
|
1487
1608
|
export { Transfer, from$5 as from };
|
|
1488
1609
|
}
|
|
@@ -1521,25 +1642,46 @@ declare namespace from$5 {
|
|
|
1521
1642
|
type ReturnType = Transfer;
|
|
1522
1643
|
}
|
|
1523
1644
|
declare namespace Tree_d_exports {
|
|
1524
|
-
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs };
|
|
1645
|
+
export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs, signatureDomain, signatureTypes };
|
|
1525
1646
|
}
|
|
1526
1647
|
/**
|
|
1527
1648
|
* A merkle tree of offers built from offer hashes.
|
|
1528
1649
|
* Constructed via {@link from}. The tree root can be signed for onchain broadcast.
|
|
1529
1650
|
*/
|
|
1530
1651
|
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
1531
|
-
/** The offers in the tree. */
|
|
1532
|
-
offers: Offer[];
|
|
1533
|
-
/** The root of the tree. */
|
|
1652
|
+
/** The offers in the tree. */offers: Offer[]; /** The root of the tree. */
|
|
1534
1653
|
root: Hex;
|
|
1535
1654
|
}>;
|
|
1536
1655
|
type Proof = {
|
|
1537
|
-
/** The offer that the proof is for. */
|
|
1538
|
-
offer: Offer;
|
|
1539
|
-
/** The merkle proof path for the offer. */
|
|
1656
|
+
/** The offer that the proof is for. */offer: Offer; /** The merkle proof path for the offer. */
|
|
1540
1657
|
path: Hex[];
|
|
1541
1658
|
};
|
|
1542
1659
|
declare const VERSION = 1;
|
|
1660
|
+
type SignatureDomain = {
|
|
1661
|
+
/** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
|
|
1662
|
+
verifyingContract: Address;
|
|
1663
|
+
};
|
|
1664
|
+
/** Normalized Root signature domain (BigInt chain id, lowercase address). */
|
|
1665
|
+
type NormalizedSignatureDomain = {
|
|
1666
|
+
chainId: bigint;
|
|
1667
|
+
verifyingContract: Address;
|
|
1668
|
+
};
|
|
1669
|
+
/**
|
|
1670
|
+
* EIP-712 types for signing the tree root (Root(bytes32 root)).
|
|
1671
|
+
*/
|
|
1672
|
+
declare const signatureTypes: {
|
|
1673
|
+
readonly EIP712Domain: readonly [{
|
|
1674
|
+
readonly name: "chainId";
|
|
1675
|
+
readonly type: "uint256";
|
|
1676
|
+
}, {
|
|
1677
|
+
readonly name: "verifyingContract";
|
|
1678
|
+
readonly type: "address";
|
|
1679
|
+
}];
|
|
1680
|
+
readonly Root: readonly [{
|
|
1681
|
+
readonly name: "root";
|
|
1682
|
+
readonly type: "bytes32";
|
|
1683
|
+
}];
|
|
1684
|
+
};
|
|
1543
1685
|
/**
|
|
1544
1686
|
* Builds a Merkle tree from a list of offers.
|
|
1545
1687
|
*
|
|
@@ -1562,6 +1704,11 @@ declare const from$4: (offers: Offer[]) => Tree;
|
|
|
1562
1704
|
* @returns Array of proofs - {@link Proof}
|
|
1563
1705
|
*/
|
|
1564
1706
|
declare const proofs: (tree: Tree) => Proof[];
|
|
1707
|
+
/**
|
|
1708
|
+
* Normalizes a Root signature domain (BigInt chain id, lowercase address).
|
|
1709
|
+
* @throws {SignatureDomainError} When the domain is invalid.
|
|
1710
|
+
*/
|
|
1711
|
+
declare const signatureDomain: (domain: SignatureDomain) => NormalizedSignatureDomain;
|
|
1565
1712
|
/**
|
|
1566
1713
|
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1567
1714
|
*
|
|
@@ -1569,15 +1716,21 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1569
1716
|
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1570
1717
|
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1571
1718
|
* - `{root}`: 32-byte merkle root
|
|
1572
|
-
* - `{signature}`: 65-byte EIP-
|
|
1719
|
+
* - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
|
|
1573
1720
|
*
|
|
1574
1721
|
* Validates signature authenticity and root integrity before encoding.
|
|
1575
1722
|
*
|
|
1576
1723
|
* @example
|
|
1577
1724
|
* ```typescript
|
|
1578
1725
|
* const tree = Tree.from(offers);
|
|
1579
|
-
* const signature = await wallet.
|
|
1580
|
-
*
|
|
1726
|
+
* const signature = await wallet.signTypedData({
|
|
1727
|
+
* account: wallet.account,
|
|
1728
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1729
|
+
* types: Tree.signatureTypes,
|
|
1730
|
+
* primaryType: "Root",
|
|
1731
|
+
* message: { root: tree.root },
|
|
1732
|
+
* });
|
|
1733
|
+
* const calldata = await Tree.encode(tree, signature, { chainId, verifyingContract });
|
|
1581
1734
|
* await broadcast(calldata);
|
|
1582
1735
|
* ```
|
|
1583
1736
|
*
|
|
@@ -1587,16 +1740,23 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1587
1740
|
* const tree = Tree.from(offers);
|
|
1588
1741
|
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1589
1742
|
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1590
|
-
* const signature = await wallet.
|
|
1743
|
+
* const signature = await wallet.signTypedData({
|
|
1744
|
+
* account: wallet.account,
|
|
1745
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1746
|
+
* types: Tree.signatureTypes,
|
|
1747
|
+
* primaryType: "Root",
|
|
1748
|
+
* message: { root: tree.root },
|
|
1749
|
+
* });
|
|
1591
1750
|
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1592
1751
|
* ```
|
|
1593
1752
|
*
|
|
1594
1753
|
* @param tree - Merkle tree of offers
|
|
1595
|
-
* @param signature - EIP-
|
|
1754
|
+
* @param signature - EIP-712 signature over Root(bytes32 root)
|
|
1755
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1596
1756
|
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1597
1757
|
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1598
1758
|
*/
|
|
1599
|
-
declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1759
|
+
declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
|
|
1600
1760
|
/**
|
|
1601
1761
|
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1602
1762
|
*
|
|
@@ -1626,15 +1786,16 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
|
1626
1786
|
*
|
|
1627
1787
|
* @example
|
|
1628
1788
|
* ```typescript
|
|
1629
|
-
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1789
|
+
* const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
|
|
1630
1790
|
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1631
1791
|
* ```
|
|
1632
1792
|
*
|
|
1633
1793
|
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1794
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1634
1795
|
* @returns Validated tree, signature, and recovered signer address
|
|
1635
1796
|
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1636
1797
|
*/
|
|
1637
|
-
declare const decode: (encoded: Hex) => Promise<{
|
|
1798
|
+
declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
|
|
1638
1799
|
tree: Tree;
|
|
1639
1800
|
signature: Hex;
|
|
1640
1801
|
signer: Address;
|
|
@@ -1663,13 +1824,19 @@ declare class DecodeError extends BaseError {
|
|
|
1663
1824
|
name: string;
|
|
1664
1825
|
constructor(reason: string);
|
|
1665
1826
|
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Error thrown when an invalid signature domain is supplied.
|
|
1829
|
+
*/
|
|
1830
|
+
declare class SignatureDomainError extends BaseError {
|
|
1831
|
+
name: string;
|
|
1832
|
+
constructor(reason: string);
|
|
1833
|
+
}
|
|
1666
1834
|
//#endregion
|
|
1667
1835
|
//#region src/api/Schema/generated/swagger.d.ts
|
|
1668
1836
|
/**
|
|
1669
1837
|
* This file was auto-generated by openapi-typescript.
|
|
1670
1838
|
* Do not make direct changes to the file.
|
|
1671
1839
|
*/
|
|
1672
|
-
|
|
1673
1840
|
interface paths {
|
|
1674
1841
|
"/v1/books/{obligationId}/{side}": {
|
|
1675
1842
|
parameters: {
|
|
@@ -1713,16 +1880,14 @@ interface paths {
|
|
|
1713
1880
|
};
|
|
1714
1881
|
requestBody?: never;
|
|
1715
1882
|
responses: {
|
|
1716
|
-
/** @description Success */
|
|
1717
|
-
200: {
|
|
1883
|
+
/** @description Success */200: {
|
|
1718
1884
|
headers: {
|
|
1719
1885
|
[name: string]: unknown;
|
|
1720
1886
|
};
|
|
1721
1887
|
content: {
|
|
1722
1888
|
"application/json": components["schemas"]["BookListResponse"];
|
|
1723
1889
|
};
|
|
1724
|
-
};
|
|
1725
|
-
/** @description Bad Request */
|
|
1890
|
+
}; /** @description Bad Request */
|
|
1726
1891
|
400: {
|
|
1727
1892
|
headers: {
|
|
1728
1893
|
[name: string]: unknown;
|
|
@@ -1741,7 +1906,7 @@ interface paths {
|
|
|
1741
1906
|
patch?: never;
|
|
1742
1907
|
trace?: never;
|
|
1743
1908
|
};
|
|
1744
|
-
"/v1/config": {
|
|
1909
|
+
"/v1/config/contracts": {
|
|
1745
1910
|
parameters: {
|
|
1746
1911
|
query?: never;
|
|
1747
1912
|
header?: never;
|
|
@@ -1749,25 +1914,99 @@ interface paths {
|
|
|
1749
1914
|
cookie?: never;
|
|
1750
1915
|
};
|
|
1751
1916
|
/**
|
|
1752
|
-
* Get
|
|
1753
|
-
* @description Returns
|
|
1917
|
+
* Get indexer contract configuration
|
|
1918
|
+
* @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
|
|
1754
1919
|
*/
|
|
1755
1920
|
get: {
|
|
1756
1921
|
parameters: {
|
|
1757
|
-
query?:
|
|
1922
|
+
query?: {
|
|
1923
|
+
/**
|
|
1924
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1925
|
+
* @example 1,8453
|
|
1926
|
+
*/
|
|
1927
|
+
chains?: number[];
|
|
1928
|
+
/**
|
|
1929
|
+
* @description Maximum number of contracts to return (max 1000).
|
|
1930
|
+
* @example 1000
|
|
1931
|
+
*/
|
|
1932
|
+
limit?: number;
|
|
1933
|
+
/**
|
|
1934
|
+
* @description Pagination cursor in chain_id:address format (lowercase address).
|
|
1935
|
+
* @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
|
|
1936
|
+
*/
|
|
1937
|
+
cursor?: string;
|
|
1938
|
+
};
|
|
1939
|
+
header?: never;
|
|
1940
|
+
path?: never;
|
|
1941
|
+
cookie?: never;
|
|
1942
|
+
};
|
|
1943
|
+
requestBody?: never;
|
|
1944
|
+
responses: {
|
|
1945
|
+
/** @description Success */200: {
|
|
1946
|
+
headers: {
|
|
1947
|
+
[name: string]: unknown;
|
|
1948
|
+
};
|
|
1949
|
+
content: {
|
|
1950
|
+
"application/json": components["schemas"]["ConfigContractsSuccessResponse"];
|
|
1951
|
+
};
|
|
1952
|
+
};
|
|
1953
|
+
};
|
|
1954
|
+
};
|
|
1955
|
+
put?: never;
|
|
1956
|
+
post?: never;
|
|
1957
|
+
delete?: never;
|
|
1958
|
+
options?: never;
|
|
1959
|
+
head?: never;
|
|
1960
|
+
patch?: never;
|
|
1961
|
+
trace?: never;
|
|
1962
|
+
};
|
|
1963
|
+
"/v1/config/rules": {
|
|
1964
|
+
parameters: {
|
|
1965
|
+
query?: never;
|
|
1966
|
+
header?: never;
|
|
1967
|
+
path?: never;
|
|
1968
|
+
cookie?: never;
|
|
1969
|
+
};
|
|
1970
|
+
/**
|
|
1971
|
+
* Get config rules
|
|
1972
|
+
* @description Returns configured rules for supported chains.
|
|
1973
|
+
*/
|
|
1974
|
+
get: {
|
|
1975
|
+
parameters: {
|
|
1976
|
+
query?: {
|
|
1977
|
+
/**
|
|
1978
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1979
|
+
* @example 1,8453
|
|
1980
|
+
*/
|
|
1981
|
+
chains?: number[];
|
|
1982
|
+
/**
|
|
1983
|
+
* @description Filter by rule types (comma-separated).
|
|
1984
|
+
* @example maturity,loan_token
|
|
1985
|
+
*/
|
|
1986
|
+
types?: string[];
|
|
1987
|
+
/**
|
|
1988
|
+
* @description Maximum number of rules to return (max 1000).
|
|
1989
|
+
* @example 100
|
|
1990
|
+
*/
|
|
1991
|
+
limit?: number;
|
|
1992
|
+
/**
|
|
1993
|
+
* @description Pagination cursor in type:chain_id:<value> format.
|
|
1994
|
+
* @example maturity:1:1730415600:end_of_next_month
|
|
1995
|
+
*/
|
|
1996
|
+
cursor?: string;
|
|
1997
|
+
};
|
|
1758
1998
|
header?: never;
|
|
1759
1999
|
path?: never;
|
|
1760
2000
|
cookie?: never;
|
|
1761
2001
|
};
|
|
1762
2002
|
requestBody?: never;
|
|
1763
2003
|
responses: {
|
|
1764
|
-
/** @description Success */
|
|
1765
|
-
200: {
|
|
2004
|
+
/** @description Success */200: {
|
|
1766
2005
|
headers: {
|
|
1767
2006
|
[name: string]: unknown;
|
|
1768
2007
|
};
|
|
1769
2008
|
content: {
|
|
1770
|
-
"application/json": components["schemas"]["
|
|
2009
|
+
"application/json": components["schemas"]["ConfigRulesSuccessResponse"];
|
|
1771
2010
|
};
|
|
1772
2011
|
};
|
|
1773
2012
|
};
|
|
@@ -1826,16 +2065,14 @@ interface paths {
|
|
|
1826
2065
|
};
|
|
1827
2066
|
requestBody?: never;
|
|
1828
2067
|
responses: {
|
|
1829
|
-
/** @description Success */
|
|
1830
|
-
200: {
|
|
2068
|
+
/** @description Success */200: {
|
|
1831
2069
|
headers: {
|
|
1832
2070
|
[name: string]: unknown;
|
|
1833
2071
|
};
|
|
1834
2072
|
content: {
|
|
1835
2073
|
"application/json": components["schemas"]["OfferListResponse"];
|
|
1836
2074
|
};
|
|
1837
|
-
};
|
|
1838
|
-
/** @description Bad Request */
|
|
2075
|
+
}; /** @description Bad Request */
|
|
1839
2076
|
400: {
|
|
1840
2077
|
headers: {
|
|
1841
2078
|
[name: string]: unknown;
|
|
@@ -1869,25 +2106,25 @@ interface paths {
|
|
|
1869
2106
|
parameters: {
|
|
1870
2107
|
query?: {
|
|
1871
2108
|
/**
|
|
1872
|
-
* @description Filter by exact maturity
|
|
1873
|
-
* @example 1761922800
|
|
2109
|
+
* @description Filter by exact maturity timestamps (comma-separated, unix seconds).
|
|
2110
|
+
* @example 1761922800,1764524800
|
|
1874
2111
|
*/
|
|
1875
|
-
|
|
2112
|
+
maturities?: number[];
|
|
1876
2113
|
/**
|
|
1877
|
-
* @description Filter by collateral
|
|
1878
|
-
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
2114
|
+
* @description Filter by collateral tokens (comma-separated, matches any collateral).
|
|
2115
|
+
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751,0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
1879
2116
|
*/
|
|
1880
|
-
|
|
2117
|
+
collateral_tokens?: string[];
|
|
1881
2118
|
/**
|
|
1882
|
-
* @description Filter by loan token
|
|
1883
|
-
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
2119
|
+
* @description Filter by loan token addresses (comma-separated).
|
|
2120
|
+
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078,0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
1884
2121
|
*/
|
|
1885
|
-
|
|
2122
|
+
loan_tokens?: string[];
|
|
1886
2123
|
/**
|
|
1887
|
-
* @description Filter by chain
|
|
1888
|
-
* @example 1
|
|
2124
|
+
* @description Filter by chain IDs (comma-separated).
|
|
2125
|
+
* @example 1,8453
|
|
1889
2126
|
*/
|
|
1890
|
-
|
|
2127
|
+
chains?: number[];
|
|
1891
2128
|
/**
|
|
1892
2129
|
* @description Maximum number of obligations to return.
|
|
1893
2130
|
* @example 10
|
|
@@ -1905,16 +2142,14 @@ interface paths {
|
|
|
1905
2142
|
};
|
|
1906
2143
|
requestBody?: never;
|
|
1907
2144
|
responses: {
|
|
1908
|
-
/** @description Success */
|
|
1909
|
-
200: {
|
|
2145
|
+
/** @description Success */200: {
|
|
1910
2146
|
headers: {
|
|
1911
2147
|
[name: string]: unknown;
|
|
1912
2148
|
};
|
|
1913
2149
|
content: {
|
|
1914
2150
|
"application/json": components["schemas"]["ObligationListResponse"];
|
|
1915
2151
|
};
|
|
1916
|
-
};
|
|
1917
|
-
/** @description Bad Request */
|
|
2152
|
+
}; /** @description Bad Request */
|
|
1918
2153
|
400: {
|
|
1919
2154
|
headers: {
|
|
1920
2155
|
[name: string]: unknown;
|
|
@@ -1959,16 +2194,14 @@ interface paths {
|
|
|
1959
2194
|
};
|
|
1960
2195
|
requestBody?: never;
|
|
1961
2196
|
responses: {
|
|
1962
|
-
/** @description Success */
|
|
1963
|
-
200: {
|
|
2197
|
+
/** @description Success */200: {
|
|
1964
2198
|
headers: {
|
|
1965
2199
|
[name: string]: unknown;
|
|
1966
2200
|
};
|
|
1967
2201
|
content: {
|
|
1968
2202
|
"application/json": components["schemas"]["ObligationSingleSuccessResponse"];
|
|
1969
2203
|
};
|
|
1970
|
-
};
|
|
1971
|
-
/** @description Bad Request */
|
|
2204
|
+
}; /** @description Bad Request */
|
|
1972
2205
|
400: {
|
|
1973
2206
|
headers: {
|
|
1974
2207
|
[name: string]: unknown;
|
|
@@ -2013,8 +2246,7 @@ interface paths {
|
|
|
2013
2246
|
};
|
|
2014
2247
|
requestBody?: never;
|
|
2015
2248
|
responses: {
|
|
2016
|
-
/** @description Success */
|
|
2017
|
-
200: {
|
|
2249
|
+
/** @description Success */200: {
|
|
2018
2250
|
headers: {
|
|
2019
2251
|
[name: string]: unknown;
|
|
2020
2252
|
};
|
|
@@ -2058,8 +2290,7 @@ interface paths {
|
|
|
2058
2290
|
};
|
|
2059
2291
|
requestBody?: never;
|
|
2060
2292
|
responses: {
|
|
2061
|
-
/** @description Success */
|
|
2062
|
-
200: {
|
|
2293
|
+
/** @description Success */200: {
|
|
2063
2294
|
headers: {
|
|
2064
2295
|
[name: string]: unknown;
|
|
2065
2296
|
};
|
|
@@ -2103,8 +2334,7 @@ interface paths {
|
|
|
2103
2334
|
};
|
|
2104
2335
|
requestBody?: never;
|
|
2105
2336
|
responses: {
|
|
2106
|
-
/** @description Success */
|
|
2107
|
-
200: {
|
|
2337
|
+
/** @description Success */200: {
|
|
2108
2338
|
headers: {
|
|
2109
2339
|
[name: string]: unknown;
|
|
2110
2340
|
};
|
|
@@ -2159,16 +2389,14 @@ interface paths {
|
|
|
2159
2389
|
};
|
|
2160
2390
|
requestBody?: never;
|
|
2161
2391
|
responses: {
|
|
2162
|
-
/** @description Success */
|
|
2163
|
-
200: {
|
|
2392
|
+
/** @description Success */200: {
|
|
2164
2393
|
headers: {
|
|
2165
2394
|
[name: string]: unknown;
|
|
2166
2395
|
};
|
|
2167
2396
|
content: {
|
|
2168
2397
|
"application/json": components["schemas"]["PositionListResponse"];
|
|
2169
2398
|
};
|
|
2170
|
-
};
|
|
2171
|
-
/** @description Bad Request */
|
|
2399
|
+
}; /** @description Bad Request */
|
|
2172
2400
|
400: {
|
|
2173
2401
|
headers: {
|
|
2174
2402
|
[name: string]: unknown;
|
|
@@ -2199,15 +2427,6 @@ interface paths {
|
|
|
2199
2427
|
/**
|
|
2200
2428
|
* Validate offers
|
|
2201
2429
|
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
2202
|
-
*
|
|
2203
|
-
* **Available validation rules:**
|
|
2204
|
-
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
2205
|
-
* - **mixed_maker**: Validates that all offers in a batch have the same maker address
|
|
2206
|
-
* - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
|
|
2207
|
-
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
2208
|
-
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
2209
|
-
* - **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]
|
|
2210
|
-
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
|
|
2211
2430
|
*/
|
|
2212
2431
|
post: {
|
|
2213
2432
|
parameters: {
|
|
@@ -2222,16 +2441,64 @@ interface paths {
|
|
|
2222
2441
|
};
|
|
2223
2442
|
};
|
|
2224
2443
|
responses: {
|
|
2225
|
-
/** @description Success */
|
|
2226
|
-
200: {
|
|
2444
|
+
/** @description Success */200: {
|
|
2227
2445
|
headers: {
|
|
2228
2446
|
[name: string]: unknown;
|
|
2229
2447
|
};
|
|
2230
2448
|
content: {
|
|
2231
2449
|
"application/json": components["schemas"]["ValidationSuccessResponse"];
|
|
2232
2450
|
};
|
|
2451
|
+
}; /** @description Bad Request */
|
|
2452
|
+
400: {
|
|
2453
|
+
headers: {
|
|
2454
|
+
[name: string]: unknown;
|
|
2455
|
+
};
|
|
2456
|
+
content: {
|
|
2457
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
2458
|
+
};
|
|
2459
|
+
};
|
|
2460
|
+
};
|
|
2461
|
+
};
|
|
2462
|
+
delete?: never;
|
|
2463
|
+
options?: never;
|
|
2464
|
+
head?: never;
|
|
2465
|
+
patch?: never;
|
|
2466
|
+
trace?: never;
|
|
2467
|
+
};
|
|
2468
|
+
"/v1/callbacks": {
|
|
2469
|
+
parameters: {
|
|
2470
|
+
query?: never;
|
|
2471
|
+
header?: never;
|
|
2472
|
+
path?: never;
|
|
2473
|
+
cookie?: never;
|
|
2474
|
+
};
|
|
2475
|
+
get?: never;
|
|
2476
|
+
put?: never;
|
|
2477
|
+
/**
|
|
2478
|
+
* Resolve callback types
|
|
2479
|
+
* @description Returns callback types for callback addresses grouped by chain.
|
|
2480
|
+
*/
|
|
2481
|
+
post: {
|
|
2482
|
+
parameters: {
|
|
2483
|
+
query?: never;
|
|
2484
|
+
header?: never;
|
|
2485
|
+
path?: never;
|
|
2486
|
+
cookie?: never;
|
|
2487
|
+
};
|
|
2488
|
+
requestBody?: {
|
|
2489
|
+
content: {
|
|
2490
|
+
"application/json": components["schemas"]["CallbackTypesRequest"];
|
|
2233
2491
|
};
|
|
2234
|
-
|
|
2492
|
+
};
|
|
2493
|
+
responses: {
|
|
2494
|
+
/** @description Success */200: {
|
|
2495
|
+
headers: {
|
|
2496
|
+
[name: string]: unknown;
|
|
2497
|
+
};
|
|
2498
|
+
content: {
|
|
2499
|
+
"application/json": components["schemas"]["CallbackTypesSuccessResponse"];
|
|
2500
|
+
};
|
|
2501
|
+
}; /** @description Bad Request */
|
|
2235
2502
|
400: {
|
|
2236
2503
|
headers: {
|
|
2237
2504
|
[name: string]: unknown;
|
|
@@ -2252,22 +2519,16 @@ interface paths {
|
|
|
2252
2519
|
interface components {
|
|
2253
2520
|
schemas: {
|
|
2254
2521
|
BookListResponse: {
|
|
2255
|
-
meta: components["schemas"]["Meta"];
|
|
2256
|
-
/** @
|
|
2257
|
-
cursor: string | null;
|
|
2258
|
-
/** @description Aggregated book levels grouped by computed price. */
|
|
2522
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2523
|
+
cursor: string | null; /** @description Aggregated book levels grouped by computed price. */
|
|
2259
2524
|
data: components["schemas"]["BookLevelResponse"][];
|
|
2260
2525
|
};
|
|
2261
2526
|
Meta: {
|
|
2262
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2263
|
-
timestamp: string;
|
|
2527
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string;
|
|
2264
2528
|
};
|
|
2265
2529
|
BookLevelResponse: {
|
|
2266
|
-
/** @example 2750000000000000000 */
|
|
2267
|
-
|
|
2268
|
-
/** @example 369216000000000000000000 */
|
|
2269
|
-
assets: string;
|
|
2270
|
-
/** @example 5 */
|
|
2530
|
+
/** @example 2750000000000000000 */price: string; /** @example 369216000000000000000000 */
|
|
2531
|
+
assets: string; /** @example 5 */
|
|
2271
2532
|
count: number;
|
|
2272
2533
|
};
|
|
2273
2534
|
BadRequestResponse: {
|
|
@@ -2279,8 +2540,7 @@ interface components {
|
|
|
2279
2540
|
* @example VALIDATION_ERROR
|
|
2280
2541
|
* @enum {string}
|
|
2281
2542
|
*/
|
|
2282
|
-
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
|
|
2283
|
-
/** @example Limit must be greater than 0. */
|
|
2543
|
+
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST"; /** @example Limit must be greater than 0. */
|
|
2284
2544
|
message: string;
|
|
2285
2545
|
/**
|
|
2286
2546
|
* @example [
|
|
@@ -2292,59 +2552,81 @@ interface components {
|
|
|
2292
2552
|
*/
|
|
2293
2553
|
details: Record<string, never>;
|
|
2294
2554
|
};
|
|
2295
|
-
|
|
2296
|
-
meta: components["schemas"]["Meta"];
|
|
2297
|
-
/** @example null */
|
|
2555
|
+
ConfigContractsSuccessResponse: {
|
|
2556
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2298
2557
|
cursor: string | null;
|
|
2299
2558
|
/**
|
|
2300
|
-
* @description
|
|
2559
|
+
* @description Indexer contract configuration for all indexed chains.
|
|
2301
2560
|
* @example [
|
|
2302
2561
|
* {
|
|
2303
2562
|
* "chain_id": 505050505,
|
|
2304
|
-
* "
|
|
2305
|
-
*
|
|
2306
|
-
*
|
|
2307
|
-
*
|
|
2308
|
-
*
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2563
|
+
* "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
|
|
2564
|
+
* "name": "mempool"
|
|
2565
|
+
* },
|
|
2566
|
+
* {
|
|
2567
|
+
* "chain_id": 505050505,
|
|
2568
|
+
* "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
|
|
2569
|
+
* "name": "multicall"
|
|
2570
|
+
* },
|
|
2571
|
+
* {
|
|
2572
|
+
* "chain_id": 505050505,
|
|
2573
|
+
* "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
|
|
2574
|
+
* "name": "v2"
|
|
2311
2575
|
* }
|
|
2312
2576
|
* ]
|
|
2313
2577
|
*/
|
|
2314
|
-
data: components["schemas"]["
|
|
2578
|
+
data: components["schemas"]["ConfigContractResponse"][];
|
|
2315
2579
|
};
|
|
2316
|
-
|
|
2317
|
-
/** @example 505050505 */
|
|
2318
|
-
|
|
2319
|
-
contracts: components["schemas"]["ConfigContractsResponse"];
|
|
2580
|
+
ConfigContractResponse: {
|
|
2581
|
+
/** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
2582
|
+
address: string;
|
|
2320
2583
|
/**
|
|
2321
|
-
* @
|
|
2322
|
-
* @
|
|
2323
|
-
* "end_of_month": 1738335600,
|
|
2324
|
-
* "end_of_next_month": 1740754800
|
|
2325
|
-
* }
|
|
2584
|
+
* @example mempool
|
|
2585
|
+
* @enum {string}
|
|
2326
2586
|
*/
|
|
2327
|
-
|
|
2328
|
-
};
|
|
2329
|
-
ConfigContractsResponse: {
|
|
2330
|
-
/** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
2331
|
-
mempool: string;
|
|
2587
|
+
name: "mempool" | "multicall" | "v2";
|
|
2332
2588
|
};
|
|
2333
|
-
|
|
2334
|
-
/**
|
|
2335
|
-
|
|
2336
|
-
* @example 1738335600
|
|
2337
|
-
*/
|
|
2338
|
-
end_of_month: number;
|
|
2589
|
+
ConfigRulesSuccessResponse: {
|
|
2590
|
+
meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
|
|
2591
|
+
cursor: string | null;
|
|
2339
2592
|
/**
|
|
2340
|
-
* @description
|
|
2341
|
-
* @example
|
|
2593
|
+
* @description Configured rules returned by the router API.
|
|
2594
|
+
* @example [
|
|
2595
|
+
* {
|
|
2596
|
+
* "type": "maturity",
|
|
2597
|
+
* "chain_id": 1,
|
|
2598
|
+
* "name": "end_of_next_month",
|
|
2599
|
+
* "timestamp": 1730415600
|
|
2600
|
+
* },
|
|
2601
|
+
* {
|
|
2602
|
+
* "type": "callback",
|
|
2603
|
+
* "chain_id": 1,
|
|
2604
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2605
|
+
* "callback_type": "sell_erc20_callback"
|
|
2606
|
+
* },
|
|
2607
|
+
* {
|
|
2608
|
+
* "type": "loan_token",
|
|
2609
|
+
* "chain_id": 1,
|
|
2610
|
+
* "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
2611
|
+
* }
|
|
2612
|
+
* ]
|
|
2342
2613
|
*/
|
|
2343
|
-
|
|
2614
|
+
data: components["schemas"]["ConfigRulesRuleResponse"][];
|
|
2615
|
+
};
|
|
2616
|
+
ConfigRulesMeta: {
|
|
2617
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
|
|
2618
|
+
checksum: string;
|
|
2619
|
+
};
|
|
2620
|
+
ConfigRulesRuleResponse: {
|
|
2621
|
+
/** @example maturity */type: string; /** @example 1 */
|
|
2622
|
+
chain_id: number; /** @example end_of_next_month */
|
|
2623
|
+
name?: string; /** @example 1730415600 */
|
|
2624
|
+
timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
|
|
2625
|
+
address?: string; /** @example sell_erc20_callback */
|
|
2626
|
+
callback_type?: string;
|
|
2344
2627
|
};
|
|
2345
2628
|
OfferListResponse: {
|
|
2346
|
-
meta: components["schemas"]["Meta"];
|
|
2347
|
-
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2629
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2348
2630
|
cursor: string | null;
|
|
2349
2631
|
/**
|
|
2350
2632
|
* @description Offers matching the provided filters.
|
|
@@ -2420,20 +2702,13 @@ interface components {
|
|
|
2420
2702
|
* "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2421
2703
|
* }
|
|
2422
2704
|
*/
|
|
2423
|
-
offer: components["schemas"]["OfferDataResponse"];
|
|
2424
|
-
/** @example
|
|
2425
|
-
|
|
2426
|
-
/** @example
|
|
2427
|
-
|
|
2428
|
-
/** @example
|
|
2429
|
-
|
|
2430
|
-
/** @example 0 */
|
|
2431
|
-
consumed: string;
|
|
2432
|
-
/** @example 369216000000000000000000 */
|
|
2433
|
-
takeable: string;
|
|
2434
|
-
/** @example 2942933377146801 */
|
|
2435
|
-
block_number: number;
|
|
2436
|
-
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2705
|
+
offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
2706
|
+
offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2707
|
+
obligation_id: string; /** @example 1 */
|
|
2708
|
+
chain_id: number; /** @example 0 */
|
|
2709
|
+
consumed: string; /** @example 369216000000000000000000 */
|
|
2710
|
+
takeable: string; /** @example 2942933377146801 */
|
|
2711
|
+
block_number: number; /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2437
2712
|
root: string | null;
|
|
2438
2713
|
/**
|
|
2439
2714
|
* @example [
|
|
@@ -2441,8 +2716,7 @@ interface components {
|
|
|
2441
2716
|
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2442
2717
|
* ]
|
|
2443
2718
|
*/
|
|
2444
|
-
proof: string[] | null;
|
|
2445
|
-
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2719
|
+
proof: string[] | null; /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2446
2720
|
signature: string | null;
|
|
2447
2721
|
};
|
|
2448
2722
|
OfferDataResponse: {
|
|
@@ -2459,35 +2733,22 @@ interface components {
|
|
|
2459
2733
|
* "maturity": 1761922799
|
|
2460
2734
|
* }
|
|
2461
2735
|
*/
|
|
2462
|
-
obligation: components["schemas"]["ObligationOfferResponse"];
|
|
2463
|
-
/** @example
|
|
2464
|
-
|
|
2465
|
-
/** @example
|
|
2466
|
-
|
|
2467
|
-
/** @example
|
|
2468
|
-
|
|
2469
|
-
/** @example
|
|
2470
|
-
|
|
2471
|
-
/** @example
|
|
2472
|
-
|
|
2473
|
-
/** @example
|
|
2474
|
-
start: number;
|
|
2475
|
-
/** @example 1761922799 */
|
|
2476
|
-
expiry: number;
|
|
2477
|
-
/** @example 2750000000000000000 */
|
|
2478
|
-
price: string;
|
|
2479
|
-
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2480
|
-
group: string;
|
|
2481
|
-
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2482
|
-
session: string;
|
|
2483
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2484
|
-
callback: string;
|
|
2485
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2736
|
+
obligation: components["schemas"]["ObligationOfferResponse"]; /** @example false */
|
|
2737
|
+
buy: boolean; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2738
|
+
maker: string; /** @example 369216000000000000000000 */
|
|
2739
|
+
assets: string; /** @example 0 */
|
|
2740
|
+
obligation_units: string; /** @example 0 */
|
|
2741
|
+
obligation_shares: string; /** @example 1761922790 */
|
|
2742
|
+
start: number; /** @example 1761922799 */
|
|
2743
|
+
expiry: number; /** @example 2750000000000000000 */
|
|
2744
|
+
price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2745
|
+
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2746
|
+
session: string; /** @example 0x1111111111111111111111111111111111111111 */
|
|
2747
|
+
callback: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2486
2748
|
callback_data: string;
|
|
2487
2749
|
};
|
|
2488
2750
|
ObligationOfferResponse: {
|
|
2489
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2490
|
-
loan_token: string;
|
|
2751
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
|
|
2491
2752
|
/**
|
|
2492
2753
|
* @example [
|
|
2493
2754
|
* {
|
|
@@ -2497,51 +2758,37 @@ interface components {
|
|
|
2497
2758
|
* }
|
|
2498
2759
|
* ]
|
|
2499
2760
|
*/
|
|
2500
|
-
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2501
|
-
/** @example 1761922799 */
|
|
2761
|
+
collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922799 */
|
|
2502
2762
|
maturity: number;
|
|
2503
2763
|
};
|
|
2504
2764
|
CollateralResponse: {
|
|
2505
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2506
|
-
|
|
2507
|
-
/** @example 860000000000000000 */
|
|
2508
|
-
lltv: string;
|
|
2509
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2765
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */token: string; /** @example 860000000000000000 */
|
|
2766
|
+
lltv: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2510
2767
|
oracle: string;
|
|
2511
2768
|
};
|
|
2512
2769
|
ObligationListResponse: {
|
|
2513
|
-
meta: components["schemas"]["Meta"];
|
|
2514
|
-
/** @
|
|
2515
|
-
cursor: string | null;
|
|
2516
|
-
/** @description List of obligations with takable offers. */
|
|
2770
|
+
meta: components["schemas"]["Meta"]; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2771
|
+
cursor: string | null; /** @description List of obligations with takable offers. */
|
|
2517
2772
|
data: components["schemas"]["ObligationResponse"][];
|
|
2518
2773
|
};
|
|
2519
2774
|
ObligationResponse: {
|
|
2520
|
-
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
|
|
2521
|
-
|
|
2522
|
-
/** @example 1 */
|
|
2523
|
-
chain_id: number;
|
|
2524
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2775
|
+
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */id: string; /** @example 1 */
|
|
2776
|
+
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2525
2777
|
loan_token: string;
|
|
2526
|
-
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2527
|
-
/** @example 1761922800 */
|
|
2778
|
+
collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922800 */
|
|
2528
2779
|
maturity: number;
|
|
2529
2780
|
ask: components["schemas"]["AskResponse"];
|
|
2530
2781
|
bid: components["schemas"]["BidResponse"];
|
|
2531
2782
|
};
|
|
2532
2783
|
AskResponse: {
|
|
2533
|
-
/** @example 1000000000000000000 */
|
|
2534
|
-
price: string;
|
|
2784
|
+
/** @example 1000000000000000000 */price: string;
|
|
2535
2785
|
};
|
|
2536
2786
|
BidResponse: {
|
|
2537
|
-
/** @example 1000000000000000000 */
|
|
2538
|
-
price: string;
|
|
2787
|
+
/** @example 1000000000000000000 */price: string;
|
|
2539
2788
|
};
|
|
2540
2789
|
ObligationSingleSuccessResponse: {
|
|
2541
|
-
meta: components["schemas"]["Meta"];
|
|
2542
|
-
/** @
|
|
2543
|
-
cursor: string | null;
|
|
2544
|
-
/** @description Obligation details. */
|
|
2790
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2791
|
+
cursor: string | null; /** @description Obligation details. */
|
|
2545
2792
|
data: components["schemas"]["ObligationResponse"];
|
|
2546
2793
|
};
|
|
2547
2794
|
RouterStatusSuccessResponse: {
|
|
@@ -2562,8 +2809,7 @@ interface components {
|
|
|
2562
2809
|
* @example live
|
|
2563
2810
|
* @enum {string}
|
|
2564
2811
|
*/
|
|
2565
|
-
status: "live" | "syncing";
|
|
2566
|
-
/** @example true */
|
|
2812
|
+
status: "live" | "syncing"; /** @example true */
|
|
2567
2813
|
initialized: boolean;
|
|
2568
2814
|
/**
|
|
2569
2815
|
* @description Configured chain ids missing initialization rows.
|
|
@@ -2577,9 +2823,7 @@ interface components {
|
|
|
2577
2823
|
missing_collectors: components["schemas"]["MissingCollectorResponse"][];
|
|
2578
2824
|
};
|
|
2579
2825
|
MissingCollectorResponse: {
|
|
2580
|
-
/** @example 1 */
|
|
2581
|
-
chain_id: number;
|
|
2582
|
-
/** @example offers */
|
|
2826
|
+
/** @example 1 */chain_id: number; /** @example offers */
|
|
2583
2827
|
name: string;
|
|
2584
2828
|
};
|
|
2585
2829
|
CollectorsHealthSuccessResponse: {
|
|
@@ -2601,22 +2845,16 @@ interface components {
|
|
|
2601
2845
|
data: components["schemas"]["CollectorHealthResponse"][];
|
|
2602
2846
|
};
|
|
2603
2847
|
CollectorHealthResponse: {
|
|
2604
|
-
/** @example offers */
|
|
2605
|
-
|
|
2606
|
-
/** @example
|
|
2607
|
-
|
|
2608
|
-
/** @example 21345678 */
|
|
2609
|
-
block_number: number | null;
|
|
2610
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2611
|
-
updated_at: string | null;
|
|
2612
|
-
/** @example 0 */
|
|
2848
|
+
/** @example offers */name: string; /** @example 1 */
|
|
2849
|
+
chain_id: number; /** @example 21345678 */
|
|
2850
|
+
block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
|
|
2851
|
+
updated_at: string | null; /** @example 0 */
|
|
2613
2852
|
lag: number | null;
|
|
2614
2853
|
/**
|
|
2615
2854
|
* @example live
|
|
2616
2855
|
* @enum {string}
|
|
2617
2856
|
*/
|
|
2618
|
-
status: "live" | "lagging" | "unknown";
|
|
2619
|
-
/** @example true */
|
|
2857
|
+
status: "live" | "lagging" | "unknown"; /** @example true */
|
|
2620
2858
|
initialized: boolean;
|
|
2621
2859
|
};
|
|
2622
2860
|
ChainsHealthSuccessResponse: {
|
|
@@ -2636,20 +2874,14 @@ interface components {
|
|
|
2636
2874
|
data: components["schemas"]["ChainHealthResponse"][];
|
|
2637
2875
|
};
|
|
2638
2876
|
ChainHealthResponse: {
|
|
2639
|
-
/** @example 1 */
|
|
2640
|
-
|
|
2641
|
-
/** @example
|
|
2642
|
-
|
|
2643
|
-
/** @example 21345690 */
|
|
2644
|
-
remote_block_number: number | null;
|
|
2645
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2646
|
-
updated_at: string | null;
|
|
2647
|
-
/** @example true */
|
|
2877
|
+
/** @example 1 */chain_id: number; /** @example 21345678 */
|
|
2878
|
+
local_block_number: number | null; /** @example 21345690 */
|
|
2879
|
+
remote_block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
|
|
2880
|
+
updated_at: string | null; /** @example true */
|
|
2648
2881
|
initialized: boolean;
|
|
2649
2882
|
};
|
|
2650
2883
|
PositionListResponse: {
|
|
2651
|
-
meta: components["schemas"]["Meta"];
|
|
2652
|
-
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2884
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2653
2885
|
cursor: string | null;
|
|
2654
2886
|
/**
|
|
2655
2887
|
* @description User positions with reserved balances from active offers.
|
|
@@ -2666,47 +2898,28 @@ interface components {
|
|
|
2666
2898
|
data: components["schemas"]["PositionListItemResponse"][];
|
|
2667
2899
|
};
|
|
2668
2900
|
PositionListItemResponse: {
|
|
2669
|
-
/** @example 1 */
|
|
2670
|
-
|
|
2671
|
-
/** @example
|
|
2672
|
-
|
|
2673
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2674
|
-
user: string;
|
|
2675
|
-
/** @example 200000000000000000000 */
|
|
2676
|
-
reserved: string;
|
|
2677
|
-
/** @example 21345678 */
|
|
2901
|
+
/** @example 1 */chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2902
|
+
contract: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2903
|
+
user: string; /** @example 200000000000000000000 */
|
|
2904
|
+
reserved: string; /** @example 21345678 */
|
|
2678
2905
|
block_number: number;
|
|
2679
2906
|
};
|
|
2680
2907
|
ValidateOffersRequest: {
|
|
2681
|
-
/** @description Array of offers in snake_case format. Required, non-empty. */
|
|
2682
|
-
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2908
|
+
/** @description Array of offers in snake_case format. Required, non-empty. */offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2683
2909
|
};
|
|
2684
2910
|
ValidateOfferRequest: {
|
|
2685
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2686
|
-
|
|
2687
|
-
/** @example
|
|
2688
|
-
|
|
2689
|
-
/** @example
|
|
2690
|
-
|
|
2691
|
-
/** @example
|
|
2692
|
-
|
|
2693
|
-
/** @example
|
|
2694
|
-
|
|
2695
|
-
/** @example
|
|
2696
|
-
|
|
2697
|
-
/** @example 1761922799 */
|
|
2698
|
-
expiry: number;
|
|
2699
|
-
/** @example 1761922790 */
|
|
2700
|
-
start: number;
|
|
2701
|
-
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2702
|
-
group: string;
|
|
2703
|
-
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2704
|
-
session: string;
|
|
2705
|
-
/** @example false */
|
|
2706
|
-
buy: boolean;
|
|
2707
|
-
/** @example 1 */
|
|
2708
|
-
chain_id: number;
|
|
2709
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2911
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
|
|
2912
|
+
assets: string; /** @example 0 */
|
|
2913
|
+
obligation_units?: string; /** @example 0 */
|
|
2914
|
+
obligation_shares?: string; /** @example 2750000000000000000 */
|
|
2915
|
+
price: string; /** @example 1761922799 */
|
|
2916
|
+
maturity: number; /** @example 1761922799 */
|
|
2917
|
+
expiry: number; /** @example 1761922790 */
|
|
2918
|
+
start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2919
|
+
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2920
|
+
session: string; /** @example false */
|
|
2921
|
+
buy: boolean; /** @example 1 */
|
|
2922
|
+
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2710
2923
|
loan_token: string;
|
|
2711
2924
|
/**
|
|
2712
2925
|
* @example [
|
|
@@ -2727,24 +2940,17 @@ interface components {
|
|
|
2727
2940
|
callback: components["schemas"]["ValidateCallbackRequest"];
|
|
2728
2941
|
};
|
|
2729
2942
|
ValidateCollateralRequest: {
|
|
2730
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2731
|
-
|
|
2732
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2733
|
-
oracle: string;
|
|
2734
|
-
/** @example 860000000000000000 */
|
|
2943
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2944
|
+
oracle: string; /** @example 860000000000000000 */
|
|
2735
2945
|
lltv: string;
|
|
2736
2946
|
};
|
|
2737
2947
|
ValidateCallbackRequest: {
|
|
2738
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2739
|
-
address: string;
|
|
2740
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2948
|
+
/** @example 0x1111111111111111111111111111111111111111 */address: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2741
2949
|
data: string;
|
|
2742
2950
|
};
|
|
2743
2951
|
ValidationSuccessResponse: {
|
|
2744
|
-
meta: components["schemas"]["Meta"];
|
|
2745
|
-
/** @
|
|
2746
|
-
cursor: string | null;
|
|
2747
|
-
/** @description Payload and root for client-side signing. */
|
|
2952
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2953
|
+
cursor: string | null; /** @description Payload and root for client-side signing. */
|
|
2748
2954
|
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
2749
2955
|
};
|
|
2750
2956
|
ValidationSuccessDataResponse: {
|
|
@@ -2759,6 +2965,84 @@ interface components {
|
|
|
2759
2965
|
*/
|
|
2760
2966
|
root: string;
|
|
2761
2967
|
};
|
|
2968
|
+
CallbackTypesRequest: {
|
|
2969
|
+
/**
|
|
2970
|
+
* @example [
|
|
2971
|
+
* {
|
|
2972
|
+
* "chain_id": 1,
|
|
2973
|
+
* "addresses": [
|
|
2974
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2975
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2976
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2977
|
+
* ]
|
|
2978
|
+
* }
|
|
2979
|
+
* ]
|
|
2980
|
+
*/
|
|
2981
|
+
callbacks: components["schemas"]["CallbackTypesChainRequest"][];
|
|
2982
|
+
};
|
|
2983
|
+
CallbackTypesChainRequest: {
|
|
2984
|
+
/** @example 1 */chain_id: number;
|
|
2985
|
+
/**
|
|
2986
|
+
* @example [
|
|
2987
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2988
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2989
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2990
|
+
* ]
|
|
2991
|
+
*/
|
|
2992
|
+
addresses: string[];
|
|
2993
|
+
};
|
|
2994
|
+
CallbackTypesSuccessResponse: {
|
|
2995
|
+
meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
|
|
2996
|
+
cursor: string | null;
|
|
2997
|
+
/**
|
|
2998
|
+
* @description Callback types grouped by chain.
|
|
2999
|
+
* @example [
|
|
3000
|
+
* {
|
|
3001
|
+
* "chain_id": 1,
|
|
3002
|
+
* "sell_erc20_callback": [
|
|
3003
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3004
|
+
* ],
|
|
3005
|
+
* "buy_erc20": [
|
|
3006
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3007
|
+
* ],
|
|
3008
|
+
* "buy_vault_v1_callback": [
|
|
3009
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3010
|
+
* ],
|
|
3011
|
+
* "not_supported": [
|
|
3012
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3013
|
+
* ]
|
|
3014
|
+
* }
|
|
3015
|
+
* ]
|
|
3016
|
+
*/
|
|
3017
|
+
data: components["schemas"]["CallbackTypesChainResponse"][];
|
|
3018
|
+
};
|
|
3019
|
+
CallbackTypesChainResponse: {
|
|
3020
|
+
/** @example 1 */chain_id: number;
|
|
3021
|
+
/**
|
|
3022
|
+
* @example [
|
|
3023
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3024
|
+
* ]
|
|
3025
|
+
*/
|
|
3026
|
+
buy_vault_v1_callback?: string[];
|
|
3027
|
+
/**
|
|
3028
|
+
* @example [
|
|
3029
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3030
|
+
* ]
|
|
3031
|
+
*/
|
|
3032
|
+
sell_erc20_callback?: string[];
|
|
3033
|
+
/**
|
|
3034
|
+
* @example [
|
|
3035
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3036
|
+
* ]
|
|
3037
|
+
*/
|
|
3038
|
+
buy_erc20?: string[];
|
|
3039
|
+
/**
|
|
3040
|
+
* @example [
|
|
3041
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3042
|
+
* ]
|
|
3043
|
+
*/
|
|
3044
|
+
not_supported: string[];
|
|
3045
|
+
};
|
|
2762
3046
|
};
|
|
2763
3047
|
responses: never;
|
|
2764
3048
|
parameters: never;
|
|
@@ -2827,6 +3111,9 @@ declare class BooksController {
|
|
|
2827
3111
|
declare class ValidateController {
|
|
2828
3112
|
validateOffers(): Promise<void>;
|
|
2829
3113
|
}
|
|
3114
|
+
declare class CallbacksController {
|
|
3115
|
+
resolveCallbackTypes(): Promise<void>;
|
|
3116
|
+
}
|
|
2830
3117
|
declare class OffersController {
|
|
2831
3118
|
getOffers(): Promise<void>;
|
|
2832
3119
|
}
|
|
@@ -2835,8 +3122,11 @@ declare class HealthController {
|
|
|
2835
3122
|
getCollectorsHealth(): Promise<void>;
|
|
2836
3123
|
getChainsHealth(): Promise<void>;
|
|
2837
3124
|
}
|
|
2838
|
-
declare class
|
|
2839
|
-
|
|
3125
|
+
declare class ConfigContractsController {
|
|
3126
|
+
getConfigContracts(): Promise<void>;
|
|
3127
|
+
}
|
|
3128
|
+
declare class ConfigRulesController {
|
|
3129
|
+
getConfigRules(): Promise<void>;
|
|
2840
3130
|
}
|
|
2841
3131
|
declare class ObligationsController {
|
|
2842
3132
|
getObligations(): Promise<void>;
|
|
@@ -2845,33 +3135,22 @@ declare class ObligationsController {
|
|
|
2845
3135
|
declare class UsersController {
|
|
2846
3136
|
getUserPositions(): Promise<void>;
|
|
2847
3137
|
}
|
|
2848
|
-
|
|
2849
|
-
name: string;
|
|
2850
|
-
description: string;
|
|
2851
|
-
};
|
|
2852
|
-
type OpenApiOptions = {
|
|
2853
|
-
rules?: RuleInfo[];
|
|
2854
|
-
};
|
|
2855
|
-
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
3138
|
+
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
2856
3139
|
//#endregion
|
|
2857
3140
|
//#region src/database/domains/Positions.d.ts
|
|
2858
3141
|
type PaginationParams = {
|
|
2859
|
-
/** Cursor string returned by a previous call, for pagination */
|
|
2860
|
-
cursor?: string;
|
|
2861
|
-
/** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
3142
|
+
/** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
2862
3143
|
limit?: number;
|
|
2863
3144
|
};
|
|
2864
3145
|
declare namespace getByUser {
|
|
2865
3146
|
type Parameters = PaginationParams & {
|
|
2866
|
-
/** The user address to get positions for. */
|
|
2867
|
-
user: Address;
|
|
3147
|
+
/** The user address to get positions for. */user: Address;
|
|
2868
3148
|
};
|
|
2869
3149
|
type PositionWithReserved = {
|
|
2870
3150
|
chainId: Id;
|
|
2871
3151
|
contract: Address;
|
|
2872
3152
|
user: Address;
|
|
2873
|
-
blockNumber: number;
|
|
2874
|
-
/** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
3153
|
+
blockNumber: number; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
2875
3154
|
reserved: bigint;
|
|
2876
3155
|
};
|
|
2877
3156
|
type ReturnType = {
|
|
@@ -2923,6 +3202,21 @@ declare const schemas: {
|
|
|
2923
3202
|
false: "false";
|
|
2924
3203
|
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
2925
3204
|
}, z$1.core.$strip>;
|
|
3205
|
+
readonly get_config_contracts: z$1.ZodObject<{
|
|
3206
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3207
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3208
|
+
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>>>>>;
|
|
3209
|
+
}, z$1.core.$strip>;
|
|
3210
|
+
readonly get_config_rules: 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
|
+
types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
|
|
3214
|
+
maturity: "maturity";
|
|
3215
|
+
callback: "callback";
|
|
3216
|
+
loan_token: "loan_token";
|
|
3217
|
+
}>>>>;
|
|
3218
|
+
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>>>>>;
|
|
3219
|
+
}, z$1.core.$strip>;
|
|
2926
3220
|
readonly get_offers: z$1.ZodObject<{
|
|
2927
3221
|
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2928
3222
|
buy: "buy";
|
|
@@ -2935,10 +3229,10 @@ declare const schemas: {
|
|
|
2935
3229
|
}, z$1.core.$strip>;
|
|
2936
3230
|
readonly get_obligations: z$1.ZodObject<{
|
|
2937
3231
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
3232
|
+
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>>>>>;
|
|
3233
|
+
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>>>>>;
|
|
3234
|
+
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>>>>>;
|
|
3235
|
+
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>>>>>;
|
|
2942
3236
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2943
3237
|
}, z$1.core.$strip>;
|
|
2944
3238
|
readonly get_obligation: z$1.ZodObject<{
|
|
@@ -2956,6 +3250,12 @@ declare const schemas: {
|
|
|
2956
3250
|
readonly validate_offers: z$1.ZodObject<{
|
|
2957
3251
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
2958
3252
|
}, z$1.core.$strict>;
|
|
3253
|
+
readonly callback_types: z$1.ZodObject<{
|
|
3254
|
+
callbacks: z$1.ZodArray<z$1.ZodObject<{
|
|
3255
|
+
chain_id: z$1.ZodNumber;
|
|
3256
|
+
addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3257
|
+
}, z$1.core.$strict>>;
|
|
3258
|
+
}, z$1.core.$strict>;
|
|
2959
3259
|
readonly get_user_positions: z$1.ZodObject<{
|
|
2960
3260
|
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2961
3261
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -2966,15 +3266,13 @@ type Action = keyof typeof schemas;
|
|
|
2966
3266
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2967
3267
|
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]>>;
|
|
2968
3268
|
declare namespace index_d_exports$1 {
|
|
2969
|
-
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse,
|
|
3269
|
+
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 };
|
|
2970
3270
|
}
|
|
2971
|
-
declare namespace Client_d_exports {
|
|
3271
|
+
declare namespace Client_d_exports$1 {
|
|
2972
3272
|
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
2973
3273
|
}
|
|
2974
3274
|
type RouterClientConfig = {
|
|
2975
|
-
/** The URL of the router. */
|
|
2976
|
-
readonly url: URL;
|
|
2977
|
-
/** The default headers to use for each request. */
|
|
3275
|
+
/** The URL of the router. */readonly url: URL; /** The default headers to use for each request. */
|
|
2978
3276
|
readonly headers: Headers;
|
|
2979
3277
|
};
|
|
2980
3278
|
type Client$2 = Compute<RouterClientConfig & {
|
|
@@ -3011,10 +3309,8 @@ type ConnectOptions = {
|
|
|
3011
3309
|
/** The URL of the router to interact with.
|
|
3012
3310
|
* @default "https://router.morpho.dev"
|
|
3013
3311
|
*/
|
|
3014
|
-
url?: string;
|
|
3015
|
-
/** The
|
|
3016
|
-
apiKey?: string;
|
|
3017
|
-
/** The default headers to use for each request. */
|
|
3312
|
+
url?: string; /** The API key to use for the router API. */
|
|
3313
|
+
apiKey?: string; /** The default headers to use for each request. */
|
|
3018
3314
|
headers?: Headers;
|
|
3019
3315
|
};
|
|
3020
3316
|
/**
|
|
@@ -3037,13 +3333,9 @@ declare namespace connect$1 {
|
|
|
3037
3333
|
declare function getOffers(apiClient: Client<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
3038
3334
|
declare namespace getOffers {
|
|
3039
3335
|
type Parameters = {
|
|
3040
|
-
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
3041
|
-
|
|
3042
|
-
/**
|
|
3043
|
-
obligationId: Hex;
|
|
3044
|
-
/** Pagination cursor in base64url-encoded format */
|
|
3045
|
-
cursor?: string;
|
|
3046
|
-
/** Maximum number of offers to return. @default 20 */
|
|
3336
|
+
/** 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 */
|
|
3337
|
+
obligationId: Hex; /** Pagination cursor in base64url-encoded format */
|
|
3338
|
+
cursor?: string; /** Maximum number of offers to return. @default 20 */
|
|
3047
3339
|
limit?: number;
|
|
3048
3340
|
};
|
|
3049
3341
|
type ReturnType = {
|
|
@@ -3053,14 +3345,10 @@ declare namespace getOffers {
|
|
|
3053
3345
|
consumed: bigint;
|
|
3054
3346
|
takeable: bigint;
|
|
3055
3347
|
} & {
|
|
3056
|
-
/** 32-byte merkle root. */
|
|
3057
|
-
|
|
3058
|
-
/** Sibling hashes for the merkle proof. */
|
|
3059
|
-
proof?: Hex[];
|
|
3060
|
-
/** Offer signature from the Merkle tree. */
|
|
3348
|
+
/** 32-byte merkle root. */root?: Hex; /** Sibling hashes for the merkle proof. */
|
|
3349
|
+
proof?: Hex[]; /** Offer signature from the Merkle tree. */
|
|
3061
3350
|
signature?: Hex;
|
|
3062
|
-
}>[];
|
|
3063
|
-
/** The pagination cursor. */
|
|
3351
|
+
}>[]; /** The pagination cursor. */
|
|
3064
3352
|
cursor: string | null;
|
|
3065
3353
|
};
|
|
3066
3354
|
type ErrorType = GetApiErrorType;
|
|
@@ -3068,25 +3356,17 @@ declare namespace getOffers {
|
|
|
3068
3356
|
declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
3069
3357
|
declare namespace getObligations {
|
|
3070
3358
|
type Parameters = {
|
|
3071
|
-
/** Pagination cursor is a 32-byte hex string. */
|
|
3072
|
-
|
|
3073
|
-
/**
|
|
3074
|
-
|
|
3075
|
-
/** Filter by
|
|
3076
|
-
|
|
3077
|
-
/** Filter by loan token address. */
|
|
3078
|
-
loanToken?: Address;
|
|
3079
|
-
/** Filter by collateral token (matches any collateral in the obligation). */
|
|
3080
|
-
collateralToken?: Address;
|
|
3081
|
-
/** Filter by exact maturity timestamp (unix seconds). */
|
|
3082
|
-
maturity?: number;
|
|
3359
|
+
/** Pagination cursor is a 32-byte hex string. */cursor?: Hex; /** Maximum number of obligations to return. @default 20 */
|
|
3360
|
+
limit?: number; /** Filter by chain IDs (comma-separated). */
|
|
3361
|
+
chainIds?: number[]; /** Filter by loan token addresses (comma-separated). */
|
|
3362
|
+
loanTokens?: Address[]; /** Filter by collateral tokens (comma-separated, matches any collateral). */
|
|
3363
|
+
collateralTokens?: Address[]; /** Filter by exact maturity timestamps (comma-separated, unix seconds). */
|
|
3364
|
+
maturities?: number[];
|
|
3083
3365
|
};
|
|
3084
3366
|
type ReturnType = {
|
|
3085
3367
|
obligations: Compute<{
|
|
3086
|
-
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
3087
|
-
|
|
3088
|
-
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
3089
|
-
/** The pagination cursor. */
|
|
3368
|
+
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/id: () => Hex;
|
|
3369
|
+
} & Obligation & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
|
|
3090
3370
|
cursor: string | null;
|
|
3091
3371
|
};
|
|
3092
3372
|
type ErrorType = GetApiErrorType;
|
|
@@ -3122,20 +3402,20 @@ declare namespace Gate_d_exports {
|
|
|
3122
3402
|
/**
|
|
3123
3403
|
* A validation rule.
|
|
3124
3404
|
*/
|
|
3125
|
-
type Rule<T, Name
|
|
3405
|
+
type Rule<T, Name extends string = string> = {
|
|
3126
3406
|
kind: "single";
|
|
3127
|
-
name: Name
|
|
3407
|
+
name: Name;
|
|
3128
3408
|
description: string;
|
|
3129
|
-
run: Single<T, Name
|
|
3409
|
+
run: Single<T, Name>;
|
|
3130
3410
|
} | {
|
|
3131
3411
|
kind: "batch";
|
|
3132
|
-
name: Name
|
|
3412
|
+
name: Name;
|
|
3133
3413
|
description: string;
|
|
3134
|
-
run: Batch<T, Name
|
|
3414
|
+
run: Batch<T, Name>;
|
|
3135
3415
|
};
|
|
3136
|
-
type RuleNames<Rules
|
|
3416
|
+
type RuleNames<Rules extends readonly {
|
|
3137
3417
|
name: string;
|
|
3138
|
-
}[]> = Rules
|
|
3418
|
+
}[]> = Rules[number]["name"];
|
|
3139
3419
|
/**
|
|
3140
3420
|
* A single item validation rule.
|
|
3141
3421
|
* @param item - The item to validate.
|
|
@@ -3155,7 +3435,7 @@ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<
|
|
|
3155
3435
|
* @param run - The function that validates the rule.
|
|
3156
3436
|
* @returns The created rule.
|
|
3157
3437
|
*/
|
|
3158
|
-
declare function single<Name
|
|
3438
|
+
declare function single<Name extends string, T>(name: Name, description: string, run: Single<T, Name>): Rule<T, Name>;
|
|
3159
3439
|
/**
|
|
3160
3440
|
* Create a validation rule iterating over a batch of items at a time.
|
|
3161
3441
|
* @param name - The name of the rule.
|
|
@@ -3163,95 +3443,134 @@ declare function single<Name$1 extends string, T>(name: Name$1, description: str
|
|
|
3163
3443
|
* @param run - The function that validates the rule.
|
|
3164
3444
|
* @returns The created rule.
|
|
3165
3445
|
*/
|
|
3166
|
-
declare function batch$1<Name
|
|
3446
|
+
declare function batch$1<Name extends string, T>(name: Name, description: string, run: Batch<T, Name>): Rule<T, Name>;
|
|
3167
3447
|
/**
|
|
3168
3448
|
* A validation issue.
|
|
3169
3449
|
*/
|
|
3170
3450
|
type Issue<T, RuleName extends string = string> = {
|
|
3171
|
-
/** The name of the rule that caused the issue. */
|
|
3172
|
-
|
|
3173
|
-
/** The message of the issue. */
|
|
3174
|
-
message: string;
|
|
3175
|
-
/** The item that was not valid. */
|
|
3451
|
+
/** The name of the rule that caused the issue. */ruleName: RuleName; /** The message of the issue. */
|
|
3452
|
+
message: string; /** The item that was not valid. */
|
|
3176
3453
|
item: T;
|
|
3177
3454
|
};
|
|
3178
3455
|
/**
|
|
3179
3456
|
* The result of a validation.
|
|
3180
3457
|
*/
|
|
3181
3458
|
type Result<T, RuleName extends string = string> = {
|
|
3182
|
-
/** The items that were valid. */
|
|
3183
|
-
valid: T[];
|
|
3184
|
-
/** The reports of the failed validations. */
|
|
3459
|
+
/** The items that were valid. */valid: T[]; /** The reports of the failed validations. */
|
|
3185
3460
|
issues: Issue<T, RuleName>[];
|
|
3186
3461
|
};
|
|
3187
|
-
declare function run<T, Name
|
|
3462
|
+
declare function run<T, Name extends string, Rules extends readonly Rule<T, Name>[]>(parameters: {
|
|
3188
3463
|
items: T[];
|
|
3189
|
-
rules: Rules
|
|
3464
|
+
rules: Rules;
|
|
3190
3465
|
chunkSize?: number;
|
|
3191
|
-
}): Promise<Result<T, RuleNames<Rules
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
type
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
type CallbackConfig = {
|
|
3200
|
-
type: CallbackType.BuyVaultV1Callback;
|
|
3201
|
-
addresses: Address[];
|
|
3202
|
-
vaultFactories: Address[];
|
|
3466
|
+
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
3467
|
+
//#endregion
|
|
3468
|
+
//#region src/gatekeeper/types.d.ts
|
|
3469
|
+
type ConfigRule = {
|
|
3470
|
+
type: "maturity";
|
|
3471
|
+
chain_id: Id;
|
|
3472
|
+
name: MaturityType;
|
|
3473
|
+
timestamp: Maturity;
|
|
3203
3474
|
} | {
|
|
3204
|
-
type:
|
|
3205
|
-
|
|
3475
|
+
type: "callback";
|
|
3476
|
+
chain_id: Id;
|
|
3477
|
+
address: Address;
|
|
3478
|
+
callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
|
|
3206
3479
|
} | {
|
|
3207
|
-
type:
|
|
3480
|
+
type: "loan_token";
|
|
3481
|
+
chain_id: Id;
|
|
3482
|
+
address: Address;
|
|
3483
|
+
};
|
|
3484
|
+
type ValidationIssue = {
|
|
3485
|
+
index: number;
|
|
3486
|
+
rule: string;
|
|
3487
|
+
message: string;
|
|
3488
|
+
};
|
|
3489
|
+
type ValidateOffersSuccess = {
|
|
3490
|
+
payload: Hex;
|
|
3491
|
+
root: Hex;
|
|
3492
|
+
};
|
|
3493
|
+
type ValidateOffersIssues = {
|
|
3494
|
+
issues: ValidationIssue[];
|
|
3495
|
+
};
|
|
3496
|
+
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
3497
|
+
type CallbackType = Type$1 | "not_supported";
|
|
3498
|
+
type CallbackTypesRequest = {
|
|
3499
|
+
callbacks: Array<{
|
|
3500
|
+
chain_id: Id;
|
|
3501
|
+
addresses: Address[];
|
|
3502
|
+
}>;
|
|
3503
|
+
};
|
|
3504
|
+
type CallbackTypesResponse = Array<{
|
|
3505
|
+
chain_id: Id;
|
|
3506
|
+
} & Partial<Record<CallbackType, Address[]>>>;
|
|
3507
|
+
type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
|
|
3508
|
+
type SuccessPayload<T> = {
|
|
3509
|
+
meta: {
|
|
3510
|
+
timestamp: string;
|
|
3511
|
+
checksum?: string;
|
|
3512
|
+
};
|
|
3513
|
+
cursor: string | null;
|
|
3514
|
+
data: T;
|
|
3515
|
+
};
|
|
3516
|
+
type ErrorPayload = {
|
|
3517
|
+
meta: {
|
|
3518
|
+
timestamp: string;
|
|
3519
|
+
checksum?: string;
|
|
3520
|
+
};
|
|
3521
|
+
error: {
|
|
3522
|
+
code: string;
|
|
3523
|
+
message: string;
|
|
3524
|
+
details?: unknown;
|
|
3525
|
+
};
|
|
3526
|
+
};
|
|
3527
|
+
declare namespace Client_d_exports {
|
|
3528
|
+
export { ClientConfig, GatekeeperClient, createHttpClient };
|
|
3529
|
+
}
|
|
3530
|
+
type GatekeeperClient = {
|
|
3531
|
+
/** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
|
|
3532
|
+
statusCode: number;
|
|
3533
|
+
body: unknown;
|
|
3534
|
+
}>; /** Get configured rules for supported chains. */
|
|
3535
|
+
getConfigRules: (query?: {
|
|
3536
|
+
cursor?: string;
|
|
3537
|
+
limit?: number | string;
|
|
3538
|
+
types?: Array<ConfigRule["type"]> | ConfigRule["type"];
|
|
3539
|
+
}) => Promise<{
|
|
3540
|
+
statusCode: number;
|
|
3541
|
+
body: ConfigRulesPayload;
|
|
3542
|
+
}>; /** Validate offers and return decision results. */
|
|
3543
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
|
|
3544
|
+
getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
|
|
3545
|
+
baseUrl: string;
|
|
3546
|
+
};
|
|
3547
|
+
type ClientConfig = {
|
|
3548
|
+
baseUrl: string;
|
|
3549
|
+
timeoutMs?: number;
|
|
3550
|
+
fetchFn?: typeof fetch;
|
|
3551
|
+
originSecret?: string;
|
|
3208
3552
|
};
|
|
3209
|
-
declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
3210
|
-
type: CallbackType.BuyVaultV1Callback;
|
|
3211
|
-
}> | undefined;
|
|
3212
|
-
declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
3213
|
-
type: CallbackType.SellERC20Callback;
|
|
3214
|
-
}> | undefined;
|
|
3215
|
-
declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
3216
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
3217
|
-
}> | undefined;
|
|
3218
|
-
declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
|
|
3219
|
-
/**
|
|
3220
|
-
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
3221
|
-
* Skips the empty callback type as it does not carry addresses.
|
|
3222
|
-
*
|
|
3223
|
-
* @param chain - Chain name for which to infer the callback type
|
|
3224
|
-
* @param address - Callback contract address
|
|
3225
|
-
* @returns The callback type when found, otherwise undefined
|
|
3226
|
-
*/
|
|
3227
|
-
declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
|
|
3228
|
-
/**
|
|
3229
|
-
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
3230
|
-
* @param chain - Chain name for which to read the validation configuration
|
|
3231
|
-
* @param type - Callback type to retrieve
|
|
3232
|
-
* @returns The matching callback addresses or an empty array if not configured
|
|
3233
|
-
*/
|
|
3234
|
-
declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
|
|
3235
3553
|
/**
|
|
3236
|
-
*
|
|
3237
|
-
*
|
|
3238
|
-
* @
|
|
3239
|
-
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
3554
|
+
* Create an HTTP client for a gatekeeper service.
|
|
3555
|
+
* @param config - Gatekeeper client configuration. {@link ClientConfig}
|
|
3556
|
+
* @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
|
|
3240
3557
|
*/
|
|
3241
|
-
declare
|
|
3242
|
-
declare const assets: Record<string, Address[]>;
|
|
3243
|
-
declare const configs: Record<Name, GateConfig>;
|
|
3558
|
+
declare function createHttpClient(config: ClientConfig): GatekeeperClient;
|
|
3244
3559
|
declare namespace Gatekeeper_d_exports {
|
|
3245
3560
|
export { Gatekeeper, Rules, create };
|
|
3246
3561
|
}
|
|
3247
3562
|
type Rules = readonly Rule<Offer, string>[];
|
|
3248
3563
|
type Gatekeeper = {
|
|
3249
|
-
rules: Rules;
|
|
3250
3564
|
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
3251
3565
|
};
|
|
3252
3566
|
type GatekeeperParameters = {
|
|
3253
3567
|
rules: Rules;
|
|
3254
3568
|
};
|
|
3569
|
+
/**
|
|
3570
|
+
* Create a gatekeeper instance with the provided rules.
|
|
3571
|
+
* @param parameters - Gatekeeper parameters. {@link GatekeeperParameters}
|
|
3572
|
+
* @returns Gatekeeper instance. {@link Gatekeeper}
|
|
3573
|
+
*/
|
|
3255
3574
|
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
3256
3575
|
//#endregion
|
|
3257
3576
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
@@ -3283,7 +3602,7 @@ declare const callback: ({
|
|
|
3283
3602
|
callbacks,
|
|
3284
3603
|
allowedAddresses
|
|
3285
3604
|
}: {
|
|
3286
|
-
callbacks:
|
|
3605
|
+
callbacks: Type$1[];
|
|
3287
3606
|
allowedAddresses: Address[];
|
|
3288
3607
|
}) => Rule<Offer, "callback">;
|
|
3289
3608
|
/**
|
|
@@ -3313,11 +3632,9 @@ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusiv
|
|
|
3313
3632
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
3314
3633
|
declare namespace from {
|
|
3315
3634
|
type Parameters = {
|
|
3316
|
-
/** The viem client to use. */
|
|
3317
|
-
|
|
3318
|
-
/** The mempool
|
|
3319
|
-
mempoolAddress: Address;
|
|
3320
|
-
/** The block window to use for the mempool. Defaults to 100. */
|
|
3635
|
+
/** The viem client to use. */client: WalletClient; /** The mempool address. */
|
|
3636
|
+
mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
|
|
3637
|
+
morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
|
|
3321
3638
|
blockWindow?: number;
|
|
3322
3639
|
};
|
|
3323
3640
|
type ReturnType = Client$1;
|
|
@@ -3328,18 +3645,12 @@ declare namespace MempoolClient_d_exports {
|
|
|
3328
3645
|
}
|
|
3329
3646
|
type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
|
|
3330
3647
|
type GetParameters = {
|
|
3331
|
-
/** The block number to get offers from. */
|
|
3332
|
-
|
|
3333
|
-
/** The
|
|
3334
|
-
|
|
3335
|
-
/** The loan asset to get offers from. */
|
|
3336
|
-
loanToken?: string;
|
|
3337
|
-
/** The order to get offers. Defaults to "desc". */
|
|
3338
|
-
order?: "asc" | "desc";
|
|
3339
|
-
/** The options to get offers from. */
|
|
3648
|
+
/** The block number to get offers from. */blockNumberGte?: number; /** The block number to get offers to. */
|
|
3649
|
+
blockNumberLte?: number; /** The loan asset to get offers from. */
|
|
3650
|
+
loanToken?: string; /** The order to get offers. Defaults to "desc". */
|
|
3651
|
+
order?: "asc" | "desc"; /** The options to get offers from. */
|
|
3340
3652
|
options?: {
|
|
3341
|
-
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
|
|
3342
|
-
maxBatchSize?: number;
|
|
3653
|
+
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */maxBatchSize?: number;
|
|
3343
3654
|
};
|
|
3344
3655
|
};
|
|
3345
3656
|
/**
|
|
@@ -3350,11 +3661,9 @@ type Client$1 = {
|
|
|
3350
3661
|
* Add an offer to the mempool.
|
|
3351
3662
|
* @returns The created offer with its hash.
|
|
3352
3663
|
*/
|
|
3353
|
-
add: (parameters: AddParameters) => Promise<Hex>;
|
|
3354
|
-
/** Get offers from the mempool. */
|
|
3664
|
+
add: (parameters: AddParameters) => Promise<Hex>; /** Get offers from the mempool. */
|
|
3355
3665
|
get: (parameters?: GetParameters) => AsyncGenerator<{
|
|
3356
|
-
offers: Offer[];
|
|
3357
|
-
/** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
3666
|
+
offers: Offer[]; /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
3358
3667
|
blockNumber: number;
|
|
3359
3668
|
}>;
|
|
3360
3669
|
/**
|
|
@@ -3510,5 +3819,5 @@ declare namespace index_d_exports$2 {
|
|
|
3510
3819
|
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 };
|
|
3511
3820
|
}
|
|
3512
3821
|
//#endregion
|
|
3513
|
-
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,
|
|
3822
|
+
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 };
|
|
3514
3823
|
//# sourceMappingURL=index.browser.d.ts.map
|