@morpho-dev/router 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,8 +5,8 @@ import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
5
5
  import { z } from "zod/v4";
6
6
  import "reflect-metadata";
7
7
  import { OpenAPIDocument } from "openapi-metadata";
8
- import { Client as Client$1 } from "openapi-fetch";
9
8
  import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
9
+ import { Client as Client$1 } from "openapi-fetch";
10
10
  import { PGlite } from "@electric-sql/pglite";
11
11
  import { drizzle } from "drizzle-orm/node-postgres";
12
12
  import { drizzle as drizzle$1 } from "drizzle-orm/pglite";
@@ -273,19 +273,48 @@ declare const Morpho: readonly [{
273
273
  }];
274
274
  readonly stateMutability: "view";
275
275
  }];
276
+ //#endregion
277
+ //#region src/core/types.d.ts
278
+ /** Combines members of an intersection into a readable type. */
279
+ type Compute<type> = { [key in keyof type]: type[key] } & unknown;
280
+ declare const BrandTypeId: unique symbol;
281
+ type Brand<in out ID extends string | symbol> = {
282
+ readonly [BrandTypeId]: { readonly [id in ID]: ID };
283
+ };
276
284
  declare namespace Callback_d_exports {
277
- export { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, decode$2 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$2 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
285
+ 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 };
278
286
  }
279
- declare enum CallbackType {
287
+ /** A position decoded from callback data. */
288
+ type CallbackPosition = {
289
+ /** The ERC20 token contract address. */contract: Address; /** The maximum amount available from this position. */
290
+ amount: bigint;
291
+ };
292
+ type Callback = {
293
+ type: Type$1.BuyWithEmptyCallback;
294
+ } | (({
295
+ /** The address of the callback contract. */address: Address; /** The ABI-encoded callback data. */
296
+ data: Hex;
297
+ } & {
298
+ type: Type$1.BuyERC20; /** The decoded callback inputs. */
299
+ inputs: {
300
+ /** The ERC20 positions available for the callback. */positions: CallbackPosition[];
301
+ };
302
+ }) & Brand<"Callback">);
303
+ declare enum Type$1 {
280
304
  BuyWithEmptyCallback = "buy_with_empty_callback",
305
+ BuyERC20 = "buy_erc20",
281
306
  BuyVaultV1Callback = "buy_vault_v1_callback",
282
- SellERC20Callback = "sell_erc20_callback",
307
+ SellERC20Callback = "sell_erc20_callback"
283
308
  }
284
309
  declare const isEmptyCallback: (offer: Offer) => boolean;
285
- declare function decode$2(type: CallbackType, data: Hex): {
310
+ declare function decode$2(type: Type$1, data: Hex): {
286
311
  contract: Address;
287
312
  amount: bigint;
288
313
  }[];
314
+ type BuyERC20Data = {
315
+ tokens: Address[];
316
+ amounts: bigint[];
317
+ };
289
318
  type BuyVaultV1CallbackData = {
290
319
  vaults: Address[];
291
320
  amounts: bigint[];
@@ -294,8 +323,28 @@ type SellERC20CallbackData = {
294
323
  collaterals: Address[];
295
324
  amounts: bigint[];
296
325
  };
297
- declare function encode$2(type: CallbackType.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
298
- declare function encode$2(type: CallbackType.SellERC20Callback, data: SellERC20CallbackData): Hex;
326
+ declare function encode$2(type: Type$1.BuyERC20, data: BuyERC20Data): Hex;
327
+ declare function encode$2(type: Type$1.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
328
+ declare function encode$2(type: Type$1.SellERC20Callback, data: SellERC20CallbackData): Hex;
329
+ /**
330
+ * Decodes BuyERC20 callback data into positions.
331
+ * @param data - The ABI-encoded callback data containing token addresses and amounts.
332
+ * @returns Array of positions with contract address and amount.
333
+ * @throws If data is empty, malformed, or arrays have mismatched lengths.
334
+ */
335
+ declare function decodeBuyERC20(data: Hex): Array<{
336
+ contract: Address;
337
+ amount: bigint;
338
+ }>;
339
+ /**
340
+ * Encodes BuyERC20 callback parameters into ABI-encoded data.
341
+ * @param parameters - The tokens and amounts to encode.
342
+ * @returns ABI-encoded hex string.
343
+ */
344
+ declare function encodeBuyERC20(parameters: {
345
+ tokens: Address[];
346
+ amounts: bigint[];
347
+ }): Hex;
299
348
  declare function decodeBuyVaultV1Callback(data: Hex): Array<{
300
349
  contract: Address;
301
350
  amount: bigint;
@@ -357,6 +406,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
357
406
  v1_1: ChainContract;
358
407
  };
359
408
  };
409
+ callbacks: Callback[];
360
410
  }>, "custom"> & {
361
411
  id: Id;
362
412
  name: Name$1;
@@ -370,6 +420,7 @@ type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
370
420
  v1_1: ChainContract;
371
421
  };
372
422
  };
423
+ callbacks: Callback[];
373
424
  };
374
425
  }>;
375
426
  declare const ChainId: {
@@ -423,17 +474,14 @@ type ChainRegistry = {
423
474
  getById: (chainId: Id) => Chain$1 | undefined;
424
475
  list: () => Chain$1[];
425
476
  };
477
+ /**
478
+ * Creates a chain registry from a list of chains.
479
+ * @param chains - Array of chain objects to register.
480
+ * @returns A registry for looking up chains by ID. {@link ChainRegistry}
481
+ */
426
482
  declare function create$6(chains: Chain$1[]): ChainRegistry;
427
- //#endregion
428
- //#region src/core/types.d.ts
429
- /** Combines members of an intersection into a readable type. */
430
- type Compute<type> = { [key in keyof type]: type[key] } & unknown;
431
- declare const BrandTypeId: unique symbol;
432
- type Brand<in out ID extends string | symbol> = {
433
- readonly [BrandTypeId]: { readonly [id in ID]: ID };
434
- };
435
483
  declare namespace LLTV_d_exports {
436
- export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$16 as from };
484
+ export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$17 as from };
437
485
  }
438
486
  type LLTV = bigint & Brand<"LLTV">;
439
487
  declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
@@ -443,8 +491,8 @@ type Options = (typeof Options)[number];
443
491
  * @param lltv - The LLTV option or the scaled LLTV.
444
492
  * @returns The LLTV.
445
493
  */
446
- declare function from$16(lltv: Options | bigint): LLTV;
447
- declare namespace from$16 {
494
+ declare function from$17(lltv: Options | bigint): LLTV;
495
+ declare namespace from$17 {
448
496
  type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
449
497
  }
450
498
  declare class InvalidOptionError$1 extends BaseError {
@@ -457,14 +505,11 @@ declare class InvalidLLTVError extends BaseError {
457
505
  }
458
506
  declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
459
507
  declare namespace Collateral_d_exports {
460
- export { Collateral, CollateralSchema, CollateralsSchema, from$15 as from, random$3 as random };
508
+ export { Collateral, CollateralSchema, CollateralsSchema, from$16 as from, random$3 as random };
461
509
  }
462
510
  type Collateral = {
463
- /** Asset being used as collateral. */
464
- asset: Address;
465
- /** Liquidation Loan-to-Value of the collateral. */
466
- lltv: LLTV;
467
- /** Oracle contract used to price the collateral. */
511
+ /** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
512
+ lltv: LLTV; /** Oracle contract used to price the collateral. */
468
513
  oracle: Address;
469
514
  };
470
515
  declare const CollateralSchema: z$1.ZodObject<{
@@ -477,8 +522,8 @@ declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
477
522
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
478
523
  lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
479
524
  }, z$1.core.$strip>>;
480
- declare const from$15: (parameters: from$15.Parameters) => from$15.ReturnType;
481
- declare namespace from$15 {
525
+ declare const from$16: (parameters: from$16.Parameters) => from$16.ReturnType;
526
+ declare namespace from$16 {
482
527
  type Parameters = {
483
528
  asset: Address;
484
529
  lltv: Options | bigint;
@@ -516,8 +561,7 @@ declare namespace ERC4626_d_exports {
516
561
  declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
517
562
  declare namespace decimalsOffset {
518
563
  type Parameters = {
519
- /** The number of decimals of the underlying asset. */
520
- underlyingDecimals: number;
564
+ /** The number of decimals of the underlying asset. */underlyingDecimals: number;
521
565
  };
522
566
  type ReturnType = number;
523
567
  }
@@ -536,11 +580,8 @@ declare namespace decimalsOffset {
536
580
  declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
537
581
  declare namespace convertToAssets {
538
582
  type Parameters = {
539
- /** The amount of shares to convert. */
540
- shares: bigint;
541
- /** Total amount of assets in the vault. */
542
- totalAssets: bigint;
543
- /** Total amount of shares in the vault. */
583
+ /** The amount of shares to convert. */shares: bigint; /** Total amount of assets in the vault. */
584
+ totalAssets: bigint; /** Total amount of shares in the vault. */
544
585
  totalSupply: bigint;
545
586
  /**
546
587
  * OpenZeppelin decimals offset used by the ERC4626 implementation.
@@ -567,11 +608,8 @@ declare namespace convertToAssets {
567
608
  declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
568
609
  declare namespace convertToShares {
569
610
  type Parameters = {
570
- /** The amount of assets to convert. */
571
- assets: bigint;
572
- /** Total amount of assets in the vault. */
573
- totalAssets: bigint;
574
- /** Total amount of shares in the vault. */
611
+ /** The amount of assets to convert. */assets: bigint; /** Total amount of assets in the vault. */
612
+ totalAssets: bigint; /** Total amount of shares in the vault. */
575
613
  totalSupply: bigint;
576
614
  /**
577
615
  * OpenZeppelin decimals offset used by the ERC4626 implementation.
@@ -707,7 +745,7 @@ declare function generateMarketLiquidityPoolId(parameters: {
707
745
  marketId: string;
708
746
  }): string;
709
747
  declare namespace Maturity_d_exports {
710
- export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$14 as from };
748
+ export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$15 as from };
711
749
  }
712
750
  /**
713
751
  * Maturity is a number that represents a date in seconds.
@@ -720,7 +758,7 @@ declare enum MaturityType {
720
758
  EndOfMonth = "end_of_month",
721
759
  EndOfNextMonth = "end_of_next_month",
722
760
  EndOfQuarter = "end_of_quarter",
723
- EndOfNextQuarter = "end_of_next_quarter",
761
+ EndOfNextQuarter = "end_of_next_quarter"
724
762
  }
725
763
  declare const MaturityOptions: {
726
764
  readonly end_of_week: () => Maturity;
@@ -737,8 +775,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
737
775
  * @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
738
776
  * @throws {InvalidOptionError} If the maturity is not a valid option.
739
777
  */
740
- declare function from$14(ts: from$14.Parameters): Maturity;
741
- declare namespace from$14 {
778
+ declare function from$15(ts: from$15.Parameters): Maturity;
779
+ declare namespace from$15 {
742
780
  type Parameters = number | MaturityOptions;
743
781
  type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
744
782
  }
@@ -782,16 +820,12 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
782
820
  declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
783
821
  declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
784
822
  declare namespace Obligation_d_exports {
785
- export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$13 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
823
+ export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$14 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
786
824
  }
787
825
  type Obligation = {
788
- /** The chain id where the liquidity for this obligation is located. */
789
- chainId: Id;
790
- /** The token that is being borrowed for this obligation. */
791
- loanToken: Address;
792
- /** The exact set of collaterals required to borrow the loan token. */
793
- collaterals: Collateral[];
794
- /** The maturity of the obligation. */
826
+ /** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
827
+ loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
828
+ collaterals: Collateral[]; /** The maturity of the obligation. */
795
829
  maturity: Maturity;
796
830
  };
797
831
  declare const ObligationSchema: z$1.ZodObject<{
@@ -827,17 +861,13 @@ declare const ObligationSchema: z$1.ZodObject<{
827
861
  * });
828
862
  * ```
829
863
  */
830
- declare function from$13(parameters: from$13.Parameters): from$13.ReturnType;
831
- declare namespace from$13 {
864
+ declare function from$14(parameters: from$14.Parameters): from$14.ReturnType;
865
+ declare namespace from$14 {
832
866
  type Parameters = {
833
- /** The chain id where the liquidity for this obligation is located. */
834
- chainId: number;
835
- /** The token that is being borrowed for this obligation. */
836
- loanToken: Address;
837
- /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
838
- collaterals: from$15.Parameters[] | readonly from$15.Parameters[];
839
- /** The maturity of the obligation. */
840
- maturity: from$14.Parameters;
867
+ /** The chain id where the liquidity for this obligation is located. */chainId: number; /** The token that is being borrowed for this obligation. */
868
+ loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
869
+ collaterals: from$16.Parameters[] | readonly from$16.Parameters[]; /** The maturity of the obligation. */
870
+ maturity: from$15.Parameters;
841
871
  };
842
872
  type ReturnType = Obligation;
843
873
  type ErrorType = InvalidObligationError;
@@ -898,6 +928,18 @@ declare function random$2(): random$2.ReturnType;
898
928
  declare namespace random$2 {
899
929
  type ReturnType = Obligation;
900
930
  }
931
+ /**
932
+ * Creates an obligation from an offer.
933
+ * @constructor
934
+ *
935
+ * @param offer - The offer to create the obligation from.
936
+ * @returns The created obligation. {@link fromOffer.ReturnType}
937
+ */
938
+ declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
939
+ declare namespace fromOffer$1 {
940
+ type Parameters = Offer;
941
+ type ReturnType = Obligation;
942
+ }
901
943
  declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
902
944
  readonly name = "Obligation.InvalidObligationError";
903
945
  constructor(error: z$1.ZodError | Error);
@@ -907,38 +949,23 @@ declare class CollateralsAreNotSortedError extends BaseError {
907
949
  constructor();
908
950
  }
909
951
  declare namespace Offer_d_exports {
910
- export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$12 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, sign, signatureMsg, toSnakeCase, types };
952
+ export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$13 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, toSnakeCase, types };
911
953
  }
912
954
  type Offer = {
913
- /** The address that made the offer. */
914
- readonly maker: Address;
915
- /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
916
- readonly assets: bigint;
917
- /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
918
- readonly obligationUnits: bigint;
919
- /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
920
- readonly obligationShares: bigint;
921
- /** The price (18 decimals). */
922
- readonly price: bigint;
923
- /** The date at which all interests will be paid. */
924
- readonly maturity: Maturity;
925
- /** The date at which the offer will expire. */
926
- readonly expiry: number;
927
- /** The date at which the offer will start. */
928
- readonly start: number;
929
- /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
930
- readonly group: Hex;
931
- /** The session. Used for session-based offer management. */
932
- readonly session: Hex;
933
- /** The side of the offer. `true` for buy, `false` for sell. */
934
- readonly buy: boolean;
935
- /** The chain id where the liquidity for this offer is located. */
936
- readonly chainId: Id;
937
- /** The token that is being borrowed. */
938
- readonly loanToken: Address;
939
- /** The exact set of collaterals required to borrow the loan token. */
940
- readonly collaterals: readonly Collateral[];
941
- /** The optional callback data to retrieve the maker funds. */
955
+ /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
956
+ readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
957
+ readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
958
+ readonly obligationShares: bigint; /** The price (18 decimals). */
959
+ readonly price: bigint; /** The date at which all interests will be paid. */
960
+ readonly maturity: Maturity; /** The date at which the offer will expire. */
961
+ readonly expiry: number; /** The date at which the offer will start. */
962
+ readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
963
+ readonly group: Hex; /** The session. Used for session-based offer management. */
964
+ readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
965
+ readonly buy: boolean; /** The chain id where the liquidity for this offer is located. */
966
+ readonly chainId: Id; /** The token that is being borrowed. */
967
+ readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
968
+ readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
942
969
  readonly callback: {
943
970
  readonly address: Address;
944
971
  readonly data: Hex;
@@ -946,7 +973,7 @@ type Offer = {
946
973
  };
947
974
  declare enum Status {
948
975
  VALID = "VALID",
949
- SIMULATION_ERROR = "SIMULATION_ERROR",
976
+ SIMULATION_ERROR = "SIMULATION_ERROR"
950
977
  }
951
978
  type Validation = {
952
979
  offerHash: Hex;
@@ -989,12 +1016,9 @@ declare const OfferSchema: () => z$1.ZodObject<{
989
1016
  */
990
1017
  type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares"> & {
991
1018
  chainId: number;
992
- group: Hex | bigint | number | string;
993
- /** Optional: defaults to zero bytes32. */
994
- session?: Hex | bigint | number | string;
995
- /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
996
- obligationUnits?: bigint;
997
- /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
1019
+ group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
1020
+ session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
1021
+ obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
998
1022
  obligationShares?: bigint;
999
1023
  }>;
1000
1024
  /**
@@ -1003,8 +1027,8 @@ type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligat
1003
1027
  * @param input - The offer to create.
1004
1028
  * @returns The created offer.
1005
1029
  */
1006
- declare function from$12(input: OfferInput): Offer;
1007
- declare namespace from$12 {
1030
+ declare function from$13(input: OfferInput): Offer;
1031
+ declare namespace from$13 {
1008
1032
  type ErrorType = InvalidOfferError;
1009
1033
  }
1010
1034
  /**
@@ -1164,15 +1188,6 @@ declare const types: {
1164
1188
  readonly type: "bytes";
1165
1189
  }];
1166
1190
  };
1167
- /**
1168
- * Signs an array of offers.
1169
- * @throws {Error} If the wallet account is not set.
1170
- * @param offers - The offers to sign.
1171
- * @param wallet - The wallet to sign the offers with.
1172
- * @returns The signed offers.
1173
- */
1174
- declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
1175
- declare function signatureMsg(offers: Offer[]): Hex;
1176
1191
  declare function hash(offer: Offer): Hex;
1177
1192
  /**
1178
1193
  * Calculates the obligation id for an offer based on the smart contract's Obligation struct.
@@ -1230,24 +1245,16 @@ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
1230
1245
  */
1231
1246
  get formattedMessage(): string;
1232
1247
  }
1233
- declare class AccountNotSetError extends BaseError {
1234
- readonly name = "Offer.AccountNotSetError";
1235
- constructor();
1236
- }
1237
1248
  declare namespace Oracle_d_exports {
1238
- export { Conversion, Oracle, from$11 as from };
1249
+ export { Conversion, Oracle, from$12 as from, fromCollateral, fromOffer, fromOffers };
1239
1250
  }
1240
1251
  /**
1241
1252
  * An oracle contract that provides price information for assets.
1242
1253
  */
1243
1254
  type Oracle = {
1244
- /** The chain id where the oracle is deployed. */
1245
- readonly chainId: Id;
1246
- /** The address of the oracle contract. */
1247
- readonly address: Address;
1248
- /** The price returned by the oracle (in the oracle's native units), null if no price available. */
1249
- readonly price: bigint | null;
1250
- /** The block number at which the price was fetched. */
1255
+ /** The chain id where the oracle is deployed. */readonly chainId: Id; /** The address of the oracle contract. */
1256
+ readonly address: Address; /** The price returned by the oracle (in the oracle's native units), null if no price available. */
1257
+ readonly price: bigint | null; /** The block number at which the price was fetched. */
1251
1258
  readonly blockNumber: number;
1252
1259
  };
1253
1260
  /**
@@ -1255,8 +1262,8 @@ type Oracle = {
1255
1262
  * @param data - The data to create the oracle from.
1256
1263
  * @returns The created oracle.
1257
1264
  */
1258
- declare function from$11(data: from$11.Parameters): from$11.ReturnType;
1259
- declare namespace from$11 {
1265
+ declare function from$12(data: from$12.Parameters): from$12.ReturnType;
1266
+ declare namespace from$12 {
1260
1267
  type Parameters = {
1261
1268
  chainId: Id;
1262
1269
  address: Address;
@@ -1265,6 +1272,55 @@ declare namespace from$11 {
1265
1272
  };
1266
1273
  type ReturnType = Oracle;
1267
1274
  }
1275
+ /**
1276
+ * Creates an oracle from a collateral.
1277
+ * @constructor
1278
+ *
1279
+ * @param parameters - {@link fromCollateral.Parameters}
1280
+ * @returns The created oracle. {@link fromCollateral.ReturnType}
1281
+ */
1282
+ declare function fromCollateral(parameters: fromCollateral.Parameters): fromCollateral.ReturnType;
1283
+ declare namespace fromCollateral {
1284
+ type Parameters = {
1285
+ chainId: Id;
1286
+ collateral: Collateral;
1287
+ blockNumber: number;
1288
+ price?: bigint | null;
1289
+ };
1290
+ type ReturnType = Oracle;
1291
+ }
1292
+ /**
1293
+ * Creates oracles from a single offer.
1294
+ * @constructor
1295
+ *
1296
+ * @param parameters - {@link fromOffer.Parameters}
1297
+ * @returns The created oracles. {@link fromOffer.ReturnType}
1298
+ */
1299
+ declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
1300
+ declare namespace fromOffer {
1301
+ type Parameters = {
1302
+ offer: Offer;
1303
+ blockNumber: number;
1304
+ price?: bigint | null;
1305
+ };
1306
+ type ReturnType = Oracle[];
1307
+ }
1308
+ /**
1309
+ * Creates oracles from a list of offers.
1310
+ * @constructor
1311
+ *
1312
+ * @param parameters - {@link fromOffers.Parameters}
1313
+ * @returns The created oracles. {@link fromOffers.ReturnType}
1314
+ */
1315
+ declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
1316
+ declare namespace fromOffers {
1317
+ type Parameters = {
1318
+ offers: Offer[];
1319
+ blockNumber: number;
1320
+ price?: bigint | null;
1321
+ };
1322
+ type ReturnType = Oracle[];
1323
+ }
1268
1324
  /**
1269
1325
  * Conversion utilities for converting between collateral and loan token amounts
1270
1326
  * using oracle prices and LLTV
@@ -1297,33 +1353,28 @@ declare namespace Conversion {
1297
1353
  }): bigint;
1298
1354
  }
1299
1355
  declare namespace Position_d_exports {
1300
- export { Position, Type, from$10 as from };
1356
+ export { Position, Type, from$11 as from };
1301
1357
  }
1302
1358
  type Position = {
1303
- /** The chain id. */
1304
- chainId: Id;
1359
+ /** The chain id. */chainId: Id;
1305
1360
  /** The contract address from which the position is called.
1306
1361
  * While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
1307
1362
  * 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.
1308
1363
  */
1309
- contract: Address;
1310
- /** The user address. */
1311
- user: Address;
1312
- /** The type of position. */
1313
- type: Type;
1314
- /** The balance of the position. */
1364
+ contract: Address; /** The user address. */
1365
+ user: Address; /** The type of position. */
1366
+ type: Type; /** The balance of the position. */
1315
1367
  balance?: bigint;
1316
1368
  /** The underlying asset of the position.
1317
1369
  * For ERC20 positions, this equals the contract address.
1318
1370
  * For vault positions, this is the vault's underlying asset.
1319
1371
  */
1320
- asset?: Address;
1321
- /** The block number at which the position was last updated. */
1372
+ asset?: Address; /** The block number at which the position was last updated. */
1322
1373
  blockNumber: number;
1323
1374
  };
1324
1375
  declare enum Type {
1325
1376
  ERC20 = "erc20",
1326
- VAULT_V1 = "vault_v1",
1377
+ VAULT_V1 = "vault_v1"
1327
1378
  }
1328
1379
  /**
1329
1380
  * @constructor
@@ -1331,8 +1382,8 @@ declare enum Type {
1331
1382
  * @param parameters - {@link from.Parameters}
1332
1383
  * @returns The created Position. {@link from.ReturnType}
1333
1384
  */
1334
- declare function from$10(parameters: from$10.Parameters): from$10.ReturnType;
1335
- declare namespace from$10 {
1385
+ declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
1386
+ declare namespace from$11 {
1336
1387
  type Parameters = {
1337
1388
  chainId: Id;
1338
1389
  contract: Address;
@@ -1345,18 +1396,15 @@ declare namespace from$10 {
1345
1396
  type ReturnType = Position;
1346
1397
  }
1347
1398
  declare namespace Quote_d_exports {
1348
- export { InvalidQuoteError, Quote, QuoteSchema, from$9 as from, fromSnakeCase, random };
1399
+ export { InvalidQuoteError, Quote, QuoteSchema, from$10 as from, fromSnakeCase, random };
1349
1400
  }
1350
1401
  type Quote = {
1351
- /** The obligation id. */
1352
- obligationId: Hex;
1402
+ /** The obligation id. */obligationId: Hex;
1353
1403
  ask: {
1354
- /** The ask price for the obligation. (18 decimals). */
1355
- price: bigint;
1404
+ /** The ask price for the obligation. (18 decimals). */price: bigint;
1356
1405
  };
1357
1406
  bid: {
1358
- /** The bid price for the obligation. (18 decimals). */
1359
- price: bigint;
1407
+ /** The bid price for the obligation. (18 decimals). */price: bigint;
1360
1408
  };
1361
1409
  };
1362
1410
  declare const QuoteSchema: z$1.ZodObject<{
@@ -1380,8 +1428,8 @@ declare const QuoteSchema: z$1.ZodObject<{
1380
1428
  * const quote = Quote.from({ obligationId: "0x123", ask: { price: 100n }, bid: { price: 100n } });
1381
1429
  * ```
1382
1430
  */
1383
- declare function from$9(parameters: from$9.Parameters): from$9.ReturnType;
1384
- declare namespace from$9 {
1431
+ declare function from$10(parameters: from$10.Parameters): from$10.ReturnType;
1432
+ declare namespace from$10 {
1385
1433
  type Parameters = Quote;
1386
1434
  type ReturnType = Quote;
1387
1435
  type ErrorType = InvalidQuoteError;
@@ -1396,7 +1444,7 @@ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.R
1396
1444
  declare namespace fromSnakeCase {
1397
1445
  type Parameters = Snake<Quote>;
1398
1446
  type ReturnType = Quote;
1399
- type ErrorType = from$9.ErrorType;
1447
+ type ErrorType = from$10.ErrorType;
1400
1448
  }
1401
1449
  /**
1402
1450
  * Generates a random quote.
@@ -1411,12 +1459,85 @@ declare function random(): random.ReturnType;
1411
1459
  declare namespace random {
1412
1460
  type Parameters = never;
1413
1461
  type ReturnType = Quote;
1414
- type ErrorType = from$9.ErrorType;
1462
+ type ErrorType = from$10.ErrorType;
1415
1463
  }
1416
1464
  declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
1417
1465
  readonly name = "Quote.InvalidQuoteError";
1418
1466
  constructor(error: z$1.ZodError | Error);
1419
1467
  }
1468
+ declare namespace TradingFee_d_exports {
1469
+ export { BREAKPOINTS, Fees, InvalidFeeError, InvalidFeesLengthError, TradingFee, WAD, activate, compute, deactivate, from$9 as from, getFees, isActivated };
1470
+ }
1471
+ /**
1472
+ * Time breakpoints in seconds for piecewise linear fee interpolation.
1473
+ * Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d.
1474
+ */
1475
+ declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n];
1476
+ /** WAD constant (1e18) for fee scaling. */
1477
+ declare const WAD: bigint;
1478
+ /** Tuple type for the 6 fee values at each breakpoint. */
1479
+ type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint];
1480
+ /**
1481
+ * TradingFee represents a piecewise linear fee curve with 6 breakpoints.
1482
+ * The internal storage mimics on-chain bitmap behavior but uses a struct for clarity.
1483
+ */
1484
+ type TradingFee = {
1485
+ readonly _activated: boolean;
1486
+ readonly _fees: Fees;
1487
+ } & Brand<"TradingFee">;
1488
+ /**
1489
+ * Create a TradingFee from an activation flag and 6 fee values.
1490
+ * @param activated - Whether the fee is active.
1491
+ * @param fees - Tuple of 6 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d).
1492
+ * @returns A new TradingFee instance.
1493
+ * @throws {@link InvalidFeeError} if any fee exceeds WAD (100%).
1494
+ * @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 6 elements.
1495
+ */
1496
+ declare function from$9(activated: boolean, fees: Fees): TradingFee;
1497
+ declare namespace from$9 {
1498
+ type ErrorType = InvalidFeeError | InvalidFeesLengthError;
1499
+ }
1500
+ /**
1501
+ * Compute the trading fee for a given time to maturity using piecewise linear interpolation.
1502
+ * @param tradingFee - The TradingFee instance.
1503
+ * @param timeToMaturity - Time to maturity in seconds.
1504
+ * @returns The interpolated fee in WAD. Returns 0n if not activated.
1505
+ */
1506
+ declare function compute(tradingFee: TradingFee, timeToMaturity: number): bigint;
1507
+ /**
1508
+ * Check if the trading fee is activated.
1509
+ * @param tradingFee - The TradingFee instance.
1510
+ * @returns True if activated, false otherwise.
1511
+ */
1512
+ declare function isActivated(tradingFee: TradingFee): boolean;
1513
+ /**
1514
+ * Create a new TradingFee with activation enabled.
1515
+ * @param tradingFee - The TradingFee instance.
1516
+ * @returns A new TradingFee with activated set to true.
1517
+ */
1518
+ declare function activate(tradingFee: TradingFee): TradingFee;
1519
+ /**
1520
+ * Create a new TradingFee with activation disabled.
1521
+ * @param tradingFee - The TradingFee instance.
1522
+ * @returns A new TradingFee with activated set to false.
1523
+ */
1524
+ declare function deactivate(tradingFee: TradingFee): TradingFee;
1525
+ /**
1526
+ * Get the fee values at each breakpoint.
1527
+ * @param tradingFee - The TradingFee instance.
1528
+ * @returns The tuple of 6 fee values.
1529
+ */
1530
+ declare function getFees(tradingFee: TradingFee): Fees;
1531
+ /** Error thrown when a fee value is invalid (negative or exceeds WAD). */
1532
+ declare class InvalidFeeError extends BaseError {
1533
+ readonly name = "TradingFee.InvalidFeeError";
1534
+ constructor(fee: bigint, index: number);
1535
+ }
1536
+ /** Error thrown when fees array doesn't have exactly 6 elements. */
1537
+ declare class InvalidFeesLengthError extends BaseError {
1538
+ readonly name = "TradingFee.InvalidFeesLengthError";
1539
+ constructor(length: number);
1540
+ }
1420
1541
  declare namespace Transfer_d_exports {
1421
1542
  export { Transfer, from$8 as from };
1422
1543
  }
@@ -1455,25 +1576,46 @@ declare namespace from$8 {
1455
1576
  type ReturnType = Transfer;
1456
1577
  }
1457
1578
  declare namespace Tree_d_exports {
1458
- export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs };
1579
+ export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs, signatureDomain, signatureTypes };
1459
1580
  }
1460
1581
  /**
1461
1582
  * A merkle tree of offers built from offer hashes.
1462
1583
  * Constructed via {@link from}. The tree root can be signed for onchain broadcast.
1463
1584
  */
1464
1585
  type Tree = Compute<StandardMerkleTree<[Hex]> & {
1465
- /** The offers in the tree. */
1466
- offers: Offer[];
1467
- /** The root of the tree. */
1586
+ /** The offers in the tree. */offers: Offer[]; /** The root of the tree. */
1468
1587
  root: Hex;
1469
1588
  }>;
1470
1589
  type Proof = {
1471
- /** The offer that the proof is for. */
1472
- offer: Offer;
1473
- /** The merkle proof path for the offer. */
1590
+ /** The offer that the proof is for. */offer: Offer; /** The merkle proof path for the offer. */
1474
1591
  path: Hex[];
1475
1592
  };
1476
1593
  declare const VERSION$1 = 1;
1594
+ type SignatureDomain = {
1595
+ /** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
1596
+ verifyingContract: Address;
1597
+ };
1598
+ /** Normalized Root signature domain (BigInt chain id, lowercase address). */
1599
+ type NormalizedSignatureDomain = {
1600
+ chainId: bigint;
1601
+ verifyingContract: Address;
1602
+ };
1603
+ /**
1604
+ * EIP-712 types for signing the tree root (Root(bytes32 root)).
1605
+ */
1606
+ declare const signatureTypes: {
1607
+ readonly EIP712Domain: readonly [{
1608
+ readonly name: "chainId";
1609
+ readonly type: "uint256";
1610
+ }, {
1611
+ readonly name: "verifyingContract";
1612
+ readonly type: "address";
1613
+ }];
1614
+ readonly Root: readonly [{
1615
+ readonly name: "root";
1616
+ readonly type: "bytes32";
1617
+ }];
1618
+ };
1477
1619
  /**
1478
1620
  * Builds a Merkle tree from a list of offers.
1479
1621
  *
@@ -1496,6 +1638,11 @@ declare const from$7: (offers: Offer[]) => Tree;
1496
1638
  * @returns Array of proofs - {@link Proof}
1497
1639
  */
1498
1640
  declare const proofs: (tree: Tree) => Proof[];
1641
+ /**
1642
+ * Normalizes a Root signature domain (BigInt chain id, lowercase address).
1643
+ * @throws {SignatureDomainError} When the domain is invalid.
1644
+ */
1645
+ declare const signatureDomain: (domain: SignatureDomain) => NormalizedSignatureDomain;
1499
1646
  /**
1500
1647
  * Encodes a merkle tree with signature into hex calldata for onchain broadcast.
1501
1648
  *
@@ -1503,15 +1650,21 @@ declare const proofs: (tree: Tree) => Proof[];
1503
1650
  * - `{vv}`: 1-byte version (currently 0x01)
1504
1651
  * - `{gzip([...offers])}`: gzipped JSON array of serialized offers
1505
1652
  * - `{root}`: 32-byte merkle root
1506
- * - `{signature}`: 65-byte EIP-191 signature over raw root bytes
1653
+ * - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
1507
1654
  *
1508
1655
  * Validates signature authenticity and root integrity before encoding.
1509
1656
  *
1510
1657
  * @example
1511
1658
  * ```typescript
1512
1659
  * const tree = Tree.from(offers);
1513
- * const signature = await wallet.signMessage({ message: { raw: tree.root } });
1514
- * const calldata = await Tree.encode(tree, signature);
1660
+ * const signature = await wallet.signTypedData({
1661
+ * account: wallet.account,
1662
+ * domain: Tree.signatureDomain({ chainId, verifyingContract }),
1663
+ * types: Tree.signatureTypes,
1664
+ * primaryType: "Root",
1665
+ * message: { root: tree.root },
1666
+ * });
1667
+ * const calldata = await Tree.encode(tree, signature, { chainId, verifyingContract });
1515
1668
  * await broadcast(calldata);
1516
1669
  * ```
1517
1670
  *
@@ -1521,16 +1674,23 @@ declare const proofs: (tree: Tree) => Proof[];
1521
1674
  * const tree = Tree.from(offers);
1522
1675
  * const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
1523
1676
  * const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
1524
- * const signature = await wallet.signMessage({ message: { raw: tree.root } });
1677
+ * const signature = await wallet.signTypedData({
1678
+ * account: wallet.account,
1679
+ * domain: Tree.signatureDomain({ chainId, verifyingContract }),
1680
+ * types: Tree.signatureTypes,
1681
+ * primaryType: "Root",
1682
+ * message: { root: tree.root },
1683
+ * });
1525
1684
  * const calldata = `${partial}${signature.slice(2)}`;
1526
1685
  * ```
1527
1686
  *
1528
1687
  * @param tree - Merkle tree of offers
1529
- * @param signature - EIP-191 signature over raw root bytes
1688
+ * @param signature - EIP-712 signature over Root(bytes32 root)
1689
+ * @param domain - EIP-712 domain with chain id and verifying contract
1530
1690
  * @returns Hex-encoded calldata ready for onchain broadcast
1531
1691
  * @throws {EncodeError} If signature verification fails or root mismatch
1532
1692
  */
1533
- declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
1693
+ declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
1534
1694
  /**
1535
1695
  * Encodes a merkle tree without a signature into hex payload for client-side signing.
1536
1696
  *
@@ -1560,15 +1720,16 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
1560
1720
  *
1561
1721
  * @example
1562
1722
  * ```typescript
1563
- * const { tree, signature, signer } = await Tree.decode(calldata);
1723
+ * const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
1564
1724
  * console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
1565
1725
  * ```
1566
1726
  *
1567
1727
  * @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
1728
+ * @param domain - EIP-712 domain with chain id and verifying contract
1568
1729
  * @returns Validated tree, signature, and recovered signer address
1569
1730
  * @throws {DecodeError} If version invalid, signature invalid, or root mismatch
1570
1731
  */
1571
- declare const decode: (encoded: Hex) => Promise<{
1732
+ declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
1572
1733
  tree: Tree;
1573
1734
  signature: Hex;
1574
1735
  signer: Address;
@@ -1597,21 +1758,23 @@ declare class DecodeError extends BaseError {
1597
1758
  name: string;
1598
1759
  constructor(reason: string);
1599
1760
  }
1761
+ /**
1762
+ * Error thrown when an invalid signature domain is supplied.
1763
+ */
1764
+ declare class SignatureDomainError extends BaseError {
1765
+ name: string;
1766
+ constructor(reason: string);
1767
+ }
1600
1768
  //#endregion
1601
1769
  //#region src/indexer/collectors/Collector.d.ts
1602
1770
  declare const names: readonly ["offers", "consumed_events", "positions", "prices"];
1603
1771
  type Name = (typeof names)[number];
1604
1772
  /** A general collector interface. */
1605
1773
  type Collector<name extends Name = Name, client extends PublicClient<Transport, Chain$1> = PublicClient<Transport, Chain$1>> = {
1606
- /** The name of the collector. */
1607
- readonly name: name;
1608
- /** The chain the collector is running on. */
1609
- readonly chain: client["chain"];
1610
- /** The public client used to query chain head. */
1611
- readonly client: client;
1612
- /** The database connection for collector metadata. */
1613
- readonly db: Database;
1614
- /** The normal polling interval (ms) for this collector. */
1774
+ /** The name of the collector. */readonly name: name; /** The chain the collector is running on. */
1775
+ readonly chain: client["chain"]; /** The public client used to query chain head. */
1776
+ readonly client: client; /** The database connection for collector metadata. */
1777
+ readonly db: Database; /** The normal polling interval (ms) for this collector. */
1615
1778
  readonly interval: number;
1616
1779
  /** Start collecting data from external sources.
1617
1780
  * @yields The last block number processed by the collector.
@@ -1659,31 +1822,23 @@ type HandleReorgParameters = {
1659
1822
  collectorNames?: Name[];
1660
1823
  };
1661
1824
  type BlocksDomain = {
1662
- /** Initialize and return chain + collector state, seeding rows when missing. */
1663
- init: (parameters: InitParameters) => Promise<{
1825
+ /** Initialize and return chain + collector state, seeding rows when missing. */init: (parameters: InitParameters) => Promise<{
1664
1826
  chain: ChainState;
1665
1827
  collector: CollectorState;
1666
- }>;
1667
- /** Return chain state, failing if it has not been initialized yet. */
1668
- getChain: (chainId: Id) => Promise<ChainState>;
1669
- /** Return collector state, failing if it has not been initialized yet. */
1828
+ }>; /** Return chain state, failing if it has not been initialized yet. */
1829
+ getChain: (chainId: Id) => Promise<ChainState>; /** Return collector state, failing if it has not been initialized yet. */
1670
1830
  getCollector: (parameters: {
1671
1831
  chainId: Id;
1672
1832
  collectorName: Name;
1673
- }) => Promise<CollectorState>;
1674
- /** Return chain state rows, optionally filtered by chain id. */
1833
+ }) => Promise<CollectorState>; /** Return chain state rows, optionally filtered by chain id. */
1675
1834
  getChains: (parameters?: {
1676
1835
  chainId?: Id;
1677
- }) => Promise<ChainSnapshot[]>;
1678
- /** Return collector state rows, optionally filtered by chain id. */
1836
+ }) => Promise<ChainSnapshot[]>; /** Return collector state rows, optionally filtered by chain id. */
1679
1837
  getCollectors: (parameters?: {
1680
1838
  chainId?: Id;
1681
- }) => Promise<CollectorSnapshot[]>;
1682
- /** Persist chain block state updates. */
1683
- advanceChain: (parameters: AdvanceChainParameters) => Promise<void>;
1684
- /** Persist collector block state updates and enforce invariants via storage CAS. */
1685
- advanceCollector: (parameters: AdvanceCollectorParameters) => Promise<void>;
1686
- /** Apply a reorg by advancing the chain epoch and fencing collectors. */
1839
+ }) => Promise<CollectorSnapshot[]>; /** Persist chain block state updates. */
1840
+ advanceChain: (parameters: AdvanceChainParameters) => Promise<void>; /** Persist collector block state updates and enforce invariants via storage CAS. */
1841
+ advanceCollector: (parameters: AdvanceCollectorParameters) => Promise<void>; /** Apply a reorg by advancing the chain epoch and fencing collectors. */
1687
1842
  handleReorg: (parameters: HandleReorgParameters) => Promise<void>;
1688
1843
  };
1689
1844
  declare namespace Logger_d_exports {
@@ -1743,8 +1898,7 @@ type Row = {
1743
1898
  blockNumber: number;
1744
1899
  };
1745
1900
  type OffersDomain = {
1746
- /** Create multiple offers. */
1747
- create: (batches: CreateBatch[]) => Promise<Hex[]>;
1901
+ /** Insert offers (insert-only). */create: (batches: CreateBatch[]) => Promise<Hex[]>;
1748
1902
  /** Delete multiple offers by hashes or block number greater than or equal to the given value on a given chain.
1749
1903
  * @returns the number of offers deleted.
1750
1904
  */
@@ -1753,65 +1907,50 @@ type OffersDomain = {
1753
1907
  } | {
1754
1908
  blockNumberGte: number;
1755
1909
  chainId: Id;
1756
- }) => Promise<number>;
1757
- /** Get all offers. */
1910
+ }) => Promise<number>; /** Get offers with collaterals only (no availability/takeable computation). */
1758
1911
  get: (parameters?: GetOffersParams) => Promise<{
1759
1912
  rows: Row[];
1760
1913
  nextCursor: string | null;
1761
- }>;
1762
- /** Get obligations */
1914
+ }>; /** Get obligations */
1763
1915
  getObligations: (parameters?: {
1764
1916
  ids?: Hex[];
1765
- chainId?: Id;
1766
- loanToken?: Address;
1767
- collateralToken?: Address;
1768
- maturity?: number;
1917
+ chainId?: Id[];
1918
+ loanToken?: Address[];
1919
+ collateralToken?: Address[];
1920
+ maturity?: number[];
1769
1921
  cursor?: string;
1770
1922
  limit?: number;
1771
1923
  }) => Promise<{
1772
1924
  obligations: Obligation[];
1773
1925
  nextCursor: string | null;
1774
- }>;
1775
- /** Get quotes for given obligations. */
1926
+ }>; /** Get quotes for given obligations. */
1776
1927
  getQuotes: (parameters: {
1777
1928
  obligationIds: Hex[];
1778
1929
  }) => Promise<Quote[]>;
1779
1930
  };
1780
1931
  type PaginationParams$1 = {
1781
- /** Cursor string returned by a previous call, for pagination */
1782
- cursor?: string;
1783
- /** Page size; defaults to {@link DEFAULT_LIMIT} */
1932
+ /** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
1784
1933
  limit?: number;
1785
1934
  };
1786
1935
  type GetOffersParams = {
1787
- /** Filter by maker address */
1788
- maker?: Address;
1936
+ /** Filter by maker address */maker?: Address;
1789
1937
  } & PaginationParams$1;
1790
1938
  //#endregion
1791
1939
  //#region src/database/domains/Book.d.ts
1792
1940
  type BookDomain = {
1793
- /** Get aggregated book levels for a given obligation side. */
1794
- get: (parameters: get$4.Parameters) => Promise<get$4.ReturnType>;
1795
- /** Get all offers for a given obligation side with cross-invalidation. */
1941
+ /** Get aggregated book levels for a given obligation side. */get: (parameters: get$4.Parameters) => Promise<get$4.ReturnType>; /** Get all offers for a given obligation side with cross-invalidation. */
1796
1942
  getOffers: (parameters: getOffers$2.Parameters) => Promise<getOffers$2.ReturnType>;
1797
1943
  };
1798
1944
  declare namespace get$4 {
1799
1945
  type Parameters = {
1800
- /** The side of the offer. */
1801
- side: "buy" | "sell";
1802
- /** The obligationId of the offer. */
1803
- obligationId: Hex;
1804
- /** Cursor string returned by a previous call, for pagination */
1805
- cursor?: string;
1806
- /** Page size; defaults to {@link DEFAULT_LIMIT} */
1946
+ /** The side of the offer. */side: "buy" | "sell"; /** The obligationId of the offer. */
1947
+ obligationId: Hex; /** Cursor string returned by a previous call, for pagination */
1948
+ cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
1807
1949
  limit?: number;
1808
1950
  };
1809
1951
  type Level = {
1810
- /** The computed price for this level (interpolated at query time) */
1811
- price: bigint;
1812
- /** Sum of takeable amounts at this price */
1813
- assets: bigint;
1814
- /** Number of offers at this price */
1952
+ /** The computed price for this level (interpolated at query time) */price: bigint; /** Sum of takeable amounts at this price */
1953
+ assets: bigint; /** Number of offers at this price */
1815
1954
  count: number;
1816
1955
  };
1817
1956
  type ReturnType = {
@@ -1821,13 +1960,9 @@ declare namespace get$4 {
1821
1960
  }
1822
1961
  declare namespace getOffers$2 {
1823
1962
  type Parameters = {
1824
- /** The side of the offer. */
1825
- side: "buy" | "sell";
1826
- /** The obligationId of the offer. */
1827
- obligationId: Hex;
1828
- /** Cursor string returned by a previous call, for pagination */
1829
- cursor?: string;
1830
- /** Page size; defaults to {@link DEFAULT_LIMIT} */
1963
+ /** The side of the offer. */side: "buy" | "sell"; /** The obligationId of the offer. */
1964
+ obligationId: Hex; /** Cursor string returned by a previous call, for pagination */
1965
+ cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
1831
1966
  limit?: number;
1832
1967
  };
1833
1968
  type ReturnType = {
@@ -1836,6 +1971,35 @@ declare namespace getOffers$2 {
1836
1971
  };
1837
1972
  }
1838
1973
  //#endregion
1974
+ //#region src/database/domains/Callbacks.d.ts
1975
+ type CallbackInput = {
1976
+ chainId: Id;
1977
+ contract: Address;
1978
+ user: Address;
1979
+ amount: bigint;
1980
+ };
1981
+ type OfferCallbacks = {
1982
+ offerHash: Hex;
1983
+ callbacks: CallbackInput[];
1984
+ };
1985
+ type CallbacksDomain = {
1986
+ /**
1987
+ * Upsert callbacks and their offer associations.
1988
+ * @param inputs - Callback associations grouped by offer hash. {@link OfferCallbacks}
1989
+ */
1990
+ upsert: (inputs: OfferCallbacks[]) => Promise<void>;
1991
+ /**
1992
+ * Delete callback associations by offer hashes.
1993
+ * @param parameters - Offer hashes to delete. {@link DeleteParameters}
1994
+ * @returns Number of rows deleted. {@link DeleteReturnType}
1995
+ */
1996
+ delete: (parameters: DeleteParameters) => Promise<DeleteReturnType>;
1997
+ };
1998
+ type DeleteParameters = {
1999
+ offers: Hex[];
2000
+ };
2001
+ type DeleteReturnType = number;
2002
+ //#endregion
1839
2003
  //#region src/database/domains/Consumed.d.ts
1840
2004
  type Event = {
1841
2005
  id: string;
@@ -1846,15 +2010,29 @@ type Event = {
1846
2010
  blockNumber: number;
1847
2011
  };
1848
2012
  type ConsumedDomain = {
1849
- /** Create new consumed events. */
1850
- create: (parameters: Event[]) => Promise<void>;
1851
- /** Delete multiple consumed events by chain and block number greater than or equal to the given value. */
2013
+ /** Create new consumed events. */create: (parameters: Event[]) => Promise<void>; /** Delete multiple consumed events by chain and block number greater than or equal to the given value. */
1852
2014
  delete: (parameters: {
1853
2015
  chainId: Id;
1854
2016
  blockNumberGte: number;
1855
2017
  }) => Promise<number>;
1856
2018
  };
1857
2019
  //#endregion
2020
+ //#region src/database/domains/Groups.d.ts
2021
+ type GroupInput = {
2022
+ chainId: Id;
2023
+ maker: Address;
2024
+ group: Hex;
2025
+ blockNumber: number;
2026
+ consumed?: bigint;
2027
+ };
2028
+ type GroupsDomain = {
2029
+ /**
2030
+ * Insert groups (insert-only).
2031
+ * @param groups - Groups to insert. {@link GroupInput}
2032
+ */
2033
+ create: (groups: GroupInput[]) => Promise<void>;
2034
+ };
2035
+ //#endregion
1858
2036
  //#region src/database/domains/Lots.d.ts
1859
2037
  type Lot = {
1860
2038
  chainId: Id;
@@ -1899,6 +2077,15 @@ declare namespace get$3 {
1899
2077
  }
1900
2078
  declare function create$5(db: Core): LotsDomain;
1901
2079
  //#endregion
2080
+ //#region src/database/domains/Obligations.d.ts
2081
+ type ObligationsDomain = {
2082
+ /**
2083
+ * Insert obligations (insert-only).
2084
+ * @param obligations - Obligations to insert. {@link Obligation.Obligation}
2085
+ */
2086
+ create: (obligations: Obligation[]) => Promise<void>;
2087
+ };
2088
+ //#endregion
1902
2089
  //#region src/database/domains/Offsets.d.ts
1903
2090
  type Offset = {
1904
2091
  chainId: Id;
@@ -1942,9 +2129,7 @@ type OraclesDomain = {
1942
2129
  //#endregion
1943
2130
  //#region src/database/domains/Positions.d.ts
1944
2131
  type PaginationParams = {
1945
- /** Cursor string returned by a previous call, for pagination */
1946
- cursor?: string;
1947
- /** Page size; defaults to {@link DEFAULT_LIMIT} */
2132
+ /** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
1948
2133
  limit?: number;
1949
2134
  };
1950
2135
  type PositionsDomain = {
@@ -1982,11 +2167,8 @@ declare namespace upsert {
1982
2167
  }
1983
2168
  declare namespace get$1 {
1984
2169
  type Parameters = PaginationParams & {
1985
- /** The chain id to get positions for. Default is all chains. */
1986
- chainId?: Id;
1987
- /** The type of position to get. Default is all types. */
1988
- type?: Type;
1989
- /** If true, only return positions that have a balance. */
2170
+ /** The chain id to get positions for. Default is all chains. */chainId?: Id; /** The type of position to get. Default is all types. */
2171
+ type?: Type; /** If true, only return positions that have a balance. */
1990
2172
  filled?: boolean;
1991
2173
  };
1992
2174
  type ReturnType = {
@@ -1996,15 +2178,13 @@ declare namespace get$1 {
1996
2178
  }
1997
2179
  declare namespace getByUser {
1998
2180
  type Parameters = PaginationParams & {
1999
- /** The user address to get positions for. */
2000
- user: Address;
2181
+ /** The user address to get positions for. */user: Address;
2001
2182
  };
2002
2183
  type PositionWithReserved = {
2003
2184
  chainId: Id;
2004
2185
  contract: Address;
2005
2186
  user: Address;
2006
- blockNumber: number;
2007
- /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
2187
+ blockNumber: number; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
2008
2188
  reserved: bigint;
2009
2189
  };
2010
2190
  type ReturnType = {
@@ -2014,9 +2194,7 @@ declare namespace getByUser {
2014
2194
  }
2015
2195
  declare namespace setEmptyAfter {
2016
2196
  type Parameters = {
2017
- /** The chain id . */
2018
- chainId: Id;
2019
- /** The block number after which all positions should be set to empty. (inclusive) */
2197
+ /** The chain id . */chainId: Id; /** The block number after which all positions should be set to empty. (inclusive) */
2020
2198
  blockNumber: number;
2021
2199
  };
2022
2200
  type ReturnType = number;
@@ -2052,11 +2230,10 @@ type Attestation = {
2052
2230
  type CreateInput = {
2053
2231
  tree: Tree;
2054
2232
  signature: Hex;
2055
- blockNumber: number;
2056
2233
  };
2057
2234
  type TreesDomain = {
2058
2235
  /**
2059
- * Creates trees, offers, and attestation links in a single transaction.
2236
+ * Creates trees and attestation links in a single transaction.
2060
2237
  *
2061
2238
  * @param trees - Array of decoded trees with signatures (batch insertion)
2062
2239
  * @returns Array of tree roots that were created/upserted
@@ -2102,9 +2279,12 @@ type Driver = ReturnType<typeof drizzle> | ReturnType<typeof drizzle$1>;
2102
2279
  type Domains = {
2103
2280
  book: BookDomain;
2104
2281
  blocks: BlocksDomain;
2282
+ callbacks: CallbacksDomain;
2105
2283
  offers: OffersDomain;
2106
2284
  consumed: ConsumedDomain;
2285
+ groups: GroupsDomain;
2107
2286
  lots: LotsDomain;
2287
+ obligations: ObligationsDomain;
2108
2288
  offsets: OffsetsDomain;
2109
2289
  oracles: OraclesDomain;
2110
2290
  trees: TreesDomain;
@@ -2135,20 +2315,20 @@ declare namespace Gate_d_exports {
2135
2315
  /**
2136
2316
  * A validation rule.
2137
2317
  */
2138
- type Rule<T, Name$2 extends string = string> = {
2318
+ type Rule<T, Name extends string = string> = {
2139
2319
  kind: "single";
2140
- name: Name$2;
2320
+ name: Name;
2141
2321
  description: string;
2142
- run: Single<T, Name$2>;
2322
+ run: Single<T, Name>;
2143
2323
  } | {
2144
2324
  kind: "batch";
2145
- name: Name$2;
2325
+ name: Name;
2146
2326
  description: string;
2147
- run: Batch<T, Name$2>;
2327
+ run: Batch<T, Name>;
2148
2328
  };
2149
- type RuleNames<Rules$1 extends readonly {
2329
+ type RuleNames<Rules extends readonly {
2150
2330
  name: string;
2151
- }[]> = Rules$1[number]["name"];
2331
+ }[]> = Rules[number]["name"];
2152
2332
  /**
2153
2333
  * A single item validation rule.
2154
2334
  * @param item - The item to validate.
@@ -2168,7 +2348,7 @@ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<
2168
2348
  * @param run - The function that validates the rule.
2169
2349
  * @returns The created rule.
2170
2350
  */
2171
- declare function single<Name$2 extends string, T>(name: Name$2, description: string, run: Single<T, Name$2>): Rule<T, Name$2>;
2351
+ declare function single<Name extends string, T>(name: Name, description: string, run: Single<T, Name>): Rule<T, Name>;
2172
2352
  /**
2173
2353
  * Create a validation rule iterating over a batch of items at a time.
2174
2354
  * @param name - The name of the rule.
@@ -2176,153 +2356,121 @@ declare function single<Name$2 extends string, T>(name: Name$2, description: str
2176
2356
  * @param run - The function that validates the rule.
2177
2357
  * @returns The created rule.
2178
2358
  */
2179
- declare function batch$1<Name$2 extends string, T>(name: Name$2, description: string, run: Batch<T, Name$2>): Rule<T, Name$2>;
2359
+ declare function batch$1<Name extends string, T>(name: Name, description: string, run: Batch<T, Name>): Rule<T, Name>;
2180
2360
  /**
2181
2361
  * A validation issue.
2182
2362
  */
2183
2363
  type Issue<T, RuleName extends string = string> = {
2184
- /** The name of the rule that caused the issue. */
2185
- ruleName: RuleName;
2186
- /** The message of the issue. */
2187
- message: string;
2188
- /** The item that was not valid. */
2364
+ /** The name of the rule that caused the issue. */ruleName: RuleName; /** The message of the issue. */
2365
+ message: string; /** The item that was not valid. */
2189
2366
  item: T;
2190
2367
  };
2191
2368
  /**
2192
2369
  * The result of a validation.
2193
2370
  */
2194
2371
  type Result<T, RuleName extends string = string> = {
2195
- /** The items that were valid. */
2196
- valid: T[];
2197
- /** The reports of the failed validations. */
2372
+ /** The items that were valid. */valid: T[]; /** The reports of the failed validations. */
2198
2373
  issues: Issue<T, RuleName>[];
2199
2374
  };
2200
- declare function run<T, Name$2 extends string, Rules$1 extends readonly Rule<T, Name$2>[]>(parameters: {
2375
+ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name>[]>(parameters: {
2201
2376
  items: T[];
2202
- rules: Rules$1;
2203
- chunkSize?: number;
2204
- }): Promise<Result<T, RuleNames<Rules$1>>>;
2205
- declare namespace Gatekeeper_d_exports {
2206
- export { Gatekeeper, Rules, create$3 as create };
2207
- }
2208
- type Rules = readonly Rule<Offer, string>[];
2209
- type Gatekeeper = {
2210
2377
  rules: Rules;
2211
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
2378
+ chunkSize?: number;
2379
+ }): Promise<Result<T, RuleNames<Rules>>>;
2380
+ //#endregion
2381
+ //#region src/gatekeeper/types.d.ts
2382
+ type ConfigRule = {
2383
+ type: "maturity";
2384
+ chain_id: Id;
2385
+ name: MaturityType;
2386
+ timestamp: Maturity;
2387
+ } | {
2388
+ type: "callback";
2389
+ chain_id: Id;
2390
+ address: Address;
2391
+ callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
2392
+ } | {
2393
+ type: "loan_token";
2394
+ chain_id: Id;
2395
+ address: Address;
2212
2396
  };
2213
- type GatekeeperParameters = {
2214
- rules: Rules;
2397
+ type ValidationIssue = {
2398
+ index: number;
2399
+ rule: string;
2400
+ message: string;
2215
2401
  };
2216
- declare function create$3(parameters: GatekeeperParameters): Gatekeeper;
2217
- declare namespace GateConfig_d_exports {
2218
- export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
2219
- }
2220
- type GateConfig = {
2221
- callbacks?: CallbackConfig[];
2222
- maturities?: MaturityType[];
2402
+ type ValidateOffersSuccess = {
2403
+ payload: Hex;
2404
+ root: Hex;
2223
2405
  };
2224
- type CallbackConfig = {
2225
- type: CallbackType.BuyVaultV1Callback;
2226
- addresses: Address[];
2227
- vaultFactories: Address[];
2228
- } | {
2229
- type: CallbackType.SellERC20Callback;
2230
- addresses: Address[];
2231
- } | {
2232
- type: CallbackType.BuyWithEmptyCallback;
2406
+ type ValidateOffersIssues = {
2407
+ issues: ValidationIssue[];
2233
2408
  };
2234
- declare function getCallback(chain: Name$1, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
2235
- type: CallbackType.BuyVaultV1Callback;
2236
- }> | undefined;
2237
- declare function getCallback(chain: Name$1, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
2238
- type: CallbackType.SellERC20Callback;
2239
- }> | undefined;
2240
- declare function getCallback(chain: Name$1, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
2241
- type: CallbackType.BuyWithEmptyCallback;
2242
- }> | undefined;
2243
- declare function getCallback(chain: Name$1, type: CallbackType): CallbackConfig | undefined;
2244
- /**
2245
- * Attempts to infer the configured callback type from a callback address on a chain.
2246
- * Skips the empty callback type as it does not carry addresses.
2247
- *
2248
- * @param chain - Chain name for which to infer the callback type
2249
- * @param address - Callback contract address
2250
- * @returns The callback type when found, otherwise undefined
2251
- */
2252
- declare function getCallbackType(chain: Name$1, address: Address): CallbackType | undefined;
2253
- /**
2254
- * Returns the callback addresses for a given chain and callback type, if it exists.
2255
- * @param chain - Chain name for which to read the validation configuration
2256
- * @param type - Callback type to retrieve
2257
- * @returns The matching callback addresses or an empty array if not configured
2258
- */
2259
- declare function getCallbackTypeAddresses(chain: Name$1, type: CallbackType): Address[];
2260
- /**
2261
- * Returns the list of allowed non-empty callback addresses for a chain.
2262
- *
2263
- * @param chain - Chain name
2264
- * @returns Array of allowed callback addresses (lowercased). Empty when none configured
2265
- */
2266
- declare const getCallbackAddresses: (chain: Name$1) => Address[];
2267
- declare const assets: Record<string, Address[]>;
2268
- declare const configs: Record<Name$1, GateConfig>;
2269
- //#endregion
2270
- //#region src/gatekeeper/morphoRules.d.ts
2271
- declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token"> | Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity">)[];
2272
- declare namespace Rules_d_exports {
2273
- export { ValidityParameters, amountMutualExclusivity, callback, chains$1 as chains, maturity, sameMaker, token, validity };
2409
+ type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
2410
+ type CallbackType = Type$1 | "not_supported";
2411
+ type CallbackTypesRequest = {
2412
+ callbacks: Array<{
2413
+ chain_id: Id;
2414
+ addresses: Address[];
2415
+ }>;
2416
+ };
2417
+ type CallbackTypesResponse = Array<{
2418
+ chain_id: Id;
2419
+ } & Partial<Record<CallbackType, Address[]>>>;
2420
+ type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
2421
+ type SuccessPayload<T> = {
2422
+ meta: {
2423
+ timestamp: string;
2424
+ checksum?: string;
2425
+ };
2426
+ cursor: string | null;
2427
+ data: T;
2428
+ };
2429
+ type ErrorPayload = {
2430
+ meta: {
2431
+ timestamp: string;
2432
+ checksum?: string;
2433
+ };
2434
+ error: {
2435
+ code: string;
2436
+ message: string;
2437
+ details?: unknown;
2438
+ };
2439
+ };
2440
+ declare namespace Client_d_exports {
2441
+ export { ClientConfig, GatekeeperClient, createHttpClient };
2274
2442
  }
2275
- type ValidityParameters = {
2276
- client: PublicClient<Transport, Chain$1>;
2443
+ type GatekeeperClient = {
2444
+ /** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
2445
+ statusCode: number;
2446
+ body: unknown;
2447
+ }>; /** Get configured rules for supported chains. */
2448
+ getConfigRules: (query?: {
2449
+ cursor?: string;
2450
+ limit?: number | string;
2451
+ types?: Array<ConfigRule["type"]> | ConfigRule["type"];
2452
+ }) => Promise<{
2453
+ statusCode: number;
2454
+ body: ConfigRulesPayload;
2455
+ }>; /** Validate offers and return decision results. */
2456
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
2457
+ getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
2458
+ baseUrl: string;
2459
+ };
2460
+ type ClientConfig = {
2461
+ baseUrl: string;
2462
+ timeoutMs?: number;
2463
+ fetchFn?: typeof fetch;
2464
+ originSecret?: string;
2277
2465
  };
2278
2466
  /**
2279
- * set of rules to validate offers.
2280
- *
2281
- * @param parameters - Validity parameters with chain and client
2282
- * @returns Array of validation rules to evaluate against offers
2283
- */
2284
- declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
2285
- declare const chains$1: ({
2286
- chains: chains$1
2287
- }: {
2288
- chains: Chain$1[];
2289
- }) => Rule<Offer, "chain_ids">;
2290
- declare const maturity: ({
2291
- maturities
2292
- }: {
2293
- maturities: MaturityType[];
2294
- }) => Rule<Offer, "maturity">;
2295
- declare const callback: ({
2296
- callbacks,
2297
- allowedAddresses
2298
- }: {
2299
- callbacks: CallbackType[];
2300
- allowedAddresses: Address[];
2301
- }) => Rule<Offer, "callback">;
2302
- /**
2303
- * A validation rule that checks if the offer's tokens are allowed for its chain.
2304
- * @param assetsByChainId - Allowed assets indexed by chain id.
2305
- * @returns The issue that was found. If the offer is valid, this will be undefined.
2306
- */
2307
- declare const token: ({
2308
- assetsByChainId
2309
- }: {
2310
- assetsByChainId: Partial<Record<Id, Address[]>>;
2311
- }) => Rule<Offer, "token">;
2312
- /**
2313
- * A batch validation rule that ensures all offers in a tree have the same maker address.
2314
- * Returns an issue only for the first non-conforming offer.
2315
- * This rule is signing-agnostic; signer verification is handled at the collector level.
2467
+ * Create an HTTP client for a gatekeeper service.
2468
+ * @param config - Gatekeeper client configuration. {@link ClientConfig}
2469
+ * @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
2316
2470
  */
2317
- declare const sameMaker: () => Rule<Offer, "mixed_maker">;
2318
- /**
2319
- * A validation rule that ensures mutual exclusivity of offer amount fields.
2320
- * At most one of (assets, obligationUnits, obligationShares) can be non-zero.
2321
- * Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
2322
- */
2323
- declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
2471
+ declare function createHttpClient(config: ClientConfig): GatekeeperClient;
2324
2472
  declare namespace Indexer_d_exports {
2325
- export { Indexer, IndexerConfig, create$2 as create, from$6 as from };
2473
+ export { Indexer, IndexerConfig, create$3 as create, from$6 as from };
2326
2474
  }
2327
2475
  type Indexer = {
2328
2476
  start: () => () => void;
@@ -2332,7 +2480,7 @@ type Indexer = {
2332
2480
  type IndexerConfig<client extends PublicClient<Transport, Chain$1, Account | undefined>> = {
2333
2481
  client: client;
2334
2482
  db: Database;
2335
- gatekeeper: Gatekeeper;
2483
+ gatekeeper: GatekeeperClient;
2336
2484
  interval?: number;
2337
2485
  maxBatchSize?: number;
2338
2486
  maxBlockNumber?: number;
@@ -2341,12 +2489,12 @@ type IndexerConfig<client extends PublicClient<Transport, Chain$1, Account | und
2341
2489
  retryDelayMs?: number;
2342
2490
  };
2343
2491
  declare function from$6<client extends PublicClient<Transport, Chain$1, Account | undefined>>(config: IndexerConfig<client>): Indexer;
2344
- declare function create$2<client extends PublicClient<Transport, Chain$1, Account | undefined>>(params: {
2492
+ declare function create$3<client extends PublicClient<Transport, Chain$1, Account | undefined>>(params: {
2345
2493
  collectors: Collector[];
2346
2494
  client: client;
2347
2495
  }): Indexer;
2348
2496
  declare namespace Health_d_exports {
2349
- export { ChainHealth$1 as ChainHealth, CollectorHealth$1 as CollectorHealth, CollectorHealthStatus, HealthService, HealthServiceParameters, MissingCollector, RouterHealth, RouterStatus, create$1 as create };
2497
+ export { ChainHealth$1 as ChainHealth, CollectorHealth$1 as CollectorHealth, CollectorHealthStatus, HealthService, HealthServiceParameters, MissingCollector, RouterHealth, RouterStatus, create$2 as create };
2350
2498
  }
2351
2499
  type CollectorHealthStatus = "live" | "lagging" | "unknown";
2352
2500
  type RouterStatus = "live" | "syncing";
@@ -2384,12 +2532,9 @@ type HealthService = {
2384
2532
  getChains: () => Promise<ChainHealth$1[]>;
2385
2533
  };
2386
2534
  type HealthServiceParameters = {
2387
- db: Database;
2388
- /** Maximum number of blocks a collector can lag behind its chain before being considered lagging. */
2389
- maxAllowedLag?: number;
2390
- /** Map of chainId to client for fetching remote block numbers. */
2391
- healthClients?: Map<Id, Client>;
2392
- /** Chain registry for deriving expected initialization state. */
2535
+ db: Database; /** Maximum number of blocks a collector can lag behind its chain before being considered lagging. */
2536
+ maxAllowedLag?: number; /** Map of chainId to client for fetching remote block numbers. */
2537
+ healthClients?: Map<Id, Client>; /** Chain registry for deriving expected initialization state. */
2393
2538
  chainRegistry?: ChainRegistry;
2394
2539
  };
2395
2540
  type Snapshot = {
@@ -2403,7 +2548,7 @@ type Snapshot = {
2403
2548
  /**
2404
2549
  * Create a health service that exposes collector and chain block numbers.
2405
2550
  */
2406
- declare function create$1(parameters: HealthServiceParameters): HealthService;
2551
+ declare function create$2(parameters: HealthServiceParameters): HealthService;
2407
2552
  //#endregion
2408
2553
  //#region src/api/Api.d.ts
2409
2554
  type RouterApi = {
@@ -2411,18 +2556,18 @@ type RouterApi = {
2411
2556
  };
2412
2557
  type ApiConfig = {
2413
2558
  db: Database;
2414
- gatekeeper: Gatekeeper;
2559
+ gatekeeper: GatekeeperClient;
2415
2560
  port: number;
2416
2561
  chainRegistry: ChainRegistry;
2417
2562
  };
2418
2563
  declare function from$5(config: ApiConfig): RouterApi;
2419
2564
  type CreateParameters = {
2420
2565
  db: Database;
2421
- gatekeeper: Gatekeeper;
2566
+ gatekeeper: GatekeeperClient;
2422
2567
  port: number;
2423
2568
  chainRegistry: ChainRegistry;
2424
2569
  };
2425
- declare function create(params: CreateParameters): RouterApi;
2570
+ declare function create$1(params: CreateParameters): RouterApi;
2426
2571
  declare namespace BookResponse_d_exports {
2427
2572
  export { BookLevelResponse, from$4 as from };
2428
2573
  }
@@ -2499,7 +2644,6 @@ type RouterStatusResponse = z.infer<typeof RouterStatusResponse>;
2499
2644
  * This file was auto-generated by openapi-typescript.
2500
2645
  * Do not make direct changes to the file.
2501
2646
  */
2502
-
2503
2647
  interface paths {
2504
2648
  "/v1/books/{obligationId}/{side}": {
2505
2649
  parameters: {
@@ -2543,16 +2687,14 @@ interface paths {
2543
2687
  };
2544
2688
  requestBody?: never;
2545
2689
  responses: {
2546
- /** @description Success */
2547
- 200: {
2690
+ /** @description Success */200: {
2548
2691
  headers: {
2549
2692
  [name: string]: unknown;
2550
2693
  };
2551
2694
  content: {
2552
2695
  "application/json": components["schemas"]["BookListResponse"];
2553
2696
  };
2554
- };
2555
- /** @description Bad Request */
2697
+ }; /** @description Bad Request */
2556
2698
  400: {
2557
2699
  headers: {
2558
2700
  [name: string]: unknown;
@@ -2571,7 +2713,7 @@ interface paths {
2571
2713
  patch?: never;
2572
2714
  trace?: never;
2573
2715
  };
2574
- "/v1/config": {
2716
+ "/v1/config/contracts": {
2575
2717
  parameters: {
2576
2718
  query?: never;
2577
2719
  header?: never;
@@ -2579,25 +2721,99 @@ interface paths {
2579
2721
  cookie?: never;
2580
2722
  };
2581
2723
  /**
2582
- * Get router configuration
2583
- * @description Returns chain configurations including contract addresses and supported maturity timestamps.
2724
+ * Get indexer contract configuration
2725
+ * @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
2584
2726
  */
2585
2727
  get: {
2586
2728
  parameters: {
2587
- query?: never;
2729
+ query?: {
2730
+ /**
2731
+ * @description Filter by chain IDs (comma-separated).
2732
+ * @example 1,8453
2733
+ */
2734
+ chains?: number[];
2735
+ /**
2736
+ * @description Maximum number of contracts to return (max 1000).
2737
+ * @example 1000
2738
+ */
2739
+ limit?: number;
2740
+ /**
2741
+ * @description Pagination cursor in chain_id:address format (lowercase address).
2742
+ * @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
2743
+ */
2744
+ cursor?: string;
2745
+ };
2588
2746
  header?: never;
2589
2747
  path?: never;
2590
2748
  cookie?: never;
2591
2749
  };
2592
2750
  requestBody?: never;
2593
2751
  responses: {
2594
- /** @description Success */
2595
- 200: {
2752
+ /** @description Success */200: {
2596
2753
  headers: {
2597
2754
  [name: string]: unknown;
2598
2755
  };
2599
2756
  content: {
2600
- "application/json": components["schemas"]["ConfigSuccessResponse"];
2757
+ "application/json": components["schemas"]["ConfigContractsSuccessResponse"];
2758
+ };
2759
+ };
2760
+ };
2761
+ };
2762
+ put?: never;
2763
+ post?: never;
2764
+ delete?: never;
2765
+ options?: never;
2766
+ head?: never;
2767
+ patch?: never;
2768
+ trace?: never;
2769
+ };
2770
+ "/v1/config/rules": {
2771
+ parameters: {
2772
+ query?: never;
2773
+ header?: never;
2774
+ path?: never;
2775
+ cookie?: never;
2776
+ };
2777
+ /**
2778
+ * Get config rules
2779
+ * @description Returns configured rules for supported chains.
2780
+ */
2781
+ get: {
2782
+ parameters: {
2783
+ query?: {
2784
+ /**
2785
+ * @description Filter by chain IDs (comma-separated).
2786
+ * @example 1,8453
2787
+ */
2788
+ chains?: number[];
2789
+ /**
2790
+ * @description Filter by rule types (comma-separated).
2791
+ * @example maturity,loan_token
2792
+ */
2793
+ types?: string[];
2794
+ /**
2795
+ * @description Maximum number of rules to return (max 1000).
2796
+ * @example 100
2797
+ */
2798
+ limit?: number;
2799
+ /**
2800
+ * @description Pagination cursor in type:chain_id:<value> format.
2801
+ * @example maturity:1:1730415600:end_of_next_month
2802
+ */
2803
+ cursor?: string;
2804
+ };
2805
+ header?: never;
2806
+ path?: never;
2807
+ cookie?: never;
2808
+ };
2809
+ requestBody?: never;
2810
+ responses: {
2811
+ /** @description Success */200: {
2812
+ headers: {
2813
+ [name: string]: unknown;
2814
+ };
2815
+ content: {
2816
+ "application/json": components["schemas"]["ConfigRulesSuccessResponse"];
2601
2817
  };
2602
2818
  };
2603
2819
  };
@@ -2656,16 +2872,14 @@ interface paths {
2656
2872
  };
2657
2873
  requestBody?: never;
2658
2874
  responses: {
2659
- /** @description Success */
2660
- 200: {
2875
+ /** @description Success */200: {
2661
2876
  headers: {
2662
2877
  [name: string]: unknown;
2663
2878
  };
2664
2879
  content: {
2665
2880
  "application/json": components["schemas"]["OfferListResponse"];
2666
2881
  };
2667
- };
2668
- /** @description Bad Request */
2882
+ }; /** @description Bad Request */
2669
2883
  400: {
2670
2884
  headers: {
2671
2885
  [name: string]: unknown;
@@ -2699,25 +2913,25 @@ interface paths {
2699
2913
  parameters: {
2700
2914
  query?: {
2701
2915
  /**
2702
- * @description Filter by exact maturity timestamp (unix seconds).
2703
- * @example 1761922800
2916
+ * @description Filter by exact maturity timestamps (comma-separated, unix seconds).
2917
+ * @example 1761922800,1764524800
2704
2918
  */
2705
- maturity?: number;
2919
+ maturities?: number[];
2706
2920
  /**
2707
- * @description Filter by collateral token (matches any collateral in the obligation).
2708
- * @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751
2921
+ * @description Filter by collateral tokens (comma-separated, matches any collateral).
2922
+ * @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751,0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
2709
2923
  */
2710
- collateral_token?: string;
2924
+ collateral_tokens?: string[];
2711
2925
  /**
2712
- * @description Filter by loan token address.
2713
- * @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
2926
+ * @description Filter by loan token addresses (comma-separated).
2927
+ * @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078,0x34Cf890dB685FC536E05652FB41f02090c3fb751
2714
2928
  */
2715
- loan_token?: string;
2929
+ loan_tokens?: string[];
2716
2930
  /**
2717
- * @description Filter by chain ID.
2718
- * @example 1
2931
+ * @description Filter by chain IDs (comma-separated).
2932
+ * @example 1,8453
2719
2933
  */
2720
- chain?: number;
2934
+ chains?: number[];
2721
2935
  /**
2722
2936
  * @description Maximum number of obligations to return.
2723
2937
  * @example 10
@@ -2735,16 +2949,14 @@ interface paths {
2735
2949
  };
2736
2950
  requestBody?: never;
2737
2951
  responses: {
2738
- /** @description Success */
2739
- 200: {
2952
+ /** @description Success */200: {
2740
2953
  headers: {
2741
2954
  [name: string]: unknown;
2742
2955
  };
2743
2956
  content: {
2744
2957
  "application/json": components["schemas"]["ObligationListResponse"];
2745
2958
  };
2746
- };
2747
- /** @description Bad Request */
2959
+ }; /** @description Bad Request */
2748
2960
  400: {
2749
2961
  headers: {
2750
2962
  [name: string]: unknown;
@@ -2789,16 +3001,14 @@ interface paths {
2789
3001
  };
2790
3002
  requestBody?: never;
2791
3003
  responses: {
2792
- /** @description Success */
2793
- 200: {
3004
+ /** @description Success */200: {
2794
3005
  headers: {
2795
3006
  [name: string]: unknown;
2796
3007
  };
2797
3008
  content: {
2798
3009
  "application/json": components["schemas"]["ObligationSingleSuccessResponse"];
2799
3010
  };
2800
- };
2801
- /** @description Bad Request */
3011
+ }; /** @description Bad Request */
2802
3012
  400: {
2803
3013
  headers: {
2804
3014
  [name: string]: unknown;
@@ -2843,8 +3053,7 @@ interface paths {
2843
3053
  };
2844
3054
  requestBody?: never;
2845
3055
  responses: {
2846
- /** @description Success */
2847
- 200: {
3056
+ /** @description Success */200: {
2848
3057
  headers: {
2849
3058
  [name: string]: unknown;
2850
3059
  };
@@ -2888,8 +3097,7 @@ interface paths {
2888
3097
  };
2889
3098
  requestBody?: never;
2890
3099
  responses: {
2891
- /** @description Success */
2892
- 200: {
3100
+ /** @description Success */200: {
2893
3101
  headers: {
2894
3102
  [name: string]: unknown;
2895
3103
  };
@@ -2933,8 +3141,7 @@ interface paths {
2933
3141
  };
2934
3142
  requestBody?: never;
2935
3143
  responses: {
2936
- /** @description Success */
2937
- 200: {
3144
+ /** @description Success */200: {
2938
3145
  headers: {
2939
3146
  [name: string]: unknown;
2940
3147
  };
@@ -2965,40 +3172,90 @@ interface paths {
2965
3172
  */
2966
3173
  get: {
2967
3174
  parameters: {
2968
- query?: {
2969
- /**
2970
- * @description Maximum number of positions to return.
2971
- * @example 10
2972
- */
2973
- limit?: number;
2974
- /**
2975
- * @description Pagination cursor in base64url-encoded format.
2976
- * @example eyJvZmZzZXQiOjEwMH0
2977
- */
2978
- cursor?: string;
2979
- };
3175
+ query?: {
3176
+ /**
3177
+ * @description Maximum number of positions to return.
3178
+ * @example 10
3179
+ */
3180
+ limit?: number;
3181
+ /**
3182
+ * @description Pagination cursor in base64url-encoded format.
3183
+ * @example eyJvZmZzZXQiOjEwMH0
3184
+ */
3185
+ cursor?: string;
3186
+ };
3187
+ header?: never;
3188
+ path: {
3189
+ /**
3190
+ * @description User address to get positions for.
3191
+ * @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
3192
+ */
3193
+ userAddress: string;
3194
+ };
3195
+ cookie?: never;
3196
+ };
3197
+ requestBody?: never;
3198
+ responses: {
3199
+ /** @description Success */200: {
3200
+ headers: {
3201
+ [name: string]: unknown;
3202
+ };
3203
+ content: {
3204
+ "application/json": components["schemas"]["PositionListResponse"];
3205
+ };
3206
+ }; /** @description Bad Request */
3207
+ 400: {
3208
+ headers: {
3209
+ [name: string]: unknown;
3210
+ };
3211
+ content: {
3212
+ "application/json": components["schemas"]["BadRequestResponse"];
3213
+ };
3214
+ };
3215
+ };
3216
+ };
3217
+ put?: never;
3218
+ post?: never;
3219
+ delete?: never;
3220
+ options?: never;
3221
+ head?: never;
3222
+ patch?: never;
3223
+ trace?: never;
3224
+ };
3225
+ "/v1/validate": {
3226
+ parameters: {
3227
+ query?: never;
3228
+ header?: never;
3229
+ path?: never;
3230
+ cookie?: never;
3231
+ };
3232
+ get?: never;
3233
+ put?: never;
3234
+ /**
3235
+ * Validate offers
3236
+ * @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
3237
+ */
3238
+ post: {
3239
+ parameters: {
3240
+ query?: never;
2980
3241
  header?: never;
2981
- path: {
2982
- /**
2983
- * @description User address to get positions for.
2984
- * @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
2985
- */
2986
- userAddress: string;
2987
- };
3242
+ path?: never;
2988
3243
  cookie?: never;
2989
3244
  };
2990
- requestBody?: never;
3245
+ requestBody?: {
3246
+ content: {
3247
+ "application/json": components["schemas"]["ValidateOffersRequest"];
3248
+ };
3249
+ };
2991
3250
  responses: {
2992
- /** @description Success */
2993
- 200: {
3251
+ /** @description Success */200: {
2994
3252
  headers: {
2995
3253
  [name: string]: unknown;
2996
3254
  };
2997
3255
  content: {
2998
- "application/json": components["schemas"]["PositionListResponse"];
3256
+ "application/json": components["schemas"]["ValidationSuccessResponse"];
2999
3257
  };
3000
- };
3001
- /** @description Bad Request */
3258
+ }; /** @description Bad Request */
3002
3259
  400: {
3003
3260
  headers: {
3004
3261
  [name: string]: unknown;
@@ -3009,15 +3266,13 @@ interface paths {
3009
3266
  };
3010
3267
  };
3011
3268
  };
3012
- put?: never;
3013
- post?: never;
3014
3269
  delete?: never;
3015
3270
  options?: never;
3016
3271
  head?: never;
3017
3272
  patch?: never;
3018
3273
  trace?: never;
3019
3274
  };
3020
- "/v1/validate": {
3275
+ "/v1/callbacks": {
3021
3276
  parameters: {
3022
3277
  query?: never;
3023
3278
  header?: never;
@@ -3027,17 +3282,8 @@ interface paths {
3027
3282
  get?: never;
3028
3283
  put?: never;
3029
3284
  /**
3030
- * Validate offers
3031
- * @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
3032
- *
3033
- * **Available validation rules:**
3034
- * - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
3035
- * - **mixed_maker**: Validates that all offers in a batch have the same maker address
3036
- * - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
3037
- * - **chain_ids**: Validates that offer chain is one of: [109111114]
3038
- * - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
3039
- * - **callback**: Validates callbacks: buy empty callback is allowed; sell offers must use a non-empty callback; non-empty callbacks must target one of [0x3333333333333333333333333333333333333333, 0x4444444444444444444444444444444444444444, 0x1111111111111111111111111111111111111111, 0x2222222222222222222222222222222222222222]
3040
- * - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
3285
+ * Resolve callback types
3286
+ * @description Returns callback types for callback addresses grouped by chain.
3041
3287
  */
3042
3288
  post: {
3043
3289
  parameters: {
@@ -3048,20 +3294,18 @@ interface paths {
3048
3294
  };
3049
3295
  requestBody?: {
3050
3296
  content: {
3051
- "application/json": components["schemas"]["ValidateOffersRequest"];
3297
+ "application/json": components["schemas"]["CallbackTypesRequest"];
3052
3298
  };
3053
3299
  };
3054
3300
  responses: {
3055
- /** @description Success */
3056
- 200: {
3301
+ /** @description Success */200: {
3057
3302
  headers: {
3058
3303
  [name: string]: unknown;
3059
3304
  };
3060
3305
  content: {
3061
- "application/json": components["schemas"]["ValidationSuccessResponse"];
3306
+ "application/json": components["schemas"]["CallbackTypesSuccessResponse"];
3062
3307
  };
3063
- };
3064
- /** @description Bad Request */
3308
+ }; /** @description Bad Request */
3065
3309
  400: {
3066
3310
  headers: {
3067
3311
  [name: string]: unknown;
@@ -3082,22 +3326,16 @@ interface paths {
3082
3326
  interface components {
3083
3327
  schemas: {
3084
3328
  BookListResponse: {
3085
- meta: components["schemas"]["Meta"];
3086
- /** @example eyJvZmZzZXQiOjEwMH0 */
3087
- cursor: string | null;
3088
- /** @description Aggregated book levels grouped by computed price. */
3329
+ meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
3330
+ cursor: string | null; /** @description Aggregated book levels grouped by computed price. */
3089
3331
  data: components["schemas"]["BookLevelResponse"][];
3090
3332
  };
3091
3333
  Meta: {
3092
- /** @example 2024-01-01T12:00:00.000Z */
3093
- timestamp: string;
3334
+ /** @example 2024-01-01T12:00:00.000Z */timestamp: string;
3094
3335
  };
3095
3336
  BookLevelResponse: {
3096
- /** @example 2750000000000000000 */
3097
- price: string;
3098
- /** @example 369216000000000000000000 */
3099
- assets: string;
3100
- /** @example 5 */
3337
+ /** @example 2750000000000000000 */price: string; /** @example 369216000000000000000000 */
3338
+ assets: string; /** @example 5 */
3101
3339
  count: number;
3102
3340
  };
3103
3341
  BadRequestResponse: {
@@ -3109,8 +3347,7 @@ interface components {
3109
3347
  * @example VALIDATION_ERROR
3110
3348
  * @enum {string}
3111
3349
  */
3112
- code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
3113
- /** @example Limit must be greater than 0. */
3350
+ code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST"; /** @example Limit must be greater than 0. */
3114
3351
  message: string;
3115
3352
  /**
3116
3353
  * @example [
@@ -3122,59 +3359,81 @@ interface components {
3122
3359
  */
3123
3360
  details: Record<string, never>;
3124
3361
  };
3125
- ConfigSuccessResponse: {
3126
- meta: components["schemas"]["Meta"];
3127
- /** @example null */
3362
+ ConfigContractsSuccessResponse: {
3363
+ meta: components["schemas"]["Meta"]; /** @example null */
3128
3364
  cursor: string | null;
3129
3365
  /**
3130
- * @description Array of chain configurations for all indexed chains.
3366
+ * @description Indexer contract configuration for all indexed chains.
3131
3367
  * @example [
3132
3368
  * {
3133
3369
  * "chain_id": 505050505,
3134
- * "contracts": {
3135
- * "mempool": "0xD946246695A9259F3B33a78629026F61B3Ab40aF"
3136
- * },
3137
- * "maturities": {
3138
- * "end_of_month": 1738335600,
3139
- * "end_of_next_month": 1740754800
3140
- * }
3370
+ * "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
3371
+ * "name": "mempool"
3372
+ * },
3373
+ * {
3374
+ * "chain_id": 505050505,
3375
+ * "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
3376
+ * "name": "multicall"
3377
+ * },
3378
+ * {
3379
+ * "chain_id": 505050505,
3380
+ * "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
3381
+ * "name": "v2"
3141
3382
  * }
3142
3383
  * ]
3143
3384
  */
3144
- data: components["schemas"]["ConfigDataResponse"][];
3385
+ data: components["schemas"]["ConfigContractResponse"][];
3145
3386
  };
3146
- ConfigDataResponse: {
3147
- /** @example 505050505 */
3148
- chain_id: number;
3149
- contracts: components["schemas"]["ConfigContractsResponse"];
3387
+ ConfigContractResponse: {
3388
+ /** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
3389
+ address: string;
3150
3390
  /**
3151
- * @description Supported maturity timestamps. Offers must use one of these values.
3152
- * @example {
3153
- * "end_of_month": 1738335600,
3154
- * "end_of_next_month": 1740754800
3155
- * }
3391
+ * @example mempool
3392
+ * @enum {string}
3156
3393
  */
3157
- maturities: components["schemas"]["MaturitiesResponse"];
3394
+ name: "mempool" | "multicall" | "v2";
3158
3395
  };
3159
- ConfigContractsResponse: {
3160
- /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
3161
- mempool: string;
3162
- };
3163
- MaturitiesResponse: {
3164
- /**
3165
- * @description Unix timestamp for end of current month maturity (last Friday 15:00 UTC).
3166
- * @example 1738335600
3167
- */
3168
- end_of_month: number;
3396
+ ConfigRulesSuccessResponse: {
3397
+ meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
3398
+ cursor: string | null;
3169
3399
  /**
3170
- * @description Unix timestamp for end of next month maturity (last Friday 15:00 UTC).
3171
- * @example 1740754800
3400
+ * @description Configured rules returned by the router API.
3401
+ * @example [
3402
+ * {
3403
+ * "type": "maturity",
3404
+ * "chain_id": 1,
3405
+ * "name": "end_of_next_month",
3406
+ * "timestamp": 1730415600
3407
+ * },
3408
+ * {
3409
+ * "type": "callback",
3410
+ * "chain_id": 1,
3411
+ * "address": "0x1111111111111111111111111111111111111111",
3412
+ * "callback_type": "sell_erc20_callback"
3413
+ * },
3414
+ * {
3415
+ * "type": "loan_token",
3416
+ * "chain_id": 1,
3417
+ * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
3418
+ * }
3419
+ * ]
3172
3420
  */
3173
- end_of_next_month: number;
3421
+ data: components["schemas"]["ConfigRulesRuleResponse"][];
3422
+ };
3423
+ ConfigRulesMeta: {
3424
+ /** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
3425
+ checksum: string;
3426
+ };
3427
+ ConfigRulesRuleResponse: {
3428
+ /** @example maturity */type: string; /** @example 1 */
3429
+ chain_id: number; /** @example end_of_next_month */
3430
+ name?: string; /** @example 1730415600 */
3431
+ timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
3432
+ address?: string; /** @example sell_erc20_callback */
3433
+ callback_type?: string;
3174
3434
  };
3175
3435
  OfferListResponse: {
3176
- meta: components["schemas"]["Meta"];
3177
- /** @example eyJvZmZzZXQiOjEwMH0 */
3436
+ meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
3178
3437
  cursor: string | null;
3179
3438
  /**
3180
3439
  * @description Offers matching the provided filters.
@@ -3250,20 +3509,13 @@ interface components {
3250
3509
  * "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
3251
3510
  * }
3252
3511
  */
3253
- offer: components["schemas"]["OfferDataResponse"];
3254
- /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
3255
- offer_hash: string;
3256
- /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
3257
- obligation_id: string;
3258
- /** @example 1 */
3259
- chain_id: number;
3260
- /** @example 0 */
3261
- consumed: string;
3262
- /** @example 369216000000000000000000 */
3263
- takeable: string;
3264
- /** @example 2942933377146801 */
3265
- block_number: number;
3266
- /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
3512
+ offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
3513
+ offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
3514
+ obligation_id: string; /** @example 1 */
3515
+ chain_id: number; /** @example 0 */
3516
+ consumed: string; /** @example 369216000000000000000000 */
3517
+ takeable: string; /** @example 2942933377146801 */
3518
+ block_number: number; /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
3267
3519
  root: string | null;
3268
3520
  /**
3269
3521
  * @example [
@@ -3271,8 +3523,7 @@ interface components {
3271
3523
  * "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
3272
3524
  * ]
3273
3525
  */
3274
- proof: string[] | null;
3275
- /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
3526
+ proof: string[] | null; /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
3276
3527
  signature: string | null;
3277
3528
  };
3278
3529
  OfferDataResponse: {
@@ -3289,35 +3540,22 @@ interface components {
3289
3540
  * "maturity": 1761922799
3290
3541
  * }
3291
3542
  */
3292
- obligation: components["schemas"]["ObligationOfferResponse"];
3293
- /** @example false */
3294
- buy: boolean;
3295
- /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
3296
- maker: string;
3297
- /** @example 369216000000000000000000 */
3298
- assets: string;
3299
- /** @example 0 */
3300
- obligation_units: string;
3301
- /** @example 0 */
3302
- obligation_shares: string;
3303
- /** @example 1761922790 */
3304
- start: number;
3305
- /** @example 1761922799 */
3306
- expiry: number;
3307
- /** @example 2750000000000000000 */
3308
- price: string;
3309
- /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
3310
- group: string;
3311
- /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
3312
- session: string;
3313
- /** @example 0x1111111111111111111111111111111111111111 */
3314
- callback: string;
3315
- /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
3543
+ obligation: components["schemas"]["ObligationOfferResponse"]; /** @example false */
3544
+ buy: boolean; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
3545
+ maker: string; /** @example 369216000000000000000000 */
3546
+ assets: string; /** @example 0 */
3547
+ obligation_units: string; /** @example 0 */
3548
+ obligation_shares: string; /** @example 1761922790 */
3549
+ start: number; /** @example 1761922799 */
3550
+ expiry: number; /** @example 2750000000000000000 */
3551
+ price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
3552
+ group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
3553
+ session: string; /** @example 0x1111111111111111111111111111111111111111 */
3554
+ callback: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
3316
3555
  callback_data: string;
3317
3556
  };
3318
3557
  ObligationOfferResponse: {
3319
- /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
3320
- loan_token: string;
3558
+ /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
3321
3559
  /**
3322
3560
  * @example [
3323
3561
  * {
@@ -3327,51 +3565,37 @@ interface components {
3327
3565
  * }
3328
3566
  * ]
3329
3567
  */
3330
- collaterals: components["schemas"]["CollateralResponse"][];
3331
- /** @example 1761922799 */
3568
+ collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922799 */
3332
3569
  maturity: number;
3333
3570
  };
3334
3571
  CollateralResponse: {
3335
- /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
3336
- token: string;
3337
- /** @example 860000000000000000 */
3338
- lltv: string;
3339
- /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
3572
+ /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */token: string; /** @example 860000000000000000 */
3573
+ lltv: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
3340
3574
  oracle: string;
3341
3575
  };
3342
3576
  ObligationListResponse: {
3343
- meta: components["schemas"]["Meta"];
3344
- /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
3345
- cursor: string | null;
3346
- /** @description List of obligations with takable offers. */
3577
+ meta: components["schemas"]["Meta"]; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
3578
+ cursor: string | null; /** @description List of obligations with takable offers. */
3347
3579
  data: components["schemas"]["ObligationResponse"][];
3348
3580
  };
3349
3581
  ObligationResponse: {
3350
- /** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
3351
- id: string;
3352
- /** @example 1 */
3353
- chain_id: number;
3354
- /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
3582
+ /** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */id: string; /** @example 1 */
3583
+ chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
3355
3584
  loan_token: string;
3356
- collaterals: components["schemas"]["CollateralResponse"][];
3357
- /** @example 1761922800 */
3585
+ collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922800 */
3358
3586
  maturity: number;
3359
3587
  ask: components["schemas"]["AskResponse"];
3360
3588
  bid: components["schemas"]["BidResponse"];
3361
3589
  };
3362
3590
  AskResponse: {
3363
- /** @example 1000000000000000000 */
3364
- price: string;
3591
+ /** @example 1000000000000000000 */price: string;
3365
3592
  };
3366
3593
  BidResponse: {
3367
- /** @example 1000000000000000000 */
3368
- price: string;
3594
+ /** @example 1000000000000000000 */price: string;
3369
3595
  };
3370
3596
  ObligationSingleSuccessResponse: {
3371
- meta: components["schemas"]["Meta"];
3372
- /** @example null */
3373
- cursor: string | null;
3374
- /** @description Obligation details. */
3597
+ meta: components["schemas"]["Meta"]; /** @example null */
3598
+ cursor: string | null; /** @description Obligation details. */
3375
3599
  data: components["schemas"]["ObligationResponse"];
3376
3600
  };
3377
3601
  RouterStatusSuccessResponse: {
@@ -3392,8 +3616,7 @@ interface components {
3392
3616
  * @example live
3393
3617
  * @enum {string}
3394
3618
  */
3395
- status: "live" | "syncing";
3396
- /** @example true */
3619
+ status: "live" | "syncing"; /** @example true */
3397
3620
  initialized: boolean;
3398
3621
  /**
3399
3622
  * @description Configured chain ids missing initialization rows.
@@ -3407,9 +3630,7 @@ interface components {
3407
3630
  missing_collectors: components["schemas"]["MissingCollectorResponse"][];
3408
3631
  };
3409
3632
  MissingCollectorResponse: {
3410
- /** @example 1 */
3411
- chain_id: number;
3412
- /** @example offers */
3633
+ /** @example 1 */chain_id: number; /** @example offers */
3413
3634
  name: string;
3414
3635
  };
3415
3636
  CollectorsHealthSuccessResponse: {
@@ -3431,22 +3652,16 @@ interface components {
3431
3652
  data: components["schemas"]["CollectorHealthResponse"][];
3432
3653
  };
3433
3654
  CollectorHealthResponse: {
3434
- /** @example offers */
3435
- name: string;
3436
- /** @example 1 */
3437
- chain_id: number;
3438
- /** @example 21345678 */
3439
- block_number: number | null;
3440
- /** @example 2024-01-01T12:00:00.000Z */
3441
- updated_at: string | null;
3442
- /** @example 0 */
3655
+ /** @example offers */name: string; /** @example 1 */
3656
+ chain_id: number; /** @example 21345678 */
3657
+ block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
3658
+ updated_at: string | null; /** @example 0 */
3443
3659
  lag: number | null;
3444
3660
  /**
3445
3661
  * @example live
3446
3662
  * @enum {string}
3447
3663
  */
3448
- status: "live" | "lagging" | "unknown";
3449
- /** @example true */
3664
+ status: "live" | "lagging" | "unknown"; /** @example true */
3450
3665
  initialized: boolean;
3451
3666
  };
3452
3667
  ChainsHealthSuccessResponse: {
@@ -3466,20 +3681,14 @@ interface components {
3466
3681
  data: components["schemas"]["ChainHealthResponse"][];
3467
3682
  };
3468
3683
  ChainHealthResponse: {
3469
- /** @example 1 */
3470
- chain_id: number;
3471
- /** @example 21345678 */
3472
- local_block_number: number | null;
3473
- /** @example 21345690 */
3474
- remote_block_number: number | null;
3475
- /** @example 2024-01-01T12:00:00.000Z */
3476
- updated_at: string | null;
3477
- /** @example true */
3684
+ /** @example 1 */chain_id: number; /** @example 21345678 */
3685
+ local_block_number: number | null; /** @example 21345690 */
3686
+ remote_block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
3687
+ updated_at: string | null; /** @example true */
3478
3688
  initialized: boolean;
3479
3689
  };
3480
3690
  PositionListResponse: {
3481
- meta: components["schemas"]["Meta"];
3482
- /** @example eyJvZmZzZXQiOjEwMH0 */
3691
+ meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
3483
3692
  cursor: string | null;
3484
3693
  /**
3485
3694
  * @description User positions with reserved balances from active offers.
@@ -3496,47 +3705,28 @@ interface components {
3496
3705
  data: components["schemas"]["PositionListItemResponse"][];
3497
3706
  };
3498
3707
  PositionListItemResponse: {
3499
- /** @example 1 */
3500
- chain_id: number;
3501
- /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
3502
- contract: string;
3503
- /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
3504
- user: string;
3505
- /** @example 200000000000000000000 */
3506
- reserved: string;
3507
- /** @example 21345678 */
3708
+ /** @example 1 */chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
3709
+ contract: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
3710
+ user: string; /** @example 200000000000000000000 */
3711
+ reserved: string; /** @example 21345678 */
3508
3712
  block_number: number;
3509
3713
  };
3510
3714
  ValidateOffersRequest: {
3511
- /** @description Array of offers in snake_case format. Required, non-empty. */
3512
- offers: components["schemas"]["ValidateOfferRequest"][];
3715
+ /** @description Array of offers in snake_case format. Required, non-empty. */offers: components["schemas"]["ValidateOfferRequest"][];
3513
3716
  };
3514
3717
  ValidateOfferRequest: {
3515
- /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
3516
- maker: string;
3517
- /** @example 369216000000000000000000 */
3518
- assets: string;
3519
- /** @example 0 */
3520
- obligation_units?: string;
3521
- /** @example 0 */
3522
- obligation_shares?: string;
3523
- /** @example 2750000000000000000 */
3524
- price: string;
3525
- /** @example 1761922799 */
3526
- maturity: number;
3527
- /** @example 1761922799 */
3528
- expiry: number;
3529
- /** @example 1761922790 */
3530
- start: number;
3531
- /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
3532
- group: string;
3533
- /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
3534
- session: string;
3535
- /** @example false */
3536
- buy: boolean;
3537
- /** @example 1 */
3538
- chain_id: number;
3539
- /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
3718
+ /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
3719
+ assets: string; /** @example 0 */
3720
+ obligation_units?: string; /** @example 0 */
3721
+ obligation_shares?: string; /** @example 2750000000000000000 */
3722
+ price: string; /** @example 1761922799 */
3723
+ maturity: number; /** @example 1761922799 */
3724
+ expiry: number; /** @example 1761922790 */
3725
+ start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
3726
+ group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
3727
+ session: string; /** @example false */
3728
+ buy: boolean; /** @example 1 */
3729
+ chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
3540
3730
  loan_token: string;
3541
3731
  /**
3542
3732
  * @example [
@@ -3557,24 +3747,17 @@ interface components {
3557
3747
  callback: components["schemas"]["ValidateCallbackRequest"];
3558
3748
  };
3559
3749
  ValidateCollateralRequest: {
3560
- /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
3561
- asset: string;
3562
- /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
3563
- oracle: string;
3564
- /** @example 860000000000000000 */
3750
+ /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
3751
+ oracle: string; /** @example 860000000000000000 */
3565
3752
  lltv: string;
3566
3753
  };
3567
3754
  ValidateCallbackRequest: {
3568
- /** @example 0x1111111111111111111111111111111111111111 */
3569
- address: string;
3570
- /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
3755
+ /** @example 0x1111111111111111111111111111111111111111 */address: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
3571
3756
  data: string;
3572
3757
  };
3573
3758
  ValidationSuccessResponse: {
3574
- meta: components["schemas"]["Meta"];
3575
- /** @example null */
3576
- cursor: string | null;
3577
- /** @description Payload and root for client-side signing. */
3759
+ meta: components["schemas"]["Meta"]; /** @example null */
3760
+ cursor: string | null; /** @description Payload and root for client-side signing. */
3578
3761
  data: components["schemas"]["ValidationSuccessDataResponse"];
3579
3762
  };
3580
3763
  ValidationSuccessDataResponse: {
@@ -3589,6 +3772,84 @@ interface components {
3589
3772
  */
3590
3773
  root: string;
3591
3774
  };
3775
+ CallbackTypesRequest: {
3776
+ /**
3777
+ * @example [
3778
+ * {
3779
+ * "chain_id": 1,
3780
+ * "addresses": [
3781
+ * "0x1111111111111111111111111111111111111111",
3782
+ * "0x3333333333333333333333333333333333333333",
3783
+ * "0x9999999999999999999999999999999999999999"
3784
+ * ]
3785
+ * }
3786
+ * ]
3787
+ */
3788
+ callbacks: components["schemas"]["CallbackTypesChainRequest"][];
3789
+ };
3790
+ CallbackTypesChainRequest: {
3791
+ /** @example 1 */chain_id: number;
3792
+ /**
3793
+ * @example [
3794
+ * "0x1111111111111111111111111111111111111111",
3795
+ * "0x3333333333333333333333333333333333333333",
3796
+ * "0x9999999999999999999999999999999999999999"
3797
+ * ]
3798
+ */
3799
+ addresses: string[];
3800
+ };
3801
+ CallbackTypesSuccessResponse: {
3802
+ meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
3803
+ cursor: string | null;
3804
+ /**
3805
+ * @description Callback types grouped by chain.
3806
+ * @example [
3807
+ * {
3808
+ * "chain_id": 1,
3809
+ * "sell_erc20_callback": [
3810
+ * "0x1111111111111111111111111111111111111111"
3811
+ * ],
3812
+ * "buy_erc20": [
3813
+ * "0x5555555555555555555555555555555555555555"
3814
+ * ],
3815
+ * "buy_vault_v1_callback": [
3816
+ * "0x3333333333333333333333333333333333333333"
3817
+ * ],
3818
+ * "not_supported": [
3819
+ * "0x9999999999999999999999999999999999999999"
3820
+ * ]
3821
+ * }
3822
+ * ]
3823
+ */
3824
+ data: components["schemas"]["CallbackTypesChainResponse"][];
3825
+ };
3826
+ CallbackTypesChainResponse: {
3827
+ /** @example 1 */chain_id: number;
3828
+ /**
3829
+ * @example [
3830
+ * "0x3333333333333333333333333333333333333333"
3831
+ * ]
3832
+ */
3833
+ buy_vault_v1_callback?: string[];
3834
+ /**
3835
+ * @example [
3836
+ * "0x1111111111111111111111111111111111111111"
3837
+ * ]
3838
+ */
3839
+ sell_erc20_callback?: string[];
3840
+ /**
3841
+ * @example [
3842
+ * "0x5555555555555555555555555555555555555555"
3843
+ * ]
3844
+ */
3845
+ buy_erc20?: string[];
3846
+ /**
3847
+ * @example [
3848
+ * "0x9999999999999999999999999999999999999999"
3849
+ * ]
3850
+ */
3851
+ not_supported: string[];
3852
+ };
3592
3853
  };
3593
3854
  responses: never;
3594
3855
  parameters: never;
@@ -3657,6 +3918,9 @@ declare class BooksController {
3657
3918
  declare class ValidateController {
3658
3919
  validateOffers(): Promise<void>;
3659
3920
  }
3921
+ declare class CallbacksController {
3922
+ resolveCallbackTypes(): Promise<void>;
3923
+ }
3660
3924
  declare class OffersController {
3661
3925
  getOffers(): Promise<void>;
3662
3926
  }
@@ -3665,8 +3929,11 @@ declare class HealthController {
3665
3929
  getCollectorsHealth(): Promise<void>;
3666
3930
  getChainsHealth(): Promise<void>;
3667
3931
  }
3668
- declare class ConfigController {
3669
- getConfig(): Promise<void>;
3932
+ declare class ConfigContractsController {
3933
+ getConfigContracts(): Promise<void>;
3934
+ }
3935
+ declare class ConfigRulesController {
3936
+ getConfigRules(): Promise<void>;
3670
3937
  }
3671
3938
  declare class ObligationsController {
3672
3939
  getObligations(): Promise<void>;
@@ -3675,14 +3942,7 @@ declare class ObligationsController {
3675
3942
  declare class UsersController {
3676
3943
  getUserPositions(): Promise<void>;
3677
3944
  }
3678
- type RuleInfo = {
3679
- name: string;
3680
- description: string;
3681
- };
3682
- type OpenApiOptions = {
3683
- rules?: RuleInfo[];
3684
- };
3685
- declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
3945
+ declare const OpenApi: () => Promise<OpenAPIDocument>;
3686
3946
  declare namespace PositionResponse_d_exports {
3687
3947
  export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
3688
3948
  }
@@ -3707,25 +3967,40 @@ declare const schemas: {
3707
3967
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
3708
3968
  0: "0";
3709
3969
  1: "1";
3710
- false: "false";
3711
3970
  true: "true";
3712
- }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
3971
+ false: "false";
3972
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
3713
3973
  }, z$1.core.$strip>;
3714
3974
  readonly get_health_collectors: z$1.ZodObject<{
3715
3975
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
3716
3976
  0: "0";
3717
3977
  1: "1";
3718
- false: "false";
3719
3978
  true: "true";
3720
- }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
3979
+ false: "false";
3980
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
3721
3981
  }, z$1.core.$strip>;
3722
3982
  readonly get_health_chains: z$1.ZodObject<{
3723
3983
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
3724
3984
  0: "0";
3725
3985
  1: "1";
3726
- false: "false";
3727
3986
  true: "true";
3728
- }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
3987
+ false: "false";
3988
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
3989
+ }, z$1.core.$strip>;
3990
+ readonly get_config_contracts: z$1.ZodObject<{
3991
+ cursor: z$1.ZodOptional<z$1.ZodString>;
3992
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3993
+ 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>>>>>;
3994
+ }, z$1.core.$strip>;
3995
+ readonly get_config_rules: z$1.ZodObject<{
3996
+ cursor: z$1.ZodOptional<z$1.ZodString>;
3997
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3998
+ types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
3999
+ maturity: "maturity";
4000
+ callback: "callback";
4001
+ loan_token: "loan_token";
4002
+ }>>>>;
4003
+ 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>>>>>;
3729
4004
  }, z$1.core.$strip>;
3730
4005
  readonly get_offers: z$1.ZodObject<{
3731
4006
  side: z$1.ZodOptional<z$1.ZodEnum<{
@@ -3739,10 +4014,10 @@ declare const schemas: {
3739
4014
  }, z$1.core.$strip>;
3740
4015
  readonly get_obligations: z$1.ZodObject<{
3741
4016
  cursor: z$1.ZodOptional<z$1.ZodString>;
3742
- chain: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>;
3743
- loan_token: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3744
- collateral_token: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3745
- maturity: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>;
4017
+ 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>>>>>;
4018
+ 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>>>>>;
4019
+ 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>>>>>;
4020
+ 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>>>>>;
3746
4021
  limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3747
4022
  }, z$1.core.$strip>;
3748
4023
  readonly get_obligation: z$1.ZodObject<{
@@ -3760,6 +4035,12 @@ declare const schemas: {
3760
4035
  readonly validate_offers: z$1.ZodObject<{
3761
4036
  offers: z$1.ZodArray<z$1.ZodUnknown>;
3762
4037
  }, z$1.core.$strict>;
4038
+ readonly callback_types: z$1.ZodObject<{
4039
+ callbacks: z$1.ZodArray<z$1.ZodObject<{
4040
+ chain_id: z$1.ZodNumber;
4041
+ addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
4042
+ }, z$1.core.$strict>>;
4043
+ }, z$1.core.$strict>;
3763
4044
  readonly get_user_positions: z$1.ZodObject<{
3764
4045
  user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
3765
4046
  cursor: z$1.ZodOptional<z$1.ZodString>;
@@ -3777,17 +4058,18 @@ declare enum STATUS_CODE {
3777
4058
  SUCCESS = 200,
3778
4059
  BAD_REQUEST = 400,
3779
4060
  NOT_FOUND = 404,
3780
- INTERNAL_SERVER_ERROR = 500,
4061
+ INTERNAL_SERVER_ERROR = 500
3781
4062
  }
3782
4063
  type Meta = {
3783
4064
  timestamp: string;
4065
+ checksum?: string;
3784
4066
  };
3785
4067
  type ErrorDetail = {
3786
4068
  code: APIErrorCode;
3787
4069
  message: string;
3788
4070
  details?: unknown;
3789
4071
  };
3790
- type SuccessPayload<T> = Compute<{
4072
+ type SuccessPayload$1<T> = Compute<{
3791
4073
  statusCode: STATUS_CODE.SUCCESS;
3792
4074
  body: {
3793
4075
  cursor: string | null;
@@ -3795,48 +4077,54 @@ type SuccessPayload<T> = Compute<{
3795
4077
  meta: Meta;
3796
4078
  };
3797
4079
  }>;
3798
- type ErrorPayload<statusCode extends Exclude<STATUS_CODE, STATUS_CODE.SUCCESS> = Exclude<STATUS_CODE, STATUS_CODE.SUCCESS>> = Compute<{
4080
+ type ErrorPayload$1<statusCode extends Exclude<STATUS_CODE, STATUS_CODE.SUCCESS> = Exclude<STATUS_CODE, STATUS_CODE.SUCCESS>> = Compute<{
3799
4081
  statusCode: statusCode;
3800
4082
  body: {
3801
4083
  meta: Meta;
3802
4084
  error: ErrorDetail;
3803
4085
  };
3804
4086
  }>;
3805
- type Payload<T> = SuccessPayload<T> | ErrorPayload;
4087
+ type Payload<T> = SuccessPayload$1<T> | ErrorPayload$1;
3806
4088
  //#endregion
3807
4089
  //#region src/api/Controllers/getBook.d.ts
3808
4090
  declare function getBook(params: object, db: Database): Promise<Payload<BookLevelResponse[]>>;
3809
4091
  //#endregion
3810
- //#region src/api/Controllers/getConfig.d.ts
3811
- type MaturitiesConfig = {
3812
- end_of_month: number;
3813
- end_of_next_month: number;
3814
- };
3815
- type ChainConfig = {
4092
+ //#region src/api/Controllers/getConfigContracts.d.ts
4093
+ declare const CONFIG_CONTRACT_NAMES: readonly ["mempool", "multicall", "v2"];
4094
+ type ConfigContractName = (typeof CONFIG_CONTRACT_NAMES)[number];
4095
+ type ConfigContract = {
3816
4096
  chain_id: Id;
3817
- contracts: {
3818
- mempool: string;
3819
- };
3820
- maturities: MaturitiesConfig;
4097
+ address: Address;
4098
+ name: ConfigContractName;
3821
4099
  };
3822
4100
  /**
3823
- * Returns the configuration for all chains the router is indexing.
4101
+ * Returns contract addresses used by indexers (mempool, v2) plus multicall per chain.
4102
+ * @param query - Raw query parameters containing optional chain filters.
3824
4103
  * @param chainRegistry - The chain registry instance. {@link ChainRegistry.ChainRegistry}
3825
- * @returns The configuration for all chains the router is indexing. {@link ApiPayload.Payload<ChainConfig[]>}
4104
+ * @returns The indexer contract configuration. {@link ApiPayload.Payload<ConfigContract[]>}
4105
+ */
4106
+ declare function getConfigContracts(query: unknown, chainRegistry: ChainRegistry): Promise<Payload<ConfigContract[]>>;
4107
+ //#endregion
4108
+ //#region src/api/Controllers/getConfigRules.d.ts
4109
+ /**
4110
+ * Returns configured rules for the configured chains.
4111
+ * @param query - Raw query parameters containing filters/cursor/limit.
4112
+ * @param chains - Chains to include in the configured rules.
4113
+ * @returns Config rules response payload. {@link ApiPayload.Payload}
3826
4114
  */
3827
- declare function getConfig(chainRegistry: ChainRegistry): Promise<Payload<ChainConfig[]>>;
4115
+ declare function getConfigRules(query: unknown, chains: Chain$1[]): Promise<Payload<ConfigRule[]>>;
3828
4116
  //#endregion
3829
4117
  //#region src/api/Controllers/getDocs.d.ts
3830
- declare function getSwaggerJson({
3831
- gatekeeper
3832
- }: {
3833
- gatekeeper: Gatekeeper;
3834
- }): Promise<OpenAPIDocument>;
3835
- declare function getDocsHtml({
3836
- gatekeeper
3837
- }: {
3838
- gatekeeper: Gatekeeper;
3839
- }): Promise<string>;
4118
+ /**
4119
+ * Build the OpenAPI document for the router.
4120
+ * @returns OpenAPI document. {@link OpenAPIDocument}
4121
+ */
4122
+ declare function getSwaggerJson(): Promise<OpenAPIDocument>;
4123
+ /**
4124
+ * Render the API documentation HTML page.
4125
+ * @returns HTML page as string.
4126
+ */
4127
+ declare function getDocsHtml(): Promise<string>;
3840
4128
  /**
3841
4129
  * Renders the integrator documentation as HTML.
3842
4130
  * @returns HTML page with the rendered markdown documentation.
@@ -3855,6 +4143,21 @@ declare function getObligation(params: object, db: Database): Promise<Payload<Ob
3855
4143
  declare function getObligations$1(queryParameters: object, db: Database): Promise<Payload<ObligationResponse[]>>;
3856
4144
  //#endregion
3857
4145
  //#region src/api/Controllers/getOffers.d.ts
4146
+ type GetOffersQueryParams = {
4147
+ /** Filter by maker address */maker?: Address; /** Cursor string returned by a previous call, for pagination */
4148
+ cursor?: string; /** Page size; defaults to {@link OffersDomain.DEFAULT_LIMIT} */
4149
+ limit?: number;
4150
+ };
4151
+ /**
4152
+ * Query offers with computed consumed/available/takeable values.
4153
+ * @param db - The database client. {@link Database.Core}
4154
+ * @param parameters - {@link GetOffersQueryParams}
4155
+ * @returns The offers with pagination cursor.
4156
+ */
4157
+ declare function getOffersQuery(db: Core, parameters?: GetOffersQueryParams): Promise<{
4158
+ rows: Row[];
4159
+ nextCursor: string | null;
4160
+ }>;
3858
4161
  declare function getOffers$1(queryParameters: object, db: Database): Promise<Payload<OfferResponse[]>>;
3859
4162
  //#endregion
3860
4163
  //#region src/api/Controllers/getUserPositions.d.ts
@@ -3866,34 +4169,58 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
3866
4169
  */
3867
4170
  declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
3868
4171
  //#endregion
4172
+ //#region src/api/Controllers/resolveCallbackTypes.d.ts
4173
+ type CallbackTypesPayload = SuccessPayload$1<CallbackTypesResponse>;
4174
+ /**
4175
+ * Resolve callback types for a list of callback addresses grouped by chain.
4176
+ * @param body - Request body with callback addresses. {@link CallbackTypesRequest}
4177
+ * @param chains - Chains to resolve callback types against. {@link Chain.Chain}
4178
+ * @returns Callback types grouped by chain. {@link CallbackTypesPayload}
4179
+ */
4180
+ declare function resolveCallbackTypes(body: object, chains: Chain$1[]): Promise<CallbackTypesPayload | ErrorPayload$1>;
4181
+ declare namespace Gatekeeper_d_exports {
4182
+ export { Gatekeeper, Rules, create };
4183
+ }
4184
+ type Rules = readonly Rule<Offer, string>[];
4185
+ type Gatekeeper = {
4186
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
4187
+ };
4188
+ type GatekeeperParameters = {
4189
+ rules: Rules;
4190
+ };
4191
+ /**
4192
+ * Create a gatekeeper instance with the provided rules.
4193
+ * @param parameters - Gatekeeper parameters. {@link GatekeeperParameters}
4194
+ * @returns Gatekeeper instance. {@link Gatekeeper}
4195
+ */
4196
+ declare function create(parameters: GatekeeperParameters): Gatekeeper;
4197
+ //#endregion
3869
4198
  //#region src/api/Controllers/validateOffers.d.ts
3870
- type ValidationIssue = {
4199
+ type ValidationIssue$1 = {
3871
4200
  index: number;
3872
4201
  rule: string;
3873
4202
  message: string;
3874
4203
  };
3875
- type ValidateOffersSuccessPayload = SuccessPayload<{
4204
+ type ValidateOffersSuccessPayload = SuccessPayload$1<{
3876
4205
  payload: Hex;
3877
4206
  root: Hex;
3878
4207
  }>;
3879
- type ValidateOffersIssuesPayload = SuccessPayload<{
3880
- issues: ValidationIssue[];
4208
+ type ValidateOffersIssuesPayload = SuccessPayload$1<{
4209
+ issues: ValidationIssue$1[];
3881
4210
  }>;
3882
4211
  type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
3883
- declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload>;
4212
+ declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload$1>;
3884
4213
  declare namespace index_d_exports$4 {
3885
- export { ChainConfig, MaturitiesConfig, ValidationIssue, getBook, getConfig, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getIntegratorDocsHtml, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getSwaggerJson, getUserPositions, validateOffers };
4214
+ export { CONFIG_CONTRACT_NAMES, ConfigContract, ConfigContractName, GetOffersQueryParams, ValidationIssue$1 as ValidationIssue, getBook, getConfigContracts, getConfigRules, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getIntegratorDocsHtml, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getOffersQuery, getSwaggerJson, getUserPositions, resolveCallbackTypes, validateOffers };
3886
4215
  }
3887
4216
  declare namespace RouterApi_d_exports {
3888
- export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigController, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, RuleInfo, UsersController, ValidateController, create, from$5 as from, parse, safeParse };
4217
+ export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, CallbacksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, UsersController, ValidateController, create$1 as create, from$5 as from, parse, safeParse };
3889
4218
  }
3890
- declare namespace Client_d_exports {
4219
+ declare namespace Client_d_exports$1 {
3891
4220
  export { Client$3 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
3892
4221
  }
3893
4222
  type RouterClientConfig = {
3894
- /** The URL of the router. */
3895
- readonly url: URL;
3896
- /** The default headers to use for each request. */
4223
+ /** The URL of the router. */readonly url: URL; /** The default headers to use for each request. */
3897
4224
  readonly headers: Headers;
3898
4225
  };
3899
4226
  type Client$3 = Compute<RouterClientConfig & {
@@ -3930,10 +4257,8 @@ type ConnectOptions = {
3930
4257
  /** The URL of the router to interact with.
3931
4258
  * @default "https://router.morpho.dev"
3932
4259
  */
3933
- url?: string;
3934
- /** The API key to use for the router API. */
3935
- apiKey?: string;
3936
- /** The default headers to use for each request. */
4260
+ url?: string; /** The API key to use for the router API. */
4261
+ apiKey?: string; /** The default headers to use for each request. */
3937
4262
  headers?: Headers;
3938
4263
  };
3939
4264
  /**
@@ -3956,13 +4281,9 @@ declare namespace connect$1 {
3956
4281
  declare function getOffers(apiClient: Client$1<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
3957
4282
  declare namespace getOffers {
3958
4283
  type Parameters = {
3959
- /** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
3960
- side: "buy" | "sell";
3961
- /** The offers obligation id */
3962
- obligationId: Hex;
3963
- /** Pagination cursor in base64url-encoded format */
3964
- cursor?: string;
3965
- /** Maximum number of offers to return. @default 20 */
4284
+ /** 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 */
4285
+ obligationId: Hex; /** Pagination cursor in base64url-encoded format */
4286
+ cursor?: string; /** Maximum number of offers to return. @default 20 */
3966
4287
  limit?: number;
3967
4288
  };
3968
4289
  type ReturnType = {
@@ -3972,14 +4293,10 @@ declare namespace getOffers {
3972
4293
  consumed: bigint;
3973
4294
  takeable: bigint;
3974
4295
  } & {
3975
- /** 32-byte merkle root. */
3976
- root?: Hex;
3977
- /** Sibling hashes for the merkle proof. */
3978
- proof?: Hex[];
3979
- /** Offer signature from the Merkle tree. */
4296
+ /** 32-byte merkle root. */root?: Hex; /** Sibling hashes for the merkle proof. */
4297
+ proof?: Hex[]; /** Offer signature from the Merkle tree. */
3980
4298
  signature?: Hex;
3981
- }>[];
3982
- /** The pagination cursor. */
4299
+ }>[]; /** The pagination cursor. */
3983
4300
  cursor: string | null;
3984
4301
  };
3985
4302
  type ErrorType = GetApiErrorType;
@@ -3987,25 +4304,17 @@ declare namespace getOffers {
3987
4304
  declare function getObligations(apiClient: Client$1<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
3988
4305
  declare namespace getObligations {
3989
4306
  type Parameters = {
3990
- /** Pagination cursor is a 32-byte hex string. */
3991
- cursor?: Hex;
3992
- /** Maximum number of obligations to return. @default 20 */
3993
- limit?: number;
3994
- /** Filter by chain ID. */
3995
- chainId?: number;
3996
- /** Filter by loan token address. */
3997
- loanToken?: Address;
3998
- /** Filter by collateral token (matches any collateral in the obligation). */
3999
- collateralToken?: Address;
4000
- /** Filter by exact maturity timestamp (unix seconds). */
4001
- maturity?: number;
4307
+ /** Pagination cursor is a 32-byte hex string. */cursor?: Hex; /** Maximum number of obligations to return. @default 20 */
4308
+ limit?: number; /** Filter by chain IDs (comma-separated). */
4309
+ chainIds?: number[]; /** Filter by loan token addresses (comma-separated). */
4310
+ loanTokens?: Address[]; /** Filter by collateral tokens (comma-separated, matches any collateral). */
4311
+ collateralTokens?: Address[]; /** Filter by exact maturity timestamps (comma-separated, unix seconds). */
4312
+ maturities?: number[];
4002
4313
  };
4003
4314
  type ReturnType = {
4004
4315
  obligations: Compute<{
4005
- /** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
4006
- id: () => Hex;
4007
- } & Obligation & Omit<Quote, "obligationId">>[];
4008
- /** The pagination cursor. */
4316
+ /** The obligation id. Uses {@link Obligation.id} to calculate the id.*/id: () => Hex;
4317
+ } & Obligation & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
4009
4318
  cursor: string | null;
4010
4319
  };
4011
4320
  type ErrorType = GetApiErrorType;
@@ -4057,7 +4366,7 @@ declare enum EnumTableName {
4057
4366
  LOTS = "lots",
4058
4367
  OFFSETS = "offsets",
4059
4368
  TREES = "trees",
4060
- MERKLE_PATHS = "merkle_paths",
4369
+ MERKLE_PATHS = "merkle_paths"
4061
4370
  }
4062
4371
  declare const TABLE_NAMES: readonly EnumTableName[];
4063
4372
  declare const VERSIONED_TABLE_NAMES: ("\"router_v1.6\".\"obligations\"" | "\"router_v1.6\".\"groups\"" | "\"router_v1.6\".\"consumed_events\"" | "\"router_v1.6\".\"obligation_collaterals_v2\"" | "\"router_v1.6\".\"oracles\"" | "\"router_v1.6\".\"offers\"" | "\"router_v1.6\".\"offers_callbacks\"" | "\"router_v1.6\".\"callbacks\"" | "\"router_v1.6\".\"positions\"" | "\"router_v1.6\".\"transfers\"" | "\"router_v1.6\".\"validations\"" | "\"router_v1.6\".\"collectors\"" | "\"router_v1.6\".\"chains\"" | "\"router_v1.6\".\"lots\"" | "\"router_v1.6\".\"offsets\"" | "\"router_v1.6\".\"trees\"" | "\"router_v1.6\".\"merkle_paths\"")[];
@@ -4490,23 +4799,6 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
4490
4799
  identity: undefined;
4491
4800
  generated: undefined;
4492
4801
  }, {}, {}>;
4493
- blockNumber: drizzle_orm_pg_core0.PgColumn<{
4494
- name: "block_number";
4495
- tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
4496
- dataType: "number";
4497
- columnType: "PgBigInt53";
4498
- data: number;
4499
- driverParam: string | number;
4500
- notNull: true;
4501
- hasDefault: false;
4502
- isPrimaryKey: false;
4503
- isAutoincrement: false;
4504
- hasRuntimeDefault: false;
4505
- enumValues: undefined;
4506
- baseColumn: never;
4507
- identity: undefined;
4508
- generated: undefined;
4509
- }, {}, {}>;
4510
4802
  updatedAt: drizzle_orm_pg_core0.PgColumn<{
4511
4803
  name: "updated_at";
4512
4804
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
@@ -5856,7 +6148,7 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
5856
6148
  };
5857
6149
  dialect: "pg";
5858
6150
  }>;
5859
- declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
6151
+ declare const chains$1: drizzle_orm_pg_core0.PgTableWithColumns<{
5860
6152
  name: EnumTableName.CHAINS;
5861
6153
  schema: "router_v1.6";
5862
6154
  columns: {
@@ -6075,23 +6367,77 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
6075
6367
  dialect: "pg";
6076
6368
  }>;
6077
6369
  declare namespace index_d_exports$2 {
6078
- export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, lots, merklePaths, obligationCollateralsV2, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
6370
+ export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains$1 as chains, collectors, consumedEvents, groups, lots, merklePaths, obligationCollateralsV2, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
6371
+ }
6372
+ //#endregion
6373
+ //#region src/gatekeeper/morphoRules.d.ts
6374
+ declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
6375
+ declare namespace Rules_d_exports {
6376
+ export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
6079
6377
  }
6378
+ type ValidityParameters = {
6379
+ client: PublicClient<Transport, Chain$1>;
6380
+ };
6381
+ /**
6382
+ * set of rules to validate offers.
6383
+ *
6384
+ * @param parameters - Validity parameters with chain and client
6385
+ * @returns Array of validation rules to evaluate against offers
6386
+ */
6387
+ declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
6388
+ declare const chains: ({
6389
+ chains
6390
+ }: {
6391
+ chains: Chain$1[];
6392
+ }) => Rule<Offer, "chain_ids">;
6393
+ declare const maturity: ({
6394
+ maturities
6395
+ }: {
6396
+ maturities: MaturityType[];
6397
+ }) => Rule<Offer, "maturity">;
6398
+ declare const callback: ({
6399
+ callbacks,
6400
+ allowedAddresses
6401
+ }: {
6402
+ callbacks: Type$1[];
6403
+ allowedAddresses: Address[];
6404
+ }) => Rule<Offer, "callback">;
6405
+ /**
6406
+ * A validation rule that checks if the offer's tokens are allowed for its chain.
6407
+ * @param assetsByChainId - Allowed assets indexed by chain id.
6408
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
6409
+ */
6410
+ declare const token: ({
6411
+ assetsByChainId
6412
+ }: {
6413
+ assetsByChainId: Partial<Record<Id, Address[]>>;
6414
+ }) => Rule<Offer, "token">;
6415
+ /**
6416
+ * A batch validation rule that ensures all offers in a tree have the same maker address.
6417
+ * Returns an issue only for the first non-conforming offer.
6418
+ * This rule is signing-agnostic; signer verification is handled at the collector level.
6419
+ */
6420
+ declare const sameMaker: () => Rule<Offer, "mixed_maker">;
6421
+ /**
6422
+ * A validation rule that ensures mutual exclusivity of offer amount fields.
6423
+ * At most one of (assets, obligationUnits, obligationShares) can be non-zero.
6424
+ * Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
6425
+ */
6426
+ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
6080
6427
  //#endregion
6081
6428
  //#region src/mempool/MempoolEVMClient.d.ts
6082
6429
  type MempoolEVMClientConfig = {
6083
6430
  readonly client: WalletClient;
6084
6431
  readonly mempoolAddress: Address;
6432
+ readonly morphoAddress?: Address;
6085
6433
  readonly blockWindow?: number;
6086
6434
  };
6087
6435
  declare function from(parameters: from.Parameters): from.ReturnType;
6088
6436
  declare namespace from {
6089
6437
  type Parameters = {
6090
- /** The viem client to use. */
6091
- client: WalletClient;
6092
- /** The mempool address. */
6093
- mempoolAddress: Address;
6094
- /** The block window to use for the mempool. Defaults to 100. */
6438
+ /** The viem client to use. */client: WalletClient; /** The mempool address. */
6439
+ mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
6440
+ morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
6095
6441
  blockWindow?: number;
6096
6442
  };
6097
6443
  type ReturnType = Client$2;
@@ -6106,7 +6452,7 @@ declare namespace from {
6106
6452
  */
6107
6453
  declare function add(config: MempoolEVMClientConfig, offers: AddParameters): Promise<Hex>;
6108
6454
  declare namespace add {
6109
- type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError;
6455
+ type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError | MissingMorphoAddressError;
6110
6456
  }
6111
6457
  declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
6112
6458
  offers: Offer[];
@@ -6115,7 +6461,7 @@ declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters)
6115
6461
  declare namespace get {
6116
6462
  type ErrorType = streamOffersReturnType;
6117
6463
  }
6118
- type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError;
6464
+ type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError | MissingMorphoAddressError;
6119
6465
  declare class WalletAccountNotSetError extends BaseError {
6120
6466
  name: string;
6121
6467
  constructor();
@@ -6127,22 +6473,20 @@ declare class ChainIdMismatchError extends BaseError {
6127
6473
  name: string;
6128
6474
  constructor(expected: Id, actual: Id);
6129
6475
  }
6476
+ declare class MissingMorphoAddressError extends BaseError {
6477
+ name: string;
6478
+ constructor();
6479
+ }
6130
6480
  //#endregion
6131
6481
  //#region src/mempool/MempoolClient.d.ts
6132
6482
  type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
6133
6483
  type GetParameters = {
6134
- /** The block number to get offers from. */
6135
- blockNumberGte?: number;
6136
- /** The block number to get offers to. */
6137
- blockNumberLte?: number;
6138
- /** The loan asset to get offers from. */
6139
- loanToken?: string;
6140
- /** The order to get offers. Defaults to "desc". */
6141
- order?: "asc" | "desc";
6142
- /** The options to get offers from. */
6484
+ /** The block number to get offers from. */blockNumberGte?: number; /** The block number to get offers to. */
6485
+ blockNumberLte?: number; /** The loan asset to get offers from. */
6486
+ loanToken?: string; /** The order to get offers. Defaults to "desc". */
6487
+ order?: "asc" | "desc"; /** The options to get offers from. */
6143
6488
  options?: {
6144
- /** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
6145
- maxBatchSize?: number;
6489
+ /** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */maxBatchSize?: number;
6146
6490
  };
6147
6491
  };
6148
6492
  /**
@@ -6153,11 +6497,9 @@ type Client$2 = {
6153
6497
  * Add an offer to the mempool.
6154
6498
  * @returns The created offer with its hash.
6155
6499
  */
6156
- add: (parameters: AddParameters) => Promise<Hex>;
6157
- /** Get offers from the mempool. */
6500
+ add: (parameters: AddParameters) => Promise<Hex>; /** Get offers from the mempool. */
6158
6501
  get: (parameters?: GetParameters) => AsyncGenerator<{
6159
- offers: Offer[];
6160
- /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
6502
+ offers: Offer[]; /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
6161
6503
  blockNumber: number;
6162
6504
  }>;
6163
6505
  /**
@@ -6181,7 +6523,7 @@ declare namespace connect {
6181
6523
  type ErrorType = from.ErrorType;
6182
6524
  }
6183
6525
  declare namespace index_d_exports$1 {
6184
- export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
6526
+ export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, MissingMorphoAddressError, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
6185
6527
  }
6186
6528
  //#endregion
6187
6529
  //#region src/utils/BigMath.d.ts
@@ -6316,5 +6658,5 @@ declare namespace index_d_exports$3 {
6316
6658
  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 };
6317
6659
  }
6318
6660
  //#endregion
6319
- export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, ConfigController, Database_d_exports as Database, 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, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, OpenApiOptions, Oracle_d_exports as Oracle, Position_d_exports as Position, PositionResponse_d_exports as PositionResponse, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports as RouterClient, RouterStatusResponse, RuleInfo, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, UsersController, index_d_exports$3 as Utils, ValidateController, Gate_d_exports as Validation, morphoRules, parse, safeParse };
6661
+ export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, CallbackType, CallbackTypesRequest, CallbackTypesResponse, CallbacksController, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, ConfigContractsController, ConfigRule, ConfigRulesController, ConfigRulesPayload, Database_d_exports as Database, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, Oracle_d_exports as Oracle, Position_d_exports as Position, PositionResponse_d_exports as PositionResponse, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports$1 as RouterClient, RouterStatusResponse, Rules_d_exports as Rules, SuccessPayload, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, UsersController, index_d_exports$3 as Utils, ValidateController, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules, parse, safeParse };
6320
6662
  //# sourceMappingURL=index.node.d.mts.map