@morpho-dev/router 0.1.16 → 0.1.18
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 +6 -6
- package/dist/cli.js +970 -565
- package/dist/cli.js.map +1 -1
- package/dist/index.browser.d.cts +182 -79
- package/dist/index.browser.d.ts +182 -79
- package/dist/index.browser.js +443 -235
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +444 -237
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +235 -124
- package/dist/index.node.d.ts +235 -124
- package/dist/index.node.js +2361 -2023
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +2361 -2024
- package/dist/index.node.mjs.map +1 -1
- package/package.json +6 -5
package/dist/index.browser.d.cts
CHANGED
|
@@ -21,28 +21,24 @@ declare const ChainHealth: z$1.ZodObject<{
|
|
|
21
21
|
block_number: z$1.ZodNumber;
|
|
22
22
|
updated_at: z$1.ZodString;
|
|
23
23
|
}, z$1.core.$strip>;
|
|
24
|
-
declare const CollectorsHealthResponse: z$1.ZodObject<{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, z$1.core.$strip>>;
|
|
37
|
-
}, z$1.core.$strip>;
|
|
24
|
+
declare const CollectorsHealthResponse: z$1.ZodArray<z$1.ZodObject<{
|
|
25
|
+
name: z$1.ZodString;
|
|
26
|
+
chain_id: z$1.ZodNumber;
|
|
27
|
+
block_number: z$1.ZodNullable<z$1.ZodNumber>;
|
|
28
|
+
updated_at: z$1.ZodNullable<z$1.ZodString>;
|
|
29
|
+
lag: z$1.ZodNullable<z$1.ZodNumber>;
|
|
30
|
+
status: z$1.ZodEnum<{
|
|
31
|
+
live: "live";
|
|
32
|
+
lagging: "lagging";
|
|
33
|
+
unknown: "unknown";
|
|
34
|
+
}>;
|
|
35
|
+
}, z$1.core.$strip>>;
|
|
38
36
|
type CollectorsHealthResponse = z$1.infer<typeof CollectorsHealthResponse>;
|
|
39
|
-
declare const ChainsHealthResponse: z$1.ZodObject<{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, z$1.core.$strip>>;
|
|
45
|
-
}, z$1.core.$strip>;
|
|
37
|
+
declare const ChainsHealthResponse: z$1.ZodArray<z$1.ZodObject<{
|
|
38
|
+
chain_id: z$1.ZodNumber;
|
|
39
|
+
block_number: z$1.ZodNumber;
|
|
40
|
+
updated_at: z$1.ZodString;
|
|
41
|
+
}, z$1.core.$strip>>;
|
|
46
42
|
type ChainsHealthResponse = z$1.infer<typeof ChainsHealthResponse>;
|
|
47
43
|
declare const RouterStatusResponse: z$1.ZodObject<{
|
|
48
44
|
status: z$1.ZodEnum<{
|
|
@@ -396,8 +392,8 @@ type Options = (typeof Options)[number];
|
|
|
396
392
|
* @param lltv - The LLTV option or the scaled LLTV.
|
|
397
393
|
* @returns The LLTV.
|
|
398
394
|
*/
|
|
399
|
-
declare function from$
|
|
400
|
-
declare namespace from$
|
|
395
|
+
declare function from$8(lltv: Options | bigint): LLTV;
|
|
396
|
+
declare namespace from$8 {
|
|
401
397
|
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
402
398
|
}
|
|
403
399
|
declare class InvalidOptionError$1 extends BaseError {
|
|
@@ -416,7 +412,7 @@ type LLTV$1_LLTV = LLTV;
|
|
|
416
412
|
declare const LLTV$1_LLTVSchema: typeof LLTVSchema;
|
|
417
413
|
type LLTV$1_Options = Options;
|
|
418
414
|
declare namespace LLTV$1 {
|
|
419
|
-
export { LLTV$1_InvalidLLTVError as InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, type LLTV$1_LLTV as LLTV, LLTV$1_LLTVSchema as LLTVSchema, type LLTV$1_Options as Options, from$
|
|
415
|
+
export { LLTV$1_InvalidLLTVError as InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, type LLTV$1_LLTV as LLTV, LLTV$1_LLTVSchema as LLTVSchema, type LLTV$1_Options as Options, from$8 as from };
|
|
420
416
|
}
|
|
421
417
|
|
|
422
418
|
type Collateral = {
|
|
@@ -437,8 +433,8 @@ declare const CollateralsSchema: z.ZodArray<z.ZodObject<{
|
|
|
437
433
|
oracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
438
434
|
lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
439
435
|
}, z.core.$strip>>;
|
|
440
|
-
declare const from$
|
|
441
|
-
declare namespace from$
|
|
436
|
+
declare const from$7: (parameters: from$7.Parameters) => from$7.ReturnType;
|
|
437
|
+
declare namespace from$7 {
|
|
442
438
|
type Parameters = {
|
|
443
439
|
asset: Address;
|
|
444
440
|
lltv: Options | bigint;
|
|
@@ -451,27 +447,7 @@ type Collateral$1_Collateral = Collateral;
|
|
|
451
447
|
declare const Collateral$1_CollateralSchema: typeof CollateralSchema;
|
|
452
448
|
declare const Collateral$1_CollateralsSchema: typeof CollateralsSchema;
|
|
453
449
|
declare namespace Collateral$1 {
|
|
454
|
-
export { type Collateral$1_Collateral as Collateral, Collateral$1_CollateralSchema as CollateralSchema, Collateral$1_CollateralsSchema as CollateralsSchema, from$
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
type Cursor = {
|
|
458
|
-
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
459
|
-
dir: "asc" | "desc";
|
|
460
|
-
rate?: string;
|
|
461
|
-
maturity?: number;
|
|
462
|
-
expiry?: number;
|
|
463
|
-
assets?: string;
|
|
464
|
-
hash: string;
|
|
465
|
-
page?: number;
|
|
466
|
-
};
|
|
467
|
-
declare function validate(cursor: unknown): cursor is Cursor;
|
|
468
|
-
declare function encode$1(c: Cursor): string;
|
|
469
|
-
declare function decode$1(token?: string): Cursor | null;
|
|
470
|
-
|
|
471
|
-
type Cursor$1_Cursor = Cursor;
|
|
472
|
-
declare const Cursor$1_validate: typeof validate;
|
|
473
|
-
declare namespace Cursor$1 {
|
|
474
|
-
export { type Cursor$1_Cursor as Cursor, decode$1 as decode, encode$1 as encode, Cursor$1_validate as validate };
|
|
450
|
+
export { type Collateral$1_Collateral as Collateral, Collateral$1_CollateralSchema as CollateralSchema, Collateral$1_CollateralsSchema as CollateralsSchema, from$7 as from };
|
|
475
451
|
}
|
|
476
452
|
|
|
477
453
|
/** The snake case representation of a type with bigint values stringified. */
|
|
@@ -500,11 +476,11 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
500
476
|
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
501
477
|
* @warning Does not unstringify bigint values.
|
|
502
478
|
*/
|
|
503
|
-
declare function fromSnakeCase$
|
|
479
|
+
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
504
480
|
|
|
505
481
|
type Format_Snake<T> = Snake<T>;
|
|
506
482
|
declare namespace Format {
|
|
507
|
-
export { type Format_Snake as Snake, fromSnakeCase$
|
|
483
|
+
export { type Format_Snake as Snake, fromSnakeCase$3 as fromSnakeCase, toSnakeCase$1 as toSnakeCase };
|
|
508
484
|
}
|
|
509
485
|
|
|
510
486
|
/**
|
|
@@ -527,8 +503,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
|
|
|
527
503
|
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
528
504
|
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
529
505
|
*/
|
|
530
|
-
declare function from$
|
|
531
|
-
declare namespace from$
|
|
506
|
+
declare function from$6(ts: from$6.Parameters): Maturity;
|
|
507
|
+
declare namespace from$6 {
|
|
532
508
|
type Parameters = number | MaturityOptions;
|
|
533
509
|
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
534
510
|
}
|
|
@@ -555,7 +531,7 @@ type Maturity$1_Maturity = Maturity;
|
|
|
555
531
|
type Maturity$1_MaturityOptions = MaturityOptions;
|
|
556
532
|
declare const Maturity$1_MaturitySchema: typeof MaturitySchema;
|
|
557
533
|
declare namespace Maturity$1 {
|
|
558
|
-
export { Maturity$1_InvalidDateError as InvalidDateError, Maturity$1_InvalidFormatError as InvalidFormatError, Maturity$1_InvalidOptionError as InvalidOptionError, type Maturity$1_Maturity as Maturity, type Maturity$1_MaturityOptions as MaturityOptions, Maturity$1_MaturitySchema as MaturitySchema, from$
|
|
534
|
+
export { Maturity$1_InvalidDateError as InvalidDateError, Maturity$1_InvalidFormatError as InvalidFormatError, Maturity$1_InvalidOptionError as InvalidOptionError, type Maturity$1_Maturity as Maturity, type Maturity$1_MaturityOptions as MaturityOptions, Maturity$1_MaturitySchema as MaturitySchema, from$6 as from };
|
|
559
535
|
}
|
|
560
536
|
|
|
561
537
|
type Offer = {
|
|
@@ -630,8 +606,8 @@ declare const OfferSchema: (parameters?: {
|
|
|
630
606
|
* @param input - The offer to create.
|
|
631
607
|
* @returns The created offer with its hash.
|
|
632
608
|
*/
|
|
633
|
-
declare function from$
|
|
634
|
-
declare namespace from$
|
|
609
|
+
declare function from$5(input: Omit<Offer, "hash">): Offer;
|
|
610
|
+
declare namespace from$5 {
|
|
635
611
|
type ErrorType = InvalidOfferError;
|
|
636
612
|
}
|
|
637
613
|
/**
|
|
@@ -640,21 +616,42 @@ declare namespace from$4 {
|
|
|
640
616
|
* @param input - The offer to create.
|
|
641
617
|
* @returns The created offer with its hash.
|
|
642
618
|
*/
|
|
643
|
-
declare function fromSnakeCase$
|
|
619
|
+
declare function fromSnakeCase$2(input: Snake<Omit<Offer, "hash">>): Offer;
|
|
644
620
|
/**
|
|
645
621
|
* Converts an offer to a snake case object.
|
|
646
622
|
* @param offer - The offer to convert.
|
|
647
623
|
* @returns The converted offer.
|
|
648
624
|
*/
|
|
649
625
|
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
626
|
+
type RandomConfig = {
|
|
627
|
+
chains?: Chain[];
|
|
628
|
+
loanTokens?: Address[];
|
|
629
|
+
collateralTokens?: Address[];
|
|
630
|
+
assetsDecimals?: Record<Address, number>;
|
|
631
|
+
buy?: boolean;
|
|
632
|
+
assets?: bigint;
|
|
633
|
+
consumed?: bigint;
|
|
634
|
+
offering?: Address;
|
|
635
|
+
maturity?: Maturity;
|
|
636
|
+
start?: number;
|
|
637
|
+
expiry?: number;
|
|
638
|
+
nonce?: bigint;
|
|
639
|
+
rate?: bigint;
|
|
640
|
+
callback?: {
|
|
641
|
+
address: Address;
|
|
642
|
+
data: Hex;
|
|
643
|
+
gasLimit: bigint;
|
|
644
|
+
};
|
|
645
|
+
collaterals?: readonly Collateral[];
|
|
646
|
+
signature?: Hex;
|
|
647
|
+
};
|
|
650
648
|
/**
|
|
651
649
|
* Generates a random Offer.
|
|
652
|
-
* The returned Offer contains randomly generated values
|
|
653
|
-
* Some fields use fixed or deterministic values (e.g., chainId, collaterals, callback).
|
|
650
|
+
* The returned Offer contains randomly generated values.
|
|
654
651
|
* @warning The generated Offer should not be used for production usage.
|
|
655
652
|
* @returns {Offer} A randomly generated Offer object.
|
|
656
653
|
*/
|
|
657
|
-
declare function random$
|
|
654
|
+
declare function random$2(config?: RandomConfig): Offer;
|
|
658
655
|
/**
|
|
659
656
|
* Creates an EIP-712 domain object.
|
|
660
657
|
* @param chainId - The chain ID.
|
|
@@ -745,8 +742,8 @@ declare function hash(offer: Omit<Offer, "hash">): Hex;
|
|
|
745
742
|
* @returns The obligation id as a 32-byte hex string.
|
|
746
743
|
*/
|
|
747
744
|
declare function obligationId(offer: Offer): Hex;
|
|
748
|
-
declare function encode(offer: Offer): `0x${string}`;
|
|
749
|
-
declare function decode(data: Hex, blockNumber: number | bigint): Offer;
|
|
745
|
+
declare function encode$1(offer: Offer): `0x${string}`;
|
|
746
|
+
declare function decode$1(data: Hex, blockNumber: number | bigint): Offer;
|
|
750
747
|
type OfferConsumed = {
|
|
751
748
|
id: string;
|
|
752
749
|
chainId: bigint;
|
|
@@ -805,10 +802,9 @@ type Offer$1_Offer = Offer;
|
|
|
805
802
|
type Offer$1_OfferConsumed = OfferConsumed;
|
|
806
803
|
declare const Offer$1_OfferHashSchema: typeof OfferHashSchema;
|
|
807
804
|
declare const Offer$1_OfferSchema: typeof OfferSchema;
|
|
805
|
+
type Offer$1_RandomConfig = RandomConfig;
|
|
808
806
|
declare const Offer$1_consumedEvent: typeof consumedEvent;
|
|
809
|
-
declare const Offer$1_decode: typeof decode;
|
|
810
807
|
declare const Offer$1_domain: typeof domain;
|
|
811
|
-
declare const Offer$1_encode: typeof encode;
|
|
812
808
|
declare const Offer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
813
809
|
declare const Offer$1_hash: typeof hash;
|
|
814
810
|
declare const Offer$1_obligationId: typeof obligationId;
|
|
@@ -816,7 +812,7 @@ declare const Offer$1_sign: typeof sign;
|
|
|
816
812
|
declare const Offer$1_toSnakeCase: typeof toSnakeCase;
|
|
817
813
|
declare const Offer$1_types: typeof types;
|
|
818
814
|
declare namespace Offer$1 {
|
|
819
|
-
export { Offer$1_AccountNotSetError as AccountNotSetError, Offer$1_InvalidOfferError as InvalidOfferError, type Offer$1_Offer as Offer, type Offer$1_OfferConsumed as OfferConsumed, Offer$1_OfferHashSchema as OfferHashSchema, Offer$1_OfferSchema as OfferSchema, Offer$1_consumedEvent as consumedEvent,
|
|
815
|
+
export { Offer$1_AccountNotSetError as AccountNotSetError, Offer$1_InvalidOfferError as InvalidOfferError, type Offer$1_Offer as Offer, type Offer$1_OfferConsumed as OfferConsumed, Offer$1_OfferHashSchema as OfferHashSchema, Offer$1_OfferSchema as OfferSchema, type Offer$1_RandomConfig as RandomConfig, Offer$1_consumedEvent as consumedEvent, decode$1 as decode, Offer$1_domain as domain, encode$1 as encode, from$5 as from, Offer$1_fromConsumedLog as fromConsumedLog, fromSnakeCase$2 as fromSnakeCase, Offer$1_hash as hash, Offer$1_obligationId as obligationId, random$2 as random, Offer$1_sign as sign, Offer$1_toSnakeCase as toSnakeCase, Offer$1_types as types };
|
|
820
816
|
}
|
|
821
817
|
|
|
822
818
|
/**
|
|
@@ -996,17 +992,17 @@ declare const ObligationSchema: z.ZodObject<{
|
|
|
996
992
|
* });
|
|
997
993
|
* ```
|
|
998
994
|
*/
|
|
999
|
-
declare function from$
|
|
1000
|
-
declare namespace from$
|
|
995
|
+
declare function from$4(parameters: from$4.Parameters): from$4.ReturnType;
|
|
996
|
+
declare namespace from$4 {
|
|
1001
997
|
type Parameters = {
|
|
1002
998
|
/** The chain id where the liquidity for this obligation is located. */
|
|
1003
999
|
chainId: Id;
|
|
1004
1000
|
/** The token that is being borrowed for this obligation. */
|
|
1005
1001
|
loanToken: Address;
|
|
1006
1002
|
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1007
|
-
collaterals: from$
|
|
1003
|
+
collaterals: from$7.Parameters[] | readonly from$7.Parameters[];
|
|
1008
1004
|
/** The maturity of the obligation. */
|
|
1009
|
-
maturity: from$
|
|
1005
|
+
maturity: from$6.Parameters;
|
|
1010
1006
|
};
|
|
1011
1007
|
type ReturnType = Obligation;
|
|
1012
1008
|
type ErrorType = InvalidObligationError;
|
|
@@ -1017,8 +1013,8 @@ declare namespace from$3 {
|
|
|
1017
1013
|
* @param input - {@link fromSnakeCase.Parameters}
|
|
1018
1014
|
* @returns The created obligation. {@link fromSnakeCase.ReturnType}
|
|
1019
1015
|
*/
|
|
1020
|
-
declare function fromSnakeCase(input: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
|
|
1021
|
-
declare namespace fromSnakeCase {
|
|
1016
|
+
declare function fromSnakeCase$1(input: fromSnakeCase$1.Parameters): fromSnakeCase$1.ReturnType;
|
|
1017
|
+
declare namespace fromSnakeCase$1 {
|
|
1022
1018
|
type Parameters = Snake<Obligation>;
|
|
1023
1019
|
type ReturnType = Obligation;
|
|
1024
1020
|
type ErrorType = InvalidObligationError;
|
|
@@ -1052,8 +1048,8 @@ declare namespace id {
|
|
|
1052
1048
|
* const obligation = Obligation.random();
|
|
1053
1049
|
* ```
|
|
1054
1050
|
*/
|
|
1055
|
-
declare function random(): random.ReturnType;
|
|
1056
|
-
declare namespace random {
|
|
1051
|
+
declare function random$1(): random$1.ReturnType;
|
|
1052
|
+
declare namespace random$1 {
|
|
1057
1053
|
type ReturnType = Obligation;
|
|
1058
1054
|
}
|
|
1059
1055
|
declare class InvalidObligationError extends BaseError<z.ZodError | Error> {
|
|
@@ -1071,24 +1067,106 @@ type Obligation$1_InvalidObligationError = InvalidObligationError;
|
|
|
1071
1067
|
declare const Obligation$1_InvalidObligationError: typeof InvalidObligationError;
|
|
1072
1068
|
type Obligation$1_Obligation = Obligation;
|
|
1073
1069
|
declare const Obligation$1_ObligationSchema: typeof ObligationSchema;
|
|
1074
|
-
declare const Obligation$1_fromSnakeCase: typeof fromSnakeCase;
|
|
1075
1070
|
declare const Obligation$1_id: typeof id;
|
|
1076
|
-
declare const Obligation$1_random: typeof random;
|
|
1077
1071
|
declare namespace Obligation$1 {
|
|
1078
|
-
export { Obligation$1_CollateralsAreNotSortedError as CollateralsAreNotSortedError, Obligation$1_InvalidObligationError as InvalidObligationError, type Obligation$1_Obligation as Obligation, Obligation$1_ObligationSchema as ObligationSchema, from$
|
|
1072
|
+
export { Obligation$1_CollateralsAreNotSortedError as CollateralsAreNotSortedError, Obligation$1_InvalidObligationError as InvalidObligationError, type Obligation$1_Obligation as Obligation, Obligation$1_ObligationSchema as ObligationSchema, from$4 as from, fromSnakeCase$1 as fromSnakeCase, Obligation$1_id as id, random$1 as random };
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
type Quote = {
|
|
1076
|
+
/** The obligation id. */
|
|
1077
|
+
obligationId: Hex;
|
|
1078
|
+
ask: {
|
|
1079
|
+
/** The highest interest rate the seller will accept to pay for the obligation. (18 decimals). */
|
|
1080
|
+
rate: bigint;
|
|
1081
|
+
};
|
|
1082
|
+
bid: {
|
|
1083
|
+
/** The lowest interest rate a buyer is willing to be paid for the obligation. (18 decimals). */
|
|
1084
|
+
rate: bigint;
|
|
1085
|
+
};
|
|
1086
|
+
};
|
|
1087
|
+
declare const QuoteSchema: z.ZodObject<{
|
|
1088
|
+
obligationId: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1089
|
+
ask: z.ZodObject<{
|
|
1090
|
+
rate: z.ZodBigInt;
|
|
1091
|
+
}, z.core.$strip>;
|
|
1092
|
+
bid: z.ZodObject<{
|
|
1093
|
+
rate: z.ZodBigInt;
|
|
1094
|
+
}, z.core.$strip>;
|
|
1095
|
+
}, z.core.$strip>;
|
|
1096
|
+
/**
|
|
1097
|
+
* Creates a quote for a given obligation.
|
|
1098
|
+
* @constructor
|
|
1099
|
+
* @param parameters - {@link from.Parameters}
|
|
1100
|
+
* @returns The created quote. {@link Quote}
|
|
1101
|
+
* @throws If the quote is invalid. {@link InvalidQuoteError}
|
|
1102
|
+
*
|
|
1103
|
+
* @example
|
|
1104
|
+
* ```ts
|
|
1105
|
+
* const quote = Quote.from({ obligationId: "0x123", ask: { assets: 100n, rate: 100n }, bid: { assets: 100n, rate: 100n } });
|
|
1106
|
+
* ```
|
|
1107
|
+
*/
|
|
1108
|
+
declare function from$3(parameters: from$3.Parameters): from$3.ReturnType;
|
|
1109
|
+
declare namespace from$3 {
|
|
1110
|
+
type Parameters = Quote;
|
|
1111
|
+
type ReturnType = Quote;
|
|
1112
|
+
type ErrorType = InvalidQuoteError;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Creates a quote from a snake case object.
|
|
1116
|
+
* @throws If the quote is invalid. {@link InvalidQuoteError}
|
|
1117
|
+
* @param snake - {@link fromSnakeCase.Parameters}
|
|
1118
|
+
* @returns The created quote. {@link fromSnakeCase.ReturnType}
|
|
1119
|
+
*/
|
|
1120
|
+
declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
|
|
1121
|
+
declare namespace fromSnakeCase {
|
|
1122
|
+
type Parameters = Snake<Quote>;
|
|
1123
|
+
type ReturnType = Quote;
|
|
1124
|
+
type ErrorType = from$3.ErrorType;
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Generates a random quote.
|
|
1128
|
+
* @returns A randomly generated quote. {@link random.ReturnType}
|
|
1129
|
+
*
|
|
1130
|
+
* @example
|
|
1131
|
+
* ```ts
|
|
1132
|
+
* const quote = Quote.random();
|
|
1133
|
+
* ```
|
|
1134
|
+
*/
|
|
1135
|
+
declare function random(): random.ReturnType;
|
|
1136
|
+
declare namespace random {
|
|
1137
|
+
type Parameters = never;
|
|
1138
|
+
type ReturnType = Quote;
|
|
1139
|
+
type ErrorType = from$3.ErrorType;
|
|
1140
|
+
}
|
|
1141
|
+
declare class InvalidQuoteError extends BaseError<z.ZodError | Error> {
|
|
1142
|
+
readonly name = "Quote.InvalidQuoteError";
|
|
1143
|
+
constructor(error: z.ZodError | Error);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
type Quote$1_InvalidQuoteError = InvalidQuoteError;
|
|
1147
|
+
declare const Quote$1_InvalidQuoteError: typeof InvalidQuoteError;
|
|
1148
|
+
type Quote$1_Quote = Quote;
|
|
1149
|
+
declare const Quote$1_QuoteSchema: typeof QuoteSchema;
|
|
1150
|
+
declare const Quote$1_fromSnakeCase: typeof fromSnakeCase;
|
|
1151
|
+
declare const Quote$1_random: typeof random;
|
|
1152
|
+
declare namespace Quote$1 {
|
|
1153
|
+
export { Quote$1_InvalidQuoteError as InvalidQuoteError, type Quote$1_Quote as Quote, Quote$1_QuoteSchema as QuoteSchema, from$3 as from, Quote$1_fromSnakeCase as fromSnakeCase, Quote$1_random as random };
|
|
1079
1154
|
}
|
|
1080
1155
|
|
|
1081
1156
|
type ObligationResponse = Snake<Compute<{
|
|
1082
1157
|
/** The obligation id. */
|
|
1083
1158
|
id: Hex;
|
|
1084
|
-
} & Obligation
|
|
1159
|
+
} & Obligation & {
|
|
1160
|
+
ask: Quote["ask"];
|
|
1161
|
+
bid: Quote["bid"];
|
|
1162
|
+
}>>;
|
|
1085
1163
|
/**
|
|
1086
1164
|
* Creates an `ObligationResponse` from a `Obligation`.
|
|
1087
1165
|
* @constructor
|
|
1088
1166
|
* @param obligation - {@link Obligation}
|
|
1089
1167
|
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
1090
1168
|
*/
|
|
1091
|
-
declare function from$2(obligation: Obligation): ObligationResponse;
|
|
1169
|
+
declare function from$2(obligation: Obligation, quote: Quote): ObligationResponse;
|
|
1092
1170
|
|
|
1093
1171
|
type ObligationResponse$1_ObligationResponse = ObligationResponse;
|
|
1094
1172
|
declare namespace ObligationResponse$1 {
|
|
@@ -1230,7 +1308,10 @@ declare namespace getObligations {
|
|
|
1230
1308
|
limit?: number;
|
|
1231
1309
|
};
|
|
1232
1310
|
type ReturnType = {
|
|
1233
|
-
obligations:
|
|
1311
|
+
obligations: Compute<{
|
|
1312
|
+
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
1313
|
+
id: () => Hex;
|
|
1314
|
+
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
1234
1315
|
/** The pagination cursor. */
|
|
1235
1316
|
cursor: string | null;
|
|
1236
1317
|
};
|
|
@@ -1484,6 +1565,28 @@ declare namespace MempoolClient {
|
|
|
1484
1565
|
export { type MempoolClient_AddParameters as AddParameters, type MempoolClient_Client as Client, type MempoolClient_GetParameters as GetParameters, type MempoolClient_WatchParameters as WatchParameters, MempoolClient_connect as connect };
|
|
1485
1566
|
}
|
|
1486
1567
|
|
|
1568
|
+
type Cursor = {
|
|
1569
|
+
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
1570
|
+
dir: "asc" | "desc";
|
|
1571
|
+
rate?: string;
|
|
1572
|
+
maturity?: number;
|
|
1573
|
+
expiry?: number;
|
|
1574
|
+
assets?: string;
|
|
1575
|
+
hash: string;
|
|
1576
|
+
page?: number;
|
|
1577
|
+
};
|
|
1578
|
+
declare function validate(cursor: unknown): cursor is Cursor;
|
|
1579
|
+
declare function encode(c: Cursor): string;
|
|
1580
|
+
declare function decode(token?: string): Cursor | null;
|
|
1581
|
+
|
|
1582
|
+
type Cursor$1_Cursor = Cursor;
|
|
1583
|
+
declare const Cursor$1_decode: typeof decode;
|
|
1584
|
+
declare const Cursor$1_encode: typeof encode;
|
|
1585
|
+
declare const Cursor$1_validate: typeof validate;
|
|
1586
|
+
declare namespace Cursor$1 {
|
|
1587
|
+
export { type Cursor$1_Cursor as Cursor, Cursor$1_decode as decode, Cursor$1_encode as encode, Cursor$1_validate as validate };
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1487
1590
|
declare function max$1(a: bigint, b: bigint): bigint;
|
|
1488
1591
|
declare function min(a: bigint, b: bigint): bigint;
|
|
1489
1592
|
|
|
@@ -1566,7 +1669,7 @@ declare const index_poll: typeof poll;
|
|
|
1566
1669
|
declare const index_retry: typeof retry;
|
|
1567
1670
|
declare const index_wait: typeof wait;
|
|
1568
1671
|
declare namespace index {
|
|
1569
|
-
export { index_BaseError as BaseError, type index_GlobalErrorType as GlobalErrorType, type index_Snake as Snake, time as Time, index_batch as batch, index_batchMulticall as batchMulticall, fromSnakeCase$
|
|
1672
|
+
export { index_BaseError as BaseError, type index_GlobalErrorType as GlobalErrorType, type index_Snake as Snake, time as Time, index_batch as batch, index_batchMulticall as batchMulticall, fromSnakeCase$3 as fromSnakeCase, index_lazy as lazy, max$1 as max, index_min as min, index_poll as poll, index_retry as retry, toSnakeCase$1 as toSnakeCase, index_wait as wait };
|
|
1570
1673
|
}
|
|
1571
1674
|
|
|
1572
|
-
export { Abi, type Brand, BrandTypeId, Callback, Chain$1 as Chain, Collateral$1 as Collateral, type Compute, Cursor$1 as Cursor, Errors, Format, LLTV$1 as LLTV, Liquidity, Maturity$1 as Maturity, MempoolClient as Mempool, Obligation$1 as Obligation, Offer$1 as Offer, index$1 as RouterApi, Client$2 as RouterClient, time as Time, index as Utils, Validation, ValidationRule };
|
|
1675
|
+
export { Abi, type Brand, BrandTypeId, Callback, Chain$1 as Chain, Collateral$1 as Collateral, type Compute, Cursor$1 as Cursor, Errors, Format, LLTV$1 as LLTV, Liquidity, Maturity$1 as Maturity, MempoolClient as Mempool, Obligation$1 as Obligation, Offer$1 as Offer, Quote$1 as Quote, index$1 as RouterApi, Client$2 as RouterClient, time as Time, index as Utils, Validation, ValidationRule };
|