@morpho-dev/router 0.5.0 → 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.
@@ -821,7 +821,7 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
821
821
  declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
822
822
  declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
823
823
  declare namespace Obligation_d_exports {
824
- export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$14 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 };
825
825
  }
826
826
  type Obligation = {
827
827
  /** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
@@ -929,6 +929,18 @@ declare function random$2(): random$2.ReturnType;
929
929
  declare namespace random$2 {
930
930
  type ReturnType = Obligation;
931
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
+ }
932
944
  declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
933
945
  readonly name = "Obligation.InvalidObligationError";
934
946
  constructor(error: z$1.ZodError | Error);
@@ -938,7 +950,7 @@ declare class CollateralsAreNotSortedError extends BaseError {
938
950
  constructor();
939
951
  }
940
952
  declare namespace Offer_d_exports {
941
- export { AccountNotSetError, 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, 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 };
942
954
  }
943
955
  type Offer = {
944
956
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
@@ -1177,15 +1189,6 @@ declare const types: {
1177
1189
  readonly type: "bytes";
1178
1190
  }];
1179
1191
  };
1180
- /**
1181
- * Signs an array of offers.
1182
- * @throws {Error} If the wallet account is not set.
1183
- * @param offers - The offers to sign.
1184
- * @param wallet - The wallet to sign the offers with.
1185
- * @returns The signed offers.
1186
- */
1187
- declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
1188
- declare function signatureMsg(offers: Offer[]): Hex;
1189
1192
  declare function hash(offer: Offer): Hex;
1190
1193
  /**
1191
1194
  * Calculates the obligation id for an offer based on the smart contract's Obligation struct.
@@ -1243,12 +1246,8 @@ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
1243
1246
  */
1244
1247
  get formattedMessage(): string;
1245
1248
  }
1246
- declare class AccountNotSetError extends BaseError {
1247
- readonly name = "Offer.AccountNotSetError";
1248
- constructor();
1249
- }
1250
1249
  declare namespace Oracle_d_exports {
1251
- export { Conversion, Oracle, from$12 as from };
1250
+ export { Conversion, Oracle, from$12 as from, fromCollateral, fromOffer, fromOffers };
1252
1251
  }
1253
1252
  /**
1254
1253
  * An oracle contract that provides price information for assets.
@@ -1274,6 +1273,55 @@ declare namespace from$12 {
1274
1273
  };
1275
1274
  type ReturnType = Oracle;
1276
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
+ }
1277
1325
  /**
1278
1326
  * Conversion utilities for converting between collateral and loan token amounts
1279
1327
  * using oracle prices and LLTV
@@ -1529,7 +1577,7 @@ declare namespace from$8 {
1529
1577
  type ReturnType = Transfer;
1530
1578
  }
1531
1579
  declare namespace Tree_d_exports {
1532
- 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 };
1533
1581
  }
1534
1582
  /**
1535
1583
  * A merkle tree of offers built from offer hashes.
@@ -1544,6 +1592,31 @@ type Proof = {
1544
1592
  path: Hex[];
1545
1593
  };
1546
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
+ };
1547
1620
  /**
1548
1621
  * Builds a Merkle tree from a list of offers.
1549
1622
  *
@@ -1566,6 +1639,11 @@ declare const from$7: (offers: Offer[]) => Tree;
1566
1639
  * @returns Array of proofs - {@link Proof}
1567
1640
  */
1568
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;
1569
1647
  /**
1570
1648
  * Encodes a merkle tree with signature into hex calldata for onchain broadcast.
1571
1649
  *
@@ -1573,15 +1651,21 @@ declare const proofs: (tree: Tree) => Proof[];
1573
1651
  * - `{vv}`: 1-byte version (currently 0x01)
1574
1652
  * - `{gzip([...offers])}`: gzipped JSON array of serialized offers
1575
1653
  * - `{root}`: 32-byte merkle root
1576
- * - `{signature}`: 65-byte EIP-191 signature over raw root bytes
1654
+ * - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
1577
1655
  *
1578
1656
  * Validates signature authenticity and root integrity before encoding.
1579
1657
  *
1580
1658
  * @example
1581
1659
  * ```typescript
1582
1660
  * const tree = Tree.from(offers);
1583
- * const signature = await wallet.signMessage({ message: { raw: tree.root } });
1584
- * 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 });
1585
1669
  * await broadcast(calldata);
1586
1670
  * ```
1587
1671
  *
@@ -1591,16 +1675,23 @@ declare const proofs: (tree: Tree) => Proof[];
1591
1675
  * const tree = Tree.from(offers);
1592
1676
  * const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
1593
1677
  * const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
1594
- * 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
+ * });
1595
1685
  * const calldata = `${partial}${signature.slice(2)}`;
1596
1686
  * ```
1597
1687
  *
1598
1688
  * @param tree - Merkle tree of offers
1599
- * @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
1600
1691
  * @returns Hex-encoded calldata ready for onchain broadcast
1601
1692
  * @throws {EncodeError} If signature verification fails or root mismatch
1602
1693
  */
1603
- declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
1694
+ declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
1604
1695
  /**
1605
1696
  * Encodes a merkle tree without a signature into hex payload for client-side signing.
1606
1697
  *
@@ -1630,15 +1721,16 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
1630
1721
  *
1631
1722
  * @example
1632
1723
  * ```typescript
1633
- * const { tree, signature, signer } = await Tree.decode(calldata);
1724
+ * const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
1634
1725
  * console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
1635
1726
  * ```
1636
1727
  *
1637
1728
  * @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
1729
+ * @param domain - EIP-712 domain with chain id and verifying contract
1638
1730
  * @returns Validated tree, signature, and recovered signer address
1639
1731
  * @throws {DecodeError} If version invalid, signature invalid, or root mismatch
1640
1732
  */
1641
- declare const decode: (encoded: Hex) => Promise<{
1733
+ declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
1642
1734
  tree: Tree;
1643
1735
  signature: Hex;
1644
1736
  signer: Address;
@@ -1667,6 +1759,13 @@ declare class DecodeError extends BaseError {
1667
1759
  name: string;
1668
1760
  constructor(reason: string);
1669
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
+ }
1670
1769
  //#endregion
1671
1770
  //#region src/indexer/collectors/Collector.d.ts
1672
1771
  declare const names: readonly ["offers", "consumed_events", "positions", "prices"];
@@ -1800,7 +1899,7 @@ type Row = {
1800
1899
  blockNumber: number;
1801
1900
  };
1802
1901
  type OffersDomain = {
1803
- /** Create multiple offers. */create: (batches: CreateBatch[]) => Promise<Hex[]>;
1902
+ /** Insert offers (insert-only). */create: (batches: CreateBatch[]) => Promise<Hex[]>;
1804
1903
  /** Delete multiple offers by hashes or block number greater than or equal to the given value on a given chain.
1805
1904
  * @returns the number of offers deleted.
1806
1905
  */
@@ -1809,7 +1908,7 @@ type OffersDomain = {
1809
1908
  } | {
1810
1909
  blockNumberGte: number;
1811
1910
  chainId: Id;
1812
- }) => Promise<number>; /** Get all offers. */
1911
+ }) => Promise<number>; /** Get offers with collaterals only (no availability/takeable computation). */
1813
1912
  get: (parameters?: GetOffersParams) => Promise<{
1814
1913
  rows: Row[];
1815
1914
  nextCursor: string | null;
@@ -1873,6 +1972,35 @@ declare namespace getOffers$2 {
1873
1972
  };
1874
1973
  }
1875
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
1876
2004
  //#region src/database/domains/Consumed.d.ts
1877
2005
  type Event = {
1878
2006
  id: string;
@@ -1890,6 +2018,22 @@ type ConsumedDomain = {
1890
2018
  }) => Promise<number>;
1891
2019
  };
1892
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
1893
2037
  //#region src/database/domains/Lots.d.ts
1894
2038
  type Lot = {
1895
2039
  chainId: Id;
@@ -1934,6 +2078,15 @@ declare namespace get$3 {
1934
2078
  }
1935
2079
  declare function create$5(db: Core): LotsDomain;
1936
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
1937
2090
  //#region src/database/domains/Offsets.d.ts
1938
2091
  type Offset = {
1939
2092
  chainId: Id;
@@ -2078,11 +2231,10 @@ type Attestation = {
2078
2231
  type CreateInput = {
2079
2232
  tree: Tree;
2080
2233
  signature: Hex;
2081
- blockNumber: number;
2082
2234
  };
2083
2235
  type TreesDomain = {
2084
2236
  /**
2085
- * Creates trees, offers, and attestation links in a single transaction.
2237
+ * Creates trees and attestation links in a single transaction.
2086
2238
  *
2087
2239
  * @param trees - Array of decoded trees with signatures (batch insertion)
2088
2240
  * @returns Array of tree roots that were created/upserted
@@ -2128,9 +2280,12 @@ type Driver = ReturnType<typeof drizzle> | ReturnType<typeof drizzle$1>;
2128
2280
  type Domains = {
2129
2281
  book: BookDomain;
2130
2282
  blocks: BlocksDomain;
2283
+ callbacks: CallbacksDomain;
2131
2284
  offers: OffersDomain;
2132
2285
  consumed: ConsumedDomain;
2286
+ groups: GroupsDomain;
2133
2287
  lots: LotsDomain;
2288
+ obligations: ObligationsDomain;
2134
2289
  offsets: OffsetsDomain;
2135
2290
  oracles: OraclesDomain;
2136
2291
  trees: TreesDomain;
@@ -2225,12 +2380,20 @@ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name
2225
2380
  }): Promise<Result<T, RuleNames<Rules>>>;
2226
2381
  //#endregion
2227
2382
  //#region src/gatekeeper/types.d.ts
2228
- type RuleInfo = {
2229
- name: string;
2230
- description: string;
2231
- };
2232
- type RulesProvider = {
2233
- getRules: () => Promise<RuleInfo[]>;
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;
2234
2397
  };
2235
2398
  type ValidationIssue = {
2236
2399
  index: number;
@@ -2245,9 +2408,21 @@ type ValidateOffersIssues = {
2245
2408
  issues: ValidationIssue[];
2246
2409
  };
2247
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;
2248
2422
  type SuccessPayload<T> = {
2249
2423
  meta: {
2250
2424
  timestamp: string;
2425
+ checksum?: string;
2251
2426
  };
2252
2427
  cursor: string | null;
2253
2428
  data: T;
@@ -2255,6 +2430,7 @@ type SuccessPayload<T> = {
2255
2430
  type ErrorPayload = {
2256
2431
  meta: {
2257
2432
  timestamp: string;
2433
+ checksum?: string;
2258
2434
  };
2259
2435
  error: {
2260
2436
  code: string;
@@ -2265,18 +2441,28 @@ type ErrorPayload = {
2265
2441
  declare namespace Client_d_exports {
2266
2442
  export { ClientConfig, GatekeeperClient, createHttpClient };
2267
2443
  }
2268
- type GatekeeperClient = RulesProvider & {
2444
+ type GatekeeperClient = {
2269
2445
  /** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
2270
2446
  statusCode: number;
2271
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;
2272
2456
  }>; /** Validate offers and return decision results. */
2273
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
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. */
2274
2459
  baseUrl: string;
2275
2460
  };
2276
2461
  type ClientConfig = {
2277
2462
  baseUrl: string;
2278
2463
  timeoutMs?: number;
2279
2464
  fetchFn?: typeof fetch;
2465
+ originSecret?: string;
2280
2466
  };
2281
2467
  /**
2282
2468
  * Create an HTTP client for a gatekeeper service.
@@ -2528,7 +2714,7 @@ interface paths {
2528
2714
  patch?: never;
2529
2715
  trace?: never;
2530
2716
  };
2531
- "/v1/config": {
2717
+ "/v1/config/contracts": {
2532
2718
  parameters: {
2533
2719
  query?: never;
2534
2720
  header?: never;
@@ -2536,12 +2722,28 @@ interface paths {
2536
2722
  cookie?: never;
2537
2723
  };
2538
2724
  /**
2539
- * Get router configuration
2540
- * @description Returns chain configurations including contract addresses and supported callback types.
2725
+ * Get indexer contract configuration
2726
+ * @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
2541
2727
  */
2542
2728
  get: {
2543
2729
  parameters: {
2544
- 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
+ };
2545
2747
  header?: never;
2546
2748
  path?: never;
2547
2749
  cookie?: never;
@@ -2553,7 +2755,66 @@ interface paths {
2553
2755
  [name: string]: unknown;
2554
2756
  };
2555
2757
  content: {
2556
- "application/json": components["schemas"]["ConfigSuccessResponse"];
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
+ };
2806
+ header?: never;
2807
+ path?: never;
2808
+ cookie?: never;
2809
+ };
2810
+ requestBody?: never;
2811
+ responses: {
2812
+ /** @description Success */200: {
2813
+ headers: {
2814
+ [name: string]: unknown;
2815
+ };
2816
+ content: {
2817
+ "application/json": components["schemas"]["ConfigRulesSuccessResponse"];
2557
2818
  };
2558
2819
  };
2559
2820
  };
@@ -2974,15 +3235,6 @@ interface paths {
2974
3235
  /**
2975
3236
  * Validate offers
2976
3237
  * @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
2977
- *
2978
- * **Available validation rules:**
2979
- * - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
2980
- * - **mixed_maker**: Validates that all offers in a batch have the same maker address
2981
- * - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
2982
- * - **chain_ids**: Validates that offer chain is one of: [109111114]
2983
- * - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
2984
- * - **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]
2985
- * - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
2986
3238
  */
2987
3239
  post: {
2988
3240
  parameters: {
@@ -3021,6 +3273,56 @@ interface paths {
3021
3273
  patch?: never;
3022
3274
  trace?: never;
3023
3275
  };
3276
+ "/v1/callbacks": {
3277
+ parameters: {
3278
+ query?: never;
3279
+ header?: never;
3280
+ path?: never;
3281
+ cookie?: never;
3282
+ };
3283
+ get?: never;
3284
+ put?: never;
3285
+ /**
3286
+ * Resolve callback types
3287
+ * @description Returns callback types for callback addresses grouped by chain.
3288
+ */
3289
+ post: {
3290
+ parameters: {
3291
+ query?: never;
3292
+ header?: never;
3293
+ path?: never;
3294
+ cookie?: never;
3295
+ };
3296
+ requestBody?: {
3297
+ content: {
3298
+ "application/json": components["schemas"]["CallbackTypesRequest"];
3299
+ };
3300
+ };
3301
+ responses: {
3302
+ /** @description Success */200: {
3303
+ headers: {
3304
+ [name: string]: unknown;
3305
+ };
3306
+ content: {
3307
+ "application/json": components["schemas"]["CallbackTypesSuccessResponse"];
3308
+ };
3309
+ }; /** @description Bad Request */
3310
+ 400: {
3311
+ headers: {
3312
+ [name: string]: unknown;
3313
+ };
3314
+ content: {
3315
+ "application/json": components["schemas"]["BadRequestResponse"];
3316
+ };
3317
+ };
3318
+ };
3319
+ };
3320
+ delete?: never;
3321
+ options?: never;
3322
+ head?: never;
3323
+ patch?: never;
3324
+ trace?: never;
3325
+ };
3024
3326
  }
3025
3327
  interface components {
3026
3328
  schemas: {
@@ -3058,39 +3360,78 @@ interface components {
3058
3360
  */
3059
3361
  details: Record<string, never>;
3060
3362
  };
3061
- ConfigSuccessResponse: {
3363
+ ConfigContractsSuccessResponse: {
3062
3364
  meta: components["schemas"]["Meta"]; /** @example null */
3063
3365
  cursor: string | null;
3064
3366
  /**
3065
- * @description Array of chain configurations for all indexed chains.
3367
+ * @description Indexer contract configuration for all indexed chains.
3066
3368
  * @example [
3067
3369
  * {
3068
3370
  * "chain_id": 505050505,
3069
- * "contracts": {
3070
- * "mempool": "0xD946246695A9259F3B33a78629026F61B3Ab40aF"
3071
- * },
3072
- * "callbacks": [
3073
- * "buy_with_empty_callback"
3074
- * ]
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"
3075
3383
  * }
3076
3384
  * ]
3077
3385
  */
3078
- data: components["schemas"]["ConfigDataResponse"][];
3386
+ data: components["schemas"]["ConfigContractResponse"][];
3079
3387
  };
3080
- ConfigDataResponse: {
3081
- /** @example 505050505 */chain_id: number;
3082
- contracts: components["schemas"]["ConfigContractsResponse"];
3388
+ ConfigContractResponse: {
3389
+ /** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
3390
+ address: string;
3083
3391
  /**
3084
- * @description Supported callback types for this chain.
3392
+ * @example mempool
3393
+ * @enum {string}
3394
+ */
3395
+ name: "mempool" | "multicall" | "v2";
3396
+ };
3397
+ ConfigRulesSuccessResponse: {
3398
+ meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
3399
+ cursor: string | null;
3400
+ /**
3401
+ * @description Configured rules returned by the router API.
3085
3402
  * @example [
3086
- * "buy_with_empty_callback"
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
+ * }
3087
3420
  * ]
3088
- * @enum {string}
3089
3421
  */
3090
- callbacks: "buy_with_empty_callback" | "buy_erc20" | "buy_vault_v1_callback" | "sell_erc20_callback";
3422
+ data: components["schemas"]["ConfigRulesRuleResponse"][];
3423
+ };
3424
+ ConfigRulesMeta: {
3425
+ /** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
3426
+ checksum: string;
3091
3427
  };
3092
- ConfigContractsResponse: {
3093
- /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */mempool: string;
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;
3094
3435
  };
3095
3436
  OfferListResponse: {
3096
3437
  meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
@@ -3432,6 +3773,84 @@ interface components {
3432
3773
  */
3433
3774
  root: string;
3434
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
+ };
3435
3854
  };
3436
3855
  responses: never;
3437
3856
  parameters: never;
@@ -3500,6 +3919,9 @@ declare class BooksController {
3500
3919
  declare class ValidateController {
3501
3920
  validateOffers(): Promise<void>;
3502
3921
  }
3922
+ declare class CallbacksController {
3923
+ resolveCallbackTypes(): Promise<void>;
3924
+ }
3503
3925
  declare class OffersController {
3504
3926
  getOffers(): Promise<void>;
3505
3927
  }
@@ -3508,8 +3930,11 @@ declare class HealthController {
3508
3930
  getCollectorsHealth(): Promise<void>;
3509
3931
  getChainsHealth(): Promise<void>;
3510
3932
  }
3511
- declare class ConfigController {
3512
- getConfig(): Promise<void>;
3933
+ declare class ConfigContractsController {
3934
+ getConfigContracts(): Promise<void>;
3935
+ }
3936
+ declare class ConfigRulesController {
3937
+ getConfigRules(): Promise<void>;
3513
3938
  }
3514
3939
  declare class ObligationsController {
3515
3940
  getObligations(): Promise<void>;
@@ -3518,10 +3943,7 @@ declare class ObligationsController {
3518
3943
  declare class UsersController {
3519
3944
  getUserPositions(): Promise<void>;
3520
3945
  }
3521
- type OpenApiOptions = {
3522
- rules?: RuleInfo[];
3523
- };
3524
- declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
3946
+ declare const OpenApi: () => Promise<OpenAPIDocument>;
3525
3947
  declare namespace PositionResponse_d_exports {
3526
3948
  export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
3527
3949
  }
@@ -3566,6 +3988,21 @@ declare const schemas: {
3566
3988
  false: "false";
3567
3989
  }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
3568
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>>>>>;
4005
+ }, z$1.core.$strip>;
3569
4006
  readonly get_offers: z$1.ZodObject<{
3570
4007
  side: z$1.ZodOptional<z$1.ZodEnum<{
3571
4008
  buy: "buy";
@@ -3599,6 +4036,12 @@ declare const schemas: {
3599
4036
  readonly validate_offers: z$1.ZodObject<{
3600
4037
  offers: z$1.ZodArray<z$1.ZodUnknown>;
3601
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>;
3602
4045
  readonly get_user_positions: z$1.ZodObject<{
3603
4046
  user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
3604
4047
  cursor: z$1.ZodOptional<z$1.ZodString>;
@@ -3620,6 +4063,7 @@ declare enum STATUS_CODE {
3620
4063
  }
3621
4064
  type Meta = {
3622
4065
  timestamp: string;
4066
+ checksum?: string;
3623
4067
  };
3624
4068
  type ErrorDetail = {
3625
4069
  code: APIErrorCode;
@@ -3646,42 +4090,42 @@ type Payload<T> = SuccessPayload$1<T> | ErrorPayload$1;
3646
4090
  //#region src/api/Controllers/getBook.d.ts
3647
4091
  declare function getBook(params: object, db: Database): Promise<Payload<BookLevelResponse[]>>;
3648
4092
  //#endregion
3649
- //#region src/api/Controllers/getConfig.d.ts
3650
- 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 = {
3651
4097
  chain_id: Id;
3652
- contracts: {
3653
- mempool: string;
3654
- };
3655
- callbacks: string[];
4098
+ address: Address;
4099
+ name: ConfigContractName;
3656
4100
  };
3657
4101
  /**
3658
- * 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.
3659
4104
  * @param chainRegistry - The chain registry instance. {@link ChainRegistry.ChainRegistry}
3660
- * @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}
3661
4115
  */
3662
- declare function getConfig(chainRegistry: ChainRegistry): Promise<Payload<ChainConfig[]>>;
4116
+ declare function getConfigRules(query: unknown, chains: Chain$1[]): Promise<Payload<ConfigRule[]>>;
3663
4117
  //#endregion
3664
4118
  //#region src/api/Controllers/getDocs.d.ts
3665
4119
  /**
3666
4120
  * Build the OpenAPI document for the router.
3667
- * @param parameters - Includes a {@link RulesProvider} to fetch gatekeeper rules.
3668
4121
  * @returns OpenAPI document. {@link OpenAPIDocument}
3669
4122
  */
3670
- declare function getSwaggerJson({
3671
- gatekeeper
3672
- }: {
3673
- gatekeeper: RulesProvider;
3674
- }): Promise<OpenAPIDocument>;
4123
+ declare function getSwaggerJson(): Promise<OpenAPIDocument>;
3675
4124
  /**
3676
4125
  * Render the API documentation HTML page.
3677
- * @param parameters - Includes a {@link RulesProvider} to fetch gatekeeper rules.
3678
4126
  * @returns HTML page as string.
3679
4127
  */
3680
- declare function getDocsHtml({
3681
- gatekeeper
3682
- }: {
3683
- gatekeeper: RulesProvider;
3684
- }): Promise<string>;
4128
+ declare function getDocsHtml(): Promise<string>;
3685
4129
  /**
3686
4130
  * Renders the integrator documentation as HTML.
3687
4131
  * @returns HTML page with the rendered markdown documentation.
@@ -3700,6 +4144,21 @@ declare function getObligation(params: object, db: Database): Promise<Payload<Ob
3700
4144
  declare function getObligations$1(queryParameters: object, db: Database): Promise<Payload<ObligationResponse[]>>;
3701
4145
  //#endregion
3702
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
+ }>;
3703
4162
  declare function getOffers$1(queryParameters: object, db: Database): Promise<Payload<OfferResponse[]>>;
3704
4163
  //#endregion
3705
4164
  //#region src/api/Controllers/getUserPositions.d.ts
@@ -3710,13 +4169,22 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
3710
4169
  * @returns Paginated list of positions with remaining balances.
3711
4170
  */
3712
4171
  declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
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>;
3713
4182
  declare namespace Gatekeeper_d_exports {
3714
4183
  export { Gatekeeper, Rules, create };
3715
4184
  }
3716
4185
  type Rules = readonly Rule<Offer, string>[];
3717
4186
  type Gatekeeper = {
3718
4187
  isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
3719
- getRules: () => Promise<RuleInfo[]>;
3720
4188
  };
3721
4189
  type GatekeeperParameters = {
3722
4190
  rules: Rules;
@@ -3744,10 +4212,10 @@ type ValidateOffersIssuesPayload = SuccessPayload$1<{
3744
4212
  type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
3745
4213
  declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload$1>;
3746
4214
  declare namespace index_d_exports$4 {
3747
- export { ChainConfig, ValidationIssue$1 as 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 };
3748
4216
  }
3749
4217
  declare namespace RouterApi_d_exports {
3750
- 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, UsersController, ValidateController, create$1 as 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 };
3751
4219
  }
3752
4220
  declare namespace Client_d_exports$1 {
3753
4221
  export { Client$3 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
@@ -4332,23 +4800,6 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
4332
4800
  identity: undefined;
4333
4801
  generated: undefined;
4334
4802
  }, {}, {}>;
4335
- blockNumber: drizzle_orm_pg_core0.PgColumn<{
4336
- name: "block_number";
4337
- tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
4338
- dataType: "number";
4339
- columnType: "PgBigInt53";
4340
- data: number;
4341
- driverParam: string | number;
4342
- notNull: true;
4343
- hasDefault: false;
4344
- isPrimaryKey: false;
4345
- isAutoincrement: false;
4346
- hasRuntimeDefault: false;
4347
- enumValues: undefined;
4348
- baseColumn: never;
4349
- identity: undefined;
4350
- generated: undefined;
4351
- }, {}, {}>;
4352
4803
  updatedAt: drizzle_orm_pg_core0.PgColumn<{
4353
4804
  name: "updated_at";
4354
4805
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
@@ -5919,58 +6370,6 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
5919
6370
  declare namespace index_d_exports$2 {
5920
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 };
5921
6372
  }
5922
- declare namespace GateConfig_d_exports {
5923
- export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
5924
- }
5925
- type GateConfig = {
5926
- callbacks?: CallbackConfig[];
5927
- maturities?: MaturityType[];
5928
- };
5929
- type CallbackConfig = {
5930
- type: Type$1.BuyVaultV1Callback;
5931
- addresses: Address[];
5932
- vaultFactories: Address[];
5933
- } | {
5934
- type: Type$1.SellERC20Callback;
5935
- addresses: Address[];
5936
- } | {
5937
- type: Type$1.BuyWithEmptyCallback;
5938
- };
5939
- declare function getCallback(chain: Name$1, type: Type$1.BuyVaultV1Callback): Extract<CallbackConfig, {
5940
- type: Type$1.BuyVaultV1Callback;
5941
- }> | undefined;
5942
- declare function getCallback(chain: Name$1, type: Type$1.SellERC20Callback): Extract<CallbackConfig, {
5943
- type: Type$1.SellERC20Callback;
5944
- }> | undefined;
5945
- declare function getCallback(chain: Name$1, type: Type$1.BuyWithEmptyCallback): Extract<CallbackConfig, {
5946
- type: Type$1.BuyWithEmptyCallback;
5947
- }> | undefined;
5948
- declare function getCallback(chain: Name$1, type: Type$1): CallbackConfig | undefined;
5949
- /**
5950
- * Attempts to infer the configured callback type from a callback address on a chain.
5951
- * Skips the empty callback type as it does not carry addresses.
5952
- *
5953
- * @param chain - Chain name for which to infer the callback type
5954
- * @param address - Callback contract address
5955
- * @returns The callback type when found, otherwise undefined
5956
- */
5957
- declare function getCallbackType(chain: Name$1, address: Address): Type$1.BuyWithEmptyCallback | Type$1.BuyVaultV1Callback | Type$1.SellERC20Callback | undefined;
5958
- /**
5959
- * Returns the callback addresses for a given chain and callback type, if it exists.
5960
- * @param chain - Chain name for which to read the validation configuration
5961
- * @param type - Callback type to retrieve
5962
- * @returns The matching callback addresses or an empty array if not configured
5963
- */
5964
- declare function getCallbackTypeAddresses(chain: Name$1, type: Type$1): Address[];
5965
- /**
5966
- * Returns the list of allowed non-empty callback addresses for a chain.
5967
- *
5968
- * @param chain - Chain name
5969
- * @returns Array of allowed callback addresses (lowercased). Empty when none configured
5970
- */
5971
- declare const getCallbackAddresses: (chain: Name$1) => Address[];
5972
- declare const assets: Record<string, Address[]>;
5973
- declare const configs: Record<Name$1, GateConfig>;
5974
6373
  //#endregion
5975
6374
  //#region src/gatekeeper/morphoRules.d.ts
5976
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">)[];
@@ -6031,13 +6430,15 @@ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusiv
6031
6430
  type MempoolEVMClientConfig = {
6032
6431
  readonly client: WalletClient;
6033
6432
  readonly mempoolAddress: Address;
6433
+ readonly morphoAddress?: Address;
6034
6434
  readonly blockWindow?: number;
6035
6435
  };
6036
6436
  declare function from(parameters: from.Parameters): from.ReturnType;
6037
6437
  declare namespace from {
6038
6438
  type Parameters = {
6039
6439
  /** The viem client to use. */client: WalletClient; /** The mempool address. */
6040
- mempoolAddress: Address; /** The block window to use for the mempool. Defaults to 100. */
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. */
6041
6442
  blockWindow?: number;
6042
6443
  };
6043
6444
  type ReturnType = Client$2;
@@ -6052,7 +6453,7 @@ declare namespace from {
6052
6453
  */
6053
6454
  declare function add(config: MempoolEVMClientConfig, offers: AddParameters): Promise<Hex>;
6054
6455
  declare namespace add {
6055
- type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError;
6456
+ type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError | MissingMorphoAddressError;
6056
6457
  }
6057
6458
  declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
6058
6459
  offers: Offer[];
@@ -6061,7 +6462,7 @@ declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters)
6061
6462
  declare namespace get {
6062
6463
  type ErrorType = streamOffersReturnType;
6063
6464
  }
6064
- type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError;
6465
+ type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError | MissingMorphoAddressError;
6065
6466
  declare class WalletAccountNotSetError extends BaseError {
6066
6467
  name: string;
6067
6468
  constructor();
@@ -6073,6 +6474,10 @@ declare class ChainIdMismatchError extends BaseError {
6073
6474
  name: string;
6074
6475
  constructor(expected: Id, actual: Id);
6075
6476
  }
6477
+ declare class MissingMorphoAddressError extends BaseError {
6478
+ name: string;
6479
+ constructor();
6480
+ }
6076
6481
  //#endregion
6077
6482
  //#region src/mempool/MempoolClient.d.ts
6078
6483
  type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
@@ -6119,7 +6524,7 @@ declare namespace connect {
6119
6524
  type ErrorType = from.ErrorType;
6120
6525
  }
6121
6526
  declare namespace index_d_exports$1 {
6122
- 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 };
6123
6528
  }
6124
6529
  //#endregion
6125
6530
  //#region src/utils/BigMath.d.ts
@@ -6254,5 +6659,5 @@ declare namespace index_d_exports$3 {
6254
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 };
6255
6660
  }
6256
6661
  //#endregion
6257
- 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, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, 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$1 as RouterClient, RouterStatusResponse, RuleInfo, Rules_d_exports as Rules, RulesProvider, SuccessPayload, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, UsersController, index_d_exports$3 as Utils, ValidateController, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, 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 };
6258
6663
  //# sourceMappingURL=index.node.d.ts.map