@morpho-dev/router 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,14 +8,14 @@ import { Client } from "openapi-fetch";
8
8
 
9
9
  //#region rolldown:runtime
10
10
  declare namespace BookResponse_d_exports {
11
- export { BookLevelResponse, from$14 as from };
11
+ export { BookLevelResponse, from$15 as from };
12
12
  }
13
13
  type BookLevelResponse = {
14
14
  price: string;
15
15
  assets: string;
16
16
  count: number;
17
17
  };
18
- declare function from$14(level: {
18
+ declare function from$15(level: {
19
19
  price: bigint;
20
20
  assets: bigint;
21
21
  count: number;
@@ -29,9 +29,9 @@ declare const CollectorHealth: z.ZodObject<{
29
29
  updated_at: z.ZodNullable<z.ZodString>;
30
30
  lag: z.ZodNullable<z.ZodNumber>;
31
31
  status: z.ZodEnum<{
32
- unknown: "unknown";
33
32
  live: "live";
34
33
  lagging: "lagging";
34
+ unknown: "unknown";
35
35
  }>;
36
36
  initialized: z.ZodBoolean;
37
37
  }, z.core.$strip>;
@@ -42,9 +42,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
42
42
  updated_at: z.ZodNullable<z.ZodString>;
43
43
  lag: z.ZodNullable<z.ZodNumber>;
44
44
  status: z.ZodEnum<{
45
- unknown: "unknown";
46
45
  live: "live";
47
46
  lagging: "lagging";
47
+ unknown: "unknown";
48
48
  }>;
49
49
  initialized: z.ZodBoolean;
50
50
  }, z.core.$strip>>;
@@ -339,19 +339,48 @@ declare const Morpho: readonly [{
339
339
  }];
340
340
  readonly stateMutability: "view";
341
341
  }];
342
+ //#endregion
343
+ //#region src/core/types.d.ts
344
+ /** Combines members of an intersection into a readable type. */
345
+ type Compute<type> = { [key in keyof type]: type[key] } & unknown;
346
+ declare const BrandTypeId: unique symbol;
347
+ type Brand<in out ID extends string | symbol> = {
348
+ readonly [BrandTypeId]: { readonly [id in ID]: ID };
349
+ };
342
350
  declare namespace Callback_d_exports {
343
- export { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, decode$2 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$2 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
351
+ export { BuyERC20Data, BuyVaultV1CallbackData, Callback, CallbackPosition, SellERC20CallbackData, Type$1 as Type, decode$2 as decode, decodeBuyERC20, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$2 as encode, encodeBuyERC20, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
344
352
  }
345
- declare enum CallbackType {
353
+ /** A position decoded from callback data. */
354
+ type CallbackPosition = {
355
+ /** The ERC20 token contract address. */contract: Address; /** The maximum amount available from this position. */
356
+ amount: bigint;
357
+ };
358
+ type Callback = {
359
+ type: Type$1.BuyWithEmptyCallback;
360
+ } | (({
361
+ /** The address of the callback contract. */address: Address; /** The ABI-encoded callback data. */
362
+ data: Hex;
363
+ } & {
364
+ type: Type$1.BuyERC20; /** The decoded callback inputs. */
365
+ inputs: {
366
+ /** The ERC20 positions available for the callback. */positions: CallbackPosition[];
367
+ };
368
+ }) & Brand<"Callback">);
369
+ declare enum Type$1 {
346
370
  BuyWithEmptyCallback = "buy_with_empty_callback",
371
+ BuyERC20 = "buy_erc20",
347
372
  BuyVaultV1Callback = "buy_vault_v1_callback",
348
- SellERC20Callback = "sell_erc20_callback",
373
+ SellERC20Callback = "sell_erc20_callback"
349
374
  }
350
375
  declare const isEmptyCallback: (offer: Offer) => boolean;
351
- declare function decode$2(type: CallbackType, data: Hex): {
376
+ declare function decode$2(type: Type$1, data: Hex): {
352
377
  contract: Address;
353
378
  amount: bigint;
354
379
  }[];
380
+ type BuyERC20Data = {
381
+ tokens: Address[];
382
+ amounts: bigint[];
383
+ };
355
384
  type BuyVaultV1CallbackData = {
356
385
  vaults: Address[];
357
386
  amounts: bigint[];
@@ -360,8 +389,28 @@ type SellERC20CallbackData = {
360
389
  collaterals: Address[];
361
390
  amounts: bigint[];
362
391
  };
363
- declare function encode$2(type: CallbackType.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
364
- declare function encode$2(type: CallbackType.SellERC20Callback, data: SellERC20CallbackData): Hex;
392
+ declare function encode$2(type: Type$1.BuyERC20, data: BuyERC20Data): Hex;
393
+ declare function encode$2(type: Type$1.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
394
+ declare function encode$2(type: Type$1.SellERC20Callback, data: SellERC20CallbackData): Hex;
395
+ /**
396
+ * Decodes BuyERC20 callback data into positions.
397
+ * @param data - The ABI-encoded callback data containing token addresses and amounts.
398
+ * @returns Array of positions with contract address and amount.
399
+ * @throws If data is empty, malformed, or arrays have mismatched lengths.
400
+ */
401
+ declare function decodeBuyERC20(data: Hex): Array<{
402
+ contract: Address;
403
+ amount: bigint;
404
+ }>;
405
+ /**
406
+ * Encodes BuyERC20 callback parameters into ABI-encoded data.
407
+ * @param parameters - The tokens and amounts to encode.
408
+ * @returns ABI-encoded hex string.
409
+ */
410
+ declare function encodeBuyERC20(parameters: {
411
+ tokens: Address[];
412
+ amounts: bigint[];
413
+ }): Hex;
365
414
  declare function decodeBuyVaultV1Callback(data: Hex): Array<{
366
415
  contract: Address;
367
416
  amount: bigint;
@@ -423,6 +472,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
423
472
  v1_1: ChainContract;
424
473
  };
425
474
  };
475
+ callbacks: Callback[];
426
476
  }>, "custom"> & {
427
477
  id: Id;
428
478
  name: Name;
@@ -436,6 +486,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
436
486
  v1_1: ChainContract;
437
487
  };
438
488
  };
489
+ callbacks: Callback[];
439
490
  };
440
491
  }>;
441
492
  declare const ChainId: {
@@ -489,17 +540,14 @@ type ChainRegistry = {
489
540
  getById: (chainId: Id) => Chain$1 | undefined;
490
541
  list: () => Chain$1[];
491
542
  };
543
+ /**
544
+ * Creates a chain registry from a list of chains.
545
+ * @param chains - Array of chain objects to register.
546
+ * @returns A registry for looking up chains by ID. {@link ChainRegistry}
547
+ */
492
548
  declare function create$1(chains: Chain$1[]): ChainRegistry;
493
- //#endregion
494
- //#region src/core/types.d.ts
495
- /** Combines members of an intersection into a readable type. */
496
- type Compute<type> = { [key in keyof type]: type[key] } & unknown;
497
- declare const BrandTypeId: unique symbol;
498
- type Brand<in out ID extends string | symbol> = {
499
- readonly [BrandTypeId]: { readonly [id in ID]: ID };
500
- };
501
549
  declare namespace LLTV_d_exports {
502
- export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$13 as from };
550
+ export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$14 as from };
503
551
  }
504
552
  type LLTV = bigint & Brand<"LLTV">;
505
553
  declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
@@ -509,8 +557,8 @@ type Options = (typeof Options)[number];
509
557
  * @param lltv - The LLTV option or the scaled LLTV.
510
558
  * @returns The LLTV.
511
559
  */
512
- declare function from$13(lltv: Options | bigint): LLTV;
513
- declare namespace from$13 {
560
+ declare function from$14(lltv: Options | bigint): LLTV;
561
+ declare namespace from$14 {
514
562
  type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
515
563
  }
516
564
  declare class InvalidOptionError$1 extends BaseError {
@@ -523,14 +571,11 @@ declare class InvalidLLTVError extends BaseError {
523
571
  }
524
572
  declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
525
573
  declare namespace Collateral_d_exports {
526
- export { Collateral, CollateralSchema, CollateralsSchema, from$12 as from, random$3 as random };
574
+ export { Collateral, CollateralSchema, CollateralsSchema, from$13 as from, random$3 as random };
527
575
  }
528
576
  type Collateral = {
529
- /** Asset being used as collateral. */
530
- asset: Address;
531
- /** Liquidation Loan-to-Value of the collateral. */
532
- lltv: LLTV;
533
- /** Oracle contract used to price the collateral. */
577
+ /** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
578
+ lltv: LLTV; /** Oracle contract used to price the collateral. */
534
579
  oracle: Address;
535
580
  };
536
581
  declare const CollateralSchema: z$1.ZodObject<{
@@ -543,8 +588,8 @@ declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
543
588
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
544
589
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
545
590
  }, z$1.core.$strip>>;
546
- declare const from$12: (parameters: from$12.Parameters) => from$12.ReturnType;
547
- declare namespace from$12 {
591
+ declare const from$13: (parameters: from$13.Parameters) => from$13.ReturnType;
592
+ declare namespace from$13 {
548
593
  type Parameters = {
549
594
  asset: Address;
550
595
  lltv: Options | bigint;
@@ -582,8 +627,7 @@ declare namespace ERC4626_d_exports {
582
627
  declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
583
628
  declare namespace decimalsOffset {
584
629
  type Parameters = {
585
- /** The number of decimals of the underlying asset. */
586
- underlyingDecimals: number;
630
+ /** The number of decimals of the underlying asset. */underlyingDecimals: number;
587
631
  };
588
632
  type ReturnType = number;
589
633
  }
@@ -602,11 +646,8 @@ declare namespace decimalsOffset {
602
646
  declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
603
647
  declare namespace convertToAssets {
604
648
  type Parameters = {
605
- /** The amount of shares to convert. */
606
- shares: bigint;
607
- /** Total amount of assets in the vault. */
608
- totalAssets: bigint;
609
- /** Total amount of shares in the vault. */
649
+ /** The amount of shares to convert. */shares: bigint; /** Total amount of assets in the vault. */
650
+ totalAssets: bigint; /** Total amount of shares in the vault. */
610
651
  totalSupply: bigint;
611
652
  /**
612
653
  * OpenZeppelin decimals offset used by the ERC4626 implementation.
@@ -633,11 +674,8 @@ declare namespace convertToAssets {
633
674
  declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
634
675
  declare namespace convertToShares {
635
676
  type Parameters = {
636
- /** The amount of assets to convert. */
637
- assets: bigint;
638
- /** Total amount of assets in the vault. */
639
- totalAssets: bigint;
640
- /** Total amount of shares in the vault. */
677
+ /** The amount of assets to convert. */assets: bigint; /** Total amount of assets in the vault. */
678
+ totalAssets: bigint; /** Total amount of shares in the vault. */
641
679
  totalSupply: bigint;
642
680
  /**
643
681
  * OpenZeppelin decimals offset used by the ERC4626 implementation.
@@ -773,7 +811,7 @@ declare function generateMarketLiquidityPoolId(parameters: {
773
811
  marketId: string;
774
812
  }): string;
775
813
  declare namespace Maturity_d_exports {
776
- export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$11 as from };
814
+ export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$12 as from };
777
815
  }
778
816
  /**
779
817
  * Maturity is a number that represents a date in seconds.
@@ -786,7 +824,7 @@ declare enum MaturityType {
786
824
  EndOfMonth = "end_of_month",
787
825
  EndOfNextMonth = "end_of_next_month",
788
826
  EndOfQuarter = "end_of_quarter",
789
- EndOfNextQuarter = "end_of_next_quarter",
827
+ EndOfNextQuarter = "end_of_next_quarter"
790
828
  }
791
829
  declare const MaturityOptions: {
792
830
  readonly end_of_week: () => Maturity;
@@ -803,8 +841,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
803
841
  * @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
804
842
  * @throws {InvalidOptionError} If the maturity is not a valid option.
805
843
  */
806
- declare function from$11(ts: from$11.Parameters): Maturity;
807
- declare namespace from$11 {
844
+ declare function from$12(ts: from$12.Parameters): Maturity;
845
+ declare namespace from$12 {
808
846
  type Parameters = number | MaturityOptions;
809
847
  type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
810
848
  }
@@ -848,16 +886,12 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
848
886
  declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
849
887
  declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
850
888
  declare namespace Obligation_d_exports {
851
- export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$10 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
889
+ export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
852
890
  }
853
891
  type Obligation = {
854
- /** The chain id where the liquidity for this obligation is located. */
855
- chainId: Id;
856
- /** The token that is being borrowed for this obligation. */
857
- loanToken: Address;
858
- /** The exact set of collaterals required to borrow the loan token. */
859
- collaterals: Collateral[];
860
- /** The maturity of the obligation. */
892
+ /** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
893
+ loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
894
+ collaterals: Collateral[]; /** The maturity of the obligation. */
861
895
  maturity: Maturity;
862
896
  };
863
897
  declare const ObligationSchema: z$1.ZodObject<{
@@ -893,17 +927,13 @@ declare const ObligationSchema: z$1.ZodObject<{
893
927
  * });
894
928
  * ```
895
929
  */
896
- declare function from$10(parameters: from$10.Parameters): from$10.ReturnType;
897
- declare namespace from$10 {
930
+ declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
931
+ declare namespace from$11 {
898
932
  type Parameters = {
899
- /** The chain id where the liquidity for this obligation is located. */
900
- chainId: number;
901
- /** The token that is being borrowed for this obligation. */
902
- loanToken: Address;
903
- /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
904
- collaterals: from$12.Parameters[] | readonly from$12.Parameters[];
905
- /** The maturity of the obligation. */
906
- maturity: from$11.Parameters;
933
+ /** The chain id where the liquidity for this obligation is located. */chainId: number; /** The token that is being borrowed for this obligation. */
934
+ loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
935
+ collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
936
+ maturity: from$12.Parameters;
907
937
  };
908
938
  type ReturnType = Obligation;
909
939
  type ErrorType = InvalidObligationError;
@@ -973,38 +1003,23 @@ declare class CollateralsAreNotSortedError extends BaseError {
973
1003
  constructor();
974
1004
  }
975
1005
  declare namespace Offer_d_exports {
976
- export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$9 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, sign, signatureMsg, toSnakeCase, types };
1006
+ export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, sign, signatureMsg, toSnakeCase, types };
977
1007
  }
978
1008
  type Offer = {
979
- /** The address that made the offer. */
980
- readonly maker: Address;
981
- /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
982
- readonly assets: bigint;
983
- /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
984
- readonly obligationUnits: bigint;
985
- /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
986
- readonly obligationShares: bigint;
987
- /** The price (18 decimals). */
988
- readonly price: bigint;
989
- /** The date at which all interests will be paid. */
990
- readonly maturity: Maturity;
991
- /** The date at which the offer will expire. */
992
- readonly expiry: number;
993
- /** The date at which the offer will start. */
994
- readonly start: number;
995
- /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
996
- readonly group: Hex;
997
- /** The session. Used for session-based offer management. */
998
- readonly session: Hex;
999
- /** The side of the offer. `true` for buy, `false` for sell. */
1000
- readonly buy: boolean;
1001
- /** The chain id where the liquidity for this offer is located. */
1002
- readonly chainId: Id;
1003
- /** The token that is being borrowed. */
1004
- readonly loanToken: Address;
1005
- /** The exact set of collaterals required to borrow the loan token. */
1006
- readonly collaterals: readonly Collateral[];
1007
- /** The optional callback data to retrieve the maker funds. */
1009
+ /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
1010
+ readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
1011
+ readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
1012
+ readonly obligationShares: bigint; /** The price (18 decimals). */
1013
+ readonly price: bigint; /** The date at which all interests will be paid. */
1014
+ readonly maturity: Maturity; /** The date at which the offer will expire. */
1015
+ readonly expiry: number; /** The date at which the offer will start. */
1016
+ readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
1017
+ readonly group: Hex; /** The session. Used for session-based offer management. */
1018
+ readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
1019
+ readonly buy: boolean; /** The chain id where the liquidity for this offer is located. */
1020
+ readonly chainId: Id; /** The token that is being borrowed. */
1021
+ readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1022
+ readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
1008
1023
  readonly callback: {
1009
1024
  readonly address: Address;
1010
1025
  readonly data: Hex;
@@ -1012,7 +1027,7 @@ type Offer = {
1012
1027
  };
1013
1028
  declare enum Status {
1014
1029
  VALID = "VALID",
1015
- SIMULATION_ERROR = "SIMULATION_ERROR",
1030
+ SIMULATION_ERROR = "SIMULATION_ERROR"
1016
1031
  }
1017
1032
  type Validation = {
1018
1033
  offerHash: Hex;
@@ -1055,12 +1070,9 @@ declare const OfferSchema: () => z$1.ZodObject<{
1055
1070
  */
1056
1071
  type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares"> & {
1057
1072
  chainId: number;
1058
- group: Hex | bigint | number | string;
1059
- /** Optional: defaults to zero bytes32. */
1060
- session?: Hex | bigint | number | string;
1061
- /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
1062
- obligationUnits?: bigint;
1063
- /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
1073
+ group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
1074
+ session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
1075
+ obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
1064
1076
  obligationShares?: bigint;
1065
1077
  }>;
1066
1078
  /**
@@ -1069,8 +1081,8 @@ type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligat
1069
1081
  * @param input - The offer to create.
1070
1082
  * @returns The created offer.
1071
1083
  */
1072
- declare function from$9(input: OfferInput): Offer;
1073
- declare namespace from$9 {
1084
+ declare function from$10(input: OfferInput): Offer;
1085
+ declare namespace from$10 {
1074
1086
  type ErrorType = InvalidOfferError;
1075
1087
  }
1076
1088
  /**
@@ -1301,19 +1313,15 @@ declare class AccountNotSetError extends BaseError {
1301
1313
  constructor();
1302
1314
  }
1303
1315
  declare namespace Oracle_d_exports {
1304
- export { Conversion, Oracle, from$8 as from };
1316
+ export { Conversion, Oracle, from$9 as from };
1305
1317
  }
1306
1318
  /**
1307
1319
  * An oracle contract that provides price information for assets.
1308
1320
  */
1309
1321
  type Oracle = {
1310
- /** The chain id where the oracle is deployed. */
1311
- readonly chainId: Id;
1312
- /** The address of the oracle contract. */
1313
- readonly address: Address;
1314
- /** The price returned by the oracle (in the oracle's native units), null if no price available. */
1315
- readonly price: bigint | null;
1316
- /** The block number at which the price was fetched. */
1322
+ /** The chain id where the oracle is deployed. */readonly chainId: Id; /** The address of the oracle contract. */
1323
+ readonly address: Address; /** The price returned by the oracle (in the oracle's native units), null if no price available. */
1324
+ readonly price: bigint | null; /** The block number at which the price was fetched. */
1317
1325
  readonly blockNumber: number;
1318
1326
  };
1319
1327
  /**
@@ -1321,8 +1329,8 @@ type Oracle = {
1321
1329
  * @param data - The data to create the oracle from.
1322
1330
  * @returns The created oracle.
1323
1331
  */
1324
- declare function from$8(data: from$8.Parameters): from$8.ReturnType;
1325
- declare namespace from$8 {
1332
+ declare function from$9(data: from$9.Parameters): from$9.ReturnType;
1333
+ declare namespace from$9 {
1326
1334
  type Parameters = {
1327
1335
  chainId: Id;
1328
1336
  address: Address;
@@ -1363,33 +1371,28 @@ declare namespace Conversion {
1363
1371
  }): bigint;
1364
1372
  }
1365
1373
  declare namespace Position_d_exports {
1366
- export { Position, Type, from$7 as from };
1374
+ export { Position, Type, from$8 as from };
1367
1375
  }
1368
1376
  type Position = {
1369
- /** The chain id. */
1370
- chainId: Id;
1377
+ /** The chain id. */chainId: Id;
1371
1378
  /** The contract address from which the position is called.
1372
1379
  * While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
1373
1380
  * For example, when depositing into a vault, we would specify the vault contract address as the contract not the underlying vault's ERC20 token address.
1374
1381
  */
1375
- contract: Address;
1376
- /** The user address. */
1377
- user: Address;
1378
- /** The type of position. */
1379
- type: Type;
1380
- /** The balance of the position. */
1382
+ contract: Address; /** The user address. */
1383
+ user: Address; /** The type of position. */
1384
+ type: Type; /** The balance of the position. */
1381
1385
  balance?: bigint;
1382
1386
  /** The underlying asset of the position.
1383
1387
  * For ERC20 positions, this equals the contract address.
1384
1388
  * For vault positions, this is the vault's underlying asset.
1385
1389
  */
1386
- asset?: Address;
1387
- /** The block number at which the position was last updated. */
1390
+ asset?: Address; /** The block number at which the position was last updated. */
1388
1391
  blockNumber: number;
1389
1392
  };
1390
1393
  declare enum Type {
1391
1394
  ERC20 = "erc20",
1392
- VAULT_V1 = "vault_v1",
1395
+ VAULT_V1 = "vault_v1"
1393
1396
  }
1394
1397
  /**
1395
1398
  * @constructor
@@ -1397,8 +1400,8 @@ declare enum Type {
1397
1400
  * @param parameters - {@link from.Parameters}
1398
1401
  * @returns The created Position. {@link from.ReturnType}
1399
1402
  */
1400
- declare function from$7(parameters: from$7.Parameters): from$7.ReturnType;
1401
- declare namespace from$7 {
1403
+ declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
1404
+ declare namespace from$8 {
1402
1405
  type Parameters = {
1403
1406
  chainId: Id;
1404
1407
  contract: Address;
@@ -1411,18 +1414,15 @@ declare namespace from$7 {
1411
1414
  type ReturnType = Position;
1412
1415
  }
1413
1416
  declare namespace Quote_d_exports {
1414
- export { InvalidQuoteError, Quote, QuoteSchema, from$6 as from, fromSnakeCase, random };
1417
+ export { InvalidQuoteError, Quote, QuoteSchema, from$7 as from, fromSnakeCase, random };
1415
1418
  }
1416
1419
  type Quote = {
1417
- /** The obligation id. */
1418
- obligationId: Hex;
1420
+ /** The obligation id. */obligationId: Hex;
1419
1421
  ask: {
1420
- /** The ask price for the obligation. (18 decimals). */
1421
- price: bigint;
1422
+ /** The ask price for the obligation. (18 decimals). */price: bigint;
1422
1423
  };
1423
1424
  bid: {
1424
- /** The bid price for the obligation. (18 decimals). */
1425
- price: bigint;
1425
+ /** The bid price for the obligation. (18 decimals). */price: bigint;
1426
1426
  };
1427
1427
  };
1428
1428
  declare const QuoteSchema: z$1.ZodObject<{
@@ -1446,8 +1446,8 @@ declare const QuoteSchema: z$1.ZodObject<{
1446
1446
  * const quote = Quote.from({ obligationId: "0x123", ask: { price: 100n }, bid: { price: 100n } });
1447
1447
  * ```
1448
1448
  */
1449
- declare function from$6(parameters: from$6.Parameters): from$6.ReturnType;
1450
- declare namespace from$6 {
1449
+ declare function from$7(parameters: from$7.Parameters): from$7.ReturnType;
1450
+ declare namespace from$7 {
1451
1451
  type Parameters = Quote;
1452
1452
  type ReturnType = Quote;
1453
1453
  type ErrorType = InvalidQuoteError;
@@ -1462,7 +1462,7 @@ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.R
1462
1462
  declare namespace fromSnakeCase {
1463
1463
  type Parameters = Snake<Quote>;
1464
1464
  type ReturnType = Quote;
1465
- type ErrorType = from$6.ErrorType;
1465
+ type ErrorType = from$7.ErrorType;
1466
1466
  }
1467
1467
  /**
1468
1468
  * Generates a random quote.
@@ -1477,12 +1477,85 @@ declare function random(): random.ReturnType;
1477
1477
  declare namespace random {
1478
1478
  type Parameters = never;
1479
1479
  type ReturnType = Quote;
1480
- type ErrorType = from$6.ErrorType;
1480
+ type ErrorType = from$7.ErrorType;
1481
1481
  }
1482
1482
  declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
1483
1483
  readonly name = "Quote.InvalidQuoteError";
1484
1484
  constructor(error: z$1.ZodError | Error);
1485
1485
  }
1486
+ declare namespace TradingFee_d_exports {
1487
+ export { BREAKPOINTS, Fees, InvalidFeeError, InvalidFeesLengthError, TradingFee, WAD, activate, compute, deactivate, from$6 as from, getFees, isActivated };
1488
+ }
1489
+ /**
1490
+ * Time breakpoints in seconds for piecewise linear fee interpolation.
1491
+ * Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d.
1492
+ */
1493
+ declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n];
1494
+ /** WAD constant (1e18) for fee scaling. */
1495
+ declare const WAD: bigint;
1496
+ /** Tuple type for the 6 fee values at each breakpoint. */
1497
+ type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint];
1498
+ /**
1499
+ * TradingFee represents a piecewise linear fee curve with 6 breakpoints.
1500
+ * The internal storage mimics on-chain bitmap behavior but uses a struct for clarity.
1501
+ */
1502
+ type TradingFee = {
1503
+ readonly _activated: boolean;
1504
+ readonly _fees: Fees;
1505
+ } & Brand<"TradingFee">;
1506
+ /**
1507
+ * Create a TradingFee from an activation flag and 6 fee values.
1508
+ * @param activated - Whether the fee is active.
1509
+ * @param fees - Tuple of 6 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d).
1510
+ * @returns A new TradingFee instance.
1511
+ * @throws {@link InvalidFeeError} if any fee exceeds WAD (100%).
1512
+ * @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 6 elements.
1513
+ */
1514
+ declare function from$6(activated: boolean, fees: Fees): TradingFee;
1515
+ declare namespace from$6 {
1516
+ type ErrorType = InvalidFeeError | InvalidFeesLengthError;
1517
+ }
1518
+ /**
1519
+ * Compute the trading fee for a given time to maturity using piecewise linear interpolation.
1520
+ * @param tradingFee - The TradingFee instance.
1521
+ * @param timeToMaturity - Time to maturity in seconds.
1522
+ * @returns The interpolated fee in WAD. Returns 0n if not activated.
1523
+ */
1524
+ declare function compute(tradingFee: TradingFee, timeToMaturity: number): bigint;
1525
+ /**
1526
+ * Check if the trading fee is activated.
1527
+ * @param tradingFee - The TradingFee instance.
1528
+ * @returns True if activated, false otherwise.
1529
+ */
1530
+ declare function isActivated(tradingFee: TradingFee): boolean;
1531
+ /**
1532
+ * Create a new TradingFee with activation enabled.
1533
+ * @param tradingFee - The TradingFee instance.
1534
+ * @returns A new TradingFee with activated set to true.
1535
+ */
1536
+ declare function activate(tradingFee: TradingFee): TradingFee;
1537
+ /**
1538
+ * Create a new TradingFee with activation disabled.
1539
+ * @param tradingFee - The TradingFee instance.
1540
+ * @returns A new TradingFee with activated set to false.
1541
+ */
1542
+ declare function deactivate(tradingFee: TradingFee): TradingFee;
1543
+ /**
1544
+ * Get the fee values at each breakpoint.
1545
+ * @param tradingFee - The TradingFee instance.
1546
+ * @returns The tuple of 6 fee values.
1547
+ */
1548
+ declare function getFees(tradingFee: TradingFee): Fees;
1549
+ /** Error thrown when a fee value is invalid (negative or exceeds WAD). */
1550
+ declare class InvalidFeeError extends BaseError {
1551
+ readonly name = "TradingFee.InvalidFeeError";
1552
+ constructor(fee: bigint, index: number);
1553
+ }
1554
+ /** Error thrown when fees array doesn't have exactly 6 elements. */
1555
+ declare class InvalidFeesLengthError extends BaseError {
1556
+ readonly name = "TradingFee.InvalidFeesLengthError";
1557
+ constructor(length: number);
1558
+ }
1486
1559
  declare namespace Transfer_d_exports {
1487
1560
  export { Transfer, from$5 as from };
1488
1561
  }
@@ -1528,15 +1601,11 @@ declare namespace Tree_d_exports {
1528
1601
  * Constructed via {@link from}. The tree root can be signed for onchain broadcast.
1529
1602
  */
1530
1603
  type Tree = Compute<StandardMerkleTree<[Hex]> & {
1531
- /** The offers in the tree. */
1532
- offers: Offer[];
1533
- /** The root of the tree. */
1604
+ /** The offers in the tree. */offers: Offer[]; /** The root of the tree. */
1534
1605
  root: Hex;
1535
1606
  }>;
1536
1607
  type Proof = {
1537
- /** The offer that the proof is for. */
1538
- offer: Offer;
1539
- /** The merkle proof path for the offer. */
1608
+ /** The offer that the proof is for. */offer: Offer; /** The merkle proof path for the offer. */
1540
1609
  path: Hex[];
1541
1610
  };
1542
1611
  declare const VERSION = 1;
@@ -1669,7 +1738,6 @@ declare class DecodeError extends BaseError {
1669
1738
  * This file was auto-generated by openapi-typescript.
1670
1739
  * Do not make direct changes to the file.
1671
1740
  */
1672
-
1673
1741
  interface paths {
1674
1742
  "/v1/books/{obligationId}/{side}": {
1675
1743
  parameters: {
@@ -1713,16 +1781,14 @@ interface paths {
1713
1781
  };
1714
1782
  requestBody?: never;
1715
1783
  responses: {
1716
- /** @description Success */
1717
- 200: {
1784
+ /** @description Success */200: {
1718
1785
  headers: {
1719
1786
  [name: string]: unknown;
1720
1787
  };
1721
1788
  content: {
1722
1789
  "application/json": components["schemas"]["BookListResponse"];
1723
1790
  };
1724
- };
1725
- /** @description Bad Request */
1791
+ }; /** @description Bad Request */
1726
1792
  400: {
1727
1793
  headers: {
1728
1794
  [name: string]: unknown;
@@ -1750,7 +1816,7 @@ interface paths {
1750
1816
  };
1751
1817
  /**
1752
1818
  * Get router configuration
1753
- * @description Returns chain configurations including contract addresses and supported maturity timestamps.
1819
+ * @description Returns chain configurations including contract addresses and supported callback types.
1754
1820
  */
1755
1821
  get: {
1756
1822
  parameters: {
@@ -1761,8 +1827,7 @@ interface paths {
1761
1827
  };
1762
1828
  requestBody?: never;
1763
1829
  responses: {
1764
- /** @description Success */
1765
- 200: {
1830
+ /** @description Success */200: {
1766
1831
  headers: {
1767
1832
  [name: string]: unknown;
1768
1833
  };
@@ -1826,16 +1891,14 @@ interface paths {
1826
1891
  };
1827
1892
  requestBody?: never;
1828
1893
  responses: {
1829
- /** @description Success */
1830
- 200: {
1894
+ /** @description Success */200: {
1831
1895
  headers: {
1832
1896
  [name: string]: unknown;
1833
1897
  };
1834
1898
  content: {
1835
1899
  "application/json": components["schemas"]["OfferListResponse"];
1836
1900
  };
1837
- };
1838
- /** @description Bad Request */
1901
+ }; /** @description Bad Request */
1839
1902
  400: {
1840
1903
  headers: {
1841
1904
  [name: string]: unknown;
@@ -1869,25 +1932,25 @@ interface paths {
1869
1932
  parameters: {
1870
1933
  query?: {
1871
1934
  /**
1872
- * @description Filter by exact maturity timestamp (unix seconds).
1873
- * @example 1761922800
1935
+ * @description Filter by exact maturity timestamps (comma-separated, unix seconds).
1936
+ * @example 1761922800,1764524800
1874
1937
  */
1875
- maturity?: number;
1938
+ maturities?: number[];
1876
1939
  /**
1877
- * @description Filter by collateral token (matches any collateral in the obligation).
1878
- * @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751
1940
+ * @description Filter by collateral tokens (comma-separated, matches any collateral).
1941
+ * @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751,0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
1879
1942
  */
1880
- collateral_token?: string;
1943
+ collateral_tokens?: string[];
1881
1944
  /**
1882
- * @description Filter by loan token address.
1883
- * @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
1945
+ * @description Filter by loan token addresses (comma-separated).
1946
+ * @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078,0x34Cf890dB685FC536E05652FB41f02090c3fb751
1884
1947
  */
1885
- loan_token?: string;
1948
+ loan_tokens?: string[];
1886
1949
  /**
1887
- * @description Filter by chain ID.
1888
- * @example 1
1950
+ * @description Filter by chain IDs (comma-separated).
1951
+ * @example 1,8453
1889
1952
  */
1890
- chain?: number;
1953
+ chains?: number[];
1891
1954
  /**
1892
1955
  * @description Maximum number of obligations to return.
1893
1956
  * @example 10
@@ -1905,16 +1968,14 @@ interface paths {
1905
1968
  };
1906
1969
  requestBody?: never;
1907
1970
  responses: {
1908
- /** @description Success */
1909
- 200: {
1971
+ /** @description Success */200: {
1910
1972
  headers: {
1911
1973
  [name: string]: unknown;
1912
1974
  };
1913
1975
  content: {
1914
1976
  "application/json": components["schemas"]["ObligationListResponse"];
1915
1977
  };
1916
- };
1917
- /** @description Bad Request */
1978
+ }; /** @description Bad Request */
1918
1979
  400: {
1919
1980
  headers: {
1920
1981
  [name: string]: unknown;
@@ -1959,16 +2020,14 @@ interface paths {
1959
2020
  };
1960
2021
  requestBody?: never;
1961
2022
  responses: {
1962
- /** @description Success */
1963
- 200: {
2023
+ /** @description Success */200: {
1964
2024
  headers: {
1965
2025
  [name: string]: unknown;
1966
2026
  };
1967
2027
  content: {
1968
2028
  "application/json": components["schemas"]["ObligationSingleSuccessResponse"];
1969
2029
  };
1970
- };
1971
- /** @description Bad Request */
2030
+ }; /** @description Bad Request */
1972
2031
  400: {
1973
2032
  headers: {
1974
2033
  [name: string]: unknown;
@@ -2013,8 +2072,7 @@ interface paths {
2013
2072
  };
2014
2073
  requestBody?: never;
2015
2074
  responses: {
2016
- /** @description Success */
2017
- 200: {
2075
+ /** @description Success */200: {
2018
2076
  headers: {
2019
2077
  [name: string]: unknown;
2020
2078
  };
@@ -2058,8 +2116,7 @@ interface paths {
2058
2116
  };
2059
2117
  requestBody?: never;
2060
2118
  responses: {
2061
- /** @description Success */
2062
- 200: {
2119
+ /** @description Success */200: {
2063
2120
  headers: {
2064
2121
  [name: string]: unknown;
2065
2122
  };
@@ -2103,8 +2160,7 @@ interface paths {
2103
2160
  };
2104
2161
  requestBody?: never;
2105
2162
  responses: {
2106
- /** @description Success */
2107
- 200: {
2163
+ /** @description Success */200: {
2108
2164
  headers: {
2109
2165
  [name: string]: unknown;
2110
2166
  };
@@ -2159,16 +2215,14 @@ interface paths {
2159
2215
  };
2160
2216
  requestBody?: never;
2161
2217
  responses: {
2162
- /** @description Success */
2163
- 200: {
2218
+ /** @description Success */200: {
2164
2219
  headers: {
2165
2220
  [name: string]: unknown;
2166
2221
  };
2167
2222
  content: {
2168
2223
  "application/json": components["schemas"]["PositionListResponse"];
2169
2224
  };
2170
- };
2171
- /** @description Bad Request */
2225
+ }; /** @description Bad Request */
2172
2226
  400: {
2173
2227
  headers: {
2174
2228
  [name: string]: unknown;
@@ -2222,16 +2276,14 @@ interface paths {
2222
2276
  };
2223
2277
  };
2224
2278
  responses: {
2225
- /** @description Success */
2226
- 200: {
2279
+ /** @description Success */200: {
2227
2280
  headers: {
2228
2281
  [name: string]: unknown;
2229
2282
  };
2230
2283
  content: {
2231
2284
  "application/json": components["schemas"]["ValidationSuccessResponse"];
2232
2285
  };
2233
- };
2234
- /** @description Bad Request */
2286
+ }; /** @description Bad Request */
2235
2287
  400: {
2236
2288
  headers: {
2237
2289
  [name: string]: unknown;
@@ -2252,22 +2304,16 @@ interface paths {
2252
2304
  interface components {
2253
2305
  schemas: {
2254
2306
  BookListResponse: {
2255
- meta: components["schemas"]["Meta"];
2256
- /** @example eyJvZmZzZXQiOjEwMH0 */
2257
- cursor: string | null;
2258
- /** @description Aggregated book levels grouped by computed price. */
2307
+ meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
2308
+ cursor: string | null; /** @description Aggregated book levels grouped by computed price. */
2259
2309
  data: components["schemas"]["BookLevelResponse"][];
2260
2310
  };
2261
2311
  Meta: {
2262
- /** @example 2024-01-01T12:00:00.000Z */
2263
- timestamp: string;
2312
+ /** @example 2024-01-01T12:00:00.000Z */timestamp: string;
2264
2313
  };
2265
2314
  BookLevelResponse: {
2266
- /** @example 2750000000000000000 */
2267
- price: string;
2268
- /** @example 369216000000000000000000 */
2269
- assets: string;
2270
- /** @example 5 */
2315
+ /** @example 2750000000000000000 */price: string; /** @example 369216000000000000000000 */
2316
+ assets: string; /** @example 5 */
2271
2317
  count: number;
2272
2318
  };
2273
2319
  BadRequestResponse: {
@@ -2279,8 +2325,7 @@ interface components {
2279
2325
  * @example VALIDATION_ERROR
2280
2326
  * @enum {string}
2281
2327
  */
2282
- code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
2283
- /** @example Limit must be greater than 0. */
2328
+ code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST"; /** @example Limit must be greater than 0. */
2284
2329
  message: string;
2285
2330
  /**
2286
2331
  * @example [
@@ -2293,8 +2338,7 @@ interface components {
2293
2338
  details: Record<string, never>;
2294
2339
  };
2295
2340
  ConfigSuccessResponse: {
2296
- meta: components["schemas"]["Meta"];
2297
- /** @example null */
2341
+ meta: components["schemas"]["Meta"]; /** @example null */
2298
2342
  cursor: string | null;
2299
2343
  /**
2300
2344
  * @description Array of chain configurations for all indexed chains.
@@ -2304,47 +2348,31 @@ interface components {
2304
2348
  * "contracts": {
2305
2349
  * "mempool": "0xD946246695A9259F3B33a78629026F61B3Ab40aF"
2306
2350
  * },
2307
- * "maturities": {
2308
- * "end_of_month": 1738335600,
2309
- * "end_of_next_month": 1740754800
2310
- * }
2351
+ * "callbacks": [
2352
+ * "buy_with_empty_callback"
2353
+ * ]
2311
2354
  * }
2312
2355
  * ]
2313
2356
  */
2314
2357
  data: components["schemas"]["ConfigDataResponse"][];
2315
2358
  };
2316
2359
  ConfigDataResponse: {
2317
- /** @example 505050505 */
2318
- chain_id: number;
2360
+ /** @example 505050505 */chain_id: number;
2319
2361
  contracts: components["schemas"]["ConfigContractsResponse"];
2320
2362
  /**
2321
- * @description Supported maturity timestamps. Offers must use one of these values.
2322
- * @example {
2323
- * "end_of_month": 1738335600,
2324
- * "end_of_next_month": 1740754800
2325
- * }
2363
+ * @description Supported callback types for this chain.
2364
+ * @example [
2365
+ * "buy_with_empty_callback"
2366
+ * ]
2367
+ * @enum {string}
2326
2368
  */
2327
- maturities: components["schemas"]["MaturitiesResponse"];
2369
+ callbacks: "buy_with_empty_callback" | "buy_erc20" | "buy_vault_v1_callback" | "sell_erc20_callback";
2328
2370
  };
2329
2371
  ConfigContractsResponse: {
2330
- /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
2331
- mempool: string;
2332
- };
2333
- MaturitiesResponse: {
2334
- /**
2335
- * @description Unix timestamp for end of current month maturity (last Friday 15:00 UTC).
2336
- * @example 1738335600
2337
- */
2338
- end_of_month: number;
2339
- /**
2340
- * @description Unix timestamp for end of next month maturity (last Friday 15:00 UTC).
2341
- * @example 1740754800
2342
- */
2343
- end_of_next_month: number;
2372
+ /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */mempool: string;
2344
2373
  };
2345
2374
  OfferListResponse: {
2346
- meta: components["schemas"]["Meta"];
2347
- /** @example eyJvZmZzZXQiOjEwMH0 */
2375
+ meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
2348
2376
  cursor: string | null;
2349
2377
  /**
2350
2378
  * @description Offers matching the provided filters.
@@ -2420,20 +2448,13 @@ interface components {
2420
2448
  * "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
2421
2449
  * }
2422
2450
  */
2423
- offer: components["schemas"]["OfferDataResponse"];
2424
- /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
2425
- offer_hash: string;
2426
- /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
2427
- obligation_id: string;
2428
- /** @example 1 */
2429
- chain_id: number;
2430
- /** @example 0 */
2431
- consumed: string;
2432
- /** @example 369216000000000000000000 */
2433
- takeable: string;
2434
- /** @example 2942933377146801 */
2435
- block_number: number;
2436
- /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
2451
+ offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
2452
+ offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
2453
+ obligation_id: string; /** @example 1 */
2454
+ chain_id: number; /** @example 0 */
2455
+ consumed: string; /** @example 369216000000000000000000 */
2456
+ takeable: string; /** @example 2942933377146801 */
2457
+ block_number: number; /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
2437
2458
  root: string | null;
2438
2459
  /**
2439
2460
  * @example [
@@ -2441,8 +2462,7 @@ interface components {
2441
2462
  * "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
2442
2463
  * ]
2443
2464
  */
2444
- proof: string[] | null;
2445
- /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
2465
+ proof: string[] | null; /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
2446
2466
  signature: string | null;
2447
2467
  };
2448
2468
  OfferDataResponse: {
@@ -2459,35 +2479,22 @@ interface components {
2459
2479
  * "maturity": 1761922799
2460
2480
  * }
2461
2481
  */
2462
- obligation: components["schemas"]["ObligationOfferResponse"];
2463
- /** @example false */
2464
- buy: boolean;
2465
- /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
2466
- maker: string;
2467
- /** @example 369216000000000000000000 */
2468
- assets: string;
2469
- /** @example 0 */
2470
- obligation_units: string;
2471
- /** @example 0 */
2472
- obligation_shares: string;
2473
- /** @example 1761922790 */
2474
- start: number;
2475
- /** @example 1761922799 */
2476
- expiry: number;
2477
- /** @example 2750000000000000000 */
2478
- price: string;
2479
- /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
2480
- group: string;
2481
- /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
2482
- session: string;
2483
- /** @example 0x1111111111111111111111111111111111111111 */
2484
- callback: string;
2485
- /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2482
+ obligation: components["schemas"]["ObligationOfferResponse"]; /** @example false */
2483
+ buy: boolean; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
2484
+ maker: string; /** @example 369216000000000000000000 */
2485
+ assets: string; /** @example 0 */
2486
+ obligation_units: string; /** @example 0 */
2487
+ obligation_shares: string; /** @example 1761922790 */
2488
+ start: number; /** @example 1761922799 */
2489
+ expiry: number; /** @example 2750000000000000000 */
2490
+ price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
2491
+ group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
2492
+ session: string; /** @example 0x1111111111111111111111111111111111111111 */
2493
+ callback: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2486
2494
  callback_data: string;
2487
2495
  };
2488
2496
  ObligationOfferResponse: {
2489
- /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2490
- loan_token: string;
2497
+ /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
2491
2498
  /**
2492
2499
  * @example [
2493
2500
  * {
@@ -2497,51 +2504,37 @@ interface components {
2497
2504
  * }
2498
2505
  * ]
2499
2506
  */
2500
- collaterals: components["schemas"]["CollateralResponse"][];
2501
- /** @example 1761922799 */
2507
+ collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922799 */
2502
2508
  maturity: number;
2503
2509
  };
2504
2510
  CollateralResponse: {
2505
- /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
2506
- token: string;
2507
- /** @example 860000000000000000 */
2508
- lltv: string;
2509
- /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
2511
+ /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */token: string; /** @example 860000000000000000 */
2512
+ lltv: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
2510
2513
  oracle: string;
2511
2514
  };
2512
2515
  ObligationListResponse: {
2513
- meta: components["schemas"]["Meta"];
2514
- /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
2515
- cursor: string | null;
2516
- /** @description List of obligations with takable offers. */
2516
+ meta: components["schemas"]["Meta"]; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
2517
+ cursor: string | null; /** @description List of obligations with takable offers. */
2517
2518
  data: components["schemas"]["ObligationResponse"][];
2518
2519
  };
2519
2520
  ObligationResponse: {
2520
- /** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
2521
- id: string;
2522
- /** @example 1 */
2523
- chain_id: number;
2524
- /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2521
+ /** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */id: string; /** @example 1 */
2522
+ chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2525
2523
  loan_token: string;
2526
- collaterals: components["schemas"]["CollateralResponse"][];
2527
- /** @example 1761922800 */
2524
+ collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922800 */
2528
2525
  maturity: number;
2529
2526
  ask: components["schemas"]["AskResponse"];
2530
2527
  bid: components["schemas"]["BidResponse"];
2531
2528
  };
2532
2529
  AskResponse: {
2533
- /** @example 1000000000000000000 */
2534
- price: string;
2530
+ /** @example 1000000000000000000 */price: string;
2535
2531
  };
2536
2532
  BidResponse: {
2537
- /** @example 1000000000000000000 */
2538
- price: string;
2533
+ /** @example 1000000000000000000 */price: string;
2539
2534
  };
2540
2535
  ObligationSingleSuccessResponse: {
2541
- meta: components["schemas"]["Meta"];
2542
- /** @example null */
2543
- cursor: string | null;
2544
- /** @description Obligation details. */
2536
+ meta: components["schemas"]["Meta"]; /** @example null */
2537
+ cursor: string | null; /** @description Obligation details. */
2545
2538
  data: components["schemas"]["ObligationResponse"];
2546
2539
  };
2547
2540
  RouterStatusSuccessResponse: {
@@ -2562,8 +2555,7 @@ interface components {
2562
2555
  * @example live
2563
2556
  * @enum {string}
2564
2557
  */
2565
- status: "live" | "syncing";
2566
- /** @example true */
2558
+ status: "live" | "syncing"; /** @example true */
2567
2559
  initialized: boolean;
2568
2560
  /**
2569
2561
  * @description Configured chain ids missing initialization rows.
@@ -2577,9 +2569,7 @@ interface components {
2577
2569
  missing_collectors: components["schemas"]["MissingCollectorResponse"][];
2578
2570
  };
2579
2571
  MissingCollectorResponse: {
2580
- /** @example 1 */
2581
- chain_id: number;
2582
- /** @example offers */
2572
+ /** @example 1 */chain_id: number; /** @example offers */
2583
2573
  name: string;
2584
2574
  };
2585
2575
  CollectorsHealthSuccessResponse: {
@@ -2601,22 +2591,16 @@ interface components {
2601
2591
  data: components["schemas"]["CollectorHealthResponse"][];
2602
2592
  };
2603
2593
  CollectorHealthResponse: {
2604
- /** @example offers */
2605
- name: string;
2606
- /** @example 1 */
2607
- chain_id: number;
2608
- /** @example 21345678 */
2609
- block_number: number | null;
2610
- /** @example 2024-01-01T12:00:00.000Z */
2611
- updated_at: string | null;
2612
- /** @example 0 */
2594
+ /** @example offers */name: string; /** @example 1 */
2595
+ chain_id: number; /** @example 21345678 */
2596
+ block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
2597
+ updated_at: string | null; /** @example 0 */
2613
2598
  lag: number | null;
2614
2599
  /**
2615
2600
  * @example live
2616
2601
  * @enum {string}
2617
2602
  */
2618
- status: "live" | "lagging" | "unknown";
2619
- /** @example true */
2603
+ status: "live" | "lagging" | "unknown"; /** @example true */
2620
2604
  initialized: boolean;
2621
2605
  };
2622
2606
  ChainsHealthSuccessResponse: {
@@ -2636,20 +2620,14 @@ interface components {
2636
2620
  data: components["schemas"]["ChainHealthResponse"][];
2637
2621
  };
2638
2622
  ChainHealthResponse: {
2639
- /** @example 1 */
2640
- chain_id: number;
2641
- /** @example 21345678 */
2642
- local_block_number: number | null;
2643
- /** @example 21345690 */
2644
- remote_block_number: number | null;
2645
- /** @example 2024-01-01T12:00:00.000Z */
2646
- updated_at: string | null;
2647
- /** @example true */
2623
+ /** @example 1 */chain_id: number; /** @example 21345678 */
2624
+ local_block_number: number | null; /** @example 21345690 */
2625
+ remote_block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
2626
+ updated_at: string | null; /** @example true */
2648
2627
  initialized: boolean;
2649
2628
  };
2650
2629
  PositionListResponse: {
2651
- meta: components["schemas"]["Meta"];
2652
- /** @example eyJvZmZzZXQiOjEwMH0 */
2630
+ meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
2653
2631
  cursor: string | null;
2654
2632
  /**
2655
2633
  * @description User positions with reserved balances from active offers.
@@ -2666,47 +2644,28 @@ interface components {
2666
2644
  data: components["schemas"]["PositionListItemResponse"][];
2667
2645
  };
2668
2646
  PositionListItemResponse: {
2669
- /** @example 1 */
2670
- chain_id: number;
2671
- /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2672
- contract: string;
2673
- /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
2674
- user: string;
2675
- /** @example 200000000000000000000 */
2676
- reserved: string;
2677
- /** @example 21345678 */
2647
+ /** @example 1 */chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2648
+ contract: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
2649
+ user: string; /** @example 200000000000000000000 */
2650
+ reserved: string; /** @example 21345678 */
2678
2651
  block_number: number;
2679
2652
  };
2680
2653
  ValidateOffersRequest: {
2681
- /** @description Array of offers in snake_case format. Required, non-empty. */
2682
- offers: components["schemas"]["ValidateOfferRequest"][];
2654
+ /** @description Array of offers in snake_case format. Required, non-empty. */offers: components["schemas"]["ValidateOfferRequest"][];
2683
2655
  };
2684
2656
  ValidateOfferRequest: {
2685
- /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
2686
- maker: string;
2687
- /** @example 369216000000000000000000 */
2688
- assets: string;
2689
- /** @example 0 */
2690
- obligation_units?: string;
2691
- /** @example 0 */
2692
- obligation_shares?: string;
2693
- /** @example 2750000000000000000 */
2694
- price: string;
2695
- /** @example 1761922799 */
2696
- maturity: number;
2697
- /** @example 1761922799 */
2698
- expiry: number;
2699
- /** @example 1761922790 */
2700
- start: number;
2701
- /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
2702
- group: string;
2703
- /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
2704
- session: string;
2705
- /** @example false */
2706
- buy: boolean;
2707
- /** @example 1 */
2708
- chain_id: number;
2709
- /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2657
+ /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
2658
+ assets: string; /** @example 0 */
2659
+ obligation_units?: string; /** @example 0 */
2660
+ obligation_shares?: string; /** @example 2750000000000000000 */
2661
+ price: string; /** @example 1761922799 */
2662
+ maturity: number; /** @example 1761922799 */
2663
+ expiry: number; /** @example 1761922790 */
2664
+ start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
2665
+ group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
2666
+ session: string; /** @example false */
2667
+ buy: boolean; /** @example 1 */
2668
+ chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2710
2669
  loan_token: string;
2711
2670
  /**
2712
2671
  * @example [
@@ -2727,24 +2686,17 @@ interface components {
2727
2686
  callback: components["schemas"]["ValidateCallbackRequest"];
2728
2687
  };
2729
2688
  ValidateCollateralRequest: {
2730
- /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
2731
- asset: string;
2732
- /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
2733
- oracle: string;
2734
- /** @example 860000000000000000 */
2689
+ /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
2690
+ oracle: string; /** @example 860000000000000000 */
2735
2691
  lltv: string;
2736
2692
  };
2737
2693
  ValidateCallbackRequest: {
2738
- /** @example 0x1111111111111111111111111111111111111111 */
2739
- address: string;
2740
- /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2694
+ /** @example 0x1111111111111111111111111111111111111111 */address: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2741
2695
  data: string;
2742
2696
  };
2743
2697
  ValidationSuccessResponse: {
2744
- meta: components["schemas"]["Meta"];
2745
- /** @example null */
2746
- cursor: string | null;
2747
- /** @description Payload and root for client-side signing. */
2698
+ meta: components["schemas"]["Meta"]; /** @example null */
2699
+ cursor: string | null; /** @description Payload and root for client-side signing. */
2748
2700
  data: components["schemas"]["ValidationSuccessDataResponse"];
2749
2701
  };
2750
2702
  ValidationSuccessDataResponse: {
@@ -2820,6 +2772,45 @@ type Input = Readonly<{
2820
2772
  */
2821
2773
  declare function from$2(input: Input): OfferResponse;
2822
2774
  //#endregion
2775
+ //#region src/gatekeeper/types.d.ts
2776
+ type RuleInfo = {
2777
+ name: string;
2778
+ description: string;
2779
+ };
2780
+ type RulesProvider = {
2781
+ getRules: () => Promise<RuleInfo[]>;
2782
+ };
2783
+ type ValidationIssue = {
2784
+ index: number;
2785
+ rule: string;
2786
+ message: string;
2787
+ };
2788
+ type ValidateOffersSuccess = {
2789
+ payload: Hex;
2790
+ root: Hex;
2791
+ };
2792
+ type ValidateOffersIssues = {
2793
+ issues: ValidationIssue[];
2794
+ };
2795
+ type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
2796
+ type SuccessPayload<T> = {
2797
+ meta: {
2798
+ timestamp: string;
2799
+ };
2800
+ cursor: string | null;
2801
+ data: T;
2802
+ };
2803
+ type ErrorPayload = {
2804
+ meta: {
2805
+ timestamp: string;
2806
+ };
2807
+ error: {
2808
+ code: string;
2809
+ message: string;
2810
+ details?: unknown;
2811
+ };
2812
+ };
2813
+ //#endregion
2823
2814
  //#region src/api/Schema/openapi.d.ts
2824
2815
  declare class BooksController {
2825
2816
  getBook(): Promise<void>;
@@ -2845,10 +2836,6 @@ declare class ObligationsController {
2845
2836
  declare class UsersController {
2846
2837
  getUserPositions(): Promise<void>;
2847
2838
  }
2848
- type RuleInfo = {
2849
- name: string;
2850
- description: string;
2851
- };
2852
2839
  type OpenApiOptions = {
2853
2840
  rules?: RuleInfo[];
2854
2841
  };
@@ -2856,22 +2843,18 @@ declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
2856
2843
  //#endregion
2857
2844
  //#region src/database/domains/Positions.d.ts
2858
2845
  type PaginationParams = {
2859
- /** Cursor string returned by a previous call, for pagination */
2860
- cursor?: string;
2861
- /** Page size; defaults to {@link DEFAULT_LIMIT} */
2846
+ /** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
2862
2847
  limit?: number;
2863
2848
  };
2864
2849
  declare namespace getByUser {
2865
2850
  type Parameters = PaginationParams & {
2866
- /** The user address to get positions for. */
2867
- user: Address;
2851
+ /** The user address to get positions for. */user: Address;
2868
2852
  };
2869
2853
  type PositionWithReserved = {
2870
2854
  chainId: Id;
2871
2855
  contract: Address;
2872
2856
  user: Address;
2873
- blockNumber: number;
2874
- /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
2857
+ blockNumber: number; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
2875
2858
  reserved: bigint;
2876
2859
  };
2877
2860
  type ReturnType = {
@@ -2935,10 +2918,10 @@ declare const schemas: {
2935
2918
  }, z$1.core.$strip>;
2936
2919
  readonly get_obligations: z$1.ZodObject<{
2937
2920
  cursor: z$1.ZodOptional<z$1.ZodString>;
2938
- chain: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>;
2939
- loan_token: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
2940
- collateral_token: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
2941
- maturity: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>;
2921
+ chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
2922
+ loan_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
2923
+ collateral_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
2924
+ maturities: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
2942
2925
  limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
2943
2926
  }, z$1.core.$strip>;
2944
2927
  readonly get_obligation: z$1.ZodObject<{
@@ -2966,15 +2949,13 @@ type Action = keyof typeof schemas;
2966
2949
  declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
2967
2950
  declare function safeParse<A extends Action>(action: A, query: unknown, error?: z$1.core.$ZodErrorMap<z$1.core.$ZodIssue>): z$1.ZodSafeParseResult<z$1.infer<(typeof schemas)[A]>>;
2968
2951
  declare namespace index_d_exports$1 {
2969
- export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, RuleInfo, UsersController, ValidateController, parse, safeParse };
2952
+ export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, UsersController, ValidateController, parse, safeParse };
2970
2953
  }
2971
- declare namespace Client_d_exports {
2954
+ declare namespace Client_d_exports$1 {
2972
2955
  export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
2973
2956
  }
2974
2957
  type RouterClientConfig = {
2975
- /** The URL of the router. */
2976
- readonly url: URL;
2977
- /** The default headers to use for each request. */
2958
+ /** The URL of the router. */readonly url: URL; /** The default headers to use for each request. */
2978
2959
  readonly headers: Headers;
2979
2960
  };
2980
2961
  type Client$2 = Compute<RouterClientConfig & {
@@ -3011,10 +2992,8 @@ type ConnectOptions = {
3011
2992
  /** The URL of the router to interact with.
3012
2993
  * @default "https://router.morpho.dev"
3013
2994
  */
3014
- url?: string;
3015
- /** The API key to use for the router API. */
3016
- apiKey?: string;
3017
- /** The default headers to use for each request. */
2995
+ url?: string; /** The API key to use for the router API. */
2996
+ apiKey?: string; /** The default headers to use for each request. */
3018
2997
  headers?: Headers;
3019
2998
  };
3020
2999
  /**
@@ -3037,13 +3016,9 @@ declare namespace connect$1 {
3037
3016
  declare function getOffers(apiClient: Client<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
3038
3017
  declare namespace getOffers {
3039
3018
  type Parameters = {
3040
- /** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
3041
- side: "buy" | "sell";
3042
- /** The offers obligation id */
3043
- obligationId: Hex;
3044
- /** Pagination cursor in base64url-encoded format */
3045
- cursor?: string;
3046
- /** Maximum number of offers to return. @default 20 */
3019
+ /** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */side: "buy" | "sell"; /** The offers obligation id */
3020
+ obligationId: Hex; /** Pagination cursor in base64url-encoded format */
3021
+ cursor?: string; /** Maximum number of offers to return. @default 20 */
3047
3022
  limit?: number;
3048
3023
  };
3049
3024
  type ReturnType = {
@@ -3053,14 +3028,10 @@ declare namespace getOffers {
3053
3028
  consumed: bigint;
3054
3029
  takeable: bigint;
3055
3030
  } & {
3056
- /** 32-byte merkle root. */
3057
- root?: Hex;
3058
- /** Sibling hashes for the merkle proof. */
3059
- proof?: Hex[];
3060
- /** Offer signature from the Merkle tree. */
3031
+ /** 32-byte merkle root. */root?: Hex; /** Sibling hashes for the merkle proof. */
3032
+ proof?: Hex[]; /** Offer signature from the Merkle tree. */
3061
3033
  signature?: Hex;
3062
- }>[];
3063
- /** The pagination cursor. */
3034
+ }>[]; /** The pagination cursor. */
3064
3035
  cursor: string | null;
3065
3036
  };
3066
3037
  type ErrorType = GetApiErrorType;
@@ -3068,25 +3039,17 @@ declare namespace getOffers {
3068
3039
  declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
3069
3040
  declare namespace getObligations {
3070
3041
  type Parameters = {
3071
- /** Pagination cursor is a 32-byte hex string. */
3072
- cursor?: Hex;
3073
- /** Maximum number of obligations to return. @default 20 */
3074
- limit?: number;
3075
- /** Filter by chain ID. */
3076
- chainId?: number;
3077
- /** Filter by loan token address. */
3078
- loanToken?: Address;
3079
- /** Filter by collateral token (matches any collateral in the obligation). */
3080
- collateralToken?: Address;
3081
- /** Filter by exact maturity timestamp (unix seconds). */
3082
- maturity?: number;
3042
+ /** Pagination cursor is a 32-byte hex string. */cursor?: Hex; /** Maximum number of obligations to return. @default 20 */
3043
+ limit?: number; /** Filter by chain IDs (comma-separated). */
3044
+ chainIds?: number[]; /** Filter by loan token addresses (comma-separated). */
3045
+ loanTokens?: Address[]; /** Filter by collateral tokens (comma-separated, matches any collateral). */
3046
+ collateralTokens?: Address[]; /** Filter by exact maturity timestamps (comma-separated, unix seconds). */
3047
+ maturities?: number[];
3083
3048
  };
3084
3049
  type ReturnType = {
3085
3050
  obligations: Compute<{
3086
- /** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
3087
- id: () => Hex;
3088
- } & Obligation & Omit<Quote, "obligationId">>[];
3089
- /** The pagination cursor. */
3051
+ /** The obligation id. Uses {@link Obligation.id} to calculate the id.*/id: () => Hex;
3052
+ } & Obligation & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
3090
3053
  cursor: string | null;
3091
3054
  };
3092
3055
  type ErrorType = GetApiErrorType;
@@ -3122,20 +3085,20 @@ declare namespace Gate_d_exports {
3122
3085
  /**
3123
3086
  * A validation rule.
3124
3087
  */
3125
- type Rule<T, Name$1 extends string = string> = {
3088
+ type Rule<T, Name extends string = string> = {
3126
3089
  kind: "single";
3127
- name: Name$1;
3090
+ name: Name;
3128
3091
  description: string;
3129
- run: Single<T, Name$1>;
3092
+ run: Single<T, Name>;
3130
3093
  } | {
3131
3094
  kind: "batch";
3132
- name: Name$1;
3095
+ name: Name;
3133
3096
  description: string;
3134
- run: Batch<T, Name$1>;
3097
+ run: Batch<T, Name>;
3135
3098
  };
3136
- type RuleNames<Rules$1 extends readonly {
3099
+ type RuleNames<Rules extends readonly {
3137
3100
  name: string;
3138
- }[]> = Rules$1[number]["name"];
3101
+ }[]> = Rules[number]["name"];
3139
3102
  /**
3140
3103
  * A single item validation rule.
3141
3104
  * @param item - The item to validate.
@@ -3155,7 +3118,7 @@ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<
3155
3118
  * @param run - The function that validates the rule.
3156
3119
  * @returns The created rule.
3157
3120
  */
3158
- declare function single<Name$1 extends string, T>(name: Name$1, description: string, run: Single<T, Name$1>): Rule<T, Name$1>;
3121
+ declare function single<Name extends string, T>(name: Name, description: string, run: Single<T, Name>): Rule<T, Name>;
3159
3122
  /**
3160
3123
  * Create a validation rule iterating over a batch of items at a time.
3161
3124
  * @param name - The name of the rule.
@@ -3163,32 +3126,49 @@ declare function single<Name$1 extends string, T>(name: Name$1, description: str
3163
3126
  * @param run - The function that validates the rule.
3164
3127
  * @returns The created rule.
3165
3128
  */
3166
- declare function batch$1<Name$1 extends string, T>(name: Name$1, description: string, run: Batch<T, Name$1>): Rule<T, Name$1>;
3129
+ declare function batch$1<Name extends string, T>(name: Name, description: string, run: Batch<T, Name>): Rule<T, Name>;
3167
3130
  /**
3168
3131
  * A validation issue.
3169
3132
  */
3170
3133
  type Issue<T, RuleName extends string = string> = {
3171
- /** The name of the rule that caused the issue. */
3172
- ruleName: RuleName;
3173
- /** The message of the issue. */
3174
- message: string;
3175
- /** The item that was not valid. */
3134
+ /** The name of the rule that caused the issue. */ruleName: RuleName; /** The message of the issue. */
3135
+ message: string; /** The item that was not valid. */
3176
3136
  item: T;
3177
3137
  };
3178
3138
  /**
3179
3139
  * The result of a validation.
3180
3140
  */
3181
3141
  type Result<T, RuleName extends string = string> = {
3182
- /** The items that were valid. */
3183
- valid: T[];
3184
- /** The reports of the failed validations. */
3142
+ /** The items that were valid. */valid: T[]; /** The reports of the failed validations. */
3185
3143
  issues: Issue<T, RuleName>[];
3186
3144
  };
3187
- declare function run<T, Name$1 extends string, Rules$1 extends readonly Rule<T, Name$1>[]>(parameters: {
3145
+ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name>[]>(parameters: {
3188
3146
  items: T[];
3189
- rules: Rules$1;
3147
+ rules: Rules;
3190
3148
  chunkSize?: number;
3191
- }): Promise<Result<T, RuleNames<Rules$1>>>;
3149
+ }): Promise<Result<T, RuleNames<Rules>>>;
3150
+ declare namespace Client_d_exports {
3151
+ export { ClientConfig, GatekeeperClient, createHttpClient };
3152
+ }
3153
+ type GatekeeperClient = RulesProvider & {
3154
+ /** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
3155
+ statusCode: number;
3156
+ body: unknown;
3157
+ }>; /** Validate offers and return decision results. */
3158
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
3159
+ baseUrl: string;
3160
+ };
3161
+ type ClientConfig = {
3162
+ baseUrl: string;
3163
+ timeoutMs?: number;
3164
+ fetchFn?: typeof fetch;
3165
+ };
3166
+ /**
3167
+ * Create an HTTP client for a gatekeeper service.
3168
+ * @param config - Gatekeeper client configuration. {@link ClientConfig}
3169
+ * @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
3170
+ */
3171
+ declare function createHttpClient(config: ClientConfig): GatekeeperClient;
3192
3172
  declare namespace GateConfig_d_exports {
3193
3173
  export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
3194
3174
  }
@@ -3197,25 +3177,25 @@ type GateConfig = {
3197
3177
  maturities?: MaturityType[];
3198
3178
  };
3199
3179
  type CallbackConfig = {
3200
- type: CallbackType.BuyVaultV1Callback;
3180
+ type: Type$1.BuyVaultV1Callback;
3201
3181
  addresses: Address[];
3202
3182
  vaultFactories: Address[];
3203
3183
  } | {
3204
- type: CallbackType.SellERC20Callback;
3184
+ type: Type$1.SellERC20Callback;
3205
3185
  addresses: Address[];
3206
3186
  } | {
3207
- type: CallbackType.BuyWithEmptyCallback;
3187
+ type: Type$1.BuyWithEmptyCallback;
3208
3188
  };
3209
- declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
3210
- type: CallbackType.BuyVaultV1Callback;
3189
+ declare function getCallback(chain: Name, type: Type$1.BuyVaultV1Callback): Extract<CallbackConfig, {
3190
+ type: Type$1.BuyVaultV1Callback;
3211
3191
  }> | undefined;
3212
- declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
3213
- type: CallbackType.SellERC20Callback;
3192
+ declare function getCallback(chain: Name, type: Type$1.SellERC20Callback): Extract<CallbackConfig, {
3193
+ type: Type$1.SellERC20Callback;
3214
3194
  }> | undefined;
3215
- declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
3216
- type: CallbackType.BuyWithEmptyCallback;
3195
+ declare function getCallback(chain: Name, type: Type$1.BuyWithEmptyCallback): Extract<CallbackConfig, {
3196
+ type: Type$1.BuyWithEmptyCallback;
3217
3197
  }> | undefined;
3218
- declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
3198
+ declare function getCallback(chain: Name, type: Type$1): CallbackConfig | undefined;
3219
3199
  /**
3220
3200
  * Attempts to infer the configured callback type from a callback address on a chain.
3221
3201
  * Skips the empty callback type as it does not carry addresses.
@@ -3224,14 +3204,14 @@ declare function getCallback(chain: Name, type: CallbackType): CallbackConfig |
3224
3204
  * @param address - Callback contract address
3225
3205
  * @returns The callback type when found, otherwise undefined
3226
3206
  */
3227
- declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
3207
+ declare function getCallbackType(chain: Name, address: Address): Type$1.BuyWithEmptyCallback | Type$1.BuyVaultV1Callback | Type$1.SellERC20Callback | undefined;
3228
3208
  /**
3229
3209
  * Returns the callback addresses for a given chain and callback type, if it exists.
3230
3210
  * @param chain - Chain name for which to read the validation configuration
3231
3211
  * @param type - Callback type to retrieve
3232
3212
  * @returns The matching callback addresses or an empty array if not configured
3233
3213
  */
3234
- declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
3214
+ declare function getCallbackTypeAddresses(chain: Name, type: Type$1): Address[];
3235
3215
  /**
3236
3216
  * Returns the list of allowed non-empty callback addresses for a chain.
3237
3217
  *
@@ -3246,12 +3226,17 @@ declare namespace Gatekeeper_d_exports {
3246
3226
  }
3247
3227
  type Rules = readonly Rule<Offer, string>[];
3248
3228
  type Gatekeeper = {
3249
- rules: Rules;
3250
3229
  isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
3230
+ getRules: () => Promise<RuleInfo[]>;
3251
3231
  };
3252
3232
  type GatekeeperParameters = {
3253
3233
  rules: Rules;
3254
3234
  };
3235
+ /**
3236
+ * Create a gatekeeper instance with the provided rules.
3237
+ * @param parameters - Gatekeeper parameters. {@link GatekeeperParameters}
3238
+ * @returns Gatekeeper instance. {@link Gatekeeper}
3239
+ */
3255
3240
  declare function create(parameters: GatekeeperParameters): Gatekeeper;
3256
3241
  //#endregion
3257
3242
  //#region src/gatekeeper/morphoRules.d.ts
@@ -3283,7 +3268,7 @@ declare const callback: ({
3283
3268
  callbacks,
3284
3269
  allowedAddresses
3285
3270
  }: {
3286
- callbacks: CallbackType[];
3271
+ callbacks: Type$1[];
3287
3272
  allowedAddresses: Address[];
3288
3273
  }) => Rule<Offer, "callback">;
3289
3274
  /**
@@ -3313,11 +3298,8 @@ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusiv
3313
3298
  declare function from(parameters: from.Parameters): from.ReturnType;
3314
3299
  declare namespace from {
3315
3300
  type Parameters = {
3316
- /** The viem client to use. */
3317
- client: WalletClient;
3318
- /** The mempool address. */
3319
- mempoolAddress: Address;
3320
- /** The block window to use for the mempool. Defaults to 100. */
3301
+ /** The viem client to use. */client: WalletClient; /** The mempool address. */
3302
+ mempoolAddress: Address; /** The block window to use for the mempool. Defaults to 100. */
3321
3303
  blockWindow?: number;
3322
3304
  };
3323
3305
  type ReturnType = Client$1;
@@ -3328,18 +3310,12 @@ declare namespace MempoolClient_d_exports {
3328
3310
  }
3329
3311
  type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
3330
3312
  type GetParameters = {
3331
- /** The block number to get offers from. */
3332
- blockNumberGte?: number;
3333
- /** The block number to get offers to. */
3334
- blockNumberLte?: number;
3335
- /** The loan asset to get offers from. */
3336
- loanToken?: string;
3337
- /** The order to get offers. Defaults to "desc". */
3338
- order?: "asc" | "desc";
3339
- /** The options to get offers from. */
3313
+ /** The block number to get offers from. */blockNumberGte?: number; /** The block number to get offers to. */
3314
+ blockNumberLte?: number; /** The loan asset to get offers from. */
3315
+ loanToken?: string; /** The order to get offers. Defaults to "desc". */
3316
+ order?: "asc" | "desc"; /** The options to get offers from. */
3340
3317
  options?: {
3341
- /** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
3342
- maxBatchSize?: number;
3318
+ /** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */maxBatchSize?: number;
3343
3319
  };
3344
3320
  };
3345
3321
  /**
@@ -3350,11 +3326,9 @@ type Client$1 = {
3350
3326
  * Add an offer to the mempool.
3351
3327
  * @returns The created offer with its hash.
3352
3328
  */
3353
- add: (parameters: AddParameters) => Promise<Hex>;
3354
- /** Get offers from the mempool. */
3329
+ add: (parameters: AddParameters) => Promise<Hex>; /** Get offers from the mempool. */
3355
3330
  get: (parameters?: GetParameters) => AsyncGenerator<{
3356
- offers: Offer[];
3357
- /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
3331
+ offers: Offer[]; /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
3358
3332
  blockNumber: number;
3359
3333
  }>;
3360
3334
  /**
@@ -3510,5 +3484,5 @@ declare namespace index_d_exports$2 {
3510
3484
  export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
3511
3485
  }
3512
3486
  //#endregion
3513
- export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ERC4626_d_exports as ERC4626, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports as RouterClient, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, Gate_d_exports as Validation, morphoRules };
3487
+ export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports$1 as RouterClient, RuleInfo, Rules_d_exports as Rules, RulesProvider, SuccessPayload, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
3514
3488
  //# sourceMappingURL=index.browser.d.ts.map