@morpho-dev/router 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,8 +5,8 @@ import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
5
5
  import { z } from "zod/v4";
6
6
  import "reflect-metadata";
7
7
  import { OpenAPIDocument } from "openapi-metadata";
8
- import { Client as Client$1 } from "openapi-fetch";
9
8
  import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
9
+ import { Client as Client$1 } from "openapi-fetch";
10
10
  import { PGlite } from "@electric-sql/pglite";
11
11
  import { drizzle } from "drizzle-orm/node-postgres";
12
12
  import { drizzle as drizzle$1 } from "drizzle-orm/pglite";
@@ -820,7 +820,7 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
820
820
  declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
821
821
  declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
822
822
  declare namespace Obligation_d_exports {
823
- export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$14 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
823
+ export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$14 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
824
824
  }
825
825
  type Obligation = {
826
826
  /** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
@@ -928,6 +928,18 @@ declare function random$2(): random$2.ReturnType;
928
928
  declare namespace random$2 {
929
929
  type ReturnType = Obligation;
930
930
  }
931
+ /**
932
+ * Creates an obligation from an offer.
933
+ * @constructor
934
+ *
935
+ * @param offer - The offer to create the obligation from.
936
+ * @returns The created obligation. {@link fromOffer.ReturnType}
937
+ */
938
+ declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
939
+ declare namespace fromOffer$1 {
940
+ type Parameters = Offer;
941
+ type ReturnType = Obligation;
942
+ }
931
943
  declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
932
944
  readonly name = "Obligation.InvalidObligationError";
933
945
  constructor(error: z$1.ZodError | Error);
@@ -937,7 +949,7 @@ declare class CollateralsAreNotSortedError extends BaseError {
937
949
  constructor();
938
950
  }
939
951
  declare namespace Offer_d_exports {
940
- 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 };
952
+ export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$13 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, toSnakeCase, types };
941
953
  }
942
954
  type Offer = {
943
955
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
@@ -1176,15 +1188,6 @@ declare const types: {
1176
1188
  readonly type: "bytes";
1177
1189
  }];
1178
1190
  };
1179
- /**
1180
- * Signs an array of offers.
1181
- * @throws {Error} If the wallet account is not set.
1182
- * @param offers - The offers to sign.
1183
- * @param wallet - The wallet to sign the offers with.
1184
- * @returns The signed offers.
1185
- */
1186
- declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
1187
- declare function signatureMsg(offers: Offer[]): Hex;
1188
1191
  declare function hash(offer: Offer): Hex;
1189
1192
  /**
1190
1193
  * Calculates the obligation id for an offer based on the smart contract's Obligation struct.
@@ -1242,12 +1245,8 @@ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
1242
1245
  */
1243
1246
  get formattedMessage(): string;
1244
1247
  }
1245
- declare class AccountNotSetError extends BaseError {
1246
- readonly name = "Offer.AccountNotSetError";
1247
- constructor();
1248
- }
1249
1248
  declare namespace Oracle_d_exports {
1250
- export { Conversion, Oracle, from$12 as from };
1249
+ export { Conversion, Oracle, from$12 as from, fromCollateral, fromOffer, fromOffers };
1251
1250
  }
1252
1251
  /**
1253
1252
  * An oracle contract that provides price information for assets.
@@ -1273,6 +1272,55 @@ declare namespace from$12 {
1273
1272
  };
1274
1273
  type ReturnType = Oracle;
1275
1274
  }
1275
+ /**
1276
+ * Creates an oracle from a collateral.
1277
+ * @constructor
1278
+ *
1279
+ * @param parameters - {@link fromCollateral.Parameters}
1280
+ * @returns The created oracle. {@link fromCollateral.ReturnType}
1281
+ */
1282
+ declare function fromCollateral(parameters: fromCollateral.Parameters): fromCollateral.ReturnType;
1283
+ declare namespace fromCollateral {
1284
+ type Parameters = {
1285
+ chainId: Id;
1286
+ collateral: Collateral;
1287
+ blockNumber: number;
1288
+ price?: bigint | null;
1289
+ };
1290
+ type ReturnType = Oracle;
1291
+ }
1292
+ /**
1293
+ * Creates oracles from a single offer.
1294
+ * @constructor
1295
+ *
1296
+ * @param parameters - {@link fromOffer.Parameters}
1297
+ * @returns The created oracles. {@link fromOffer.ReturnType}
1298
+ */
1299
+ declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
1300
+ declare namespace fromOffer {
1301
+ type Parameters = {
1302
+ offer: Offer;
1303
+ blockNumber: number;
1304
+ price?: bigint | null;
1305
+ };
1306
+ type ReturnType = Oracle[];
1307
+ }
1308
+ /**
1309
+ * Creates oracles from a list of offers.
1310
+ * @constructor
1311
+ *
1312
+ * @param parameters - {@link fromOffers.Parameters}
1313
+ * @returns The created oracles. {@link fromOffers.ReturnType}
1314
+ */
1315
+ declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
1316
+ declare namespace fromOffers {
1317
+ type Parameters = {
1318
+ offers: Offer[];
1319
+ blockNumber: number;
1320
+ price?: bigint | null;
1321
+ };
1322
+ type ReturnType = Oracle[];
1323
+ }
1276
1324
  /**
1277
1325
  * Conversion utilities for converting between collateral and loan token amounts
1278
1326
  * using oracle prices and LLTV
@@ -1528,7 +1576,7 @@ declare namespace from$8 {
1528
1576
  type ReturnType = Transfer;
1529
1577
  }
1530
1578
  declare namespace Tree_d_exports {
1531
- export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs };
1579
+ export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs, signatureDomain, signatureTypes };
1532
1580
  }
1533
1581
  /**
1534
1582
  * A merkle tree of offers built from offer hashes.
@@ -1543,6 +1591,31 @@ type Proof = {
1543
1591
  path: Hex[];
1544
1592
  };
1545
1593
  declare const VERSION$1 = 1;
1594
+ type SignatureDomain = {
1595
+ /** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
1596
+ verifyingContract: Address;
1597
+ };
1598
+ /** Normalized Root signature domain (BigInt chain id, lowercase address). */
1599
+ type NormalizedSignatureDomain = {
1600
+ chainId: bigint;
1601
+ verifyingContract: Address;
1602
+ };
1603
+ /**
1604
+ * EIP-712 types for signing the tree root (Root(bytes32 root)).
1605
+ */
1606
+ declare const signatureTypes: {
1607
+ readonly EIP712Domain: readonly [{
1608
+ readonly name: "chainId";
1609
+ readonly type: "uint256";
1610
+ }, {
1611
+ readonly name: "verifyingContract";
1612
+ readonly type: "address";
1613
+ }];
1614
+ readonly Root: readonly [{
1615
+ readonly name: "root";
1616
+ readonly type: "bytes32";
1617
+ }];
1618
+ };
1546
1619
  /**
1547
1620
  * Builds a Merkle tree from a list of offers.
1548
1621
  *
@@ -1565,6 +1638,11 @@ declare const from$7: (offers: Offer[]) => Tree;
1565
1638
  * @returns Array of proofs - {@link Proof}
1566
1639
  */
1567
1640
  declare const proofs: (tree: Tree) => Proof[];
1641
+ /**
1642
+ * Normalizes a Root signature domain (BigInt chain id, lowercase address).
1643
+ * @throws {SignatureDomainError} When the domain is invalid.
1644
+ */
1645
+ declare const signatureDomain: (domain: SignatureDomain) => NormalizedSignatureDomain;
1568
1646
  /**
1569
1647
  * Encodes a merkle tree with signature into hex calldata for onchain broadcast.
1570
1648
  *
@@ -1572,15 +1650,21 @@ declare const proofs: (tree: Tree) => Proof[];
1572
1650
  * - `{vv}`: 1-byte version (currently 0x01)
1573
1651
  * - `{gzip([...offers])}`: gzipped JSON array of serialized offers
1574
1652
  * - `{root}`: 32-byte merkle root
1575
- * - `{signature}`: 65-byte EIP-191 signature over raw root bytes
1653
+ * - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
1576
1654
  *
1577
1655
  * Validates signature authenticity and root integrity before encoding.
1578
1656
  *
1579
1657
  * @example
1580
1658
  * ```typescript
1581
1659
  * const tree = Tree.from(offers);
1582
- * const signature = await wallet.signMessage({ message: { raw: tree.root } });
1583
- * const calldata = await Tree.encode(tree, signature);
1660
+ * const signature = await wallet.signTypedData({
1661
+ * account: wallet.account,
1662
+ * domain: Tree.signatureDomain({ chainId, verifyingContract }),
1663
+ * types: Tree.signatureTypes,
1664
+ * primaryType: "Root",
1665
+ * message: { root: tree.root },
1666
+ * });
1667
+ * const calldata = await Tree.encode(tree, signature, { chainId, verifyingContract });
1584
1668
  * await broadcast(calldata);
1585
1669
  * ```
1586
1670
  *
@@ -1590,16 +1674,23 @@ declare const proofs: (tree: Tree) => Proof[];
1590
1674
  * const tree = Tree.from(offers);
1591
1675
  * const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
1592
1676
  * const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
1593
- * const signature = await wallet.signMessage({ message: { raw: tree.root } });
1677
+ * const signature = await wallet.signTypedData({
1678
+ * account: wallet.account,
1679
+ * domain: Tree.signatureDomain({ chainId, verifyingContract }),
1680
+ * types: Tree.signatureTypes,
1681
+ * primaryType: "Root",
1682
+ * message: { root: tree.root },
1683
+ * });
1594
1684
  * const calldata = `${partial}${signature.slice(2)}`;
1595
1685
  * ```
1596
1686
  *
1597
1687
  * @param tree - Merkle tree of offers
1598
- * @param signature - EIP-191 signature over raw root bytes
1688
+ * @param signature - EIP-712 signature over Root(bytes32 root)
1689
+ * @param domain - EIP-712 domain with chain id and verifying contract
1599
1690
  * @returns Hex-encoded calldata ready for onchain broadcast
1600
1691
  * @throws {EncodeError} If signature verification fails or root mismatch
1601
1692
  */
1602
- declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
1693
+ declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
1603
1694
  /**
1604
1695
  * Encodes a merkle tree without a signature into hex payload for client-side signing.
1605
1696
  *
@@ -1629,15 +1720,16 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
1629
1720
  *
1630
1721
  * @example
1631
1722
  * ```typescript
1632
- * const { tree, signature, signer } = await Tree.decode(calldata);
1723
+ * const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
1633
1724
  * console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
1634
1725
  * ```
1635
1726
  *
1636
1727
  * @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
1728
+ * @param domain - EIP-712 domain with chain id and verifying contract
1637
1729
  * @returns Validated tree, signature, and recovered signer address
1638
1730
  * @throws {DecodeError} If version invalid, signature invalid, or root mismatch
1639
1731
  */
1640
- declare const decode: (encoded: Hex) => Promise<{
1732
+ declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
1641
1733
  tree: Tree;
1642
1734
  signature: Hex;
1643
1735
  signer: Address;
@@ -1666,6 +1758,13 @@ declare class DecodeError extends BaseError {
1666
1758
  name: string;
1667
1759
  constructor(reason: string);
1668
1760
  }
1761
+ /**
1762
+ * Error thrown when an invalid signature domain is supplied.
1763
+ */
1764
+ declare class SignatureDomainError extends BaseError {
1765
+ name: string;
1766
+ constructor(reason: string);
1767
+ }
1669
1768
  //#endregion
1670
1769
  //#region src/indexer/collectors/Collector.d.ts
1671
1770
  declare const names: readonly ["offers", "consumed_events", "positions", "prices"];
@@ -1799,7 +1898,7 @@ type Row = {
1799
1898
  blockNumber: number;
1800
1899
  };
1801
1900
  type OffersDomain = {
1802
- /** Create multiple offers. */create: (batches: CreateBatch[]) => Promise<Hex[]>;
1901
+ /** Insert offers (insert-only). */create: (batches: CreateBatch[]) => Promise<Hex[]>;
1803
1902
  /** Delete multiple offers by hashes or block number greater than or equal to the given value on a given chain.
1804
1903
  * @returns the number of offers deleted.
1805
1904
  */
@@ -1808,7 +1907,7 @@ type OffersDomain = {
1808
1907
  } | {
1809
1908
  blockNumberGte: number;
1810
1909
  chainId: Id;
1811
- }) => Promise<number>; /** Get all offers. */
1910
+ }) => Promise<number>; /** Get offers with collaterals only (no availability/takeable computation). */
1812
1911
  get: (parameters?: GetOffersParams) => Promise<{
1813
1912
  rows: Row[];
1814
1913
  nextCursor: string | null;
@@ -1872,6 +1971,35 @@ declare namespace getOffers$2 {
1872
1971
  };
1873
1972
  }
1874
1973
  //#endregion
1974
+ //#region src/database/domains/Callbacks.d.ts
1975
+ type CallbackInput = {
1976
+ chainId: Id;
1977
+ contract: Address;
1978
+ user: Address;
1979
+ amount: bigint;
1980
+ };
1981
+ type OfferCallbacks = {
1982
+ offerHash: Hex;
1983
+ callbacks: CallbackInput[];
1984
+ };
1985
+ type CallbacksDomain = {
1986
+ /**
1987
+ * Upsert callbacks and their offer associations.
1988
+ * @param inputs - Callback associations grouped by offer hash. {@link OfferCallbacks}
1989
+ */
1990
+ upsert: (inputs: OfferCallbacks[]) => Promise<void>;
1991
+ /**
1992
+ * Delete callback associations by offer hashes.
1993
+ * @param parameters - Offer hashes to delete. {@link DeleteParameters}
1994
+ * @returns Number of rows deleted. {@link DeleteReturnType}
1995
+ */
1996
+ delete: (parameters: DeleteParameters) => Promise<DeleteReturnType>;
1997
+ };
1998
+ type DeleteParameters = {
1999
+ offers: Hex[];
2000
+ };
2001
+ type DeleteReturnType = number;
2002
+ //#endregion
1875
2003
  //#region src/database/domains/Consumed.d.ts
1876
2004
  type Event = {
1877
2005
  id: string;
@@ -1889,6 +2017,22 @@ type ConsumedDomain = {
1889
2017
  }) => Promise<number>;
1890
2018
  };
1891
2019
  //#endregion
2020
+ //#region src/database/domains/Groups.d.ts
2021
+ type GroupInput = {
2022
+ chainId: Id;
2023
+ maker: Address;
2024
+ group: Hex;
2025
+ blockNumber: number;
2026
+ consumed?: bigint;
2027
+ };
2028
+ type GroupsDomain = {
2029
+ /**
2030
+ * Insert groups (insert-only).
2031
+ * @param groups - Groups to insert. {@link GroupInput}
2032
+ */
2033
+ create: (groups: GroupInput[]) => Promise<void>;
2034
+ };
2035
+ //#endregion
1892
2036
  //#region src/database/domains/Lots.d.ts
1893
2037
  type Lot = {
1894
2038
  chainId: Id;
@@ -1933,6 +2077,15 @@ declare namespace get$3 {
1933
2077
  }
1934
2078
  declare function create$5(db: Core): LotsDomain;
1935
2079
  //#endregion
2080
+ //#region src/database/domains/Obligations.d.ts
2081
+ type ObligationsDomain = {
2082
+ /**
2083
+ * Insert obligations (insert-only).
2084
+ * @param obligations - Obligations to insert. {@link Obligation.Obligation}
2085
+ */
2086
+ create: (obligations: Obligation[]) => Promise<void>;
2087
+ };
2088
+ //#endregion
1936
2089
  //#region src/database/domains/Offsets.d.ts
1937
2090
  type Offset = {
1938
2091
  chainId: Id;
@@ -2077,11 +2230,10 @@ type Attestation = {
2077
2230
  type CreateInput = {
2078
2231
  tree: Tree;
2079
2232
  signature: Hex;
2080
- blockNumber: number;
2081
2233
  };
2082
2234
  type TreesDomain = {
2083
2235
  /**
2084
- * Creates trees, offers, and attestation links in a single transaction.
2236
+ * Creates trees and attestation links in a single transaction.
2085
2237
  *
2086
2238
  * @param trees - Array of decoded trees with signatures (batch insertion)
2087
2239
  * @returns Array of tree roots that were created/upserted
@@ -2127,9 +2279,12 @@ type Driver = ReturnType<typeof drizzle> | ReturnType<typeof drizzle$1>;
2127
2279
  type Domains = {
2128
2280
  book: BookDomain;
2129
2281
  blocks: BlocksDomain;
2282
+ callbacks: CallbacksDomain;
2130
2283
  offers: OffersDomain;
2131
2284
  consumed: ConsumedDomain;
2285
+ groups: GroupsDomain;
2132
2286
  lots: LotsDomain;
2287
+ obligations: ObligationsDomain;
2133
2288
  offsets: OffsetsDomain;
2134
2289
  oracles: OraclesDomain;
2135
2290
  trees: TreesDomain;
@@ -2224,12 +2379,24 @@ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name
2224
2379
  }): Promise<Result<T, RuleNames<Rules>>>;
2225
2380
  //#endregion
2226
2381
  //#region src/gatekeeper/types.d.ts
2227
- type RuleInfo = {
2228
- name: string;
2229
- description: string;
2230
- };
2231
- type RulesProvider = {
2232
- getRules: () => Promise<RuleInfo[]>;
2382
+ type ConfigRule = {
2383
+ type: "maturity";
2384
+ chain_id: Id;
2385
+ name: MaturityType;
2386
+ timestamp: Maturity;
2387
+ } | {
2388
+ type: "callback";
2389
+ chain_id: Id;
2390
+ address: Address;
2391
+ callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
2392
+ } | {
2393
+ type: "loan_token";
2394
+ chain_id: Id;
2395
+ address: Address;
2396
+ } | {
2397
+ type: "oracle";
2398
+ chain_id: Id;
2399
+ address: Address;
2233
2400
  };
2234
2401
  type ValidationIssue = {
2235
2402
  index: number;
@@ -2244,9 +2411,21 @@ type ValidateOffersIssues = {
2244
2411
  issues: ValidationIssue[];
2245
2412
  };
2246
2413
  type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
2414
+ type CallbackType = Type$1 | "not_supported";
2415
+ type CallbackTypesRequest = {
2416
+ callbacks: Array<{
2417
+ chain_id: Id;
2418
+ addresses: Address[];
2419
+ }>;
2420
+ };
2421
+ type CallbackTypesResponse = Array<{
2422
+ chain_id: Id;
2423
+ } & Partial<Record<CallbackType, Address[]>>>;
2424
+ type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
2247
2425
  type SuccessPayload<T> = {
2248
2426
  meta: {
2249
2427
  timestamp: string;
2428
+ checksum?: string;
2250
2429
  };
2251
2430
  cursor: string | null;
2252
2431
  data: T;
@@ -2254,6 +2433,7 @@ type SuccessPayload<T> = {
2254
2433
  type ErrorPayload = {
2255
2434
  meta: {
2256
2435
  timestamp: string;
2436
+ checksum?: string;
2257
2437
  };
2258
2438
  error: {
2259
2439
  code: string;
@@ -2264,18 +2444,28 @@ type ErrorPayload = {
2264
2444
  declare namespace Client_d_exports {
2265
2445
  export { ClientConfig, GatekeeperClient, createHttpClient };
2266
2446
  }
2267
- type GatekeeperClient = RulesProvider & {
2447
+ type GatekeeperClient = {
2268
2448
  /** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
2269
2449
  statusCode: number;
2270
2450
  body: unknown;
2451
+ }>; /** Get configured rules for supported chains. */
2452
+ getConfigRules: (query?: {
2453
+ cursor?: string;
2454
+ limit?: number | string;
2455
+ types?: Array<ConfigRule["type"]> | ConfigRule["type"];
2456
+ }) => Promise<{
2457
+ statusCode: number;
2458
+ body: ConfigRulesPayload;
2271
2459
  }>; /** Validate offers and return decision results. */
2272
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
2460
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
2461
+ getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
2273
2462
  baseUrl: string;
2274
2463
  };
2275
2464
  type ClientConfig = {
2276
2465
  baseUrl: string;
2277
2466
  timeoutMs?: number;
2278
2467
  fetchFn?: typeof fetch;
2468
+ originSecret?: string;
2279
2469
  };
2280
2470
  /**
2281
2471
  * Create an HTTP client for a gatekeeper service.
@@ -2527,7 +2717,7 @@ interface paths {
2527
2717
  patch?: never;
2528
2718
  trace?: never;
2529
2719
  };
2530
- "/v1/config": {
2720
+ "/v1/config/contracts": {
2531
2721
  parameters: {
2532
2722
  query?: never;
2533
2723
  header?: never;
@@ -2535,12 +2725,28 @@ interface paths {
2535
2725
  cookie?: never;
2536
2726
  };
2537
2727
  /**
2538
- * Get router configuration
2539
- * @description Returns chain configurations including contract addresses and supported callback types.
2728
+ * Get indexer contract configuration
2729
+ * @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
2540
2730
  */
2541
2731
  get: {
2542
2732
  parameters: {
2543
- query?: never;
2733
+ query?: {
2734
+ /**
2735
+ * @description Filter by chain IDs (comma-separated).
2736
+ * @example 1,8453
2737
+ */
2738
+ chains?: number[];
2739
+ /**
2740
+ * @description Maximum number of contracts to return (max 1000).
2741
+ * @example 1000
2742
+ */
2743
+ limit?: number;
2744
+ /**
2745
+ * @description Pagination cursor in chain_id:address format (lowercase address).
2746
+ * @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
2747
+ */
2748
+ cursor?: string;
2749
+ };
2544
2750
  header?: never;
2545
2751
  path?: never;
2546
2752
  cookie?: never;
@@ -2552,7 +2758,66 @@ interface paths {
2552
2758
  [name: string]: unknown;
2553
2759
  };
2554
2760
  content: {
2555
- "application/json": components["schemas"]["ConfigSuccessResponse"];
2761
+ "application/json": components["schemas"]["ConfigContractsSuccessResponse"];
2762
+ };
2763
+ };
2764
+ };
2765
+ };
2766
+ put?: never;
2767
+ post?: never;
2768
+ delete?: never;
2769
+ options?: never;
2770
+ head?: never;
2771
+ patch?: never;
2772
+ trace?: never;
2773
+ };
2774
+ "/v1/config/rules": {
2775
+ parameters: {
2776
+ query?: never;
2777
+ header?: never;
2778
+ path?: never;
2779
+ cookie?: never;
2780
+ };
2781
+ /**
2782
+ * Get config rules
2783
+ * @description Returns configured rules for supported chains.
2784
+ */
2785
+ get: {
2786
+ parameters: {
2787
+ query?: {
2788
+ /**
2789
+ * @description Filter by chain IDs (comma-separated).
2790
+ * @example 1,8453
2791
+ */
2792
+ chains?: number[];
2793
+ /**
2794
+ * @description Filter by rule types (comma-separated).
2795
+ * @example maturity,loan_token,oracle
2796
+ */
2797
+ types?: string[];
2798
+ /**
2799
+ * @description Maximum number of rules to return (max 1000).
2800
+ * @example 100
2801
+ */
2802
+ limit?: number;
2803
+ /**
2804
+ * @description Pagination cursor in type:chain_id:<value> format.
2805
+ * @example maturity:1:1730415600:end_of_next_month
2806
+ */
2807
+ cursor?: string;
2808
+ };
2809
+ header?: never;
2810
+ path?: never;
2811
+ cookie?: never;
2812
+ };
2813
+ requestBody?: never;
2814
+ responses: {
2815
+ /** @description Success */200: {
2816
+ headers: {
2817
+ [name: string]: unknown;
2818
+ };
2819
+ content: {
2820
+ "application/json": components["schemas"]["ConfigRulesSuccessResponse"];
2556
2821
  };
2557
2822
  };
2558
2823
  };
@@ -2973,15 +3238,6 @@ interface paths {
2973
3238
  /**
2974
3239
  * Validate offers
2975
3240
  * @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
2976
- *
2977
- * **Available validation rules:**
2978
- * - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
2979
- * - **mixed_maker**: Validates that all offers in a batch have the same maker address
2980
- * - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
2981
- * - **chain_ids**: Validates that offer chain is one of: [109111114]
2982
- * - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
2983
- * - **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]
2984
- * - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
2985
3241
  */
2986
3242
  post: {
2987
3243
  parameters: {
@@ -3020,6 +3276,56 @@ interface paths {
3020
3276
  patch?: never;
3021
3277
  trace?: never;
3022
3278
  };
3279
+ "/v1/callbacks": {
3280
+ parameters: {
3281
+ query?: never;
3282
+ header?: never;
3283
+ path?: never;
3284
+ cookie?: never;
3285
+ };
3286
+ get?: never;
3287
+ put?: never;
3288
+ /**
3289
+ * Resolve callback types
3290
+ * @description Returns callback types for callback addresses grouped by chain.
3291
+ */
3292
+ post: {
3293
+ parameters: {
3294
+ query?: never;
3295
+ header?: never;
3296
+ path?: never;
3297
+ cookie?: never;
3298
+ };
3299
+ requestBody?: {
3300
+ content: {
3301
+ "application/json": components["schemas"]["CallbackTypesRequest"];
3302
+ };
3303
+ };
3304
+ responses: {
3305
+ /** @description Success */200: {
3306
+ headers: {
3307
+ [name: string]: unknown;
3308
+ };
3309
+ content: {
3310
+ "application/json": components["schemas"]["CallbackTypesSuccessResponse"];
3311
+ };
3312
+ }; /** @description Bad Request */
3313
+ 400: {
3314
+ headers: {
3315
+ [name: string]: unknown;
3316
+ };
3317
+ content: {
3318
+ "application/json": components["schemas"]["BadRequestResponse"];
3319
+ };
3320
+ };
3321
+ };
3322
+ };
3323
+ delete?: never;
3324
+ options?: never;
3325
+ head?: never;
3326
+ patch?: never;
3327
+ trace?: never;
3328
+ };
3023
3329
  }
3024
3330
  interface components {
3025
3331
  schemas: {
@@ -3057,42 +3363,90 @@ interface components {
3057
3363
  */
3058
3364
  details: Record<string, never>;
3059
3365
  };
3060
- ConfigSuccessResponse: {
3366
+ ConfigContractsSuccessResponse: {
3061
3367
  meta: components["schemas"]["Meta"]; /** @example null */
3062
3368
  cursor: string | null;
3063
3369
  /**
3064
- * @description Array of chain configurations for all indexed chains.
3370
+ * @description Indexer contract configuration for all indexed chains.
3065
3371
  * @example [
3066
3372
  * {
3067
3373
  * "chain_id": 505050505,
3068
- * "contracts": {
3069
- * "mempool": "0xD946246695A9259F3B33a78629026F61B3Ab40aF"
3070
- * },
3071
- * "callbacks": [
3072
- * "buy_with_empty_callback"
3073
- * ]
3374
+ * "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
3375
+ * "name": "mempool"
3376
+ * },
3377
+ * {
3378
+ * "chain_id": 505050505,
3379
+ * "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
3380
+ * "name": "multicall"
3381
+ * },
3382
+ * {
3383
+ * "chain_id": 505050505,
3384
+ * "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
3385
+ * "name": "v2"
3074
3386
  * }
3075
3387
  * ]
3076
3388
  */
3077
- data: components["schemas"]["ConfigDataResponse"][];
3389
+ data: components["schemas"]["ConfigContractResponse"][];
3078
3390
  };
3079
- ConfigDataResponse: {
3080
- /** @example 505050505 */chain_id: number;
3081
- contracts: components["schemas"]["ConfigContractsResponse"];
3391
+ ConfigContractResponse: {
3392
+ /** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
3393
+ address: string;
3082
3394
  /**
3083
- * @description Supported callback types for this chain.
3395
+ * @example mempool
3396
+ * @enum {string}
3397
+ */
3398
+ name: "mempool" | "multicall" | "v2";
3399
+ };
3400
+ ConfigRulesSuccessResponse: {
3401
+ meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
3402
+ cursor: string | null;
3403
+ /**
3404
+ * @description Configured rules returned by the router API.
3084
3405
  * @example [
3085
- * "buy_with_empty_callback"
3406
+ * {
3407
+ * "type": "maturity",
3408
+ * "chain_id": 1,
3409
+ * "name": "end_of_next_month",
3410
+ * "timestamp": 1730415600
3411
+ * },
3412
+ * {
3413
+ * "type": "callback",
3414
+ * "chain_id": 1,
3415
+ * "address": "0x1111111111111111111111111111111111111111",
3416
+ * "callback_type": "sell_erc20_callback"
3417
+ * },
3418
+ * {
3419
+ * "type": "loan_token",
3420
+ * "chain_id": 1,
3421
+ * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
3422
+ * },
3423
+ * {
3424
+ * "type": "oracle",
3425
+ * "chain_id": 1,
3426
+ * "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
3427
+ * }
3086
3428
  * ]
3087
- * @enum {string}
3088
3429
  */
3089
- callbacks: "buy_with_empty_callback" | "buy_erc20" | "buy_vault_v1_callback" | "sell_erc20_callback";
3430
+ data: components["schemas"]["ConfigRulesRuleResponse"][];
3431
+ };
3432
+ ConfigRulesMeta: {
3433
+ /** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
3434
+ checksum: string;
3090
3435
  };
3091
- ConfigContractsResponse: {
3092
- /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */mempool: string;
3436
+ ConfigRulesRuleResponse: {
3437
+ /** @example maturity */type: string; /** @example 1 */
3438
+ chain_id: number; /** @example end_of_next_month */
3439
+ name?: string; /** @example 1730415600 */
3440
+ timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
3441
+ address?: string; /** @example sell_erc20_callback */
3442
+ callback_type?: string;
3093
3443
  };
3094
3444
  OfferListResponse: {
3095
- meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
3445
+ meta: components["schemas"]["Meta"];
3446
+ /**
3447
+ * @description Pagination cursor. Offer hash (0x...) for maker queries; base64url-encoded cursor for obligation queries.
3448
+ * @example eyJvZmZzZXQiOjEwMH0
3449
+ */
3096
3450
  cursor: string | null;
3097
3451
  /**
3098
3452
  * @description Offers matching the provided filters.
@@ -3431,6 +3785,84 @@ interface components {
3431
3785
  */
3432
3786
  root: string;
3433
3787
  };
3788
+ CallbackTypesRequest: {
3789
+ /**
3790
+ * @example [
3791
+ * {
3792
+ * "chain_id": 1,
3793
+ * "addresses": [
3794
+ * "0x1111111111111111111111111111111111111111",
3795
+ * "0x3333333333333333333333333333333333333333",
3796
+ * "0x9999999999999999999999999999999999999999"
3797
+ * ]
3798
+ * }
3799
+ * ]
3800
+ */
3801
+ callbacks: components["schemas"]["CallbackTypesChainRequest"][];
3802
+ };
3803
+ CallbackTypesChainRequest: {
3804
+ /** @example 1 */chain_id: number;
3805
+ /**
3806
+ * @example [
3807
+ * "0x1111111111111111111111111111111111111111",
3808
+ * "0x3333333333333333333333333333333333333333",
3809
+ * "0x9999999999999999999999999999999999999999"
3810
+ * ]
3811
+ */
3812
+ addresses: string[];
3813
+ };
3814
+ CallbackTypesSuccessResponse: {
3815
+ meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
3816
+ cursor: string | null;
3817
+ /**
3818
+ * @description Callback types grouped by chain.
3819
+ * @example [
3820
+ * {
3821
+ * "chain_id": 1,
3822
+ * "sell_erc20_callback": [
3823
+ * "0x1111111111111111111111111111111111111111"
3824
+ * ],
3825
+ * "buy_erc20": [
3826
+ * "0x5555555555555555555555555555555555555555"
3827
+ * ],
3828
+ * "buy_vault_v1_callback": [
3829
+ * "0x3333333333333333333333333333333333333333"
3830
+ * ],
3831
+ * "not_supported": [
3832
+ * "0x9999999999999999999999999999999999999999"
3833
+ * ]
3834
+ * }
3835
+ * ]
3836
+ */
3837
+ data: components["schemas"]["CallbackTypesChainResponse"][];
3838
+ };
3839
+ CallbackTypesChainResponse: {
3840
+ /** @example 1 */chain_id: number;
3841
+ /**
3842
+ * @example [
3843
+ * "0x3333333333333333333333333333333333333333"
3844
+ * ]
3845
+ */
3846
+ buy_vault_v1_callback?: string[];
3847
+ /**
3848
+ * @example [
3849
+ * "0x1111111111111111111111111111111111111111"
3850
+ * ]
3851
+ */
3852
+ sell_erc20_callback?: string[];
3853
+ /**
3854
+ * @example [
3855
+ * "0x5555555555555555555555555555555555555555"
3856
+ * ]
3857
+ */
3858
+ buy_erc20?: string[];
3859
+ /**
3860
+ * @example [
3861
+ * "0x9999999999999999999999999999999999999999"
3862
+ * ]
3863
+ */
3864
+ not_supported: string[];
3865
+ };
3434
3866
  };
3435
3867
  responses: never;
3436
3868
  parameters: never;
@@ -3499,6 +3931,9 @@ declare class BooksController {
3499
3931
  declare class ValidateController {
3500
3932
  validateOffers(): Promise<void>;
3501
3933
  }
3934
+ declare class CallbacksController {
3935
+ resolveCallbackTypes(): Promise<void>;
3936
+ }
3502
3937
  declare class OffersController {
3503
3938
  getOffers(): Promise<void>;
3504
3939
  }
@@ -3507,8 +3942,11 @@ declare class HealthController {
3507
3942
  getCollectorsHealth(): Promise<void>;
3508
3943
  getChainsHealth(): Promise<void>;
3509
3944
  }
3510
- declare class ConfigController {
3511
- getConfig(): Promise<void>;
3945
+ declare class ConfigContractsController {
3946
+ getConfigContracts(): Promise<void>;
3947
+ }
3948
+ declare class ConfigRulesController {
3949
+ getConfigRules(): Promise<void>;
3512
3950
  }
3513
3951
  declare class ObligationsController {
3514
3952
  getObligations(): Promise<void>;
@@ -3517,10 +3955,7 @@ declare class ObligationsController {
3517
3955
  declare class UsersController {
3518
3956
  getUserPositions(): Promise<void>;
3519
3957
  }
3520
- type OpenApiOptions = {
3521
- rules?: RuleInfo[];
3522
- };
3523
- declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
3958
+ declare const OpenApi: () => Promise<OpenAPIDocument>;
3524
3959
  declare namespace PositionResponse_d_exports {
3525
3960
  export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
3526
3961
  }
@@ -3545,36 +3980,64 @@ declare const schemas: {
3545
3980
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
3546
3981
  0: "0";
3547
3982
  1: "1";
3548
- true: "true";
3549
3983
  false: "false";
3550
- }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
3984
+ true: "true";
3985
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
3551
3986
  }, z$1.core.$strip>;
3552
3987
  readonly get_health_collectors: z$1.ZodObject<{
3553
3988
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
3554
3989
  0: "0";
3555
3990
  1: "1";
3556
- true: "true";
3557
3991
  false: "false";
3558
- }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
3992
+ true: "true";
3993
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
3559
3994
  }, z$1.core.$strip>;
3560
3995
  readonly get_health_chains: z$1.ZodObject<{
3561
3996
  strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
3562
3997
  0: "0";
3563
3998
  1: "1";
3564
- true: "true";
3565
3999
  false: "false";
3566
- }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
4000
+ true: "true";
4001
+ }>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
3567
4002
  }, z$1.core.$strip>;
3568
- readonly get_offers: z$1.ZodObject<{
4003
+ readonly get_config_contracts: z$1.ZodObject<{
4004
+ cursor: z$1.ZodOptional<z$1.ZodString>;
4005
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
4006
+ 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>>>>>;
4007
+ }, z$1.core.$strip>;
4008
+ readonly get_config_rules: z$1.ZodObject<{
4009
+ cursor: z$1.ZodOptional<z$1.ZodString>;
4010
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
4011
+ types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
4012
+ loan_token: "loan_token";
4013
+ maturity: "maturity";
4014
+ callback: "callback";
4015
+ oracle: "oracle";
4016
+ }>>>>;
4017
+ chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
4018
+ }, z$1.core.$strip>;
4019
+ readonly get_offers: z$1.ZodPipe<z$1.ZodObject<{
4020
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
4021
+ cursor: z$1.ZodOptional<z$1.ZodString>;
3569
4022
  side: z$1.ZodOptional<z$1.ZodEnum<{
3570
4023
  buy: "buy";
3571
4024
  sell: "sell";
3572
4025
  }>>;
3573
4026
  obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3574
4027
  maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3575
- cursor: z$1.ZodOptional<z$1.ZodString>;
3576
- limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3577
- }, z$1.core.$strip>;
4028
+ }, z$1.core.$strip>, z$1.ZodTransform<{
4029
+ limit: number;
4030
+ cursor?: string | undefined;
4031
+ side?: "buy" | "sell" | undefined;
4032
+ obligation_id?: `0x${string}` | undefined;
4033
+ maker?: `0x${string}` | undefined;
4034
+ }, {
4035
+ limit: number;
4036
+ cursor?: string | undefined;
4037
+ side?: "buy" | "sell" | undefined;
4038
+ obligation_id?: `0x${string}` | undefined;
4039
+ maker?: `0x${string}` | undefined;
4040
+ }>>;
3578
4041
  readonly get_obligations: z$1.ZodObject<{
3579
4042
  cursor: z$1.ZodOptional<z$1.ZodString>;
3580
4043
  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>>>>>;
@@ -3598,6 +4061,12 @@ declare const schemas: {
3598
4061
  readonly validate_offers: z$1.ZodObject<{
3599
4062
  offers: z$1.ZodArray<z$1.ZodUnknown>;
3600
4063
  }, z$1.core.$strict>;
4064
+ readonly callback_types: z$1.ZodObject<{
4065
+ callbacks: z$1.ZodArray<z$1.ZodObject<{
4066
+ chain_id: z$1.ZodNumber;
4067
+ addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
4068
+ }, z$1.core.$strict>>;
4069
+ }, z$1.core.$strict>;
3601
4070
  readonly get_user_positions: z$1.ZodObject<{
3602
4071
  user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
3603
4072
  cursor: z$1.ZodOptional<z$1.ZodString>;
@@ -3619,6 +4088,7 @@ declare enum STATUS_CODE {
3619
4088
  }
3620
4089
  type Meta = {
3621
4090
  timestamp: string;
4091
+ checksum?: string;
3622
4092
  };
3623
4093
  type ErrorDetail = {
3624
4094
  code: APIErrorCode;
@@ -3645,42 +4115,42 @@ type Payload<T> = SuccessPayload$1<T> | ErrorPayload$1;
3645
4115
  //#region src/api/Controllers/getBook.d.ts
3646
4116
  declare function getBook(params: object, db: Database): Promise<Payload<BookLevelResponse[]>>;
3647
4117
  //#endregion
3648
- //#region src/api/Controllers/getConfig.d.ts
3649
- type ChainConfig = {
4118
+ //#region src/api/Controllers/getConfigContracts.d.ts
4119
+ declare const CONFIG_CONTRACT_NAMES: readonly ["mempool", "multicall", "v2"];
4120
+ type ConfigContractName = (typeof CONFIG_CONTRACT_NAMES)[number];
4121
+ type ConfigContract = {
3650
4122
  chain_id: Id;
3651
- contracts: {
3652
- mempool: string;
3653
- };
3654
- callbacks: string[];
4123
+ address: Address;
4124
+ name: ConfigContractName;
3655
4125
  };
3656
4126
  /**
3657
- * Returns the configuration for all chains the router is indexing.
4127
+ * Returns contract addresses used by indexers (mempool, v2) plus multicall per chain.
4128
+ * @param query - Raw query parameters containing optional chain filters.
3658
4129
  * @param chainRegistry - The chain registry instance. {@link ChainRegistry.ChainRegistry}
3659
- * @returns The configuration for all chains the router is indexing. {@link ApiPayload.Payload<ChainConfig[]>}
4130
+ * @returns The indexer contract configuration. {@link ApiPayload.Payload<ConfigContract[]>}
3660
4131
  */
3661
- declare function getConfig(chainRegistry: ChainRegistry): Promise<Payload<ChainConfig[]>>;
4132
+ declare function getConfigContracts(query: unknown, chainRegistry: ChainRegistry): Promise<Payload<ConfigContract[]>>;
4133
+ //#endregion
4134
+ //#region src/api/Controllers/getConfigRules.d.ts
4135
+ /**
4136
+ * Returns configured rules for the configured chains.
4137
+ * @param query - Raw query parameters containing filters/cursor/limit.
4138
+ * @param chains - Chains to include in the configured rules.
4139
+ * @returns Config rules response payload. {@link ApiPayload.Payload}
4140
+ */
4141
+ declare function getConfigRules(query: unknown, chains: Chain$1[]): Promise<Payload<ConfigRule[]>>;
3662
4142
  //#endregion
3663
4143
  //#region src/api/Controllers/getDocs.d.ts
3664
4144
  /**
3665
4145
  * Build the OpenAPI document for the router.
3666
- * @param parameters - Includes a {@link RulesProvider} to fetch gatekeeper rules.
3667
4146
  * @returns OpenAPI document. {@link OpenAPIDocument}
3668
4147
  */
3669
- declare function getSwaggerJson({
3670
- gatekeeper
3671
- }: {
3672
- gatekeeper: RulesProvider;
3673
- }): Promise<OpenAPIDocument>;
4148
+ declare function getSwaggerJson(): Promise<OpenAPIDocument>;
3674
4149
  /**
3675
4150
  * Render the API documentation HTML page.
3676
- * @param parameters - Includes a {@link RulesProvider} to fetch gatekeeper rules.
3677
4151
  * @returns HTML page as string.
3678
4152
  */
3679
- declare function getDocsHtml({
3680
- gatekeeper
3681
- }: {
3682
- gatekeeper: RulesProvider;
3683
- }): Promise<string>;
4153
+ declare function getDocsHtml(): Promise<string>;
3684
4154
  /**
3685
4155
  * Renders the integrator documentation as HTML.
3686
4156
  * @returns HTML page with the rendered markdown documentation.
@@ -3699,6 +4169,21 @@ declare function getObligation(params: object, db: Database): Promise<Payload<Ob
3699
4169
  declare function getObligations$1(queryParameters: object, db: Database): Promise<Payload<ObligationResponse[]>>;
3700
4170
  //#endregion
3701
4171
  //#region src/api/Controllers/getOffers.d.ts
4172
+ type GetOffersQueryParams = {
4173
+ /** Filter by maker address */maker?: Address; /** Cursor string returned by a previous call, for pagination */
4174
+ cursor?: string; /** Page size; defaults to {@link OffersDomain.DEFAULT_LIMIT} */
4175
+ limit?: number;
4176
+ };
4177
+ /**
4178
+ * Query offers with computed consumed/available/takeable values.
4179
+ * @param db - The database client. {@link Database.Core}
4180
+ * @param parameters - {@link GetOffersQueryParams}
4181
+ * @returns The offers with pagination cursor.
4182
+ */
4183
+ declare function getOffersQuery(db: Core, parameters?: GetOffersQueryParams): Promise<{
4184
+ rows: Row[];
4185
+ nextCursor: string | null;
4186
+ }>;
3702
4187
  declare function getOffers$1(queryParameters: object, db: Database): Promise<Payload<OfferResponse[]>>;
3703
4188
  //#endregion
3704
4189
  //#region src/api/Controllers/getUserPositions.d.ts
@@ -3709,13 +4194,22 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
3709
4194
  * @returns Paginated list of positions with remaining balances.
3710
4195
  */
3711
4196
  declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
4197
+ //#endregion
4198
+ //#region src/api/Controllers/resolveCallbackTypes.d.ts
4199
+ type CallbackTypesPayload = SuccessPayload$1<CallbackTypesResponse>;
4200
+ /**
4201
+ * Resolve callback types for a list of callback addresses grouped by chain.
4202
+ * @param body - Request body with callback addresses. {@link CallbackTypesRequest}
4203
+ * @param chains - Chains to resolve callback types against. {@link Chain.Chain}
4204
+ * @returns Callback types grouped by chain. {@link CallbackTypesPayload}
4205
+ */
4206
+ declare function resolveCallbackTypes(body: object, chains: Chain$1[]): Promise<CallbackTypesPayload | ErrorPayload$1>;
3712
4207
  declare namespace Gatekeeper_d_exports {
3713
4208
  export { Gatekeeper, Rules, create };
3714
4209
  }
3715
4210
  type Rules = readonly Rule<Offer, string>[];
3716
4211
  type Gatekeeper = {
3717
4212
  isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
3718
- getRules: () => Promise<RuleInfo[]>;
3719
4213
  };
3720
4214
  type GatekeeperParameters = {
3721
4215
  rules: Rules;
@@ -3743,10 +4237,10 @@ type ValidateOffersIssuesPayload = SuccessPayload$1<{
3743
4237
  type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
3744
4238
  declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload$1>;
3745
4239
  declare namespace index_d_exports$4 {
3746
- 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 };
4240
+ 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 };
3747
4241
  }
3748
4242
  declare namespace RouterApi_d_exports {
3749
- 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 };
4243
+ 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 };
3750
4244
  }
3751
4245
  declare namespace Client_d_exports$1 {
3752
4246
  export { Client$3 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
@@ -4331,23 +4825,6 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
4331
4825
  identity: undefined;
4332
4826
  generated: undefined;
4333
4827
  }, {}, {}>;
4334
- blockNumber: drizzle_orm_pg_core0.PgColumn<{
4335
- name: "block_number";
4336
- tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
4337
- dataType: "number";
4338
- columnType: "PgBigInt53";
4339
- data: number;
4340
- driverParam: string | number;
4341
- notNull: true;
4342
- hasDefault: false;
4343
- isPrimaryKey: false;
4344
- isAutoincrement: false;
4345
- hasRuntimeDefault: false;
4346
- enumValues: undefined;
4347
- baseColumn: never;
4348
- identity: undefined;
4349
- generated: undefined;
4350
- }, {}, {}>;
4351
4828
  updatedAt: drizzle_orm_pg_core0.PgColumn<{
4352
4829
  name: "updated_at";
4353
4830
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
@@ -5918,63 +6395,11 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
5918
6395
  declare namespace index_d_exports$2 {
5919
6396
  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 };
5920
6397
  }
5921
- declare namespace GateConfig_d_exports {
5922
- export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
5923
- }
5924
- type GateConfig = {
5925
- callbacks?: CallbackConfig[];
5926
- maturities?: MaturityType[];
5927
- };
5928
- type CallbackConfig = {
5929
- type: Type$1.BuyVaultV1Callback;
5930
- addresses: Address[];
5931
- vaultFactories: Address[];
5932
- } | {
5933
- type: Type$1.SellERC20Callback;
5934
- addresses: Address[];
5935
- } | {
5936
- type: Type$1.BuyWithEmptyCallback;
5937
- };
5938
- declare function getCallback(chain: Name$1, type: Type$1.BuyVaultV1Callback): Extract<CallbackConfig, {
5939
- type: Type$1.BuyVaultV1Callback;
5940
- }> | undefined;
5941
- declare function getCallback(chain: Name$1, type: Type$1.SellERC20Callback): Extract<CallbackConfig, {
5942
- type: Type$1.SellERC20Callback;
5943
- }> | undefined;
5944
- declare function getCallback(chain: Name$1, type: Type$1.BuyWithEmptyCallback): Extract<CallbackConfig, {
5945
- type: Type$1.BuyWithEmptyCallback;
5946
- }> | undefined;
5947
- declare function getCallback(chain: Name$1, type: Type$1): CallbackConfig | undefined;
5948
- /**
5949
- * Attempts to infer the configured callback type from a callback address on a chain.
5950
- * Skips the empty callback type as it does not carry addresses.
5951
- *
5952
- * @param chain - Chain name for which to infer the callback type
5953
- * @param address - Callback contract address
5954
- * @returns The callback type when found, otherwise undefined
5955
- */
5956
- declare function getCallbackType(chain: Name$1, address: Address): Type$1.BuyWithEmptyCallback | Type$1.BuyVaultV1Callback | Type$1.SellERC20Callback | undefined;
5957
- /**
5958
- * Returns the callback addresses for a given chain and callback type, if it exists.
5959
- * @param chain - Chain name for which to read the validation configuration
5960
- * @param type - Callback type to retrieve
5961
- * @returns The matching callback addresses or an empty array if not configured
5962
- */
5963
- declare function getCallbackTypeAddresses(chain: Name$1, type: Type$1): Address[];
5964
- /**
5965
- * Returns the list of allowed non-empty callback addresses for a chain.
5966
- *
5967
- * @param chain - Chain name
5968
- * @returns Array of allowed callback addresses (lowercased). Empty when none configured
5969
- */
5970
- declare const getCallbackAddresses: (chain: Name$1) => Address[];
5971
- declare const assets: Record<string, Address[]>;
5972
- declare const configs: Record<Name$1, GateConfig>;
5973
6398
  //#endregion
5974
6399
  //#region src/gatekeeper/morphoRules.d.ts
5975
- 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">)[];
6400
+ 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"> | Rule<Offer, "oracle">)[];
5976
6401
  declare namespace Rules_d_exports {
5977
- export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
6402
+ export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
5978
6403
  }
5979
6404
  type ValidityParameters = {
5980
6405
  client: PublicClient<Transport, Chain$1>;
@@ -6013,6 +6438,16 @@ declare const token: ({
6013
6438
  }: {
6014
6439
  assetsByChainId: Partial<Record<Id, Address[]>>;
6015
6440
  }) => Rule<Offer, "token">;
6441
+ /**
6442
+ * A validation rule that checks if the offer's oracle addresses are allowed for its chain.
6443
+ * @param oraclesByChainId - Allowed oracles indexed by chain id.
6444
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
6445
+ */
6446
+ declare const oracle: ({
6447
+ oraclesByChainId
6448
+ }: {
6449
+ oraclesByChainId: Partial<Record<Id, Address[]>>;
6450
+ }) => Rule<Offer, "oracle">;
6016
6451
  /**
6017
6452
  * A batch validation rule that ensures all offers in a tree have the same maker address.
6018
6453
  * Returns an issue only for the first non-conforming offer.
@@ -6030,13 +6465,15 @@ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusiv
6030
6465
  type MempoolEVMClientConfig = {
6031
6466
  readonly client: WalletClient;
6032
6467
  readonly mempoolAddress: Address;
6468
+ readonly morphoAddress?: Address;
6033
6469
  readonly blockWindow?: number;
6034
6470
  };
6035
6471
  declare function from(parameters: from.Parameters): from.ReturnType;
6036
6472
  declare namespace from {
6037
6473
  type Parameters = {
6038
6474
  /** The viem client to use. */client: WalletClient; /** The mempool address. */
6039
- mempoolAddress: Address; /** The block window to use for the mempool. Defaults to 100. */
6475
+ mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
6476
+ morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
6040
6477
  blockWindow?: number;
6041
6478
  };
6042
6479
  type ReturnType = Client$2;
@@ -6051,7 +6488,7 @@ declare namespace from {
6051
6488
  */
6052
6489
  declare function add(config: MempoolEVMClientConfig, offers: AddParameters): Promise<Hex>;
6053
6490
  declare namespace add {
6054
- type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError;
6491
+ type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError | MissingMorphoAddressError;
6055
6492
  }
6056
6493
  declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
6057
6494
  offers: Offer[];
@@ -6060,7 +6497,7 @@ declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters)
6060
6497
  declare namespace get {
6061
6498
  type ErrorType = streamOffersReturnType;
6062
6499
  }
6063
- type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError;
6500
+ type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError | MissingMorphoAddressError;
6064
6501
  declare class WalletAccountNotSetError extends BaseError {
6065
6502
  name: string;
6066
6503
  constructor();
@@ -6072,6 +6509,10 @@ declare class ChainIdMismatchError extends BaseError {
6072
6509
  name: string;
6073
6510
  constructor(expected: Id, actual: Id);
6074
6511
  }
6512
+ declare class MissingMorphoAddressError extends BaseError {
6513
+ name: string;
6514
+ constructor();
6515
+ }
6075
6516
  //#endregion
6076
6517
  //#region src/mempool/MempoolClient.d.ts
6077
6518
  type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
@@ -6118,7 +6559,7 @@ declare namespace connect {
6118
6559
  type ErrorType = from.ErrorType;
6119
6560
  }
6120
6561
  declare namespace index_d_exports$1 {
6121
- export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
6562
+ export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, MissingMorphoAddressError, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
6122
6563
  }
6123
6564
  //#endregion
6124
6565
  //#region src/utils/BigMath.d.ts
@@ -6253,5 +6694,5 @@ declare namespace index_d_exports$3 {
6253
6694
  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 };
6254
6695
  }
6255
6696
  //#endregion
6256
- 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 };
6697
+ 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 };
6257
6698
  //# sourceMappingURL=index.node.d.mts.map