@morpho-dev/router 0.1.18 → 0.2.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.
Files changed (41) hide show
  1. package/README.md +28 -18
  2. package/dist/cli.js +3020 -2174
  3. package/dist/cli.js.map +1 -1
  4. package/dist/drizzle/VERSION.ts +3 -0
  5. package/dist/drizzle/drizzle.config.ts +18 -0
  6. package/dist/drizzle/index.ts +2 -0
  7. package/dist/drizzle/{router_v1.4/0000_add_obligation_id.sql → router_v1.5/0000_add_block_number_to_liquidity_graph_and_offer_liquidity_pools_relation.sql} +49 -39
  8. package/dist/drizzle/router_v1.5/0001_create_new_relations_to_prepare_new_liquidity_model.sql +55 -0
  9. package/dist/drizzle/router_v1.5/0002_add_new_offer_status_relation.sql +9 -0
  10. package/dist/drizzle/router_v1.5/0003_insert-status-code.sql +1 -0
  11. package/dist/drizzle/router_v1.5/0004_add_index_for_fast_book_lookup.sql +3 -0
  12. package/dist/drizzle/router_v1.5/0005_add_group_consumed_events_table.sql +12 -0
  13. package/dist/drizzle/router_v1.5/0006_add-trigger-for-consumed-events.sql +58 -0
  14. package/dist/drizzle/router_v1.5/0007_update_index_for_fast_book_lookup.sql +5 -0
  15. package/dist/drizzle/router_v1.5/0008_rename_consumed_events_table.sql +8 -0
  16. package/dist/drizzle/{router_v1.4 → router_v1.5}/meta/0000_snapshot.json +83 -27
  17. package/dist/drizzle/{router_v1.4 → router_v1.5}/meta/0001_snapshot.json +459 -27
  18. package/dist/drizzle/router_v1.5/meta/0002_snapshot.json +1463 -0
  19. package/dist/drizzle/router_v1.5/meta/0003_snapshot.json +1463 -0
  20. package/dist/drizzle/router_v1.5/meta/0004_snapshot.json +1569 -0
  21. package/dist/drizzle/router_v1.5/meta/0005_snapshot.json +1664 -0
  22. package/dist/drizzle/router_v1.5/meta/0006_snapshot.json +1664 -0
  23. package/dist/drizzle/router_v1.5/meta/0007_snapshot.json +1752 -0
  24. package/dist/drizzle/router_v1.5/meta/0008_snapshot.json +1752 -0
  25. package/dist/drizzle/router_v1.5/meta/_journal.json +69 -0
  26. package/dist/drizzle/schema.ts +363 -0
  27. package/dist/index.browser.d.cts +884 -156
  28. package/dist/index.browser.d.ts +884 -156
  29. package/dist/index.browser.js +1433 -1010
  30. package/dist/index.browser.js.map +1 -1
  31. package/dist/index.browser.mjs +1426 -1009
  32. package/dist/index.browser.mjs.map +1 -1
  33. package/dist/index.node.d.cts +2578 -930
  34. package/dist/index.node.d.ts +2578 -930
  35. package/dist/index.node.js +6544 -5459
  36. package/dist/index.node.js.map +1 -1
  37. package/dist/index.node.mjs +6769 -5688
  38. package/dist/index.node.mjs.map +1 -1
  39. package/package.json +17 -13
  40. package/dist/drizzle/router_v1.4/0001_update-primary-key-on-link.sql +0 -3
  41. package/dist/drizzle/router_v1.4/meta/_journal.json +0 -20
@@ -1,8 +1,10 @@
1
1
  import { z as z$1 } from 'zod/v4';
2
- import { Hex, Address, AbiEvent, PublicClient, GetLogsReturnType, WalletClient, PublicActions } from 'viem';
3
2
  import * as z from 'zod';
3
+ import { Hex, Address, AbiEvent, PublicClient, GetLogsReturnType, WalletClient, PublicActions } from 'viem';
4
4
  import { Chain as Chain$2 } from 'viem/chains';
5
- import * as node_modules_zod_openapi_dist_components_CXzxKPFp_js from 'node_modules/zod-openapi/dist/components-CXzxKPFp.js';
5
+ import { OpenAPIDocument } from 'openapi-metadata';
6
+ import { Client as Client$3 } from 'openapi-fetch';
7
+ import { StandardMerkleTree } from '@openzeppelin/merkle-tree';
6
8
 
7
9
  declare const CollectorHealth: z$1.ZodObject<{
8
10
  name: z$1.ZodString;
@@ -231,7 +233,15 @@ declare enum CallbackType {
231
233
  BuyVaultV1Callback = "buy_vault_v1_callback",
232
234
  SellERC20Callback = "sell_erc20_callback"
233
235
  }
234
- declare const WhitelistedCallbackAddresses: Record<CallbackType, readonly string[]>;
236
+ declare const isEmptyCallback: (offer: Offer) => boolean;
237
+ declare function decode$3(type: CallbackType, data: Hex): {
238
+ vault: Address;
239
+ amount: bigint;
240
+ }[] | {
241
+ collateral: Address;
242
+ amount: bigint;
243
+ }[];
244
+ declare function encode$3(type: CallbackType, data: any): Hex;
235
245
  declare function decodeBuyVaultV1Callback(data: Hex): Array<{
236
246
  vault: Address;
237
247
  amount: bigint;
@@ -251,13 +261,13 @@ declare function encodeSellERC20Callback(parameters: {
251
261
 
252
262
  type Callback_CallbackType = CallbackType;
253
263
  declare const Callback_CallbackType: typeof CallbackType;
254
- declare const Callback_WhitelistedCallbackAddresses: typeof WhitelistedCallbackAddresses;
255
264
  declare const Callback_decodeBuyVaultV1Callback: typeof decodeBuyVaultV1Callback;
256
265
  declare const Callback_decodeSellERC20Callback: typeof decodeSellERC20Callback;
257
266
  declare const Callback_encodeBuyVaultV1Callback: typeof encodeBuyVaultV1Callback;
258
267
  declare const Callback_encodeSellERC20Callback: typeof encodeSellERC20Callback;
268
+ declare const Callback_isEmptyCallback: typeof isEmptyCallback;
259
269
  declare namespace Callback {
260
- export { Callback_CallbackType as CallbackType, Callback_WhitelistedCallbackAddresses as WhitelistedCallbackAddresses, Callback_decodeBuyVaultV1Callback as decodeBuyVaultV1Callback, Callback_decodeSellERC20Callback as decodeSellERC20Callback, Callback_encodeBuyVaultV1Callback as encodeBuyVaultV1Callback, Callback_encodeSellERC20Callback as encodeSellERC20Callback };
270
+ export { Callback_CallbackType as CallbackType, decode$3 as decode, Callback_decodeBuyVaultV1Callback as decodeBuyVaultV1Callback, Callback_decodeSellERC20Callback as decodeSellERC20Callback, encode$3 as encode, Callback_encodeBuyVaultV1Callback as encodeBuyVaultV1Callback, Callback_encodeSellERC20Callback as encodeSellERC20Callback, Callback_isEmptyCallback as isEmptyCallback };
261
271
  }
262
272
 
263
273
  type GlobalErrorType<name extends string = "Error"> = Error & {
@@ -317,7 +327,6 @@ declare const chainIds: Set<bigint>;
317
327
  type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
318
328
  id: Id;
319
329
  name: ChainName;
320
- whitelistedAssets: Set<Address>;
321
330
  morpho: Address;
322
331
  morphoBlue: Address;
323
332
  mempool: {
@@ -325,7 +334,6 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
325
334
  deploymentBlock: number;
326
335
  reindexBuffer: number;
327
336
  };
328
- vaultV1Factory: Record<string, Address>;
329
337
  }>;
330
338
  declare function getChain(chainId: Id): Chain | undefined;
331
339
  declare const getWhitelistedChains: () => Chain[];
@@ -392,8 +400,8 @@ type Options = (typeof Options)[number];
392
400
  * @param lltv - The LLTV option or the scaled LLTV.
393
401
  * @returns The LLTV.
394
402
  */
395
- declare function from$8(lltv: Options | bigint): LLTV;
396
- declare namespace from$8 {
403
+ declare function from$9(lltv: Options | bigint): LLTV;
404
+ declare namespace from$9 {
397
405
  type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
398
406
  }
399
407
  declare class InvalidOptionError$1 extends BaseError {
@@ -412,7 +420,7 @@ type LLTV$1_LLTV = LLTV;
412
420
  declare const LLTV$1_LLTVSchema: typeof LLTVSchema;
413
421
  type LLTV$1_Options = Options;
414
422
  declare namespace LLTV$1 {
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 };
423
+ 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$9 as from };
416
424
  }
417
425
 
418
426
  type Collateral = {
@@ -433,8 +441,8 @@ declare const CollateralsSchema: z.ZodArray<z.ZodObject<{
433
441
  oracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
434
442
  lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
435
443
  }, z.core.$strip>>;
436
- declare const from$7: (parameters: from$7.Parameters) => from$7.ReturnType;
437
- declare namespace from$7 {
444
+ declare const from$8: (parameters: from$8.Parameters) => from$8.ReturnType;
445
+ declare namespace from$8 {
438
446
  type Parameters = {
439
447
  asset: Address;
440
448
  lltv: Options | bigint;
@@ -442,20 +450,39 @@ declare namespace from$7 {
442
450
  };
443
451
  type ReturnType = Collateral;
444
452
  }
453
+ /**
454
+ * Generates a random collateral.
455
+ * @returns A randomly generated collateral. {@link random.ReturnType}
456
+ *
457
+ * @example
458
+ * ```ts
459
+ * const collateral = Collateral.random();
460
+ * ```
461
+ */
462
+ declare function random$3(): random$3.ReturnType;
463
+ declare namespace random$3 {
464
+ type ReturnType = Collateral;
465
+ }
445
466
 
446
467
  type Collateral$1_Collateral = Collateral;
447
468
  declare const Collateral$1_CollateralSchema: typeof CollateralSchema;
448
469
  declare const Collateral$1_CollateralsSchema: typeof CollateralsSchema;
449
470
  declare namespace Collateral$1 {
450
- export { type Collateral$1_Collateral as Collateral, Collateral$1_CollateralSchema as CollateralSchema, Collateral$1_CollateralsSchema as CollateralsSchema, from$7 as from };
471
+ export { type Collateral$1_Collateral as Collateral, Collateral$1_CollateralSchema as CollateralSchema, Collateral$1_CollateralsSchema as CollateralsSchema, from$8 as from, random$3 as random };
451
472
  }
452
473
 
453
474
  /** The snake case representation of a type with bigint values stringified. */
454
- type Snake<T> = SnakeKeys<StringifiedBigint<T>>;
475
+ type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
476
+ /** Make arrays/tuples and object props mutable, deeply. */
477
+ type DeepMutable<T> = T extends (...args: unknown[]) => unknown ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? {
478
+ -readonly [K in keyof R]: DeepMutable<R[K]>;
479
+ } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? {
480
+ -readonly [K in keyof T]: DeepMutable<T[K]>;
481
+ } : T;
455
482
  /** Stringifies bigint values to strings and preserves branded primitives. */
456
483
  type StringifiedBigint<T> = [
457
484
  T
458
- ] extends [bigint] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? {
485
+ ] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? {
459
486
  [K in keyof T]: StringifiedBigint<T[K]>;
460
487
  } : T;
461
488
  /** Key remapping that also preserves branded primitives. */
@@ -477,10 +504,12 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
477
504
  * @warning Does not unstringify bigint values.
478
505
  */
479
506
  declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
507
+ declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
480
508
 
481
509
  type Format_Snake<T> = Snake<T>;
510
+ declare const Format_stringifyBigint: typeof stringifyBigint;
482
511
  declare namespace Format {
483
- export { type Format_Snake as Snake, fromSnakeCase$3 as fromSnakeCase, toSnakeCase$1 as toSnakeCase };
512
+ export { type Format_Snake as Snake, fromSnakeCase$3 as fromSnakeCase, Format_stringifyBigint as stringifyBigint, toSnakeCase$1 as toSnakeCase };
484
513
  }
485
514
 
486
515
  /**
@@ -488,6 +517,14 @@ declare namespace Format {
488
517
  */
489
518
  type Maturity = number & Brand<"Maturity">;
490
519
  declare const MaturitySchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<Maturity, number>>;
520
+ declare enum MaturityType {
521
+ EndOfWeek = "end_of_week",
522
+ EndOfNextWeek = "end_of_next_week",
523
+ EndOfMonth = "end_of_month",
524
+ EndOfNextMonth = "end_of_next_month",
525
+ EndOfQuarter = "end_of_quarter",
526
+ EndOfNextQuarter = "end_of_next_quarter"
527
+ }
491
528
  declare const MaturityOptions: {
492
529
  readonly end_of_week: () => Maturity;
493
530
  readonly end_of_next_week: () => Maturity;
@@ -503,8 +540,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
503
540
  * @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
504
541
  * @throws {InvalidOptionError} If the maturity is not a valid option.
505
542
  */
506
- declare function from$6(ts: from$6.Parameters): Maturity;
507
- declare namespace from$6 {
543
+ declare function from$7(ts: from$7.Parameters): Maturity;
544
+ declare namespace from$7 {
508
545
  type Parameters = number | MaturityOptions;
509
546
  type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
510
547
  }
@@ -530,8 +567,10 @@ declare const Maturity$1_InvalidOptionError: typeof InvalidOptionError;
530
567
  type Maturity$1_Maturity = Maturity;
531
568
  type Maturity$1_MaturityOptions = MaturityOptions;
532
569
  declare const Maturity$1_MaturitySchema: typeof MaturitySchema;
570
+ type Maturity$1_MaturityType = MaturityType;
571
+ declare const Maturity$1_MaturityType: typeof MaturityType;
533
572
  declare namespace Maturity$1 {
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 };
573
+ 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, Maturity$1_MaturityType as MaturityType, from$7 as from };
535
574
  }
536
575
 
537
576
  type Offer = {
@@ -572,9 +611,15 @@ type Offer = {
572
611
  /** The signature of the offer. */
573
612
  signature?: Hex;
574
613
  };
614
+ declare enum StatusCode {
615
+ VALID = "VALID",
616
+ NOT_ENOUGH_LIQUIDITY = "NOT_ENOUGH_LIQUIDITY"
617
+ }
575
618
  declare const OfferHashSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
576
619
  declare const OfferSchema: (parameters?: {
577
620
  omitHash?: boolean;
621
+ omitConsumed?: boolean;
622
+ omitBlockNumber?: boolean;
578
623
  }) => z.ZodObject<{
579
624
  offering: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
580
625
  assets: z.ZodBigInt;
@@ -596,8 +641,6 @@ declare const OfferSchema: (parameters?: {
596
641
  data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
597
642
  gasLimit: z.ZodBigInt;
598
643
  }, z.core.$strip>;
599
- consumed: z.ZodBigInt;
600
- blockNumber: z.ZodNumber;
601
644
  signature: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
602
645
  }, z.core.$strip>;
603
646
  /**
@@ -606,8 +649,8 @@ declare const OfferSchema: (parameters?: {
606
649
  * @param input - The offer to create.
607
650
  * @returns The created offer with its hash.
608
651
  */
609
- declare function from$5(input: Omit<Offer, "hash">): Offer;
610
- declare namespace from$5 {
652
+ declare function from$6(input: Omit<Offer, "hash">): Offer;
653
+ declare namespace from$6 {
611
654
  type ErrorType = InvalidOfferError;
612
655
  }
613
656
  /**
@@ -727,13 +770,14 @@ declare const types: {
727
770
  }];
728
771
  };
729
772
  /**
730
- * Signs an offer.
773
+ * Signs an array of offers.
731
774
  * @throws {Error} If the wallet account is not set.
732
- * @param offer - The offer to sign.
733
- * @param wallet - The wallet to sign the offer with.
734
- * @returns The signed offer.
775
+ * @param offers - The offers to sign.
776
+ * @param wallet - The wallet to sign the offers with.
777
+ * @returns The signed offers.
735
778
  */
736
- declare function sign(offer: Offer, wallet: WalletClient): Promise<Hex>;
779
+ declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
780
+ declare function signatureMsg(offers: Offer[]): Hex;
737
781
  declare function hash(offer: Omit<Offer, "hash">): Hex;
738
782
  /**
739
783
  * Calculates the obligation id for an offer based on the smart contract's Obligation struct.
@@ -742,8 +786,8 @@ declare function hash(offer: Omit<Offer, "hash">): Hex;
742
786
  * @returns The obligation id as a 32-byte hex string.
743
787
  */
744
788
  declare function obligationId(offer: Offer): Hex;
745
- declare function encode$1(offer: Offer): `0x${string}`;
746
- declare function decode$1(data: Hex, blockNumber: number | bigint): Offer;
789
+ declare function encode$2(offer: Offer): `0x${string}`;
790
+ declare function decode$2(data: Hex, blockNumber: number | bigint): Offer;
747
791
  type OfferConsumed = {
748
792
  id: string;
749
793
  chainId: bigint;
@@ -803,16 +847,19 @@ type Offer$1_OfferConsumed = OfferConsumed;
803
847
  declare const Offer$1_OfferHashSchema: typeof OfferHashSchema;
804
848
  declare const Offer$1_OfferSchema: typeof OfferSchema;
805
849
  type Offer$1_RandomConfig = RandomConfig;
850
+ type Offer$1_StatusCode = StatusCode;
851
+ declare const Offer$1_StatusCode: typeof StatusCode;
806
852
  declare const Offer$1_consumedEvent: typeof consumedEvent;
807
853
  declare const Offer$1_domain: typeof domain;
808
854
  declare const Offer$1_fromConsumedLog: typeof fromConsumedLog;
809
855
  declare const Offer$1_hash: typeof hash;
810
856
  declare const Offer$1_obligationId: typeof obligationId;
811
857
  declare const Offer$1_sign: typeof sign;
858
+ declare const Offer$1_signatureMsg: typeof signatureMsg;
812
859
  declare const Offer$1_toSnakeCase: typeof toSnakeCase;
813
860
  declare const Offer$1_types: typeof types;
814
861
  declare namespace Offer$1 {
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 };
862
+ 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_StatusCode as StatusCode, Offer$1_consumedEvent as consumedEvent, decode$2 as decode, Offer$1_domain as domain, encode$2 as encode, from$6 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_signatureMsg as signatureMsg, Offer$1_toSnakeCase as toSnakeCase, Offer$1_types as types };
816
863
  }
817
864
 
818
865
  /**
@@ -992,17 +1039,17 @@ declare const ObligationSchema: z.ZodObject<{
992
1039
  * });
993
1040
  * ```
994
1041
  */
995
- declare function from$4(parameters: from$4.Parameters): from$4.ReturnType;
996
- declare namespace from$4 {
1042
+ declare function from$5(parameters: from$5.Parameters): from$5.ReturnType;
1043
+ declare namespace from$5 {
997
1044
  type Parameters = {
998
1045
  /** The chain id where the liquidity for this obligation is located. */
999
1046
  chainId: Id;
1000
1047
  /** The token that is being borrowed for this obligation. */
1001
1048
  loanToken: Address;
1002
1049
  /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
1003
- collaterals: from$7.Parameters[] | readonly from$7.Parameters[];
1050
+ collaterals: from$8.Parameters[] | readonly from$8.Parameters[];
1004
1051
  /** The maturity of the obligation. */
1005
- maturity: from$6.Parameters;
1052
+ maturity: from$7.Parameters;
1006
1053
  };
1007
1054
  type ReturnType = Obligation;
1008
1055
  type ErrorType = InvalidObligationError;
@@ -1069,7 +1116,7 @@ type Obligation$1_Obligation = Obligation;
1069
1116
  declare const Obligation$1_ObligationSchema: typeof ObligationSchema;
1070
1117
  declare const Obligation$1_id: typeof id;
1071
1118
  declare namespace Obligation$1 {
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 };
1119
+ export { Obligation$1_CollateralsAreNotSortedError as CollateralsAreNotSortedError, Obligation$1_InvalidObligationError as InvalidObligationError, type Obligation$1_Obligation as Obligation, Obligation$1_ObligationSchema as ObligationSchema, from$5 as from, fromSnakeCase$1 as fromSnakeCase, Obligation$1_id as id, random$1 as random };
1073
1120
  }
1074
1121
 
1075
1122
  type Quote = {
@@ -1105,8 +1152,8 @@ declare const QuoteSchema: z.ZodObject<{
1105
1152
  * const quote = Quote.from({ obligationId: "0x123", ask: { assets: 100n, rate: 100n }, bid: { assets: 100n, rate: 100n } });
1106
1153
  * ```
1107
1154
  */
1108
- declare function from$3(parameters: from$3.Parameters): from$3.ReturnType;
1109
- declare namespace from$3 {
1155
+ declare function from$4(parameters: from$4.Parameters): from$4.ReturnType;
1156
+ declare namespace from$4 {
1110
1157
  type Parameters = Quote;
1111
1158
  type ReturnType = Quote;
1112
1159
  type ErrorType = InvalidQuoteError;
@@ -1121,7 +1168,7 @@ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.R
1121
1168
  declare namespace fromSnakeCase {
1122
1169
  type Parameters = Snake<Quote>;
1123
1170
  type ReturnType = Quote;
1124
- type ErrorType = from$3.ErrorType;
1171
+ type ErrorType = from$4.ErrorType;
1125
1172
  }
1126
1173
  /**
1127
1174
  * Generates a random quote.
@@ -1136,7 +1183,7 @@ declare function random(): random.ReturnType;
1136
1183
  declare namespace random {
1137
1184
  type Parameters = never;
1138
1185
  type ReturnType = Quote;
1139
- type ErrorType = from$3.ErrorType;
1186
+ type ErrorType = from$4.ErrorType;
1140
1187
  }
1141
1188
  declare class InvalidQuoteError extends BaseError<z.ZodError | Error> {
1142
1189
  readonly name = "Quote.InvalidQuoteError";
@@ -1150,16 +1197,607 @@ declare const Quote$1_QuoteSchema: typeof QuoteSchema;
1150
1197
  declare const Quote$1_fromSnakeCase: typeof fromSnakeCase;
1151
1198
  declare const Quote$1_random: typeof random;
1152
1199
  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 };
1200
+ export { Quote$1_InvalidQuoteError as InvalidQuoteError, type Quote$1_Quote as Quote, Quote$1_QuoteSchema as QuoteSchema, from$4 as from, Quote$1_fromSnakeCase as fromSnakeCase, Quote$1_random as random };
1201
+ }
1202
+
1203
+ type Tree = Compute<StandardMerkleTree<[Hex]> & {
1204
+ offers: Offer[];
1205
+ root: Hex;
1206
+ }>;
1207
+ declare const VERSION = 1;
1208
+ /**
1209
+ * Builds a Merkle tree from a list of offers.
1210
+ *
1211
+ * Leaves are the offer `hash` values as `bytes32` and are deterministically
1212
+ * ordered in ascending lexicographic order so that the resulting root is stable
1213
+ * regardless of the input order.
1214
+ *
1215
+ * @param offers - Offers to include in the tree.
1216
+ * @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
1217
+ */
1218
+ declare const from$3: (offers: Offer[]) => Tree;
1219
+ /**
1220
+ * Encodes an `Tree` into a Hex string with a version byte prefix and gzipped payload.
1221
+ *
1222
+ * - Layout: `0x{vv}{zip...}` where `{vv}` is one-byte version as two hex chars.
1223
+ * - Payload is gzip(JSON.stringify([root, ...offers])) with bigint stringified.
1224
+ *
1225
+ * @param tree - The offer Merkle tree to encode.
1226
+ * @returns Hex string starting with `0x{vv}` followed by gzipped payload bytes.
1227
+ * @throws Error if the given `root` does not match the offers.
1228
+ */
1229
+ declare const encode$1: (tree: Tree) => Hex;
1230
+ /**
1231
+ * Decodes a Hex string produced by {@link encode} back into an `Tree`.
1232
+ *
1233
+ * - Ensures the first byte version matches {@link VERSION}.
1234
+ * - Decompresses with gunzip, parses JSON, validates offers, and re-checks the root.
1235
+ *
1236
+ * @param encoded - Hex string in the form `0x{vv}{zip...}`.
1237
+ * @returns A validated `Tree` rebuilt from the offers.
1238
+ * @throws Error if the version is invalid or the root does not match the offers.
1239
+ */
1240
+ declare const decode$1: (encoded: Hex) => Tree;
1241
+
1242
+ type Tree$1_Tree = Tree;
1243
+ declare const Tree$1_VERSION: typeof VERSION;
1244
+ declare namespace Tree$1 {
1245
+ export { type Tree$1_Tree as Tree, Tree$1_VERSION as VERSION, decode$1 as decode, encode$1 as encode, from$3 as from };
1154
1246
  }
1155
1247
 
1156
- type ObligationResponse = Snake<Compute<{
1157
- /** The obligation id. */
1158
- id: Hex;
1159
- } & Obligation & {
1160
- ask: Quote["ask"];
1161
- bid: Quote["bid"];
1162
- }>>;
1248
+ /**
1249
+ * This file was auto-generated by openapi-typescript.
1250
+ * Do not make direct changes to the file.
1251
+ */
1252
+
1253
+ interface paths {
1254
+ "/v1/offers": {
1255
+ parameters: {
1256
+ query?: never;
1257
+ header?: never;
1258
+ path?: never;
1259
+ cookie?: never;
1260
+ };
1261
+ /**
1262
+ * List all offers
1263
+ * @description Returns a list of offers for a given obligation and side. Offers are sorted by the best rate (depending on the side), their block number (older offers first) and their assets (bigger offers first).
1264
+ */
1265
+ get: {
1266
+ parameters: {
1267
+ query: {
1268
+ /**
1269
+ * @description Maximum number of offers to return.
1270
+ * @example 10
1271
+ */
1272
+ limit?: number;
1273
+ /**
1274
+ * @description Pagination cursor in base64url-encoded format.
1275
+ * @example eyJvZmZzZXQiOjEwMH0
1276
+ */
1277
+ cursor?: string;
1278
+ /**
1279
+ * @description Obligation id used to filter offers.
1280
+ * @example 0x1234567890123456789012345678901234567890123456789012345678901234
1281
+ */
1282
+ obligation_id: string;
1283
+ /** @example buy */
1284
+ side: "buy" | "sell";
1285
+ };
1286
+ header?: never;
1287
+ path?: never;
1288
+ cookie?: never;
1289
+ };
1290
+ requestBody?: never;
1291
+ responses: {
1292
+ /** @description Success */
1293
+ 200: {
1294
+ headers: {
1295
+ [name: string]: unknown;
1296
+ };
1297
+ content: {
1298
+ "application/json": components["schemas"]["OfferListResponse"];
1299
+ };
1300
+ };
1301
+ /** @description Bad Request */
1302
+ 400: {
1303
+ headers: {
1304
+ [name: string]: unknown;
1305
+ };
1306
+ content: {
1307
+ "application/json": components["schemas"]["BadRequestResponse"];
1308
+ };
1309
+ };
1310
+ };
1311
+ };
1312
+ put?: never;
1313
+ post?: never;
1314
+ delete?: never;
1315
+ options?: never;
1316
+ head?: never;
1317
+ patch?: never;
1318
+ trace?: never;
1319
+ };
1320
+ "/v1/obligations": {
1321
+ parameters: {
1322
+ query?: never;
1323
+ header?: never;
1324
+ path?: never;
1325
+ cookie?: never;
1326
+ };
1327
+ /**
1328
+ * List all obligations
1329
+ * @description Returns a list of obligations with their current best ask and bid. Obligations are sorted by their id in ascending order by default.
1330
+ */
1331
+ get: {
1332
+ parameters: {
1333
+ query?: {
1334
+ /** @example 10 */
1335
+ limit?: number;
1336
+ /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
1337
+ cursor?: string;
1338
+ };
1339
+ header?: never;
1340
+ path?: never;
1341
+ cookie?: never;
1342
+ };
1343
+ requestBody?: never;
1344
+ responses: {
1345
+ /** @description Success */
1346
+ 200: {
1347
+ headers: {
1348
+ [name: string]: unknown;
1349
+ };
1350
+ content: {
1351
+ "application/json": components["schemas"]["ObligationListResponse"];
1352
+ };
1353
+ };
1354
+ /** @description Bad Request */
1355
+ 400: {
1356
+ headers: {
1357
+ [name: string]: unknown;
1358
+ };
1359
+ content: {
1360
+ "application/json": components["schemas"]["BadRequestResponse"];
1361
+ };
1362
+ };
1363
+ };
1364
+ };
1365
+ put?: never;
1366
+ post?: never;
1367
+ delete?: never;
1368
+ options?: never;
1369
+ head?: never;
1370
+ patch?: never;
1371
+ trace?: never;
1372
+ };
1373
+ "/v1/obligations/{obligationId}": {
1374
+ parameters: {
1375
+ query?: never;
1376
+ header?: never;
1377
+ path?: never;
1378
+ cookie?: never;
1379
+ };
1380
+ /**
1381
+ * Get an obligation
1382
+ * @description Returns an obligation by its id.
1383
+ */
1384
+ get: {
1385
+ parameters: {
1386
+ query?: never;
1387
+ header?: never;
1388
+ path?: never;
1389
+ cookie?: never;
1390
+ };
1391
+ requestBody?: never;
1392
+ responses: {
1393
+ /** @description Success */
1394
+ 200: {
1395
+ headers: {
1396
+ [name: string]: unknown;
1397
+ };
1398
+ content: {
1399
+ "application/json": components["schemas"]["ObligationSingleSuccessResponse"];
1400
+ };
1401
+ };
1402
+ /** @description Bad Request */
1403
+ 400: {
1404
+ headers: {
1405
+ [name: string]: unknown;
1406
+ };
1407
+ content: {
1408
+ "application/json": components["schemas"]["BadRequestResponse"];
1409
+ };
1410
+ };
1411
+ };
1412
+ };
1413
+ put?: never;
1414
+ post?: never;
1415
+ delete?: never;
1416
+ options?: never;
1417
+ head?: never;
1418
+ patch?: never;
1419
+ trace?: never;
1420
+ };
1421
+ "/v1/health": {
1422
+ parameters: {
1423
+ query?: never;
1424
+ header?: never;
1425
+ path?: never;
1426
+ cookie?: never;
1427
+ };
1428
+ /**
1429
+ * Retrieve global health
1430
+ * @description Returns the aggregated status of the router.
1431
+ */
1432
+ get: {
1433
+ parameters: {
1434
+ query?: never;
1435
+ header?: never;
1436
+ path?: never;
1437
+ cookie?: never;
1438
+ };
1439
+ requestBody?: never;
1440
+ responses: {
1441
+ /** @description Success */
1442
+ 200: {
1443
+ headers: {
1444
+ [name: string]: unknown;
1445
+ };
1446
+ content: {
1447
+ "application/json": components["schemas"]["RouterStatusSuccessResponse"];
1448
+ };
1449
+ };
1450
+ };
1451
+ };
1452
+ put?: never;
1453
+ post?: never;
1454
+ delete?: never;
1455
+ options?: never;
1456
+ head?: never;
1457
+ patch?: never;
1458
+ trace?: never;
1459
+ };
1460
+ "/v1/health/collectors": {
1461
+ parameters: {
1462
+ query?: never;
1463
+ header?: never;
1464
+ path?: never;
1465
+ cookie?: never;
1466
+ };
1467
+ /**
1468
+ * Retrieve collectors health
1469
+ * @description Returns the latest block numbers processed by collectors and their sync status.
1470
+ */
1471
+ get: {
1472
+ parameters: {
1473
+ query?: never;
1474
+ header?: never;
1475
+ path?: never;
1476
+ cookie?: never;
1477
+ };
1478
+ requestBody?: never;
1479
+ responses: {
1480
+ /** @description Success */
1481
+ 200: {
1482
+ headers: {
1483
+ [name: string]: unknown;
1484
+ };
1485
+ content: {
1486
+ "application/json": components["schemas"]["CollectorsHealthSuccessResponse"];
1487
+ };
1488
+ };
1489
+ };
1490
+ };
1491
+ put?: never;
1492
+ post?: never;
1493
+ delete?: never;
1494
+ options?: never;
1495
+ head?: never;
1496
+ patch?: never;
1497
+ trace?: never;
1498
+ };
1499
+ "/v1/health/chains": {
1500
+ parameters: {
1501
+ query?: never;
1502
+ header?: never;
1503
+ path?: never;
1504
+ cookie?: never;
1505
+ };
1506
+ /**
1507
+ * Retrieve chains health
1508
+ * @description Returns the latest block that can be processed by collectors for each chain.
1509
+ */
1510
+ get: {
1511
+ parameters: {
1512
+ query?: never;
1513
+ header?: never;
1514
+ path?: never;
1515
+ cookie?: never;
1516
+ };
1517
+ requestBody?: never;
1518
+ responses: {
1519
+ /** @description Success */
1520
+ 200: {
1521
+ headers: {
1522
+ [name: string]: unknown;
1523
+ };
1524
+ content: {
1525
+ "application/json": components["schemas"]["ChainsHealthSuccessResponse"];
1526
+ };
1527
+ };
1528
+ };
1529
+ };
1530
+ put?: never;
1531
+ post?: never;
1532
+ delete?: never;
1533
+ options?: never;
1534
+ head?: never;
1535
+ patch?: never;
1536
+ trace?: never;
1537
+ };
1538
+ }
1539
+ interface components {
1540
+ schemas: {
1541
+ OfferListResponse: {
1542
+ /** @enum {string} */
1543
+ status: "success";
1544
+ meta: components["schemas"]["Meta"];
1545
+ /** @example eyJvZmZzZXQiOjEwMH0 */
1546
+ cursor: string | null;
1547
+ /**
1548
+ * @description Offers matching the provided filters.
1549
+ * @example [
1550
+ * {
1551
+ * "hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
1552
+ * "offering": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
1553
+ * "assets": "369216000000000000000000",
1554
+ * "rate": "2750000000000000000",
1555
+ * "maturity": 1761922799,
1556
+ * "expiry": 1761922799,
1557
+ * "start": 1761922790,
1558
+ * "nonce": "571380",
1559
+ * "buy": false,
1560
+ * "chain_id": "1",
1561
+ * "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
1562
+ * "collaterals": [
1563
+ * {
1564
+ * "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
1565
+ * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
1566
+ * "lltv": "860000000000000000"
1567
+ * }
1568
+ * ],
1569
+ * "callback": {
1570
+ * "address": "0x1111111111111111111111111111111111111111",
1571
+ * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
1572
+ * "gas_limit": "500000"
1573
+ * },
1574
+ * "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400",
1575
+ * "consumed": "0",
1576
+ * "block_number": 2942933377146801
1577
+ * }
1578
+ * ]
1579
+ */
1580
+ data: components["schemas"]["OfferListItemResponse"][];
1581
+ };
1582
+ Meta: {
1583
+ /** @example 2024-01-01T12:00:00.000Z */
1584
+ timestamp: string;
1585
+ };
1586
+ OfferListItemResponse: {
1587
+ /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
1588
+ hash: string;
1589
+ /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
1590
+ offering: string;
1591
+ /** @example 369216000000000000000000 */
1592
+ assets: string;
1593
+ /** @example 2750000000000000000 */
1594
+ rate: string;
1595
+ /** @example 1761922799 */
1596
+ maturity: number;
1597
+ /** @example 1761922799 */
1598
+ expiry: number;
1599
+ /** @example 1761922790 */
1600
+ start: number;
1601
+ /** @example 571380 */
1602
+ nonce: string;
1603
+ /** @example false */
1604
+ buy: boolean;
1605
+ /** @example 1 */
1606
+ chain_id: string;
1607
+ /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
1608
+ loan_token: string;
1609
+ /**
1610
+ * @example [
1611
+ * {
1612
+ * "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
1613
+ * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
1614
+ * "lltv": "860000000000000000"
1615
+ * }
1616
+ * ]
1617
+ */
1618
+ collaterals: components["schemas"]["CollateralResponse"][];
1619
+ /**
1620
+ * @example {
1621
+ * "address": "0x1111111111111111111111111111111111111111",
1622
+ * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
1623
+ * "gas_limit": "500000"
1624
+ * }
1625
+ */
1626
+ callback: components["schemas"]["OfferCallbackResponse"];
1627
+ /** @example 0 */
1628
+ consumed: string;
1629
+ /** @example 2942933377146801 */
1630
+ block_number: number;
1631
+ /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
1632
+ signature: string | null;
1633
+ };
1634
+ CollateralResponse: {
1635
+ /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
1636
+ asset: string;
1637
+ /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
1638
+ oracle: string;
1639
+ /** @example 860000000000000000 */
1640
+ lltv: string;
1641
+ };
1642
+ OfferCallbackResponse: {
1643
+ /** @example 0x1111111111111111111111111111111111111111 */
1644
+ address: string;
1645
+ /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
1646
+ data: string;
1647
+ /** @example 500000 */
1648
+ gas_limit: string;
1649
+ };
1650
+ BadRequestResponse: {
1651
+ /** @enum {string} */
1652
+ status: "error";
1653
+ error: components["schemas"]["ErrorResponse"];
1654
+ meta: components["schemas"]["Meta"];
1655
+ };
1656
+ ErrorResponse: {
1657
+ /**
1658
+ * @example VALIDATION_ERROR
1659
+ * @enum {string}
1660
+ */
1661
+ code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
1662
+ /** @example Limit must be greater than 0. */
1663
+ message: string;
1664
+ /**
1665
+ * @example [
1666
+ * {
1667
+ * "field": "limit",
1668
+ * "issue": "Limit must be greater than 0."
1669
+ * }
1670
+ * ]
1671
+ */
1672
+ details: Record<string, never>;
1673
+ };
1674
+ ObligationListResponse: {
1675
+ /** @enum {string} */
1676
+ status: "success";
1677
+ meta: components["schemas"]["Meta"];
1678
+ /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
1679
+ cursor: string | null;
1680
+ /** @description List of obligations with takable offers. */
1681
+ data: components["schemas"]["ObligationResponse"][];
1682
+ };
1683
+ ObligationResponse: {
1684
+ /** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
1685
+ id: string;
1686
+ /** @example 1 */
1687
+ chain_id: string;
1688
+ /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
1689
+ loan_token: string;
1690
+ collaterals: components["schemas"]["CollateralResponse"][];
1691
+ /** @example 1761922800 */
1692
+ maturity: number;
1693
+ ask: components["schemas"]["AskResponse"];
1694
+ bid: components["schemas"]["BidResponse"];
1695
+ };
1696
+ AskResponse: {
1697
+ /** @example 1000000000000000000 */
1698
+ rate: string;
1699
+ };
1700
+ BidResponse: {
1701
+ /** @example 1000000000000000000 */
1702
+ rate: string;
1703
+ };
1704
+ ObligationSingleSuccessResponse: {
1705
+ /** @enum {string} */
1706
+ status: "success";
1707
+ meta: components["schemas"]["Meta"];
1708
+ /** @example null */
1709
+ cursor: string | null;
1710
+ /** @description Obligation details. */
1711
+ data: components["schemas"]["ObligationResponse"];
1712
+ };
1713
+ RouterStatusSuccessResponse: {
1714
+ /** @enum {string} */
1715
+ status: "success";
1716
+ meta: components["schemas"]["Meta"];
1717
+ /**
1718
+ * @description Aggregated router status.
1719
+ * @example {
1720
+ * "status": "live"
1721
+ * }
1722
+ */
1723
+ data: components["schemas"]["RouterStatusDataResponse"];
1724
+ };
1725
+ RouterStatusDataResponse: {
1726
+ /**
1727
+ * @example live
1728
+ * @enum {string}
1729
+ */
1730
+ status: "live" | "syncing";
1731
+ };
1732
+ CollectorsHealthSuccessResponse: {
1733
+ /** @enum {string} */
1734
+ status: "success";
1735
+ meta: components["schemas"]["Meta"];
1736
+ /**
1737
+ * @description Collectors health details and sync status.
1738
+ * @example [
1739
+ * {
1740
+ * "name": "mempool_offers",
1741
+ * "chain_id": "1",
1742
+ * "block_number": 21345678,
1743
+ * "updated_at": "2024-01-01T12:00:00.000Z",
1744
+ * "lag": 0,
1745
+ * "status": "live"
1746
+ * }
1747
+ * ]
1748
+ */
1749
+ data: components["schemas"]["CollectorHealthResponse"][];
1750
+ };
1751
+ CollectorHealthResponse: {
1752
+ /** @example mempool_offers */
1753
+ name: string;
1754
+ /** @example 1 */
1755
+ chain_id: string;
1756
+ /** @example 21345678 */
1757
+ block_number: number | null;
1758
+ /** @example 2024-01-01T12:00:00.000Z */
1759
+ updated_at: string | null;
1760
+ /** @example 0 */
1761
+ lag: number | null;
1762
+ /**
1763
+ * @example live
1764
+ * @enum {string}
1765
+ */
1766
+ status: "live" | "lagging" | "unknown";
1767
+ };
1768
+ ChainsHealthSuccessResponse: {
1769
+ /** @enum {string} */
1770
+ status: "success";
1771
+ meta: components["schemas"]["Meta"];
1772
+ /**
1773
+ * @description Latest processed block per chain.
1774
+ * @example [
1775
+ * {
1776
+ * "chain_id": "1",
1777
+ * "block_number": 21345678,
1778
+ * "updated_at": "2024-01-01T12:00:00.000Z"
1779
+ * }
1780
+ * ]
1781
+ */
1782
+ data: components["schemas"]["ChainHealthResponse"][];
1783
+ };
1784
+ ChainHealthResponse: {
1785
+ /** @example 1 */
1786
+ chain_id: string;
1787
+ /** @example 21345678 */
1788
+ block_number: number;
1789
+ /** @example 2024-01-01T12:00:00.000Z */
1790
+ updated_at: string;
1791
+ };
1792
+ };
1793
+ responses: never;
1794
+ parameters: never;
1795
+ requestBodies: never;
1796
+ headers: never;
1797
+ pathItems: never;
1798
+ }
1799
+
1800
+ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
1163
1801
  /**
1164
1802
  * Creates an `ObligationResponse` from a `Obligation`.
1165
1803
  * @constructor
@@ -1173,7 +1811,7 @@ declare namespace ObligationResponse$1 {
1173
1811
  export { type ObligationResponse$1_ObligationResponse as ObligationResponse, from$2 as from };
1174
1812
  }
1175
1813
 
1176
- type OfferResponse = Snake<Offer>;
1814
+ type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
1177
1815
  /**
1178
1816
  * Creates an `OfferResponse` from an `Offer`.
1179
1817
  * @constructor
@@ -1187,7 +1825,19 @@ declare namespace OfferResponse$1 {
1187
1825
  export { type OfferResponse$1_OfferResponse as OfferResponse, from$1 as from };
1188
1826
  }
1189
1827
 
1190
- declare const OpenApi: node_modules_zod_openapi_dist_components_CXzxKPFp_js.OpenAPIObject;
1828
+ declare class OffersController {
1829
+ getOffers(): Promise<void>;
1830
+ }
1831
+ declare class HealthController {
1832
+ getRouterStatus(): Promise<void>;
1833
+ getCollectorsHealth(): Promise<void>;
1834
+ getChainsHealth(): Promise<void>;
1835
+ }
1836
+ declare class ObligationsController {
1837
+ getObligations(): Promise<void>;
1838
+ getObligation(): Promise<void>;
1839
+ }
1840
+ declare const OpenApi: () => Promise<OpenAPIDocument>;
1191
1841
 
1192
1842
  declare const schemas: {
1193
1843
  readonly get_offers: z.ZodObject<{
@@ -1203,6 +1853,9 @@ declare const schemas: {
1203
1853
  cursor: z.ZodOptional<z.ZodString>;
1204
1854
  limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
1205
1855
  }, z.core.$strip>;
1856
+ readonly get_obligation: z.ZodObject<{
1857
+ obligation_id: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
1858
+ }, z.core.$strip>;
1206
1859
  };
1207
1860
  type Action = keyof typeof schemas;
1208
1861
  declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
@@ -1212,12 +1865,18 @@ declare const index$1_ChainHealth: typeof ChainHealth;
1212
1865
  type index$1_ChainsHealthResponse = ChainsHealthResponse;
1213
1866
  declare const index$1_CollectorHealth: typeof CollectorHealth;
1214
1867
  type index$1_CollectorsHealthResponse = CollectorsHealthResponse;
1868
+ type index$1_HealthController = HealthController;
1869
+ declare const index$1_HealthController: typeof HealthController;
1870
+ type index$1_ObligationsController = ObligationsController;
1871
+ declare const index$1_ObligationsController: typeof ObligationsController;
1872
+ type index$1_OffersController = OffersController;
1873
+ declare const index$1_OffersController: typeof OffersController;
1215
1874
  declare const index$1_OpenApi: typeof OpenApi;
1216
1875
  type index$1_RouterStatusResponse = RouterStatusResponse;
1217
1876
  declare const index$1_parse: typeof parse;
1218
1877
  declare const index$1_safeParse: typeof safeParse;
1219
1878
  declare namespace index$1 {
1220
- export { index$1_ChainHealth as ChainHealth, type index$1_ChainsHealthResponse as ChainsHealthResponse, index$1_CollectorHealth as CollectorHealth, type index$1_CollectorsHealthResponse as CollectorsHealthResponse, ObligationResponse$1 as ObligationResponse, OfferResponse$1 as OfferResponse, index$1_OpenApi as OpenApi, type index$1_RouterStatusResponse as RouterStatusResponse, index$1_parse as parse, index$1_safeParse as safeParse };
1879
+ export { index$1_ChainHealth as ChainHealth, type index$1_ChainsHealthResponse as ChainsHealthResponse, index$1_CollectorHealth as CollectorHealth, type index$1_CollectorsHealthResponse as CollectorsHealthResponse, index$1_HealthController as HealthController, ObligationResponse$1 as ObligationResponse, index$1_ObligationsController as ObligationsController, OfferResponse$1 as OfferResponse, index$1_OffersController as OffersController, index$1_OpenApi as OpenApi, type index$1_RouterStatusResponse as RouterStatusResponse, index$1_parse as parse, index$1_safeParse as safeParse };
1221
1880
  }
1222
1881
 
1223
1882
  type RouterClientConfig = {
@@ -1231,6 +1890,7 @@ type Client$1 = Compute<RouterClientConfig & {
1231
1890
  * Get offers from the router.
1232
1891
  * @param parameters - {@link getOffers.Parameters}
1233
1892
  * @returns The offers with pagination cursor. {@link getOffers.ReturnType}
1893
+ * @throws If the request fails - {@link getOffers.ErrorType}
1234
1894
  *
1235
1895
  * @example
1236
1896
  * ```ts
@@ -1244,12 +1904,13 @@ type Client$1 = Compute<RouterClientConfig & {
1244
1904
  * Get obligations from the router.
1245
1905
  * @param parameters - {@link getObligations.Parameters}
1246
1906
  * @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
1907
+ * @throws If the request fails - {@link getObligations.ErrorType}
1247
1908
  *
1248
1909
  * @example
1249
1910
  * ```ts
1250
1911
  * const router = RouterClient.connect({ url: "https://router.morpho.dev" });
1251
1912
  * const { obligations, cursor } = await router.getObligations();
1252
- * console.log(obligations);
1913
+ * console.log(obligations[0].id()); // 0x123...456
1253
1914
  * ```
1254
1915
  */
1255
1916
  getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
@@ -1267,20 +1928,21 @@ type ConnectOptions = {
1267
1928
  /**
1268
1929
  * Creates an instance of a router client.
1269
1930
  * @constructor
1270
- * @param options - {@link ConnectOptions}
1271
- * @returns A Router Client. {@link Client}
1931
+ * @param parameters - {@link connect.Parameters}
1932
+ * @returns A Router Client. {@link connect.ReturnType}
1272
1933
  *
1273
1934
  * @example
1274
1935
  * ```typescript
1275
1936
  * const router = RouterClient.connect({ url: "https://router.morpho.dev" });
1276
1937
  * ```
1277
1938
  */
1278
- declare function connect$1(options?: ConnectOptions): connect$1.ReturnType;
1939
+ declare function connect$1(parameters?: connect$1.Parameters): connect$1.ReturnType;
1279
1940
  declare namespace connect$1 {
1941
+ type Parameters = ConnectOptions;
1280
1942
  type ReturnType = Client$1;
1281
1943
  type ErrorType = InvalidUrlError;
1282
1944
  }
1283
- declare function getOffers(config: RouterClientConfig, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
1945
+ declare function getOffers(apiClient: Client$3<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
1284
1946
  declare namespace getOffers {
1285
1947
  type Parameters = {
1286
1948
  /** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
@@ -1299,7 +1961,7 @@ declare namespace getOffers {
1299
1961
  };
1300
1962
  type ErrorType = GetApiErrorType;
1301
1963
  }
1302
- declare function getObligations(config: RouterClientConfig, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
1964
+ declare function getObligations(apiClient: Client$3<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
1303
1965
  declare namespace getObligations {
1304
1966
  type Parameters = {
1305
1967
  /** Pagination cursor is a 32-byte hex string. */
@@ -1358,17 +2020,39 @@ declare namespace Client$2 {
1358
2020
  export { type Client$1 as Client, type Client$2_ConnectOptions as ConnectOptions, Client$2_HttpForbiddenError as HttpForbiddenError, Client$2_HttpGetApiFailedError as HttpGetApiFailedError, Client$2_HttpRateLimitError as HttpRateLimitError, Client$2_HttpUnauthorizedError as HttpUnauthorizedError, Client$2_InvalidUrlError as InvalidUrlError, connect$1 as connect, Client$2_getObligations as getObligations, Client$2_getOffers as getOffers };
1359
2021
  }
1360
2022
 
2023
+ type Cursor = {
2024
+ sort: "rate" | "maturity" | "expiry" | "amount";
2025
+ dir: "asc" | "desc";
2026
+ rate?: string;
2027
+ maturity?: number;
2028
+ expiry?: number;
2029
+ assets?: string;
2030
+ hash: string;
2031
+ page?: number;
2032
+ };
2033
+ declare function validate(cursor: unknown): cursor is Cursor;
2034
+ declare function encode(c: Cursor): string;
2035
+ declare function decode(token?: string): Cursor | null;
2036
+
2037
+ type Cursor$1_Cursor = Cursor;
2038
+ declare const Cursor$1_decode: typeof decode;
2039
+ declare const Cursor$1_encode: typeof encode;
2040
+ declare const Cursor$1_validate: typeof validate;
2041
+ declare namespace Cursor$1 {
2042
+ export { type Cursor$1_Cursor as Cursor, Cursor$1_decode as decode, Cursor$1_encode as encode, Cursor$1_validate as validate };
2043
+ }
2044
+
1361
2045
  /**
1362
2046
  * A validation rule.
1363
2047
  */
1364
- type Rule<T, Name extends string = string, Ctx = void> = {
2048
+ type Rule<T, Name extends string = string> = {
1365
2049
  kind: "single";
1366
2050
  name: Name;
1367
- run: Single<T, Name, Ctx>;
2051
+ run: Single<T, Name>;
1368
2052
  } | {
1369
2053
  kind: "batch";
1370
2054
  name: Name;
1371
- run: Batch<T, Name, Ctx>;
2055
+ run: Batch<T, Name>;
1372
2056
  };
1373
2057
  type RuleNames<Rules extends readonly {
1374
2058
  name: string;
@@ -1376,50 +2060,29 @@ type RuleNames<Rules extends readonly {
1376
2060
  /**
1377
2061
  * A single item validation rule.
1378
2062
  * @param item - The item to validate.
1379
- * @param ctx - The context of the validation.
1380
2063
  * @returns The issue that was found. If the item is valid, this will be undefined.
1381
2064
  */
1382
- type Single<T, RuleName extends string, Ctx = void> = (item: T, ctx: Ctx) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
2065
+ type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
1383
2066
  /**
1384
2067
  * A batch item validation rule.
1385
2068
  * @param items - The items to validate.
1386
- * @param ctx - The context of the validation.
1387
2069
  * @returns A map of the items to the issue that was found.
1388
2070
  */
1389
- type Batch<T, RuleName extends string, Ctx = void> = (items: T[], ctx: Ctx) => Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined> | Promise<Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>>;
2071
+ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined> | Promise<Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>>;
1390
2072
  /**
1391
2073
  * Create a validation rule iterating over a single item at a time.
1392
2074
  * @param name - The name of the rule.
1393
2075
  * @param run - The function that validates the rule.
1394
2076
  * @returns The created rule.
1395
2077
  */
1396
- declare function single<Name extends string, T, Ctx = void>(name: Name, run: Single<T, Name, Ctx>): Rule<T, Name, Ctx>;
2078
+ declare function single<Name extends string, T>(name: Name, run: Single<T, Name>): Rule<T, Name>;
1397
2079
  /**
1398
2080
  * Create a validation rule iterating over a batch of items at a time.
1399
2081
  * @param name - The name of the rule.
1400
2082
  * @param run - The function that validates the rule.
1401
2083
  * @returns The created rule.
1402
2084
  */
1403
- declare function batch$1<Name extends string, T, Ctx = void>(name: Name, run: Batch<T, Name, Ctx>): Rule<T, Name, Ctx>;
1404
- type MorphoContext = {
1405
- chain: Chain;
1406
- client: PublicClient;
1407
- };
1408
- declare function morpho(): (Rule<Offer, "chain_id", MorphoContext> | Rule<Offer, "loan_token", MorphoContext> | Rule<Offer, "expiry", MorphoContext> | Rule<Offer, "sell_offers_empty_callback", MorphoContext> | Rule<Offer, "buy_offers_non_empty_callback", MorphoContext> | Rule<Offer, "sell_offers_non_whitelisted_callback", MorphoContext> | Rule<Offer, "sell_offers_callback_data_invalid", MorphoContext> | Rule<Offer, "sell_offers_callback_collateral_invalid", MorphoContext> | Rule<Offer, "buy_offers_callback_data_invalid", MorphoContext> | Rule<Offer, "buy_offers_callback_vault_invalid", MorphoContext> | Rule<Offer, "maturity", MorphoContext>)[];
1409
-
1410
- type ValidationRule_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
1411
- type ValidationRule_MorphoContext = MorphoContext;
1412
- type ValidationRule_Rule<T, Name extends string = string, Ctx = void> = Rule<T, Name, Ctx>;
1413
- type ValidationRule_RuleNames<Rules extends readonly {
1414
- name: string;
1415
- }[]> = RuleNames<Rules>;
1416
- type ValidationRule_Single<T, RuleName extends string, Ctx = void> = Single<T, RuleName, Ctx>;
1417
- declare const ValidationRule_morpho: typeof morpho;
1418
- declare const ValidationRule_single: typeof single;
1419
- declare namespace ValidationRule {
1420
- export { type ValidationRule_Batch as Batch, type ValidationRule_MorphoContext as MorphoContext, type ValidationRule_Rule as Rule, type ValidationRule_RuleNames as RuleNames, type ValidationRule_Single as Single, batch$1 as batch, ValidationRule_morpho as morpho, ValidationRule_single as single };
1421
- }
1422
-
2085
+ declare function batch$1<Name extends string, T>(name: Name, run: Batch<T, Name>): Rule<T, Name>;
1423
2086
  /**
1424
2087
  * A validation issue.
1425
2088
  */
@@ -1440,23 +2103,141 @@ type Result<T, RuleName extends string = string> = {
1440
2103
  /** The reports of the failed validations. */
1441
2104
  issues: Issue<T, RuleName>[];
1442
2105
  };
1443
- declare function run<T, Name extends string, Rules extends readonly Rule<T, Name, void>[]>(parameters: {
1444
- items: T[];
1445
- rules: Rules;
1446
- chunkSize?: number;
1447
- }): Promise<Result<T, RuleNames<Rules>>>;
1448
- declare function run<T, Ctx, Name extends string, Rules extends readonly Rule<T, Name, Ctx>[]>(parameters: {
2106
+ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name>[]>(parameters: {
1449
2107
  items: T[];
1450
2108
  rules: Rules;
1451
- ctx: Ctx;
1452
2109
  chunkSize?: number;
1453
2110
  }): Promise<Result<T, RuleNames<Rules>>>;
1454
2111
 
1455
- type Validation_Issue<T, RuleName extends string = string> = Issue<T, RuleName>;
1456
- type Validation_Result<T, RuleName extends string = string> = Result<T, RuleName>;
1457
- declare const Validation_run: typeof run;
1458
- declare namespace Validation {
1459
- export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
2112
+ type Gate_Batch<T, RuleName extends string> = Batch<T, RuleName>;
2113
+ type Gate_Issue<T, RuleName extends string = string> = Issue<T, RuleName>;
2114
+ type Gate_Result<T, RuleName extends string = string> = Result<T, RuleName>;
2115
+ type Gate_Rule<T, Name extends string = string> = Rule<T, Name>;
2116
+ type Gate_RuleNames<Rules extends readonly {
2117
+ name: string;
2118
+ }[]> = RuleNames<Rules>;
2119
+ type Gate_Single<T, RuleName extends string> = Single<T, RuleName>;
2120
+ declare const Gate_run: typeof run;
2121
+ declare const Gate_single: typeof single;
2122
+ declare namespace Gate {
2123
+ export { type Gate_Batch as Batch, type Gate_Issue as Issue, type Gate_Result as Result, type Gate_Rule as Rule, type Gate_RuleNames as RuleNames, type Gate_Single as Single, batch$1 as batch, Gate_run as run, Gate_single as single };
2124
+ }
2125
+
2126
+ type GateConfig = {
2127
+ callbacks?: CallbackConfig[];
2128
+ maturities?: MaturityType[];
2129
+ };
2130
+ type CallbackConfig = {
2131
+ type: CallbackType.BuyVaultV1Callback;
2132
+ addresses: Address[];
2133
+ vaultFactories: Address[];
2134
+ } | {
2135
+ type: CallbackType.SellERC20Callback;
2136
+ addresses: Address[];
2137
+ } | {
2138
+ type: CallbackType.BuyWithEmptyCallback;
2139
+ };
2140
+ declare function getCallback(chain: ChainName, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
2141
+ type: CallbackType.BuyVaultV1Callback;
2142
+ }> | undefined;
2143
+ declare function getCallback(chain: ChainName, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
2144
+ type: CallbackType.SellERC20Callback;
2145
+ }> | undefined;
2146
+ declare function getCallback(chain: ChainName, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
2147
+ type: CallbackType.BuyWithEmptyCallback;
2148
+ }> | undefined;
2149
+ declare function getCallback(chain: ChainName, type: CallbackType): CallbackConfig | undefined;
2150
+ /**
2151
+ * Attempts to infer the configured callback type from a callback address on a chain.
2152
+ * Skips the empty callback type as it does not carry addresses.
2153
+ *
2154
+ * @param chain - Chain name for which to infer the callback type
2155
+ * @param address - Callback contract address
2156
+ * @returns The callback type when found, otherwise undefined
2157
+ */
2158
+ declare function getCallbackType(chain: ChainName, address: Address): CallbackType | undefined;
2159
+ /**
2160
+ * Returns the callback addresses for a given chain and callback type, if it exists.
2161
+ * @param chain - Chain name for which to read the validation configuration
2162
+ * @param type - Callback type to retrieve
2163
+ * @returns The matching callback addresses or an empty array if not configured
2164
+ */
2165
+ declare function getCallbackTypeAddresses(chain: ChainName, type: CallbackType): Address[];
2166
+ /**
2167
+ * Returns the list of allowed non-empty callback addresses for a chain.
2168
+ *
2169
+ * @param chain - Chain name
2170
+ * @returns Array of allowed callback addresses (lowercased). Empty when none configured
2171
+ */
2172
+ declare const getCallbackAddresses: (chain: ChainName) => Address[];
2173
+ declare const assets: Record<string, Address[]>;
2174
+ declare const configs: Record<ChainName, GateConfig>;
2175
+
2176
+ type GateConfig$1_CallbackConfig = CallbackConfig;
2177
+ type GateConfig$1_GateConfig = GateConfig;
2178
+ declare const GateConfig$1_assets: typeof assets;
2179
+ declare const GateConfig$1_configs: typeof configs;
2180
+ declare const GateConfig$1_getCallback: typeof getCallback;
2181
+ declare const GateConfig$1_getCallbackAddresses: typeof getCallbackAddresses;
2182
+ declare const GateConfig$1_getCallbackType: typeof getCallbackType;
2183
+ declare const GateConfig$1_getCallbackTypeAddresses: typeof getCallbackTypeAddresses;
2184
+ declare namespace GateConfig$1 {
2185
+ export { type GateConfig$1_CallbackConfig as CallbackConfig, type GateConfig$1_GateConfig as GateConfig, GateConfig$1_assets as assets, GateConfig$1_configs as configs, GateConfig$1_getCallback as getCallback, GateConfig$1_getCallbackAddresses as getCallbackAddresses, GateConfig$1_getCallbackType as getCallbackType, GateConfig$1_getCallbackTypeAddresses as getCallbackTypeAddresses };
2186
+ }
2187
+
2188
+ type Rules$1 = readonly Rule<Offer, string>[];
2189
+ type Gatekeeper = {
2190
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
2191
+ };
2192
+ type GatekeeperParameters = {
2193
+ rules: Rules$1;
2194
+ };
2195
+ declare function create(parameters: GatekeeperParameters): Gatekeeper;
2196
+
2197
+ type Gatekeeper$1_Gatekeeper = Gatekeeper;
2198
+ declare const Gatekeeper$1_create: typeof create;
2199
+ declare namespace Gatekeeper$1 {
2200
+ export { type Gatekeeper$1_Gatekeeper as Gatekeeper, type Rules$1 as Rules, Gatekeeper$1_create as create };
2201
+ }
2202
+
2203
+ type ValidityParameters = {
2204
+ chain: Chain;
2205
+ client: PublicClient;
2206
+ };
2207
+ /**
2208
+ * set of rules to validate offers.
2209
+ *
2210
+ * @param parameters - Validity parameters with chain and client
2211
+ * @returns Array of validation rules to evaluate against offers
2212
+ */
2213
+ declare function validity(parameters: ValidityParameters): (Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid"> | Rule<Offer, "expiry">)[];
2214
+ declare const chain: ({ chain }: {
2215
+ chain: Chain;
2216
+ }) => Rule<Offer, "chain_id">;
2217
+ declare const maturity: ({ maturities }: {
2218
+ maturities: MaturityType[];
2219
+ }) => Rule<Offer, "maturity">;
2220
+ declare const callback: ({ callbacks, allowedAddresses, }: {
2221
+ callbacks: CallbackType[];
2222
+ allowedAddresses: Address[];
2223
+ }) => Rule<Offer, "callback">;
2224
+ /**
2225
+ * A validation rule that checks if the offer's token is allowed.
2226
+ * @param offer - The offer to validate.
2227
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
2228
+ */
2229
+ declare const token: ({ assets }: {
2230
+ assets: Address[];
2231
+ }) => Rule<Offer, "token">;
2232
+
2233
+ type Rules_ValidityParameters = ValidityParameters;
2234
+ declare const Rules_callback: typeof callback;
2235
+ declare const Rules_chain: typeof chain;
2236
+ declare const Rules_maturity: typeof maturity;
2237
+ declare const Rules_token: typeof token;
2238
+ declare const Rules_validity: typeof validity;
2239
+ declare namespace Rules {
2240
+ export { type Rules_ValidityParameters as ValidityParameters, Rules_callback as callback, Rules_chain as chain, Rules_maturity as maturity, Rules_token as token, Rules_validity as validity };
1460
2241
  }
1461
2242
 
1462
2243
  declare function from(parameters: from.Parameters): from.ReturnType;
@@ -1473,9 +2254,7 @@ declare namespace from {
1473
2254
  type ErrorType = null;
1474
2255
  }
1475
2256
 
1476
- type AddParameters = {
1477
- offer: Compute<Omit<Offer, "hash" | "createdAt">>;
1478
- };
2257
+ type AddParameters = Compute<Omit<Offer, "hash" | "createdAt">[]>;
1479
2258
  type GetParameters = {
1480
2259
  /** The block number to get offers from. */
1481
2260
  blockNumberGte?: number;
@@ -1491,27 +2270,6 @@ type GetParameters = {
1491
2270
  maxBatchSize?: number;
1492
2271
  };
1493
2272
  };
1494
- type WatchParameters = {
1495
- /** The async function to get the last synced block number from which to start watching.
1496
- * This function will be called periodically on each poll. It should be updated by the caller (e.g. using `onOffers` callback) to track the last synced block number.
1497
- */
1498
- lastSyncedBlock: () => Promise<number>;
1499
- /** The loan asset to watch. */
1500
- loanToken?: string;
1501
- /** The callback to call when a new batch of offers is found in the mempool.
1502
- * @param offers The offers found in the mempool.
1503
- * @param blockNumber The block number of the last processed offer. Block numbers will always ascend.
1504
- */
1505
- onOffers: (offers: Offer[], blockNumber: number) => Promise<void>;
1506
- /** The polling configuration. */
1507
- polling?: {
1508
- /** The interval in milliseconds to poll for new offers. Defaults to 30000. */
1509
- interval?: number;
1510
- /** The maximum number of offers that can be returned in a single batch.
1511
- * Defaults to 100. Maximum is 1000. */
1512
- maxBatchSize?: number;
1513
- };
1514
- };
1515
2273
  /**
1516
2274
  * Mempool client interface.
1517
2275
  */
@@ -1520,21 +2278,13 @@ type Client = {
1520
2278
  * Add an offer to the mempool.
1521
2279
  * @returns The created offer with its hash.
1522
2280
  */
1523
- add: (parameters: AddParameters) => Promise<{
1524
- offer: Offer;
1525
- txHash: Hex;
1526
- }>;
2281
+ add: (parameters: AddParameters) => Promise<Hex>;
1527
2282
  /** Get offers from the mempool. */
1528
2283
  get: (parameters?: GetParameters) => AsyncGenerator<{
1529
2284
  offers: Offer[];
1530
2285
  /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
1531
2286
  blockNumber: number;
1532
2287
  }>;
1533
- /**
1534
- * Watch for new offers on a specific chain.
1535
- * @returns A function to stop watching for new offers.
1536
- */
1537
- watch: (parameters: WatchParameters) => () => boolean;
1538
2288
  /**
1539
2289
  * Stream offers from the mempool.
1540
2290
  * @returns A generator of offers alongside the last block number processed.
@@ -1559,32 +2309,9 @@ declare namespace connect {
1559
2309
  type MempoolClient_AddParameters = AddParameters;
1560
2310
  type MempoolClient_Client = Client;
1561
2311
  type MempoolClient_GetParameters = GetParameters;
1562
- type MempoolClient_WatchParameters = WatchParameters;
1563
2312
  declare const MempoolClient_connect: typeof connect;
1564
2313
  declare namespace MempoolClient {
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 };
1566
- }
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 };
2314
+ export { type MempoolClient_AddParameters as AddParameters, type MempoolClient_Client as Client, type MempoolClient_GetParameters as GetParameters, MempoolClient_connect as connect };
1588
2315
  }
1589
2316
 
1590
2317
  declare function max$1(a: bigint, b: bigint): bigint;
@@ -1667,9 +2394,10 @@ declare const index_lazy: typeof lazy;
1667
2394
  declare const index_min: typeof min;
1668
2395
  declare const index_poll: typeof poll;
1669
2396
  declare const index_retry: typeof retry;
2397
+ declare const index_stringifyBigint: typeof stringifyBigint;
1670
2398
  declare const index_wait: typeof wait;
1671
2399
  declare namespace index {
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 };
2400
+ 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, index_stringifyBigint as stringifyBigint, toSnakeCase$1 as toSnakeCase, index_wait as wait };
1673
2401
  }
1674
2402
 
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 };
2403
+ export { Abi, type Brand, BrandTypeId, Callback, Chain$1 as Chain, Collateral$1 as Collateral, type Compute, Cursor$1 as Cursor, Errors, Format, GateConfig$1 as GateConfig, Gatekeeper$1 as Gatekeeper, 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, Rules, time as Time, Tree$1 as Tree, index as Utils, Gate as Validation };