@morpho-dev/router 0.4.2 → 0.5.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 +2654 -2335
- package/dist/index.browser.d.mts +456 -482
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +456 -482
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +623 -304
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +592 -294
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +629 -692
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +629 -692
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +919 -583
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +886 -571
- package/dist/index.node.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-jass6xSI.mjs +0 -13
package/dist/index.browser.d.mts
CHANGED
|
@@ -13,14 +13,14 @@ import "pg";
|
|
|
13
13
|
|
|
14
14
|
//#region src/api/Schema/BookResponse.d.ts
|
|
15
15
|
declare namespace BookResponse_d_exports {
|
|
16
|
-
export { BookLevelResponse, from$
|
|
16
|
+
export { BookLevelResponse, from$15 as from };
|
|
17
17
|
}
|
|
18
18
|
type BookLevelResponse = {
|
|
19
19
|
price: string;
|
|
20
20
|
assets: string;
|
|
21
21
|
count: number;
|
|
22
22
|
};
|
|
23
|
-
declare function from$
|
|
23
|
+
declare function from$15(level: {
|
|
24
24
|
price: bigint;
|
|
25
25
|
assets: bigint;
|
|
26
26
|
count: number;
|
|
@@ -344,19 +344,48 @@ declare const Morpho: readonly [{
|
|
|
344
344
|
}];
|
|
345
345
|
readonly stateMutability: "view";
|
|
346
346
|
}];
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/core/types.d.ts
|
|
349
|
+
/** Combines members of an intersection into a readable type. */
|
|
350
|
+
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
351
|
+
declare const BrandTypeId: unique symbol;
|
|
352
|
+
type Brand<in out ID extends string | symbol> = {
|
|
353
|
+
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
354
|
+
};
|
|
347
355
|
declare namespace Callback_d_exports {
|
|
348
|
-
export { BuyVaultV1CallbackData,
|
|
356
|
+
export { BuyERC20Data, BuyVaultV1CallbackData, Callback, CallbackPosition, SellERC20CallbackData, Type$1 as Type, decode$2 as decode, decodeBuyERC20, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$2 as encode, encodeBuyERC20, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
349
357
|
}
|
|
350
|
-
|
|
358
|
+
/** A position decoded from callback data. */
|
|
359
|
+
type CallbackPosition = {
|
|
360
|
+
/** The ERC20 token contract address. */contract: Address; /** The maximum amount available from this position. */
|
|
361
|
+
amount: bigint;
|
|
362
|
+
};
|
|
363
|
+
type Callback = {
|
|
364
|
+
type: Type$1.BuyWithEmptyCallback;
|
|
365
|
+
} | (({
|
|
366
|
+
/** The address of the callback contract. */address: Address; /** The ABI-encoded callback data. */
|
|
367
|
+
data: Hex;
|
|
368
|
+
} & {
|
|
369
|
+
type: Type$1.BuyERC20; /** The decoded callback inputs. */
|
|
370
|
+
inputs: {
|
|
371
|
+
/** The ERC20 positions available for the callback. */positions: CallbackPosition[];
|
|
372
|
+
};
|
|
373
|
+
}) & Brand<"Callback">);
|
|
374
|
+
declare enum Type$1 {
|
|
351
375
|
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
376
|
+
BuyERC20 = "buy_erc20",
|
|
352
377
|
BuyVaultV1Callback = "buy_vault_v1_callback",
|
|
353
|
-
SellERC20Callback = "sell_erc20_callback"
|
|
378
|
+
SellERC20Callback = "sell_erc20_callback"
|
|
354
379
|
}
|
|
355
380
|
declare const isEmptyCallback: (offer: Offer) => boolean;
|
|
356
|
-
declare function decode$2(type:
|
|
381
|
+
declare function decode$2(type: Type$1, data: Hex): {
|
|
357
382
|
contract: Address;
|
|
358
383
|
amount: bigint;
|
|
359
384
|
}[];
|
|
385
|
+
type BuyERC20Data = {
|
|
386
|
+
tokens: Address[];
|
|
387
|
+
amounts: bigint[];
|
|
388
|
+
};
|
|
360
389
|
type BuyVaultV1CallbackData = {
|
|
361
390
|
vaults: Address[];
|
|
362
391
|
amounts: bigint[];
|
|
@@ -365,8 +394,28 @@ type SellERC20CallbackData = {
|
|
|
365
394
|
collaterals: Address[];
|
|
366
395
|
amounts: bigint[];
|
|
367
396
|
};
|
|
368
|
-
declare function encode$2(type:
|
|
369
|
-
declare function encode$2(type:
|
|
397
|
+
declare function encode$2(type: Type$1.BuyERC20, data: BuyERC20Data): Hex;
|
|
398
|
+
declare function encode$2(type: Type$1.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
|
|
399
|
+
declare function encode$2(type: Type$1.SellERC20Callback, data: SellERC20CallbackData): Hex;
|
|
400
|
+
/**
|
|
401
|
+
* Decodes BuyERC20 callback data into positions.
|
|
402
|
+
* @param data - The ABI-encoded callback data containing token addresses and amounts.
|
|
403
|
+
* @returns Array of positions with contract address and amount.
|
|
404
|
+
* @throws If data is empty, malformed, or arrays have mismatched lengths.
|
|
405
|
+
*/
|
|
406
|
+
declare function decodeBuyERC20(data: Hex): Array<{
|
|
407
|
+
contract: Address;
|
|
408
|
+
amount: bigint;
|
|
409
|
+
}>;
|
|
410
|
+
/**
|
|
411
|
+
* Encodes BuyERC20 callback parameters into ABI-encoded data.
|
|
412
|
+
* @param parameters - The tokens and amounts to encode.
|
|
413
|
+
* @returns ABI-encoded hex string.
|
|
414
|
+
*/
|
|
415
|
+
declare function encodeBuyERC20(parameters: {
|
|
416
|
+
tokens: Address[];
|
|
417
|
+
amounts: bigint[];
|
|
418
|
+
}): Hex;
|
|
370
419
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
371
420
|
contract: Address;
|
|
372
421
|
amount: bigint;
|
|
@@ -428,6 +477,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
|
428
477
|
v1_1: ChainContract;
|
|
429
478
|
};
|
|
430
479
|
};
|
|
480
|
+
callbacks: Callback[];
|
|
431
481
|
}>, "custom"> & {
|
|
432
482
|
id: Id;
|
|
433
483
|
name: Name;
|
|
@@ -441,6 +491,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
|
441
491
|
v1_1: ChainContract;
|
|
442
492
|
};
|
|
443
493
|
};
|
|
494
|
+
callbacks: Callback[];
|
|
444
495
|
};
|
|
445
496
|
}>;
|
|
446
497
|
declare const ChainId: {
|
|
@@ -494,17 +545,14 @@ type ChainRegistry = {
|
|
|
494
545
|
getById: (chainId: Id) => Chain$1 | undefined;
|
|
495
546
|
list: () => Chain$1[];
|
|
496
547
|
};
|
|
548
|
+
/**
|
|
549
|
+
* Creates a chain registry from a list of chains.
|
|
550
|
+
* @param chains - Array of chain objects to register.
|
|
551
|
+
* @returns A registry for looking up chains by ID. {@link ChainRegistry}
|
|
552
|
+
*/
|
|
497
553
|
declare function create$1(chains: Chain$1[]): ChainRegistry;
|
|
498
|
-
//#endregion
|
|
499
|
-
//#region src/core/types.d.ts
|
|
500
|
-
/** Combines members of an intersection into a readable type. */
|
|
501
|
-
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
502
|
-
declare const BrandTypeId: unique symbol;
|
|
503
|
-
type Brand<in out ID extends string | symbol> = {
|
|
504
|
-
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
505
|
-
};
|
|
506
554
|
declare namespace LLTV_d_exports {
|
|
507
|
-
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$
|
|
555
|
+
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$14 as from };
|
|
508
556
|
}
|
|
509
557
|
type LLTV = bigint & Brand<"LLTV">;
|
|
510
558
|
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
@@ -514,8 +562,8 @@ type Options = (typeof Options)[number];
|
|
|
514
562
|
* @param lltv - The LLTV option or the scaled LLTV.
|
|
515
563
|
* @returns The LLTV.
|
|
516
564
|
*/
|
|
517
|
-
declare function from$
|
|
518
|
-
declare namespace from$
|
|
565
|
+
declare function from$14(lltv: Options | bigint): LLTV;
|
|
566
|
+
declare namespace from$14 {
|
|
519
567
|
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
520
568
|
}
|
|
521
569
|
declare class InvalidOptionError$1 extends BaseError {
|
|
@@ -528,14 +576,11 @@ declare class InvalidLLTVError extends BaseError {
|
|
|
528
576
|
}
|
|
529
577
|
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
530
578
|
declare namespace Collateral_d_exports {
|
|
531
|
-
export { Collateral, CollateralSchema, CollateralsSchema, from$
|
|
579
|
+
export { Collateral, CollateralSchema, CollateralsSchema, from$13 as from, random$3 as random };
|
|
532
580
|
}
|
|
533
581
|
type Collateral = {
|
|
534
|
-
/** Asset being used as collateral. */
|
|
535
|
-
|
|
536
|
-
/** Liquidation Loan-to-Value of the collateral. */
|
|
537
|
-
lltv: LLTV;
|
|
538
|
-
/** Oracle contract used to price the collateral. */
|
|
582
|
+
/** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
|
|
583
|
+
lltv: LLTV; /** Oracle contract used to price the collateral. */
|
|
539
584
|
oracle: Address;
|
|
540
585
|
};
|
|
541
586
|
declare const CollateralSchema: z$1.ZodObject<{
|
|
@@ -548,8 +593,8 @@ declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
|
548
593
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
549
594
|
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
550
595
|
}, z$1.core.$strip>>;
|
|
551
|
-
declare const from$
|
|
552
|
-
declare namespace from$
|
|
596
|
+
declare const from$13: (parameters: from$13.Parameters) => from$13.ReturnType;
|
|
597
|
+
declare namespace from$13 {
|
|
553
598
|
type Parameters = {
|
|
554
599
|
asset: Address;
|
|
555
600
|
lltv: Options | bigint;
|
|
@@ -587,8 +632,7 @@ declare namespace ERC4626_d_exports {
|
|
|
587
632
|
declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
|
|
588
633
|
declare namespace decimalsOffset {
|
|
589
634
|
type Parameters = {
|
|
590
|
-
/** The number of decimals of the underlying asset. */
|
|
591
|
-
underlyingDecimals: number;
|
|
635
|
+
/** The number of decimals of the underlying asset. */underlyingDecimals: number;
|
|
592
636
|
};
|
|
593
637
|
type ReturnType = number;
|
|
594
638
|
}
|
|
@@ -607,11 +651,8 @@ declare namespace decimalsOffset {
|
|
|
607
651
|
declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
|
|
608
652
|
declare namespace convertToAssets {
|
|
609
653
|
type Parameters = {
|
|
610
|
-
/** The amount of shares to convert. */
|
|
611
|
-
|
|
612
|
-
/** Total amount of assets in the vault. */
|
|
613
|
-
totalAssets: bigint;
|
|
614
|
-
/** Total amount of shares in the vault. */
|
|
654
|
+
/** The amount of shares to convert. */shares: bigint; /** Total amount of assets in the vault. */
|
|
655
|
+
totalAssets: bigint; /** Total amount of shares in the vault. */
|
|
615
656
|
totalSupply: bigint;
|
|
616
657
|
/**
|
|
617
658
|
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
@@ -638,11 +679,8 @@ declare namespace convertToAssets {
|
|
|
638
679
|
declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
|
|
639
680
|
declare namespace convertToShares {
|
|
640
681
|
type Parameters = {
|
|
641
|
-
/** The amount of assets to convert. */
|
|
642
|
-
|
|
643
|
-
/** Total amount of assets in the vault. */
|
|
644
|
-
totalAssets: bigint;
|
|
645
|
-
/** Total amount of shares in the vault. */
|
|
682
|
+
/** The amount of assets to convert. */assets: bigint; /** Total amount of assets in the vault. */
|
|
683
|
+
totalAssets: bigint; /** Total amount of shares in the vault. */
|
|
646
684
|
totalSupply: bigint;
|
|
647
685
|
/**
|
|
648
686
|
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
@@ -778,7 +816,7 @@ declare function generateMarketLiquidityPoolId(parameters: {
|
|
|
778
816
|
marketId: string;
|
|
779
817
|
}): string;
|
|
780
818
|
declare namespace Maturity_d_exports {
|
|
781
|
-
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$
|
|
819
|
+
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$12 as from };
|
|
782
820
|
}
|
|
783
821
|
/**
|
|
784
822
|
* Maturity is a number that represents a date in seconds.
|
|
@@ -791,7 +829,7 @@ declare enum MaturityType {
|
|
|
791
829
|
EndOfMonth = "end_of_month",
|
|
792
830
|
EndOfNextMonth = "end_of_next_month",
|
|
793
831
|
EndOfQuarter = "end_of_quarter",
|
|
794
|
-
EndOfNextQuarter = "end_of_next_quarter"
|
|
832
|
+
EndOfNextQuarter = "end_of_next_quarter"
|
|
795
833
|
}
|
|
796
834
|
declare const MaturityOptions: {
|
|
797
835
|
readonly end_of_week: () => Maturity;
|
|
@@ -808,8 +846,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
|
|
|
808
846
|
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
809
847
|
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
810
848
|
*/
|
|
811
|
-
declare function from$
|
|
812
|
-
declare namespace from$
|
|
849
|
+
declare function from$12(ts: from$12.Parameters): Maturity;
|
|
850
|
+
declare namespace from$12 {
|
|
813
851
|
type Parameters = number | MaturityOptions;
|
|
814
852
|
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
815
853
|
}
|
|
@@ -853,16 +891,12 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
853
891
|
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
854
892
|
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
855
893
|
declare namespace Obligation_d_exports {
|
|
856
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$
|
|
894
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
857
895
|
}
|
|
858
896
|
type Obligation = {
|
|
859
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
860
|
-
|
|
861
|
-
/** The
|
|
862
|
-
loanToken: Address;
|
|
863
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
864
|
-
collaterals: Collateral[];
|
|
865
|
-
/** The maturity of the obligation. */
|
|
897
|
+
/** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
|
|
898
|
+
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
899
|
+
collaterals: Collateral[]; /** The maturity of the obligation. */
|
|
866
900
|
maturity: Maturity;
|
|
867
901
|
};
|
|
868
902
|
declare const ObligationSchema: z$1.ZodObject<{
|
|
@@ -898,17 +932,13 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
898
932
|
* });
|
|
899
933
|
* ```
|
|
900
934
|
*/
|
|
901
|
-
declare function from$
|
|
902
|
-
declare namespace from$
|
|
935
|
+
declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
|
|
936
|
+
declare namespace from$11 {
|
|
903
937
|
type Parameters = {
|
|
904
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
909
|
-
collaterals: from$12.Parameters[] | readonly from$12.Parameters[];
|
|
910
|
-
/** The maturity of the obligation. */
|
|
911
|
-
maturity: from$11.Parameters;
|
|
938
|
+
/** The chain id where the liquidity for this obligation is located. */chainId: number; /** The token that is being borrowed for this obligation. */
|
|
939
|
+
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
940
|
+
collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
|
|
941
|
+
maturity: from$12.Parameters;
|
|
912
942
|
};
|
|
913
943
|
type ReturnType = Obligation;
|
|
914
944
|
type ErrorType = InvalidObligationError;
|
|
@@ -978,38 +1008,23 @@ declare class CollateralsAreNotSortedError extends BaseError {
|
|
|
978
1008
|
constructor();
|
|
979
1009
|
}
|
|
980
1010
|
declare namespace Offer_d_exports {
|
|
981
|
-
export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$
|
|
1011
|
+
export { AccountNotSetError, 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, sign, signatureMsg, toSnakeCase, types };
|
|
982
1012
|
}
|
|
983
1013
|
type Offer = {
|
|
984
|
-
/** The address that made the offer. */
|
|
985
|
-
readonly
|
|
986
|
-
/** The
|
|
987
|
-
readonly
|
|
988
|
-
|
|
989
|
-
readonly
|
|
990
|
-
|
|
991
|
-
readonly
|
|
992
|
-
/** The
|
|
993
|
-
readonly
|
|
994
|
-
/** The
|
|
995
|
-
readonly
|
|
996
|
-
/** The
|
|
997
|
-
readonly
|
|
998
|
-
/** The date at which the offer will start. */
|
|
999
|
-
readonly start: number;
|
|
1000
|
-
/** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
1001
|
-
readonly group: Hex;
|
|
1002
|
-
/** The session. Used for session-based offer management. */
|
|
1003
|
-
readonly session: Hex;
|
|
1004
|
-
/** The side of the offer. `true` for buy, `false` for sell. */
|
|
1005
|
-
readonly buy: boolean;
|
|
1006
|
-
/** The chain id where the liquidity for this offer is located. */
|
|
1007
|
-
readonly chainId: Id;
|
|
1008
|
-
/** The token that is being borrowed. */
|
|
1009
|
-
readonly loanToken: Address;
|
|
1010
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
1011
|
-
readonly collaterals: readonly Collateral[];
|
|
1012
|
-
/** The optional callback data to retrieve the maker funds. */
|
|
1014
|
+
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
1015
|
+
readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
|
|
1016
|
+
readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
|
|
1017
|
+
readonly obligationShares: bigint; /** The price (18 decimals). */
|
|
1018
|
+
readonly price: bigint; /** The date at which all interests will be paid. */
|
|
1019
|
+
readonly maturity: Maturity; /** The date at which the offer will expire. */
|
|
1020
|
+
readonly expiry: number; /** The date at which the offer will start. */
|
|
1021
|
+
readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
1022
|
+
readonly group: Hex; /** The session. Used for session-based offer management. */
|
|
1023
|
+
readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
|
|
1024
|
+
readonly buy: boolean; /** The chain id where the liquidity for this offer is located. */
|
|
1025
|
+
readonly chainId: Id; /** The token that is being borrowed. */
|
|
1026
|
+
readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1027
|
+
readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
|
|
1013
1028
|
readonly callback: {
|
|
1014
1029
|
readonly address: Address;
|
|
1015
1030
|
readonly data: Hex;
|
|
@@ -1017,7 +1032,7 @@ type Offer = {
|
|
|
1017
1032
|
};
|
|
1018
1033
|
declare enum Status {
|
|
1019
1034
|
VALID = "VALID",
|
|
1020
|
-
SIMULATION_ERROR = "SIMULATION_ERROR"
|
|
1035
|
+
SIMULATION_ERROR = "SIMULATION_ERROR"
|
|
1021
1036
|
}
|
|
1022
1037
|
type Validation = {
|
|
1023
1038
|
offerHash: Hex;
|
|
@@ -1060,12 +1075,9 @@ declare const OfferSchema: () => z$1.ZodObject<{
|
|
|
1060
1075
|
*/
|
|
1061
1076
|
type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares"> & {
|
|
1062
1077
|
chainId: number;
|
|
1063
|
-
group: Hex | bigint | number | string;
|
|
1064
|
-
/** Optional: defaults to
|
|
1065
|
-
|
|
1066
|
-
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
1067
|
-
obligationUnits?: bigint;
|
|
1068
|
-
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
1078
|
+
group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
|
|
1079
|
+
session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
1080
|
+
obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
1069
1081
|
obligationShares?: bigint;
|
|
1070
1082
|
}>;
|
|
1071
1083
|
/**
|
|
@@ -1074,8 +1086,8 @@ type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligat
|
|
|
1074
1086
|
* @param input - The offer to create.
|
|
1075
1087
|
* @returns The created offer.
|
|
1076
1088
|
*/
|
|
1077
|
-
declare function from$
|
|
1078
|
-
declare namespace from$
|
|
1089
|
+
declare function from$10(input: OfferInput): Offer;
|
|
1090
|
+
declare namespace from$10 {
|
|
1079
1091
|
type ErrorType = InvalidOfferError;
|
|
1080
1092
|
}
|
|
1081
1093
|
/**
|
|
@@ -1306,19 +1318,15 @@ declare class AccountNotSetError extends BaseError {
|
|
|
1306
1318
|
constructor();
|
|
1307
1319
|
}
|
|
1308
1320
|
declare namespace Oracle_d_exports {
|
|
1309
|
-
export { Conversion, Oracle, from$
|
|
1321
|
+
export { Conversion, Oracle, from$9 as from };
|
|
1310
1322
|
}
|
|
1311
1323
|
/**
|
|
1312
1324
|
* An oracle contract that provides price information for assets.
|
|
1313
1325
|
*/
|
|
1314
1326
|
type Oracle = {
|
|
1315
|
-
/** The chain id where the oracle is deployed. */
|
|
1316
|
-
readonly
|
|
1317
|
-
/** The
|
|
1318
|
-
readonly address: Address;
|
|
1319
|
-
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1320
|
-
readonly price: bigint | null;
|
|
1321
|
-
/** The block number at which the price was fetched. */
|
|
1327
|
+
/** The chain id where the oracle is deployed. */readonly chainId: Id; /** The address of the oracle contract. */
|
|
1328
|
+
readonly address: Address; /** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1329
|
+
readonly price: bigint | null; /** The block number at which the price was fetched. */
|
|
1322
1330
|
readonly blockNumber: number;
|
|
1323
1331
|
};
|
|
1324
1332
|
/**
|
|
@@ -1326,8 +1334,8 @@ type Oracle = {
|
|
|
1326
1334
|
* @param data - The data to create the oracle from.
|
|
1327
1335
|
* @returns The created oracle.
|
|
1328
1336
|
*/
|
|
1329
|
-
declare function from$
|
|
1330
|
-
declare namespace from$
|
|
1337
|
+
declare function from$9(data: from$9.Parameters): from$9.ReturnType;
|
|
1338
|
+
declare namespace from$9 {
|
|
1331
1339
|
type Parameters = {
|
|
1332
1340
|
chainId: Id;
|
|
1333
1341
|
address: Address;
|
|
@@ -1368,33 +1376,28 @@ declare namespace Conversion {
|
|
|
1368
1376
|
}): bigint;
|
|
1369
1377
|
}
|
|
1370
1378
|
declare namespace Position_d_exports {
|
|
1371
|
-
export { Position, Type, from$
|
|
1379
|
+
export { Position, Type, from$8 as from };
|
|
1372
1380
|
}
|
|
1373
1381
|
type Position = {
|
|
1374
|
-
/** The chain id. */
|
|
1375
|
-
chainId: Id;
|
|
1382
|
+
/** The chain id. */chainId: Id;
|
|
1376
1383
|
/** The contract address from which the position is called.
|
|
1377
1384
|
* While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
|
|
1378
1385
|
* For example, when depositing into a vault, we would specify the vault contract address as the contract not the underlying vault's ERC20 token address.
|
|
1379
1386
|
*/
|
|
1380
|
-
contract: Address;
|
|
1381
|
-
/** The
|
|
1382
|
-
|
|
1383
|
-
/** The type of position. */
|
|
1384
|
-
type: Type;
|
|
1385
|
-
/** The balance of the position. */
|
|
1387
|
+
contract: Address; /** The user address. */
|
|
1388
|
+
user: Address; /** The type of position. */
|
|
1389
|
+
type: Type; /** The balance of the position. */
|
|
1386
1390
|
balance?: bigint;
|
|
1387
1391
|
/** The underlying asset of the position.
|
|
1388
1392
|
* For ERC20 positions, this equals the contract address.
|
|
1389
1393
|
* For vault positions, this is the vault's underlying asset.
|
|
1390
1394
|
*/
|
|
1391
|
-
asset?: Address;
|
|
1392
|
-
/** The block number at which the position was last updated. */
|
|
1395
|
+
asset?: Address; /** The block number at which the position was last updated. */
|
|
1393
1396
|
blockNumber: number;
|
|
1394
1397
|
};
|
|
1395
1398
|
declare enum Type {
|
|
1396
1399
|
ERC20 = "erc20",
|
|
1397
|
-
VAULT_V1 = "vault_v1"
|
|
1400
|
+
VAULT_V1 = "vault_v1"
|
|
1398
1401
|
}
|
|
1399
1402
|
/**
|
|
1400
1403
|
* @constructor
|
|
@@ -1402,8 +1405,8 @@ declare enum Type {
|
|
|
1402
1405
|
* @param parameters - {@link from.Parameters}
|
|
1403
1406
|
* @returns The created Position. {@link from.ReturnType}
|
|
1404
1407
|
*/
|
|
1405
|
-
declare function from$
|
|
1406
|
-
declare namespace from$
|
|
1408
|
+
declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
|
|
1409
|
+
declare namespace from$8 {
|
|
1407
1410
|
type Parameters = {
|
|
1408
1411
|
chainId: Id;
|
|
1409
1412
|
contract: Address;
|
|
@@ -1416,18 +1419,15 @@ declare namespace from$7 {
|
|
|
1416
1419
|
type ReturnType = Position;
|
|
1417
1420
|
}
|
|
1418
1421
|
declare namespace Quote_d_exports {
|
|
1419
|
-
export { InvalidQuoteError, Quote, QuoteSchema, from$
|
|
1422
|
+
export { InvalidQuoteError, Quote, QuoteSchema, from$7 as from, fromSnakeCase, random };
|
|
1420
1423
|
}
|
|
1421
1424
|
type Quote = {
|
|
1422
|
-
/** The obligation id. */
|
|
1423
|
-
obligationId: Hex;
|
|
1425
|
+
/** The obligation id. */obligationId: Hex;
|
|
1424
1426
|
ask: {
|
|
1425
|
-
/** The ask price for the obligation. (18 decimals). */
|
|
1426
|
-
price: bigint;
|
|
1427
|
+
/** The ask price for the obligation. (18 decimals). */price: bigint;
|
|
1427
1428
|
};
|
|
1428
1429
|
bid: {
|
|
1429
|
-
/** The bid price for the obligation. (18 decimals). */
|
|
1430
|
-
price: bigint;
|
|
1430
|
+
/** The bid price for the obligation. (18 decimals). */price: bigint;
|
|
1431
1431
|
};
|
|
1432
1432
|
};
|
|
1433
1433
|
declare const QuoteSchema: z$1.ZodObject<{
|
|
@@ -1451,8 +1451,8 @@ declare const QuoteSchema: z$1.ZodObject<{
|
|
|
1451
1451
|
* const quote = Quote.from({ obligationId: "0x123", ask: { price: 100n }, bid: { price: 100n } });
|
|
1452
1452
|
* ```
|
|
1453
1453
|
*/
|
|
1454
|
-
declare function from$
|
|
1455
|
-
declare namespace from$
|
|
1454
|
+
declare function from$7(parameters: from$7.Parameters): from$7.ReturnType;
|
|
1455
|
+
declare namespace from$7 {
|
|
1456
1456
|
type Parameters = Quote;
|
|
1457
1457
|
type ReturnType = Quote;
|
|
1458
1458
|
type ErrorType = InvalidQuoteError;
|
|
@@ -1467,7 +1467,7 @@ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.R
|
|
|
1467
1467
|
declare namespace fromSnakeCase {
|
|
1468
1468
|
type Parameters = Snake<Quote>;
|
|
1469
1469
|
type ReturnType = Quote;
|
|
1470
|
-
type ErrorType = from$
|
|
1470
|
+
type ErrorType = from$7.ErrorType;
|
|
1471
1471
|
}
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Generates a random quote.
|
|
@@ -1482,12 +1482,85 @@ declare function random(): random.ReturnType;
|
|
|
1482
1482
|
declare namespace random {
|
|
1483
1483
|
type Parameters = never;
|
|
1484
1484
|
type ReturnType = Quote;
|
|
1485
|
-
type ErrorType = from$
|
|
1485
|
+
type ErrorType = from$7.ErrorType;
|
|
1486
1486
|
}
|
|
1487
1487
|
declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
|
|
1488
1488
|
readonly name = "Quote.InvalidQuoteError";
|
|
1489
1489
|
constructor(error: z$1.ZodError | Error);
|
|
1490
1490
|
}
|
|
1491
|
+
declare namespace TradingFee_d_exports {
|
|
1492
|
+
export { BREAKPOINTS, Fees, InvalidFeeError, InvalidFeesLengthError, TradingFee, WAD, activate, compute, deactivate, from$6 as from, getFees, isActivated };
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Time breakpoints in seconds for piecewise linear fee interpolation.
|
|
1496
|
+
* Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d.
|
|
1497
|
+
*/
|
|
1498
|
+
declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n];
|
|
1499
|
+
/** WAD constant (1e18) for fee scaling. */
|
|
1500
|
+
declare const WAD: bigint;
|
|
1501
|
+
/** Tuple type for the 6 fee values at each breakpoint. */
|
|
1502
|
+
type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint];
|
|
1503
|
+
/**
|
|
1504
|
+
* TradingFee represents a piecewise linear fee curve with 6 breakpoints.
|
|
1505
|
+
* The internal storage mimics on-chain bitmap behavior but uses a struct for clarity.
|
|
1506
|
+
*/
|
|
1507
|
+
type TradingFee = {
|
|
1508
|
+
readonly _activated: boolean;
|
|
1509
|
+
readonly _fees: Fees;
|
|
1510
|
+
} & Brand<"TradingFee">;
|
|
1511
|
+
/**
|
|
1512
|
+
* Create a TradingFee from an activation flag and 6 fee values.
|
|
1513
|
+
* @param activated - Whether the fee is active.
|
|
1514
|
+
* @param fees - Tuple of 6 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d).
|
|
1515
|
+
* @returns A new TradingFee instance.
|
|
1516
|
+
* @throws {@link InvalidFeeError} if any fee exceeds WAD (100%).
|
|
1517
|
+
* @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 6 elements.
|
|
1518
|
+
*/
|
|
1519
|
+
declare function from$6(activated: boolean, fees: Fees): TradingFee;
|
|
1520
|
+
declare namespace from$6 {
|
|
1521
|
+
type ErrorType = InvalidFeeError | InvalidFeesLengthError;
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Compute the trading fee for a given time to maturity using piecewise linear interpolation.
|
|
1525
|
+
* @param tradingFee - The TradingFee instance.
|
|
1526
|
+
* @param timeToMaturity - Time to maturity in seconds.
|
|
1527
|
+
* @returns The interpolated fee in WAD. Returns 0n if not activated.
|
|
1528
|
+
*/
|
|
1529
|
+
declare function compute(tradingFee: TradingFee, timeToMaturity: number): bigint;
|
|
1530
|
+
/**
|
|
1531
|
+
* Check if the trading fee is activated.
|
|
1532
|
+
* @param tradingFee - The TradingFee instance.
|
|
1533
|
+
* @returns True if activated, false otherwise.
|
|
1534
|
+
*/
|
|
1535
|
+
declare function isActivated(tradingFee: TradingFee): boolean;
|
|
1536
|
+
/**
|
|
1537
|
+
* Create a new TradingFee with activation enabled.
|
|
1538
|
+
* @param tradingFee - The TradingFee instance.
|
|
1539
|
+
* @returns A new TradingFee with activated set to true.
|
|
1540
|
+
*/
|
|
1541
|
+
declare function activate(tradingFee: TradingFee): TradingFee;
|
|
1542
|
+
/**
|
|
1543
|
+
* Create a new TradingFee with activation disabled.
|
|
1544
|
+
* @param tradingFee - The TradingFee instance.
|
|
1545
|
+
* @returns A new TradingFee with activated set to false.
|
|
1546
|
+
*/
|
|
1547
|
+
declare function deactivate(tradingFee: TradingFee): TradingFee;
|
|
1548
|
+
/**
|
|
1549
|
+
* Get the fee values at each breakpoint.
|
|
1550
|
+
* @param tradingFee - The TradingFee instance.
|
|
1551
|
+
* @returns The tuple of 6 fee values.
|
|
1552
|
+
*/
|
|
1553
|
+
declare function getFees(tradingFee: TradingFee): Fees;
|
|
1554
|
+
/** Error thrown when a fee value is invalid (negative or exceeds WAD). */
|
|
1555
|
+
declare class InvalidFeeError extends BaseError {
|
|
1556
|
+
readonly name = "TradingFee.InvalidFeeError";
|
|
1557
|
+
constructor(fee: bigint, index: number);
|
|
1558
|
+
}
|
|
1559
|
+
/** Error thrown when fees array doesn't have exactly 6 elements. */
|
|
1560
|
+
declare class InvalidFeesLengthError extends BaseError {
|
|
1561
|
+
readonly name = "TradingFee.InvalidFeesLengthError";
|
|
1562
|
+
constructor(length: number);
|
|
1563
|
+
}
|
|
1491
1564
|
declare namespace Transfer_d_exports {
|
|
1492
1565
|
export { Transfer, from$5 as from };
|
|
1493
1566
|
}
|
|
@@ -1533,15 +1606,11 @@ declare namespace Tree_d_exports {
|
|
|
1533
1606
|
* Constructed via {@link from}. The tree root can be signed for onchain broadcast.
|
|
1534
1607
|
*/
|
|
1535
1608
|
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
1536
|
-
/** The offers in the tree. */
|
|
1537
|
-
offers: Offer[];
|
|
1538
|
-
/** The root of the tree. */
|
|
1609
|
+
/** The offers in the tree. */offers: Offer[]; /** The root of the tree. */
|
|
1539
1610
|
root: Hex;
|
|
1540
1611
|
}>;
|
|
1541
1612
|
type Proof = {
|
|
1542
|
-
/** The offer that the proof is for. */
|
|
1543
|
-
offer: Offer;
|
|
1544
|
-
/** The merkle proof path for the offer. */
|
|
1613
|
+
/** The offer that the proof is for. */offer: Offer; /** The merkle proof path for the offer. */
|
|
1545
1614
|
path: Hex[];
|
|
1546
1615
|
};
|
|
1547
1616
|
declare const VERSION = 1;
|
|
@@ -1674,7 +1743,6 @@ declare class DecodeError extends BaseError {
|
|
|
1674
1743
|
* This file was auto-generated by openapi-typescript.
|
|
1675
1744
|
* Do not make direct changes to the file.
|
|
1676
1745
|
*/
|
|
1677
|
-
|
|
1678
1746
|
interface paths {
|
|
1679
1747
|
"/v1/books/{obligationId}/{side}": {
|
|
1680
1748
|
parameters: {
|
|
@@ -1718,16 +1786,14 @@ interface paths {
|
|
|
1718
1786
|
};
|
|
1719
1787
|
requestBody?: never;
|
|
1720
1788
|
responses: {
|
|
1721
|
-
/** @description Success */
|
|
1722
|
-
200: {
|
|
1789
|
+
/** @description Success */200: {
|
|
1723
1790
|
headers: {
|
|
1724
1791
|
[name: string]: unknown;
|
|
1725
1792
|
};
|
|
1726
1793
|
content: {
|
|
1727
1794
|
"application/json": components["schemas"]["BookListResponse"];
|
|
1728
1795
|
};
|
|
1729
|
-
};
|
|
1730
|
-
/** @description Bad Request */
|
|
1796
|
+
}; /** @description Bad Request */
|
|
1731
1797
|
400: {
|
|
1732
1798
|
headers: {
|
|
1733
1799
|
[name: string]: unknown;
|
|
@@ -1755,7 +1821,7 @@ interface paths {
|
|
|
1755
1821
|
};
|
|
1756
1822
|
/**
|
|
1757
1823
|
* Get router configuration
|
|
1758
|
-
* @description Returns chain configurations including contract addresses and supported
|
|
1824
|
+
* @description Returns chain configurations including contract addresses and supported callback types.
|
|
1759
1825
|
*/
|
|
1760
1826
|
get: {
|
|
1761
1827
|
parameters: {
|
|
@@ -1766,8 +1832,7 @@ interface paths {
|
|
|
1766
1832
|
};
|
|
1767
1833
|
requestBody?: never;
|
|
1768
1834
|
responses: {
|
|
1769
|
-
/** @description Success */
|
|
1770
|
-
200: {
|
|
1835
|
+
/** @description Success */200: {
|
|
1771
1836
|
headers: {
|
|
1772
1837
|
[name: string]: unknown;
|
|
1773
1838
|
};
|
|
@@ -1831,16 +1896,14 @@ interface paths {
|
|
|
1831
1896
|
};
|
|
1832
1897
|
requestBody?: never;
|
|
1833
1898
|
responses: {
|
|
1834
|
-
/** @description Success */
|
|
1835
|
-
200: {
|
|
1899
|
+
/** @description Success */200: {
|
|
1836
1900
|
headers: {
|
|
1837
1901
|
[name: string]: unknown;
|
|
1838
1902
|
};
|
|
1839
1903
|
content: {
|
|
1840
1904
|
"application/json": components["schemas"]["OfferListResponse"];
|
|
1841
1905
|
};
|
|
1842
|
-
};
|
|
1843
|
-
/** @description Bad Request */
|
|
1906
|
+
}; /** @description Bad Request */
|
|
1844
1907
|
400: {
|
|
1845
1908
|
headers: {
|
|
1846
1909
|
[name: string]: unknown;
|
|
@@ -1874,25 +1937,25 @@ interface paths {
|
|
|
1874
1937
|
parameters: {
|
|
1875
1938
|
query?: {
|
|
1876
1939
|
/**
|
|
1877
|
-
* @description Filter by exact maturity
|
|
1878
|
-
* @example 1761922800
|
|
1940
|
+
* @description Filter by exact maturity timestamps (comma-separated, unix seconds).
|
|
1941
|
+
* @example 1761922800,1764524800
|
|
1879
1942
|
*/
|
|
1880
|
-
|
|
1943
|
+
maturities?: number[];
|
|
1881
1944
|
/**
|
|
1882
|
-
* @description Filter by collateral
|
|
1883
|
-
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
1945
|
+
* @description Filter by collateral tokens (comma-separated, matches any collateral).
|
|
1946
|
+
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751,0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
1884
1947
|
*/
|
|
1885
|
-
|
|
1948
|
+
collateral_tokens?: string[];
|
|
1886
1949
|
/**
|
|
1887
|
-
* @description Filter by loan token
|
|
1888
|
-
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
1950
|
+
* @description Filter by loan token addresses (comma-separated).
|
|
1951
|
+
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078,0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
1889
1952
|
*/
|
|
1890
|
-
|
|
1953
|
+
loan_tokens?: string[];
|
|
1891
1954
|
/**
|
|
1892
|
-
* @description Filter by chain
|
|
1893
|
-
* @example 1
|
|
1955
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1956
|
+
* @example 1,8453
|
|
1894
1957
|
*/
|
|
1895
|
-
|
|
1958
|
+
chains?: number[];
|
|
1896
1959
|
/**
|
|
1897
1960
|
* @description Maximum number of obligations to return.
|
|
1898
1961
|
* @example 10
|
|
@@ -1910,16 +1973,14 @@ interface paths {
|
|
|
1910
1973
|
};
|
|
1911
1974
|
requestBody?: never;
|
|
1912
1975
|
responses: {
|
|
1913
|
-
/** @description Success */
|
|
1914
|
-
200: {
|
|
1976
|
+
/** @description Success */200: {
|
|
1915
1977
|
headers: {
|
|
1916
1978
|
[name: string]: unknown;
|
|
1917
1979
|
};
|
|
1918
1980
|
content: {
|
|
1919
1981
|
"application/json": components["schemas"]["ObligationListResponse"];
|
|
1920
1982
|
};
|
|
1921
|
-
};
|
|
1922
|
-
/** @description Bad Request */
|
|
1983
|
+
}; /** @description Bad Request */
|
|
1923
1984
|
400: {
|
|
1924
1985
|
headers: {
|
|
1925
1986
|
[name: string]: unknown;
|
|
@@ -1964,16 +2025,14 @@ interface paths {
|
|
|
1964
2025
|
};
|
|
1965
2026
|
requestBody?: never;
|
|
1966
2027
|
responses: {
|
|
1967
|
-
/** @description Success */
|
|
1968
|
-
200: {
|
|
2028
|
+
/** @description Success */200: {
|
|
1969
2029
|
headers: {
|
|
1970
2030
|
[name: string]: unknown;
|
|
1971
2031
|
};
|
|
1972
2032
|
content: {
|
|
1973
2033
|
"application/json": components["schemas"]["ObligationSingleSuccessResponse"];
|
|
1974
2034
|
};
|
|
1975
|
-
};
|
|
1976
|
-
/** @description Bad Request */
|
|
2035
|
+
}; /** @description Bad Request */
|
|
1977
2036
|
400: {
|
|
1978
2037
|
headers: {
|
|
1979
2038
|
[name: string]: unknown;
|
|
@@ -2018,8 +2077,7 @@ interface paths {
|
|
|
2018
2077
|
};
|
|
2019
2078
|
requestBody?: never;
|
|
2020
2079
|
responses: {
|
|
2021
|
-
/** @description Success */
|
|
2022
|
-
200: {
|
|
2080
|
+
/** @description Success */200: {
|
|
2023
2081
|
headers: {
|
|
2024
2082
|
[name: string]: unknown;
|
|
2025
2083
|
};
|
|
@@ -2063,8 +2121,7 @@ interface paths {
|
|
|
2063
2121
|
};
|
|
2064
2122
|
requestBody?: never;
|
|
2065
2123
|
responses: {
|
|
2066
|
-
/** @description Success */
|
|
2067
|
-
200: {
|
|
2124
|
+
/** @description Success */200: {
|
|
2068
2125
|
headers: {
|
|
2069
2126
|
[name: string]: unknown;
|
|
2070
2127
|
};
|
|
@@ -2108,8 +2165,7 @@ interface paths {
|
|
|
2108
2165
|
};
|
|
2109
2166
|
requestBody?: never;
|
|
2110
2167
|
responses: {
|
|
2111
|
-
/** @description Success */
|
|
2112
|
-
200: {
|
|
2168
|
+
/** @description Success */200: {
|
|
2113
2169
|
headers: {
|
|
2114
2170
|
[name: string]: unknown;
|
|
2115
2171
|
};
|
|
@@ -2164,16 +2220,14 @@ interface paths {
|
|
|
2164
2220
|
};
|
|
2165
2221
|
requestBody?: never;
|
|
2166
2222
|
responses: {
|
|
2167
|
-
/** @description Success */
|
|
2168
|
-
200: {
|
|
2223
|
+
/** @description Success */200: {
|
|
2169
2224
|
headers: {
|
|
2170
2225
|
[name: string]: unknown;
|
|
2171
2226
|
};
|
|
2172
2227
|
content: {
|
|
2173
2228
|
"application/json": components["schemas"]["PositionListResponse"];
|
|
2174
2229
|
};
|
|
2175
|
-
};
|
|
2176
|
-
/** @description Bad Request */
|
|
2230
|
+
}; /** @description Bad Request */
|
|
2177
2231
|
400: {
|
|
2178
2232
|
headers: {
|
|
2179
2233
|
[name: string]: unknown;
|
|
@@ -2227,16 +2281,14 @@ interface paths {
|
|
|
2227
2281
|
};
|
|
2228
2282
|
};
|
|
2229
2283
|
responses: {
|
|
2230
|
-
/** @description Success */
|
|
2231
|
-
200: {
|
|
2284
|
+
/** @description Success */200: {
|
|
2232
2285
|
headers: {
|
|
2233
2286
|
[name: string]: unknown;
|
|
2234
2287
|
};
|
|
2235
2288
|
content: {
|
|
2236
2289
|
"application/json": components["schemas"]["ValidationSuccessResponse"];
|
|
2237
2290
|
};
|
|
2238
|
-
};
|
|
2239
|
-
/** @description Bad Request */
|
|
2291
|
+
}; /** @description Bad Request */
|
|
2240
2292
|
400: {
|
|
2241
2293
|
headers: {
|
|
2242
2294
|
[name: string]: unknown;
|
|
@@ -2257,22 +2309,16 @@ interface paths {
|
|
|
2257
2309
|
interface components {
|
|
2258
2310
|
schemas: {
|
|
2259
2311
|
BookListResponse: {
|
|
2260
|
-
meta: components["schemas"]["Meta"];
|
|
2261
|
-
/** @
|
|
2262
|
-
cursor: string | null;
|
|
2263
|
-
/** @description Aggregated book levels grouped by computed price. */
|
|
2312
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2313
|
+
cursor: string | null; /** @description Aggregated book levels grouped by computed price. */
|
|
2264
2314
|
data: components["schemas"]["BookLevelResponse"][];
|
|
2265
2315
|
};
|
|
2266
2316
|
Meta: {
|
|
2267
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2268
|
-
timestamp: string;
|
|
2317
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string;
|
|
2269
2318
|
};
|
|
2270
2319
|
BookLevelResponse: {
|
|
2271
|
-
/** @example 2750000000000000000 */
|
|
2272
|
-
|
|
2273
|
-
/** @example 369216000000000000000000 */
|
|
2274
|
-
assets: string;
|
|
2275
|
-
/** @example 5 */
|
|
2320
|
+
/** @example 2750000000000000000 */price: string; /** @example 369216000000000000000000 */
|
|
2321
|
+
assets: string; /** @example 5 */
|
|
2276
2322
|
count: number;
|
|
2277
2323
|
};
|
|
2278
2324
|
BadRequestResponse: {
|
|
@@ -2284,8 +2330,7 @@ interface components {
|
|
|
2284
2330
|
* @example VALIDATION_ERROR
|
|
2285
2331
|
* @enum {string}
|
|
2286
2332
|
*/
|
|
2287
|
-
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
|
|
2288
|
-
/** @example Limit must be greater than 0. */
|
|
2333
|
+
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST"; /** @example Limit must be greater than 0. */
|
|
2289
2334
|
message: string;
|
|
2290
2335
|
/**
|
|
2291
2336
|
* @example [
|
|
@@ -2298,8 +2343,7 @@ interface components {
|
|
|
2298
2343
|
details: Record<string, never>;
|
|
2299
2344
|
};
|
|
2300
2345
|
ConfigSuccessResponse: {
|
|
2301
|
-
meta: components["schemas"]["Meta"];
|
|
2302
|
-
/** @example null */
|
|
2346
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2303
2347
|
cursor: string | null;
|
|
2304
2348
|
/**
|
|
2305
2349
|
* @description Array of chain configurations for all indexed chains.
|
|
@@ -2309,47 +2353,31 @@ interface components {
|
|
|
2309
2353
|
* "contracts": {
|
|
2310
2354
|
* "mempool": "0xD946246695A9259F3B33a78629026F61B3Ab40aF"
|
|
2311
2355
|
* },
|
|
2312
|
-
* "
|
|
2313
|
-
* "
|
|
2314
|
-
*
|
|
2315
|
-
* }
|
|
2356
|
+
* "callbacks": [
|
|
2357
|
+
* "buy_with_empty_callback"
|
|
2358
|
+
* ]
|
|
2316
2359
|
* }
|
|
2317
2360
|
* ]
|
|
2318
2361
|
*/
|
|
2319
2362
|
data: components["schemas"]["ConfigDataResponse"][];
|
|
2320
2363
|
};
|
|
2321
2364
|
ConfigDataResponse: {
|
|
2322
|
-
/** @example 505050505 */
|
|
2323
|
-
chain_id: number;
|
|
2365
|
+
/** @example 505050505 */chain_id: number;
|
|
2324
2366
|
contracts: components["schemas"]["ConfigContractsResponse"];
|
|
2325
2367
|
/**
|
|
2326
|
-
* @description Supported
|
|
2327
|
-
* @example
|
|
2328
|
-
* "
|
|
2329
|
-
*
|
|
2330
|
-
*
|
|
2368
|
+
* @description Supported callback types for this chain.
|
|
2369
|
+
* @example [
|
|
2370
|
+
* "buy_with_empty_callback"
|
|
2371
|
+
* ]
|
|
2372
|
+
* @enum {string}
|
|
2331
2373
|
*/
|
|
2332
|
-
|
|
2374
|
+
callbacks: "buy_with_empty_callback" | "buy_erc20" | "buy_vault_v1_callback" | "sell_erc20_callback";
|
|
2333
2375
|
};
|
|
2334
2376
|
ConfigContractsResponse: {
|
|
2335
|
-
/** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
2336
|
-
mempool: string;
|
|
2337
|
-
};
|
|
2338
|
-
MaturitiesResponse: {
|
|
2339
|
-
/**
|
|
2340
|
-
* @description Unix timestamp for end of current month maturity (last Friday 15:00 UTC).
|
|
2341
|
-
* @example 1738335600
|
|
2342
|
-
*/
|
|
2343
|
-
end_of_month: number;
|
|
2344
|
-
/**
|
|
2345
|
-
* @description Unix timestamp for end of next month maturity (last Friday 15:00 UTC).
|
|
2346
|
-
* @example 1740754800
|
|
2347
|
-
*/
|
|
2348
|
-
end_of_next_month: number;
|
|
2377
|
+
/** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */mempool: string;
|
|
2349
2378
|
};
|
|
2350
2379
|
OfferListResponse: {
|
|
2351
|
-
meta: components["schemas"]["Meta"];
|
|
2352
|
-
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2380
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2353
2381
|
cursor: string | null;
|
|
2354
2382
|
/**
|
|
2355
2383
|
* @description Offers matching the provided filters.
|
|
@@ -2425,20 +2453,13 @@ interface components {
|
|
|
2425
2453
|
* "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2426
2454
|
* }
|
|
2427
2455
|
*/
|
|
2428
|
-
offer: components["schemas"]["OfferDataResponse"];
|
|
2429
|
-
/** @example
|
|
2430
|
-
|
|
2431
|
-
/** @example
|
|
2432
|
-
|
|
2433
|
-
/** @example
|
|
2434
|
-
|
|
2435
|
-
/** @example 0 */
|
|
2436
|
-
consumed: string;
|
|
2437
|
-
/** @example 369216000000000000000000 */
|
|
2438
|
-
takeable: string;
|
|
2439
|
-
/** @example 2942933377146801 */
|
|
2440
|
-
block_number: number;
|
|
2441
|
-
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2456
|
+
offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
2457
|
+
offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2458
|
+
obligation_id: string; /** @example 1 */
|
|
2459
|
+
chain_id: number; /** @example 0 */
|
|
2460
|
+
consumed: string; /** @example 369216000000000000000000 */
|
|
2461
|
+
takeable: string; /** @example 2942933377146801 */
|
|
2462
|
+
block_number: number; /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2442
2463
|
root: string | null;
|
|
2443
2464
|
/**
|
|
2444
2465
|
* @example [
|
|
@@ -2446,8 +2467,7 @@ interface components {
|
|
|
2446
2467
|
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2447
2468
|
* ]
|
|
2448
2469
|
*/
|
|
2449
|
-
proof: string[] | null;
|
|
2450
|
-
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2470
|
+
proof: string[] | null; /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2451
2471
|
signature: string | null;
|
|
2452
2472
|
};
|
|
2453
2473
|
OfferDataResponse: {
|
|
@@ -2464,35 +2484,22 @@ interface components {
|
|
|
2464
2484
|
* "maturity": 1761922799
|
|
2465
2485
|
* }
|
|
2466
2486
|
*/
|
|
2467
|
-
obligation: components["schemas"]["ObligationOfferResponse"];
|
|
2468
|
-
/** @example
|
|
2469
|
-
|
|
2470
|
-
/** @example
|
|
2471
|
-
|
|
2472
|
-
/** @example
|
|
2473
|
-
|
|
2474
|
-
/** @example
|
|
2475
|
-
|
|
2476
|
-
/** @example
|
|
2477
|
-
|
|
2478
|
-
/** @example
|
|
2479
|
-
start: number;
|
|
2480
|
-
/** @example 1761922799 */
|
|
2481
|
-
expiry: number;
|
|
2482
|
-
/** @example 2750000000000000000 */
|
|
2483
|
-
price: string;
|
|
2484
|
-
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2485
|
-
group: string;
|
|
2486
|
-
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2487
|
-
session: string;
|
|
2488
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2489
|
-
callback: string;
|
|
2490
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2487
|
+
obligation: components["schemas"]["ObligationOfferResponse"]; /** @example false */
|
|
2488
|
+
buy: boolean; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2489
|
+
maker: string; /** @example 369216000000000000000000 */
|
|
2490
|
+
assets: string; /** @example 0 */
|
|
2491
|
+
obligation_units: string; /** @example 0 */
|
|
2492
|
+
obligation_shares: string; /** @example 1761922790 */
|
|
2493
|
+
start: number; /** @example 1761922799 */
|
|
2494
|
+
expiry: number; /** @example 2750000000000000000 */
|
|
2495
|
+
price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2496
|
+
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2497
|
+
session: string; /** @example 0x1111111111111111111111111111111111111111 */
|
|
2498
|
+
callback: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2491
2499
|
callback_data: string;
|
|
2492
2500
|
};
|
|
2493
2501
|
ObligationOfferResponse: {
|
|
2494
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2495
|
-
loan_token: string;
|
|
2502
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
|
|
2496
2503
|
/**
|
|
2497
2504
|
* @example [
|
|
2498
2505
|
* {
|
|
@@ -2502,51 +2509,37 @@ interface components {
|
|
|
2502
2509
|
* }
|
|
2503
2510
|
* ]
|
|
2504
2511
|
*/
|
|
2505
|
-
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2506
|
-
/** @example 1761922799 */
|
|
2512
|
+
collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922799 */
|
|
2507
2513
|
maturity: number;
|
|
2508
2514
|
};
|
|
2509
2515
|
CollateralResponse: {
|
|
2510
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2511
|
-
|
|
2512
|
-
/** @example 860000000000000000 */
|
|
2513
|
-
lltv: string;
|
|
2514
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2516
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */token: string; /** @example 860000000000000000 */
|
|
2517
|
+
lltv: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2515
2518
|
oracle: string;
|
|
2516
2519
|
};
|
|
2517
2520
|
ObligationListResponse: {
|
|
2518
|
-
meta: components["schemas"]["Meta"];
|
|
2519
|
-
/** @
|
|
2520
|
-
cursor: string | null;
|
|
2521
|
-
/** @description List of obligations with takable offers. */
|
|
2521
|
+
meta: components["schemas"]["Meta"]; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2522
|
+
cursor: string | null; /** @description List of obligations with takable offers. */
|
|
2522
2523
|
data: components["schemas"]["ObligationResponse"][];
|
|
2523
2524
|
};
|
|
2524
2525
|
ObligationResponse: {
|
|
2525
|
-
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
|
|
2526
|
-
|
|
2527
|
-
/** @example 1 */
|
|
2528
|
-
chain_id: number;
|
|
2529
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2526
|
+
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */id: string; /** @example 1 */
|
|
2527
|
+
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2530
2528
|
loan_token: string;
|
|
2531
|
-
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2532
|
-
/** @example 1761922800 */
|
|
2529
|
+
collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922800 */
|
|
2533
2530
|
maturity: number;
|
|
2534
2531
|
ask: components["schemas"]["AskResponse"];
|
|
2535
2532
|
bid: components["schemas"]["BidResponse"];
|
|
2536
2533
|
};
|
|
2537
2534
|
AskResponse: {
|
|
2538
|
-
/** @example 1000000000000000000 */
|
|
2539
|
-
price: string;
|
|
2535
|
+
/** @example 1000000000000000000 */price: string;
|
|
2540
2536
|
};
|
|
2541
2537
|
BidResponse: {
|
|
2542
|
-
/** @example 1000000000000000000 */
|
|
2543
|
-
price: string;
|
|
2538
|
+
/** @example 1000000000000000000 */price: string;
|
|
2544
2539
|
};
|
|
2545
2540
|
ObligationSingleSuccessResponse: {
|
|
2546
|
-
meta: components["schemas"]["Meta"];
|
|
2547
|
-
/** @
|
|
2548
|
-
cursor: string | null;
|
|
2549
|
-
/** @description Obligation details. */
|
|
2541
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2542
|
+
cursor: string | null; /** @description Obligation details. */
|
|
2550
2543
|
data: components["schemas"]["ObligationResponse"];
|
|
2551
2544
|
};
|
|
2552
2545
|
RouterStatusSuccessResponse: {
|
|
@@ -2567,8 +2560,7 @@ interface components {
|
|
|
2567
2560
|
* @example live
|
|
2568
2561
|
* @enum {string}
|
|
2569
2562
|
*/
|
|
2570
|
-
status: "live" | "syncing";
|
|
2571
|
-
/** @example true */
|
|
2563
|
+
status: "live" | "syncing"; /** @example true */
|
|
2572
2564
|
initialized: boolean;
|
|
2573
2565
|
/**
|
|
2574
2566
|
* @description Configured chain ids missing initialization rows.
|
|
@@ -2582,9 +2574,7 @@ interface components {
|
|
|
2582
2574
|
missing_collectors: components["schemas"]["MissingCollectorResponse"][];
|
|
2583
2575
|
};
|
|
2584
2576
|
MissingCollectorResponse: {
|
|
2585
|
-
/** @example 1 */
|
|
2586
|
-
chain_id: number;
|
|
2587
|
-
/** @example offers */
|
|
2577
|
+
/** @example 1 */chain_id: number; /** @example offers */
|
|
2588
2578
|
name: string;
|
|
2589
2579
|
};
|
|
2590
2580
|
CollectorsHealthSuccessResponse: {
|
|
@@ -2606,22 +2596,16 @@ interface components {
|
|
|
2606
2596
|
data: components["schemas"]["CollectorHealthResponse"][];
|
|
2607
2597
|
};
|
|
2608
2598
|
CollectorHealthResponse: {
|
|
2609
|
-
/** @example offers */
|
|
2610
|
-
|
|
2611
|
-
/** @example
|
|
2612
|
-
|
|
2613
|
-
/** @example 21345678 */
|
|
2614
|
-
block_number: number | null;
|
|
2615
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2616
|
-
updated_at: string | null;
|
|
2617
|
-
/** @example 0 */
|
|
2599
|
+
/** @example offers */name: string; /** @example 1 */
|
|
2600
|
+
chain_id: number; /** @example 21345678 */
|
|
2601
|
+
block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
|
|
2602
|
+
updated_at: string | null; /** @example 0 */
|
|
2618
2603
|
lag: number | null;
|
|
2619
2604
|
/**
|
|
2620
2605
|
* @example live
|
|
2621
2606
|
* @enum {string}
|
|
2622
2607
|
*/
|
|
2623
|
-
status: "live" | "lagging" | "unknown";
|
|
2624
|
-
/** @example true */
|
|
2608
|
+
status: "live" | "lagging" | "unknown"; /** @example true */
|
|
2625
2609
|
initialized: boolean;
|
|
2626
2610
|
};
|
|
2627
2611
|
ChainsHealthSuccessResponse: {
|
|
@@ -2641,20 +2625,14 @@ interface components {
|
|
|
2641
2625
|
data: components["schemas"]["ChainHealthResponse"][];
|
|
2642
2626
|
};
|
|
2643
2627
|
ChainHealthResponse: {
|
|
2644
|
-
/** @example 1 */
|
|
2645
|
-
|
|
2646
|
-
/** @example
|
|
2647
|
-
|
|
2648
|
-
/** @example 21345690 */
|
|
2649
|
-
remote_block_number: number | null;
|
|
2650
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
2651
|
-
updated_at: string | null;
|
|
2652
|
-
/** @example true */
|
|
2628
|
+
/** @example 1 */chain_id: number; /** @example 21345678 */
|
|
2629
|
+
local_block_number: number | null; /** @example 21345690 */
|
|
2630
|
+
remote_block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
|
|
2631
|
+
updated_at: string | null; /** @example true */
|
|
2653
2632
|
initialized: boolean;
|
|
2654
2633
|
};
|
|
2655
2634
|
PositionListResponse: {
|
|
2656
|
-
meta: components["schemas"]["Meta"];
|
|
2657
|
-
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2635
|
+
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2658
2636
|
cursor: string | null;
|
|
2659
2637
|
/**
|
|
2660
2638
|
* @description User positions with reserved balances from active offers.
|
|
@@ -2671,47 +2649,28 @@ interface components {
|
|
|
2671
2649
|
data: components["schemas"]["PositionListItemResponse"][];
|
|
2672
2650
|
};
|
|
2673
2651
|
PositionListItemResponse: {
|
|
2674
|
-
/** @example 1 */
|
|
2675
|
-
|
|
2676
|
-
/** @example
|
|
2677
|
-
|
|
2678
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2679
|
-
user: string;
|
|
2680
|
-
/** @example 200000000000000000000 */
|
|
2681
|
-
reserved: string;
|
|
2682
|
-
/** @example 21345678 */
|
|
2652
|
+
/** @example 1 */chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2653
|
+
contract: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2654
|
+
user: string; /** @example 200000000000000000000 */
|
|
2655
|
+
reserved: string; /** @example 21345678 */
|
|
2683
2656
|
block_number: number;
|
|
2684
2657
|
};
|
|
2685
2658
|
ValidateOffersRequest: {
|
|
2686
|
-
/** @description Array of offers in snake_case format. Required, non-empty. */
|
|
2687
|
-
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2659
|
+
/** @description Array of offers in snake_case format. Required, non-empty. */offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2688
2660
|
};
|
|
2689
2661
|
ValidateOfferRequest: {
|
|
2690
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2691
|
-
|
|
2692
|
-
/** @example
|
|
2693
|
-
|
|
2694
|
-
/** @example
|
|
2695
|
-
|
|
2696
|
-
/** @example
|
|
2697
|
-
|
|
2698
|
-
/** @example
|
|
2699
|
-
|
|
2700
|
-
/** @example
|
|
2701
|
-
|
|
2702
|
-
/** @example 1761922799 */
|
|
2703
|
-
expiry: number;
|
|
2704
|
-
/** @example 1761922790 */
|
|
2705
|
-
start: number;
|
|
2706
|
-
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2707
|
-
group: string;
|
|
2708
|
-
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2709
|
-
session: string;
|
|
2710
|
-
/** @example false */
|
|
2711
|
-
buy: boolean;
|
|
2712
|
-
/** @example 1 */
|
|
2713
|
-
chain_id: number;
|
|
2714
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2662
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
|
|
2663
|
+
assets: string; /** @example 0 */
|
|
2664
|
+
obligation_units?: string; /** @example 0 */
|
|
2665
|
+
obligation_shares?: string; /** @example 2750000000000000000 */
|
|
2666
|
+
price: string; /** @example 1761922799 */
|
|
2667
|
+
maturity: number; /** @example 1761922799 */
|
|
2668
|
+
expiry: number; /** @example 1761922790 */
|
|
2669
|
+
start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2670
|
+
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2671
|
+
session: string; /** @example false */
|
|
2672
|
+
buy: boolean; /** @example 1 */
|
|
2673
|
+
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2715
2674
|
loan_token: string;
|
|
2716
2675
|
/**
|
|
2717
2676
|
* @example [
|
|
@@ -2732,24 +2691,17 @@ interface components {
|
|
|
2732
2691
|
callback: components["schemas"]["ValidateCallbackRequest"];
|
|
2733
2692
|
};
|
|
2734
2693
|
ValidateCollateralRequest: {
|
|
2735
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2736
|
-
|
|
2737
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2738
|
-
oracle: string;
|
|
2739
|
-
/** @example 860000000000000000 */
|
|
2694
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2695
|
+
oracle: string; /** @example 860000000000000000 */
|
|
2740
2696
|
lltv: string;
|
|
2741
2697
|
};
|
|
2742
2698
|
ValidateCallbackRequest: {
|
|
2743
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2744
|
-
address: string;
|
|
2745
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2699
|
+
/** @example 0x1111111111111111111111111111111111111111 */address: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2746
2700
|
data: string;
|
|
2747
2701
|
};
|
|
2748
2702
|
ValidationSuccessResponse: {
|
|
2749
|
-
meta: components["schemas"]["Meta"];
|
|
2750
|
-
/** @
|
|
2751
|
-
cursor: string | null;
|
|
2752
|
-
/** @description Payload and root for client-side signing. */
|
|
2703
|
+
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2704
|
+
cursor: string | null; /** @description Payload and root for client-side signing. */
|
|
2753
2705
|
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
2754
2706
|
};
|
|
2755
2707
|
ValidationSuccessDataResponse: {
|
|
@@ -2825,6 +2777,45 @@ type Input = Readonly<{
|
|
|
2825
2777
|
*/
|
|
2826
2778
|
declare function from$2(input: Input): OfferResponse;
|
|
2827
2779
|
//#endregion
|
|
2780
|
+
//#region src/gatekeeper/types.d.ts
|
|
2781
|
+
type RuleInfo = {
|
|
2782
|
+
name: string;
|
|
2783
|
+
description: string;
|
|
2784
|
+
};
|
|
2785
|
+
type RulesProvider = {
|
|
2786
|
+
getRules: () => Promise<RuleInfo[]>;
|
|
2787
|
+
};
|
|
2788
|
+
type ValidationIssue = {
|
|
2789
|
+
index: number;
|
|
2790
|
+
rule: string;
|
|
2791
|
+
message: string;
|
|
2792
|
+
};
|
|
2793
|
+
type ValidateOffersSuccess = {
|
|
2794
|
+
payload: Hex;
|
|
2795
|
+
root: Hex;
|
|
2796
|
+
};
|
|
2797
|
+
type ValidateOffersIssues = {
|
|
2798
|
+
issues: ValidationIssue[];
|
|
2799
|
+
};
|
|
2800
|
+
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
2801
|
+
type SuccessPayload<T> = {
|
|
2802
|
+
meta: {
|
|
2803
|
+
timestamp: string;
|
|
2804
|
+
};
|
|
2805
|
+
cursor: string | null;
|
|
2806
|
+
data: T;
|
|
2807
|
+
};
|
|
2808
|
+
type ErrorPayload = {
|
|
2809
|
+
meta: {
|
|
2810
|
+
timestamp: string;
|
|
2811
|
+
};
|
|
2812
|
+
error: {
|
|
2813
|
+
code: string;
|
|
2814
|
+
message: string;
|
|
2815
|
+
details?: unknown;
|
|
2816
|
+
};
|
|
2817
|
+
};
|
|
2818
|
+
//#endregion
|
|
2828
2819
|
//#region src/api/Schema/openapi.d.ts
|
|
2829
2820
|
declare class BooksController {
|
|
2830
2821
|
getBook(): Promise<void>;
|
|
@@ -2850,10 +2841,6 @@ declare class ObligationsController {
|
|
|
2850
2841
|
declare class UsersController {
|
|
2851
2842
|
getUserPositions(): Promise<void>;
|
|
2852
2843
|
}
|
|
2853
|
-
type RuleInfo = {
|
|
2854
|
-
name: string;
|
|
2855
|
-
description: string;
|
|
2856
|
-
};
|
|
2857
2844
|
type OpenApiOptions = {
|
|
2858
2845
|
rules?: RuleInfo[];
|
|
2859
2846
|
};
|
|
@@ -2861,22 +2848,18 @@ declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
|
2861
2848
|
//#endregion
|
|
2862
2849
|
//#region src/database/domains/Positions.d.ts
|
|
2863
2850
|
type PaginationParams = {
|
|
2864
|
-
/** Cursor string returned by a previous call, for pagination */
|
|
2865
|
-
cursor?: string;
|
|
2866
|
-
/** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
2851
|
+
/** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
2867
2852
|
limit?: number;
|
|
2868
2853
|
};
|
|
2869
2854
|
declare namespace getByUser {
|
|
2870
2855
|
type Parameters = PaginationParams & {
|
|
2871
|
-
/** The user address to get positions for. */
|
|
2872
|
-
user: Address;
|
|
2856
|
+
/** The user address to get positions for. */user: Address;
|
|
2873
2857
|
};
|
|
2874
2858
|
type PositionWithReserved = {
|
|
2875
2859
|
chainId: Id;
|
|
2876
2860
|
contract: Address;
|
|
2877
2861
|
user: Address;
|
|
2878
|
-
blockNumber: number;
|
|
2879
|
-
/** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
2862
|
+
blockNumber: number; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
2880
2863
|
reserved: bigint;
|
|
2881
2864
|
};
|
|
2882
2865
|
type ReturnType = {
|
|
@@ -2940,10 +2923,10 @@ declare const schemas: {
|
|
|
2940
2923
|
}, z$1.core.$strip>;
|
|
2941
2924
|
readonly get_obligations: z$1.ZodObject<{
|
|
2942
2925
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2926
|
+
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>>>>>;
|
|
2927
|
+
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>>>>>;
|
|
2928
|
+
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>>>>>;
|
|
2929
|
+
maturities: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
2947
2930
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2948
2931
|
}, z$1.core.$strip>;
|
|
2949
2932
|
readonly get_obligation: z$1.ZodObject<{
|
|
@@ -2971,15 +2954,13 @@ type Action = keyof typeof schemas;
|
|
|
2971
2954
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2972
2955
|
declare function safeParse<A extends Action>(action: A, query: unknown, error?: z$1.core.$ZodErrorMap<z$1.core.$ZodIssue>): z$1.ZodSafeParseResult<z$1.infer<(typeof schemas)[A]>>;
|
|
2973
2956
|
declare namespace index_d_exports$1 {
|
|
2974
|
-
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, PositionResponse_d_exports as PositionResponse, RouterStatusResponse,
|
|
2957
|
+
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, UsersController, ValidateController, parse, safeParse };
|
|
2975
2958
|
}
|
|
2976
|
-
declare namespace Client_d_exports {
|
|
2959
|
+
declare namespace Client_d_exports$1 {
|
|
2977
2960
|
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
2978
2961
|
}
|
|
2979
2962
|
type RouterClientConfig = {
|
|
2980
|
-
/** The URL of the router. */
|
|
2981
|
-
readonly url: URL;
|
|
2982
|
-
/** The default headers to use for each request. */
|
|
2963
|
+
/** The URL of the router. */readonly url: URL; /** The default headers to use for each request. */
|
|
2983
2964
|
readonly headers: Headers;
|
|
2984
2965
|
};
|
|
2985
2966
|
type Client$2 = Compute<RouterClientConfig & {
|
|
@@ -3016,10 +2997,8 @@ type ConnectOptions = {
|
|
|
3016
2997
|
/** The URL of the router to interact with.
|
|
3017
2998
|
* @default "https://router.morpho.dev"
|
|
3018
2999
|
*/
|
|
3019
|
-
url?: string;
|
|
3020
|
-
/** The
|
|
3021
|
-
apiKey?: string;
|
|
3022
|
-
/** The default headers to use for each request. */
|
|
3000
|
+
url?: string; /** The API key to use for the router API. */
|
|
3001
|
+
apiKey?: string; /** The default headers to use for each request. */
|
|
3023
3002
|
headers?: Headers;
|
|
3024
3003
|
};
|
|
3025
3004
|
/**
|
|
@@ -3042,13 +3021,9 @@ declare namespace connect$1 {
|
|
|
3042
3021
|
declare function getOffers(apiClient: Client<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
3043
3022
|
declare namespace getOffers {
|
|
3044
3023
|
type Parameters = {
|
|
3045
|
-
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
3046
|
-
|
|
3047
|
-
/**
|
|
3048
|
-
obligationId: Hex;
|
|
3049
|
-
/** Pagination cursor in base64url-encoded format */
|
|
3050
|
-
cursor?: string;
|
|
3051
|
-
/** Maximum number of offers to return. @default 20 */
|
|
3024
|
+
/** 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 */
|
|
3025
|
+
obligationId: Hex; /** Pagination cursor in base64url-encoded format */
|
|
3026
|
+
cursor?: string; /** Maximum number of offers to return. @default 20 */
|
|
3052
3027
|
limit?: number;
|
|
3053
3028
|
};
|
|
3054
3029
|
type ReturnType = {
|
|
@@ -3058,14 +3033,10 @@ declare namespace getOffers {
|
|
|
3058
3033
|
consumed: bigint;
|
|
3059
3034
|
takeable: bigint;
|
|
3060
3035
|
} & {
|
|
3061
|
-
/** 32-byte merkle root. */
|
|
3062
|
-
|
|
3063
|
-
/** Sibling hashes for the merkle proof. */
|
|
3064
|
-
proof?: Hex[];
|
|
3065
|
-
/** Offer signature from the Merkle tree. */
|
|
3036
|
+
/** 32-byte merkle root. */root?: Hex; /** Sibling hashes for the merkle proof. */
|
|
3037
|
+
proof?: Hex[]; /** Offer signature from the Merkle tree. */
|
|
3066
3038
|
signature?: Hex;
|
|
3067
|
-
}>[];
|
|
3068
|
-
/** The pagination cursor. */
|
|
3039
|
+
}>[]; /** The pagination cursor. */
|
|
3069
3040
|
cursor: string | null;
|
|
3070
3041
|
};
|
|
3071
3042
|
type ErrorType = GetApiErrorType;
|
|
@@ -3073,25 +3044,17 @@ declare namespace getOffers {
|
|
|
3073
3044
|
declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
3074
3045
|
declare namespace getObligations {
|
|
3075
3046
|
type Parameters = {
|
|
3076
|
-
/** Pagination cursor is a 32-byte hex string. */
|
|
3077
|
-
|
|
3078
|
-
/**
|
|
3079
|
-
|
|
3080
|
-
/** Filter by
|
|
3081
|
-
|
|
3082
|
-
/** Filter by loan token address. */
|
|
3083
|
-
loanToken?: Address;
|
|
3084
|
-
/** Filter by collateral token (matches any collateral in the obligation). */
|
|
3085
|
-
collateralToken?: Address;
|
|
3086
|
-
/** Filter by exact maturity timestamp (unix seconds). */
|
|
3087
|
-
maturity?: number;
|
|
3047
|
+
/** Pagination cursor is a 32-byte hex string. */cursor?: Hex; /** Maximum number of obligations to return. @default 20 */
|
|
3048
|
+
limit?: number; /** Filter by chain IDs (comma-separated). */
|
|
3049
|
+
chainIds?: number[]; /** Filter by loan token addresses (comma-separated). */
|
|
3050
|
+
loanTokens?: Address[]; /** Filter by collateral tokens (comma-separated, matches any collateral). */
|
|
3051
|
+
collateralTokens?: Address[]; /** Filter by exact maturity timestamps (comma-separated, unix seconds). */
|
|
3052
|
+
maturities?: number[];
|
|
3088
3053
|
};
|
|
3089
3054
|
type ReturnType = {
|
|
3090
3055
|
obligations: Compute<{
|
|
3091
|
-
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
3092
|
-
|
|
3093
|
-
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
3094
|
-
/** The pagination cursor. */
|
|
3056
|
+
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/id: () => Hex;
|
|
3057
|
+
} & Obligation & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
|
|
3095
3058
|
cursor: string | null;
|
|
3096
3059
|
};
|
|
3097
3060
|
type ErrorType = GetApiErrorType;
|
|
@@ -3127,20 +3090,20 @@ declare namespace Gate_d_exports {
|
|
|
3127
3090
|
/**
|
|
3128
3091
|
* A validation rule.
|
|
3129
3092
|
*/
|
|
3130
|
-
type Rule<T, Name
|
|
3093
|
+
type Rule<T, Name extends string = string> = {
|
|
3131
3094
|
kind: "single";
|
|
3132
|
-
name: Name
|
|
3095
|
+
name: Name;
|
|
3133
3096
|
description: string;
|
|
3134
|
-
run: Single<T, Name
|
|
3097
|
+
run: Single<T, Name>;
|
|
3135
3098
|
} | {
|
|
3136
3099
|
kind: "batch";
|
|
3137
|
-
name: Name
|
|
3100
|
+
name: Name;
|
|
3138
3101
|
description: string;
|
|
3139
|
-
run: Batch<T, Name
|
|
3102
|
+
run: Batch<T, Name>;
|
|
3140
3103
|
};
|
|
3141
|
-
type RuleNames<Rules
|
|
3104
|
+
type RuleNames<Rules extends readonly {
|
|
3142
3105
|
name: string;
|
|
3143
|
-
}[]> = Rules
|
|
3106
|
+
}[]> = Rules[number]["name"];
|
|
3144
3107
|
/**
|
|
3145
3108
|
* A single item validation rule.
|
|
3146
3109
|
* @param item - The item to validate.
|
|
@@ -3160,7 +3123,7 @@ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<
|
|
|
3160
3123
|
* @param run - The function that validates the rule.
|
|
3161
3124
|
* @returns The created rule.
|
|
3162
3125
|
*/
|
|
3163
|
-
declare function single<Name
|
|
3126
|
+
declare function single<Name extends string, T>(name: Name, description: string, run: Single<T, Name>): Rule<T, Name>;
|
|
3164
3127
|
/**
|
|
3165
3128
|
* Create a validation rule iterating over a batch of items at a time.
|
|
3166
3129
|
* @param name - The name of the rule.
|
|
@@ -3168,32 +3131,49 @@ declare function single<Name$1 extends string, T>(name: Name$1, description: str
|
|
|
3168
3131
|
* @param run - The function that validates the rule.
|
|
3169
3132
|
* @returns The created rule.
|
|
3170
3133
|
*/
|
|
3171
|
-
declare function batch$1<Name
|
|
3134
|
+
declare function batch$1<Name extends string, T>(name: Name, description: string, run: Batch<T, Name>): Rule<T, Name>;
|
|
3172
3135
|
/**
|
|
3173
3136
|
* A validation issue.
|
|
3174
3137
|
*/
|
|
3175
3138
|
type Issue<T, RuleName extends string = string> = {
|
|
3176
|
-
/** The name of the rule that caused the issue. */
|
|
3177
|
-
|
|
3178
|
-
/** The message of the issue. */
|
|
3179
|
-
message: string;
|
|
3180
|
-
/** The item that was not valid. */
|
|
3139
|
+
/** The name of the rule that caused the issue. */ruleName: RuleName; /** The message of the issue. */
|
|
3140
|
+
message: string; /** The item that was not valid. */
|
|
3181
3141
|
item: T;
|
|
3182
3142
|
};
|
|
3183
3143
|
/**
|
|
3184
3144
|
* The result of a validation.
|
|
3185
3145
|
*/
|
|
3186
3146
|
type Result<T, RuleName extends string = string> = {
|
|
3187
|
-
/** The items that were valid. */
|
|
3188
|
-
valid: T[];
|
|
3189
|
-
/** The reports of the failed validations. */
|
|
3147
|
+
/** The items that were valid. */valid: T[]; /** The reports of the failed validations. */
|
|
3190
3148
|
issues: Issue<T, RuleName>[];
|
|
3191
3149
|
};
|
|
3192
|
-
declare function run<T, Name
|
|
3150
|
+
declare function run<T, Name extends string, Rules extends readonly Rule<T, Name>[]>(parameters: {
|
|
3193
3151
|
items: T[];
|
|
3194
|
-
rules: Rules
|
|
3152
|
+
rules: Rules;
|
|
3195
3153
|
chunkSize?: number;
|
|
3196
|
-
}): Promise<Result<T, RuleNames<Rules
|
|
3154
|
+
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
3155
|
+
declare namespace Client_d_exports {
|
|
3156
|
+
export { ClientConfig, GatekeeperClient, createHttpClient };
|
|
3157
|
+
}
|
|
3158
|
+
type GatekeeperClient = RulesProvider & {
|
|
3159
|
+
/** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
|
|
3160
|
+
statusCode: number;
|
|
3161
|
+
body: unknown;
|
|
3162
|
+
}>; /** Validate offers and return decision results. */
|
|
3163
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
|
|
3164
|
+
baseUrl: string;
|
|
3165
|
+
};
|
|
3166
|
+
type ClientConfig = {
|
|
3167
|
+
baseUrl: string;
|
|
3168
|
+
timeoutMs?: number;
|
|
3169
|
+
fetchFn?: typeof fetch;
|
|
3170
|
+
};
|
|
3171
|
+
/**
|
|
3172
|
+
* Create an HTTP client for a gatekeeper service.
|
|
3173
|
+
* @param config - Gatekeeper client configuration. {@link ClientConfig}
|
|
3174
|
+
* @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
|
|
3175
|
+
*/
|
|
3176
|
+
declare function createHttpClient(config: ClientConfig): GatekeeperClient;
|
|
3197
3177
|
declare namespace GateConfig_d_exports {
|
|
3198
3178
|
export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
3199
3179
|
}
|
|
@@ -3202,25 +3182,25 @@ type GateConfig = {
|
|
|
3202
3182
|
maturities?: MaturityType[];
|
|
3203
3183
|
};
|
|
3204
3184
|
type CallbackConfig = {
|
|
3205
|
-
type:
|
|
3185
|
+
type: Type$1.BuyVaultV1Callback;
|
|
3206
3186
|
addresses: Address[];
|
|
3207
3187
|
vaultFactories: Address[];
|
|
3208
3188
|
} | {
|
|
3209
|
-
type:
|
|
3189
|
+
type: Type$1.SellERC20Callback;
|
|
3210
3190
|
addresses: Address[];
|
|
3211
3191
|
} | {
|
|
3212
|
-
type:
|
|
3192
|
+
type: Type$1.BuyWithEmptyCallback;
|
|
3213
3193
|
};
|
|
3214
|
-
declare function getCallback(chain: Name, type:
|
|
3215
|
-
type:
|
|
3194
|
+
declare function getCallback(chain: Name, type: Type$1.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
3195
|
+
type: Type$1.BuyVaultV1Callback;
|
|
3216
3196
|
}> | undefined;
|
|
3217
|
-
declare function getCallback(chain: Name, type:
|
|
3218
|
-
type:
|
|
3197
|
+
declare function getCallback(chain: Name, type: Type$1.SellERC20Callback): Extract<CallbackConfig, {
|
|
3198
|
+
type: Type$1.SellERC20Callback;
|
|
3219
3199
|
}> | undefined;
|
|
3220
|
-
declare function getCallback(chain: Name, type:
|
|
3221
|
-
type:
|
|
3200
|
+
declare function getCallback(chain: Name, type: Type$1.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
3201
|
+
type: Type$1.BuyWithEmptyCallback;
|
|
3222
3202
|
}> | undefined;
|
|
3223
|
-
declare function getCallback(chain: Name, type:
|
|
3203
|
+
declare function getCallback(chain: Name, type: Type$1): CallbackConfig | undefined;
|
|
3224
3204
|
/**
|
|
3225
3205
|
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
3226
3206
|
* Skips the empty callback type as it does not carry addresses.
|
|
@@ -3229,14 +3209,14 @@ declare function getCallback(chain: Name, type: CallbackType): CallbackConfig |
|
|
|
3229
3209
|
* @param address - Callback contract address
|
|
3230
3210
|
* @returns The callback type when found, otherwise undefined
|
|
3231
3211
|
*/
|
|
3232
|
-
declare function getCallbackType(chain: Name, address: Address):
|
|
3212
|
+
declare function getCallbackType(chain: Name, address: Address): Type$1.BuyWithEmptyCallback | Type$1.BuyVaultV1Callback | Type$1.SellERC20Callback | undefined;
|
|
3233
3213
|
/**
|
|
3234
3214
|
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
3235
3215
|
* @param chain - Chain name for which to read the validation configuration
|
|
3236
3216
|
* @param type - Callback type to retrieve
|
|
3237
3217
|
* @returns The matching callback addresses or an empty array if not configured
|
|
3238
3218
|
*/
|
|
3239
|
-
declare function getCallbackTypeAddresses(chain: Name, type:
|
|
3219
|
+
declare function getCallbackTypeAddresses(chain: Name, type: Type$1): Address[];
|
|
3240
3220
|
/**
|
|
3241
3221
|
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
3242
3222
|
*
|
|
@@ -3251,12 +3231,17 @@ declare namespace Gatekeeper_d_exports {
|
|
|
3251
3231
|
}
|
|
3252
3232
|
type Rules = readonly Rule<Offer, string>[];
|
|
3253
3233
|
type Gatekeeper = {
|
|
3254
|
-
rules: Rules;
|
|
3255
3234
|
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
3235
|
+
getRules: () => Promise<RuleInfo[]>;
|
|
3256
3236
|
};
|
|
3257
3237
|
type GatekeeperParameters = {
|
|
3258
3238
|
rules: Rules;
|
|
3259
3239
|
};
|
|
3240
|
+
/**
|
|
3241
|
+
* Create a gatekeeper instance with the provided rules.
|
|
3242
|
+
* @param parameters - Gatekeeper parameters. {@link GatekeeperParameters}
|
|
3243
|
+
* @returns Gatekeeper instance. {@link Gatekeeper}
|
|
3244
|
+
*/
|
|
3260
3245
|
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
3261
3246
|
//#endregion
|
|
3262
3247
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
@@ -3288,7 +3273,7 @@ declare const callback: ({
|
|
|
3288
3273
|
callbacks,
|
|
3289
3274
|
allowedAddresses
|
|
3290
3275
|
}: {
|
|
3291
|
-
callbacks:
|
|
3276
|
+
callbacks: Type$1[];
|
|
3292
3277
|
allowedAddresses: Address[];
|
|
3293
3278
|
}) => Rule<Offer, "callback">;
|
|
3294
3279
|
/**
|
|
@@ -3318,11 +3303,8 @@ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusiv
|
|
|
3318
3303
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
3319
3304
|
declare namespace from {
|
|
3320
3305
|
type Parameters = {
|
|
3321
|
-
/** The viem client to use. */
|
|
3322
|
-
|
|
3323
|
-
/** The mempool address. */
|
|
3324
|
-
mempoolAddress: Address;
|
|
3325
|
-
/** The block window to use for the mempool. Defaults to 100. */
|
|
3306
|
+
/** The viem client to use. */client: WalletClient; /** The mempool address. */
|
|
3307
|
+
mempoolAddress: Address; /** The block window to use for the mempool. Defaults to 100. */
|
|
3326
3308
|
blockWindow?: number;
|
|
3327
3309
|
};
|
|
3328
3310
|
type ReturnType = Client$1;
|
|
@@ -3333,18 +3315,12 @@ declare namespace MempoolClient_d_exports {
|
|
|
3333
3315
|
}
|
|
3334
3316
|
type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
|
|
3335
3317
|
type GetParameters = {
|
|
3336
|
-
/** The block number to get offers from. */
|
|
3337
|
-
|
|
3338
|
-
/** The
|
|
3339
|
-
|
|
3340
|
-
/** The loan asset to get offers from. */
|
|
3341
|
-
loanToken?: string;
|
|
3342
|
-
/** The order to get offers. Defaults to "desc". */
|
|
3343
|
-
order?: "asc" | "desc";
|
|
3344
|
-
/** The options to get offers from. */
|
|
3318
|
+
/** The block number to get offers from. */blockNumberGte?: number; /** The block number to get offers to. */
|
|
3319
|
+
blockNumberLte?: number; /** The loan asset to get offers from. */
|
|
3320
|
+
loanToken?: string; /** The order to get offers. Defaults to "desc". */
|
|
3321
|
+
order?: "asc" | "desc"; /** The options to get offers from. */
|
|
3345
3322
|
options?: {
|
|
3346
|
-
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
|
|
3347
|
-
maxBatchSize?: number;
|
|
3323
|
+
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */maxBatchSize?: number;
|
|
3348
3324
|
};
|
|
3349
3325
|
};
|
|
3350
3326
|
/**
|
|
@@ -3355,11 +3331,9 @@ type Client$1 = {
|
|
|
3355
3331
|
* Add an offer to the mempool.
|
|
3356
3332
|
* @returns The created offer with its hash.
|
|
3357
3333
|
*/
|
|
3358
|
-
add: (parameters: AddParameters) => Promise<Hex>;
|
|
3359
|
-
/** Get offers from the mempool. */
|
|
3334
|
+
add: (parameters: AddParameters) => Promise<Hex>; /** Get offers from the mempool. */
|
|
3360
3335
|
get: (parameters?: GetParameters) => AsyncGenerator<{
|
|
3361
|
-
offers: Offer[];
|
|
3362
|
-
/** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
3336
|
+
offers: Offer[]; /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
3363
3337
|
blockNumber: number;
|
|
3364
3338
|
}>;
|
|
3365
3339
|
/**
|
|
@@ -3515,5 +3489,5 @@ declare namespace index_d_exports$2 {
|
|
|
3515
3489
|
export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
|
|
3516
3490
|
}
|
|
3517
3491
|
//#endregion
|
|
3518
|
-
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ERC4626_d_exports as ERC4626, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, 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 as RouterClient, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, Gate_d_exports as Validation, morphoRules };
|
|
3492
|
+
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, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, 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, RuleInfo, Rules_d_exports as Rules, RulesProvider, SuccessPayload, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
|
|
3519
3493
|
//# sourceMappingURL=index.browser.d.mts.map
|