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