@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.
@@ -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,20 @@ 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;
2233
2396
  };
2234
2397
  type ValidationIssue = {
2235
2398
  index: number;
@@ -2244,9 +2407,21 @@ type ValidateOffersIssues = {
2244
2407
  issues: ValidationIssue[];
2245
2408
  };
2246
2409
  type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
2410
+ type CallbackType = Type$1 | "not_supported";
2411
+ type CallbackTypesRequest = {
2412
+ callbacks: Array<{
2413
+ chain_id: Id;
2414
+ addresses: Address[];
2415
+ }>;
2416
+ };
2417
+ type CallbackTypesResponse = Array<{
2418
+ chain_id: Id;
2419
+ } & Partial<Record<CallbackType, Address[]>>>;
2420
+ type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
2247
2421
  type SuccessPayload<T> = {
2248
2422
  meta: {
2249
2423
  timestamp: string;
2424
+ checksum?: string;
2250
2425
  };
2251
2426
  cursor: string | null;
2252
2427
  data: T;
@@ -2254,6 +2429,7 @@ type SuccessPayload<T> = {
2254
2429
  type ErrorPayload = {
2255
2430
  meta: {
2256
2431
  timestamp: string;
2432
+ checksum?: string;
2257
2433
  };
2258
2434
  error: {
2259
2435
  code: string;
@@ -2264,18 +2440,28 @@ type ErrorPayload = {
2264
2440
  declare namespace Client_d_exports {
2265
2441
  export { ClientConfig, GatekeeperClient, createHttpClient };
2266
2442
  }
2267
- type GatekeeperClient = RulesProvider & {
2443
+ type GatekeeperClient = {
2268
2444
  /** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
2269
2445
  statusCode: number;
2270
2446
  body: unknown;
2447
+ }>; /** Get configured rules for supported chains. */
2448
+ getConfigRules: (query?: {
2449
+ cursor?: string;
2450
+ limit?: number | string;
2451
+ types?: Array<ConfigRule["type"]> | ConfigRule["type"];
2452
+ }) => Promise<{
2453
+ statusCode: number;
2454
+ body: ConfigRulesPayload;
2271
2455
  }>; /** Validate offers and return decision results. */
2272
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
2456
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
2457
+ getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
2273
2458
  baseUrl: string;
2274
2459
  };
2275
2460
  type ClientConfig = {
2276
2461
  baseUrl: string;
2277
2462
  timeoutMs?: number;
2278
2463
  fetchFn?: typeof fetch;
2464
+ originSecret?: string;
2279
2465
  };
2280
2466
  /**
2281
2467
  * Create an HTTP client for a gatekeeper service.
@@ -2527,7 +2713,7 @@ interface paths {
2527
2713
  patch?: never;
2528
2714
  trace?: never;
2529
2715
  };
2530
- "/v1/config": {
2716
+ "/v1/config/contracts": {
2531
2717
  parameters: {
2532
2718
  query?: never;
2533
2719
  header?: never;
@@ -2535,12 +2721,28 @@ interface paths {
2535
2721
  cookie?: never;
2536
2722
  };
2537
2723
  /**
2538
- * Get router configuration
2539
- * @description Returns chain configurations including contract addresses and supported callback types.
2724
+ * Get indexer contract configuration
2725
+ * @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
2540
2726
  */
2541
2727
  get: {
2542
2728
  parameters: {
2543
- query?: never;
2729
+ query?: {
2730
+ /**
2731
+ * @description Filter by chain IDs (comma-separated).
2732
+ * @example 1,8453
2733
+ */
2734
+ chains?: number[];
2735
+ /**
2736
+ * @description Maximum number of contracts to return (max 1000).
2737
+ * @example 1000
2738
+ */
2739
+ limit?: number;
2740
+ /**
2741
+ * @description Pagination cursor in chain_id:address format (lowercase address).
2742
+ * @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
2743
+ */
2744
+ cursor?: string;
2745
+ };
2544
2746
  header?: never;
2545
2747
  path?: never;
2546
2748
  cookie?: never;
@@ -2552,7 +2754,66 @@ interface paths {
2552
2754
  [name: string]: unknown;
2553
2755
  };
2554
2756
  content: {
2555
- "application/json": components["schemas"]["ConfigSuccessResponse"];
2757
+ "application/json": components["schemas"]["ConfigContractsSuccessResponse"];
2758
+ };
2759
+ };
2760
+ };
2761
+ };
2762
+ put?: never;
2763
+ post?: never;
2764
+ delete?: never;
2765
+ options?: never;
2766
+ head?: never;
2767
+ patch?: never;
2768
+ trace?: never;
2769
+ };
2770
+ "/v1/config/rules": {
2771
+ parameters: {
2772
+ query?: never;
2773
+ header?: never;
2774
+ path?: never;
2775
+ cookie?: never;
2776
+ };
2777
+ /**
2778
+ * Get config rules
2779
+ * @description Returns configured rules for supported chains.
2780
+ */
2781
+ get: {
2782
+ parameters: {
2783
+ query?: {
2784
+ /**
2785
+ * @description Filter by chain IDs (comma-separated).
2786
+ * @example 1,8453
2787
+ */
2788
+ chains?: number[];
2789
+ /**
2790
+ * @description Filter by rule types (comma-separated).
2791
+ * @example maturity,loan_token
2792
+ */
2793
+ types?: string[];
2794
+ /**
2795
+ * @description Maximum number of rules to return (max 1000).
2796
+ * @example 100
2797
+ */
2798
+ limit?: number;
2799
+ /**
2800
+ * @description Pagination cursor in type:chain_id:<value> format.
2801
+ * @example maturity:1:1730415600:end_of_next_month
2802
+ */
2803
+ cursor?: string;
2804
+ };
2805
+ header?: never;
2806
+ path?: never;
2807
+ cookie?: never;
2808
+ };
2809
+ requestBody?: never;
2810
+ responses: {
2811
+ /** @description Success */200: {
2812
+ headers: {
2813
+ [name: string]: unknown;
2814
+ };
2815
+ content: {
2816
+ "application/json": components["schemas"]["ConfigRulesSuccessResponse"];
2556
2817
  };
2557
2818
  };
2558
2819
  };
@@ -2973,15 +3234,6 @@ interface paths {
2973
3234
  /**
2974
3235
  * Validate offers
2975
3236
  * @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
3237
  */
2986
3238
  post: {
2987
3239
  parameters: {
@@ -3020,6 +3272,56 @@ interface paths {
3020
3272
  patch?: never;
3021
3273
  trace?: never;
3022
3274
  };
3275
+ "/v1/callbacks": {
3276
+ parameters: {
3277
+ query?: never;
3278
+ header?: never;
3279
+ path?: never;
3280
+ cookie?: never;
3281
+ };
3282
+ get?: never;
3283
+ put?: never;
3284
+ /**
3285
+ * Resolve callback types
3286
+ * @description Returns callback types for callback addresses grouped by chain.
3287
+ */
3288
+ post: {
3289
+ parameters: {
3290
+ query?: never;
3291
+ header?: never;
3292
+ path?: never;
3293
+ cookie?: never;
3294
+ };
3295
+ requestBody?: {
3296
+ content: {
3297
+ "application/json": components["schemas"]["CallbackTypesRequest"];
3298
+ };
3299
+ };
3300
+ responses: {
3301
+ /** @description Success */200: {
3302
+ headers: {
3303
+ [name: string]: unknown;
3304
+ };
3305
+ content: {
3306
+ "application/json": components["schemas"]["CallbackTypesSuccessResponse"];
3307
+ };
3308
+ }; /** @description Bad Request */
3309
+ 400: {
3310
+ headers: {
3311
+ [name: string]: unknown;
3312
+ };
3313
+ content: {
3314
+ "application/json": components["schemas"]["BadRequestResponse"];
3315
+ };
3316
+ };
3317
+ };
3318
+ };
3319
+ delete?: never;
3320
+ options?: never;
3321
+ head?: never;
3322
+ patch?: never;
3323
+ trace?: never;
3324
+ };
3023
3325
  }
3024
3326
  interface components {
3025
3327
  schemas: {
@@ -3057,39 +3359,78 @@ interface components {
3057
3359
  */
3058
3360
  details: Record<string, never>;
3059
3361
  };
3060
- ConfigSuccessResponse: {
3362
+ ConfigContractsSuccessResponse: {
3061
3363
  meta: components["schemas"]["Meta"]; /** @example null */
3062
3364
  cursor: string | null;
3063
3365
  /**
3064
- * @description Array of chain configurations for all indexed chains.
3366
+ * @description Indexer contract configuration for all indexed chains.
3065
3367
  * @example [
3066
3368
  * {
3067
3369
  * "chain_id": 505050505,
3068
- * "contracts": {
3069
- * "mempool": "0xD946246695A9259F3B33a78629026F61B3Ab40aF"
3070
- * },
3071
- * "callbacks": [
3072
- * "buy_with_empty_callback"
3073
- * ]
3370
+ * "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
3371
+ * "name": "mempool"
3372
+ * },
3373
+ * {
3374
+ * "chain_id": 505050505,
3375
+ * "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
3376
+ * "name": "multicall"
3377
+ * },
3378
+ * {
3379
+ * "chain_id": 505050505,
3380
+ * "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
3381
+ * "name": "v2"
3074
3382
  * }
3075
3383
  * ]
3076
3384
  */
3077
- data: components["schemas"]["ConfigDataResponse"][];
3385
+ data: components["schemas"]["ConfigContractResponse"][];
3078
3386
  };
3079
- ConfigDataResponse: {
3080
- /** @example 505050505 */chain_id: number;
3081
- contracts: components["schemas"]["ConfigContractsResponse"];
3387
+ ConfigContractResponse: {
3388
+ /** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
3389
+ address: string;
3390
+ /**
3391
+ * @example mempool
3392
+ * @enum {string}
3393
+ */
3394
+ name: "mempool" | "multicall" | "v2";
3395
+ };
3396
+ ConfigRulesSuccessResponse: {
3397
+ meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
3398
+ cursor: string | null;
3082
3399
  /**
3083
- * @description Supported callback types for this chain.
3400
+ * @description Configured rules returned by the router API.
3084
3401
  * @example [
3085
- * "buy_with_empty_callback"
3402
+ * {
3403
+ * "type": "maturity",
3404
+ * "chain_id": 1,
3405
+ * "name": "end_of_next_month",
3406
+ * "timestamp": 1730415600
3407
+ * },
3408
+ * {
3409
+ * "type": "callback",
3410
+ * "chain_id": 1,
3411
+ * "address": "0x1111111111111111111111111111111111111111",
3412
+ * "callback_type": "sell_erc20_callback"
3413
+ * },
3414
+ * {
3415
+ * "type": "loan_token",
3416
+ * "chain_id": 1,
3417
+ * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
3418
+ * }
3086
3419
  * ]
3087
- * @enum {string}
3088
3420
  */
3089
- callbacks: "buy_with_empty_callback" | "buy_erc20" | "buy_vault_v1_callback" | "sell_erc20_callback";
3421
+ data: components["schemas"]["ConfigRulesRuleResponse"][];
3090
3422
  };
3091
- ConfigContractsResponse: {
3092
- /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */mempool: string;
3423
+ ConfigRulesMeta: {
3424
+ /** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
3425
+ checksum: string;
3426
+ };
3427
+ ConfigRulesRuleResponse: {
3428
+ /** @example maturity */type: string; /** @example 1 */
3429
+ chain_id: number; /** @example end_of_next_month */
3430
+ name?: string; /** @example 1730415600 */
3431
+ timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
3432
+ address?: string; /** @example sell_erc20_callback */
3433
+ callback_type?: string;
3093
3434
  };
3094
3435
  OfferListResponse: {
3095
3436
  meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
@@ -3431,6 +3772,84 @@ interface components {
3431
3772
  */
3432
3773
  root: string;
3433
3774
  };
3775
+ CallbackTypesRequest: {
3776
+ /**
3777
+ * @example [
3778
+ * {
3779
+ * "chain_id": 1,
3780
+ * "addresses": [
3781
+ * "0x1111111111111111111111111111111111111111",
3782
+ * "0x3333333333333333333333333333333333333333",
3783
+ * "0x9999999999999999999999999999999999999999"
3784
+ * ]
3785
+ * }
3786
+ * ]
3787
+ */
3788
+ callbacks: components["schemas"]["CallbackTypesChainRequest"][];
3789
+ };
3790
+ CallbackTypesChainRequest: {
3791
+ /** @example 1 */chain_id: number;
3792
+ /**
3793
+ * @example [
3794
+ * "0x1111111111111111111111111111111111111111",
3795
+ * "0x3333333333333333333333333333333333333333",
3796
+ * "0x9999999999999999999999999999999999999999"
3797
+ * ]
3798
+ */
3799
+ addresses: string[];
3800
+ };
3801
+ CallbackTypesSuccessResponse: {
3802
+ meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
3803
+ cursor: string | null;
3804
+ /**
3805
+ * @description Callback types grouped by chain.
3806
+ * @example [
3807
+ * {
3808
+ * "chain_id": 1,
3809
+ * "sell_erc20_callback": [
3810
+ * "0x1111111111111111111111111111111111111111"
3811
+ * ],
3812
+ * "buy_erc20": [
3813
+ * "0x5555555555555555555555555555555555555555"
3814
+ * ],
3815
+ * "buy_vault_v1_callback": [
3816
+ * "0x3333333333333333333333333333333333333333"
3817
+ * ],
3818
+ * "not_supported": [
3819
+ * "0x9999999999999999999999999999999999999999"
3820
+ * ]
3821
+ * }
3822
+ * ]
3823
+ */
3824
+ data: components["schemas"]["CallbackTypesChainResponse"][];
3825
+ };
3826
+ CallbackTypesChainResponse: {
3827
+ /** @example 1 */chain_id: number;
3828
+ /**
3829
+ * @example [
3830
+ * "0x3333333333333333333333333333333333333333"
3831
+ * ]
3832
+ */
3833
+ buy_vault_v1_callback?: string[];
3834
+ /**
3835
+ * @example [
3836
+ * "0x1111111111111111111111111111111111111111"
3837
+ * ]
3838
+ */
3839
+ sell_erc20_callback?: string[];
3840
+ /**
3841
+ * @example [
3842
+ * "0x5555555555555555555555555555555555555555"
3843
+ * ]
3844
+ */
3845
+ buy_erc20?: string[];
3846
+ /**
3847
+ * @example [
3848
+ * "0x9999999999999999999999999999999999999999"
3849
+ * ]
3850
+ */
3851
+ not_supported: string[];
3852
+ };
3434
3853
  };
3435
3854
  responses: never;
3436
3855
  parameters: never;
@@ -3499,6 +3918,9 @@ declare class BooksController {
3499
3918
  declare class ValidateController {
3500
3919
  validateOffers(): Promise<void>;
3501
3920
  }
3921
+ declare class CallbacksController {
3922
+ resolveCallbackTypes(): Promise<void>;
3923
+ }
3502
3924
  declare class OffersController {
3503
3925
  getOffers(): Promise<void>;
3504
3926
  }
@@ -3507,8 +3929,11 @@ declare class HealthController {
3507
3929
  getCollectorsHealth(): Promise<void>;
3508
3930
  getChainsHealth(): Promise<void>;
3509
3931
  }
3510
- declare class ConfigController {
3511
- getConfig(): Promise<void>;
3932
+ declare class ConfigContractsController {
3933
+ getConfigContracts(): Promise<void>;
3934
+ }
3935
+ declare class ConfigRulesController {
3936
+ getConfigRules(): Promise<void>;
3512
3937
  }
3513
3938
  declare class ObligationsController {
3514
3939
  getObligations(): Promise<void>;
@@ -3517,10 +3942,7 @@ declare class ObligationsController {
3517
3942
  declare class UsersController {
3518
3943
  getUserPositions(): Promise<void>;
3519
3944
  }
3520
- type OpenApiOptions = {
3521
- rules?: RuleInfo[];
3522
- };
3523
- declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
3945
+ declare const OpenApi: () => Promise<OpenAPIDocument>;
3524
3946
  declare namespace PositionResponse_d_exports {
3525
3947
  export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
3526
3948
  }
@@ -3565,6 +3987,21 @@ declare const schemas: {
3565
3987
  false: "false";
3566
3988
  }>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
3567
3989
  }, z$1.core.$strip>;
3990
+ readonly get_config_contracts: z$1.ZodObject<{
3991
+ cursor: z$1.ZodOptional<z$1.ZodString>;
3992
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3993
+ chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
3994
+ }, z$1.core.$strip>;
3995
+ readonly get_config_rules: z$1.ZodObject<{
3996
+ cursor: z$1.ZodOptional<z$1.ZodString>;
3997
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3998
+ types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
3999
+ maturity: "maturity";
4000
+ callback: "callback";
4001
+ loan_token: "loan_token";
4002
+ }>>>>;
4003
+ chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
4004
+ }, z$1.core.$strip>;
3568
4005
  readonly get_offers: z$1.ZodObject<{
3569
4006
  side: z$1.ZodOptional<z$1.ZodEnum<{
3570
4007
  buy: "buy";
@@ -3598,6 +4035,12 @@ declare const schemas: {
3598
4035
  readonly validate_offers: z$1.ZodObject<{
3599
4036
  offers: z$1.ZodArray<z$1.ZodUnknown>;
3600
4037
  }, z$1.core.$strict>;
4038
+ readonly callback_types: z$1.ZodObject<{
4039
+ callbacks: z$1.ZodArray<z$1.ZodObject<{
4040
+ chain_id: z$1.ZodNumber;
4041
+ addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
4042
+ }, z$1.core.$strict>>;
4043
+ }, z$1.core.$strict>;
3601
4044
  readonly get_user_positions: z$1.ZodObject<{
3602
4045
  user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
3603
4046
  cursor: z$1.ZodOptional<z$1.ZodString>;
@@ -3619,6 +4062,7 @@ declare enum STATUS_CODE {
3619
4062
  }
3620
4063
  type Meta = {
3621
4064
  timestamp: string;
4065
+ checksum?: string;
3622
4066
  };
3623
4067
  type ErrorDetail = {
3624
4068
  code: APIErrorCode;
@@ -3645,42 +4089,42 @@ type Payload<T> = SuccessPayload$1<T> | ErrorPayload$1;
3645
4089
  //#region src/api/Controllers/getBook.d.ts
3646
4090
  declare function getBook(params: object, db: Database): Promise<Payload<BookLevelResponse[]>>;
3647
4091
  //#endregion
3648
- //#region src/api/Controllers/getConfig.d.ts
3649
- type ChainConfig = {
4092
+ //#region src/api/Controllers/getConfigContracts.d.ts
4093
+ declare const CONFIG_CONTRACT_NAMES: readonly ["mempool", "multicall", "v2"];
4094
+ type ConfigContractName = (typeof CONFIG_CONTRACT_NAMES)[number];
4095
+ type ConfigContract = {
3650
4096
  chain_id: Id;
3651
- contracts: {
3652
- mempool: string;
3653
- };
3654
- callbacks: string[];
4097
+ address: Address;
4098
+ name: ConfigContractName;
3655
4099
  };
3656
4100
  /**
3657
- * Returns the configuration for all chains the router is indexing.
4101
+ * Returns contract addresses used by indexers (mempool, v2) plus multicall per chain.
4102
+ * @param query - Raw query parameters containing optional chain filters.
3658
4103
  * @param chainRegistry - The chain registry instance. {@link ChainRegistry.ChainRegistry}
3659
- * @returns The configuration for all chains the router is indexing. {@link ApiPayload.Payload<ChainConfig[]>}
4104
+ * @returns The indexer contract configuration. {@link ApiPayload.Payload<ConfigContract[]>}
4105
+ */
4106
+ declare function getConfigContracts(query: unknown, chainRegistry: ChainRegistry): Promise<Payload<ConfigContract[]>>;
4107
+ //#endregion
4108
+ //#region src/api/Controllers/getConfigRules.d.ts
4109
+ /**
4110
+ * Returns configured rules for the configured chains.
4111
+ * @param query - Raw query parameters containing filters/cursor/limit.
4112
+ * @param chains - Chains to include in the configured rules.
4113
+ * @returns Config rules response payload. {@link ApiPayload.Payload}
3660
4114
  */
3661
- declare function getConfig(chainRegistry: ChainRegistry): Promise<Payload<ChainConfig[]>>;
4115
+ declare function getConfigRules(query: unknown, chains: Chain$1[]): Promise<Payload<ConfigRule[]>>;
3662
4116
  //#endregion
3663
4117
  //#region src/api/Controllers/getDocs.d.ts
3664
4118
  /**
3665
4119
  * Build the OpenAPI document for the router.
3666
- * @param parameters - Includes a {@link RulesProvider} to fetch gatekeeper rules.
3667
4120
  * @returns OpenAPI document. {@link OpenAPIDocument}
3668
4121
  */
3669
- declare function getSwaggerJson({
3670
- gatekeeper
3671
- }: {
3672
- gatekeeper: RulesProvider;
3673
- }): Promise<OpenAPIDocument>;
4122
+ declare function getSwaggerJson(): Promise<OpenAPIDocument>;
3674
4123
  /**
3675
4124
  * Render the API documentation HTML page.
3676
- * @param parameters - Includes a {@link RulesProvider} to fetch gatekeeper rules.
3677
4125
  * @returns HTML page as string.
3678
4126
  */
3679
- declare function getDocsHtml({
3680
- gatekeeper
3681
- }: {
3682
- gatekeeper: RulesProvider;
3683
- }): Promise<string>;
4127
+ declare function getDocsHtml(): Promise<string>;
3684
4128
  /**
3685
4129
  * Renders the integrator documentation as HTML.
3686
4130
  * @returns HTML page with the rendered markdown documentation.
@@ -3699,6 +4143,21 @@ declare function getObligation(params: object, db: Database): Promise<Payload<Ob
3699
4143
  declare function getObligations$1(queryParameters: object, db: Database): Promise<Payload<ObligationResponse[]>>;
3700
4144
  //#endregion
3701
4145
  //#region src/api/Controllers/getOffers.d.ts
4146
+ type GetOffersQueryParams = {
4147
+ /** Filter by maker address */maker?: Address; /** Cursor string returned by a previous call, for pagination */
4148
+ cursor?: string; /** Page size; defaults to {@link OffersDomain.DEFAULT_LIMIT} */
4149
+ limit?: number;
4150
+ };
4151
+ /**
4152
+ * Query offers with computed consumed/available/takeable values.
4153
+ * @param db - The database client. {@link Database.Core}
4154
+ * @param parameters - {@link GetOffersQueryParams}
4155
+ * @returns The offers with pagination cursor.
4156
+ */
4157
+ declare function getOffersQuery(db: Core, parameters?: GetOffersQueryParams): Promise<{
4158
+ rows: Row[];
4159
+ nextCursor: string | null;
4160
+ }>;
3702
4161
  declare function getOffers$1(queryParameters: object, db: Database): Promise<Payload<OfferResponse[]>>;
3703
4162
  //#endregion
3704
4163
  //#region src/api/Controllers/getUserPositions.d.ts
@@ -3709,13 +4168,22 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
3709
4168
  * @returns Paginated list of positions with remaining balances.
3710
4169
  */
3711
4170
  declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
4171
+ //#endregion
4172
+ //#region src/api/Controllers/resolveCallbackTypes.d.ts
4173
+ type CallbackTypesPayload = SuccessPayload$1<CallbackTypesResponse>;
4174
+ /**
4175
+ * Resolve callback types for a list of callback addresses grouped by chain.
4176
+ * @param body - Request body with callback addresses. {@link CallbackTypesRequest}
4177
+ * @param chains - Chains to resolve callback types against. {@link Chain.Chain}
4178
+ * @returns Callback types grouped by chain. {@link CallbackTypesPayload}
4179
+ */
4180
+ declare function resolveCallbackTypes(body: object, chains: Chain$1[]): Promise<CallbackTypesPayload | ErrorPayload$1>;
3712
4181
  declare namespace Gatekeeper_d_exports {
3713
4182
  export { Gatekeeper, Rules, create };
3714
4183
  }
3715
4184
  type Rules = readonly Rule<Offer, string>[];
3716
4185
  type Gatekeeper = {
3717
4186
  isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
3718
- getRules: () => Promise<RuleInfo[]>;
3719
4187
  };
3720
4188
  type GatekeeperParameters = {
3721
4189
  rules: Rules;
@@ -3743,10 +4211,10 @@ type ValidateOffersIssuesPayload = SuccessPayload$1<{
3743
4211
  type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
3744
4212
  declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload$1>;
3745
4213
  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 };
4214
+ export { CONFIG_CONTRACT_NAMES, ConfigContract, ConfigContractName, GetOffersQueryParams, ValidationIssue$1 as ValidationIssue, getBook, getConfigContracts, getConfigRules, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getIntegratorDocsHtml, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getOffersQuery, getSwaggerJson, getUserPositions, resolveCallbackTypes, validateOffers };
3747
4215
  }
3748
4216
  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 };
4217
+ export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, CallbacksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, UsersController, ValidateController, create$1 as create, from$5 as from, parse, safeParse };
3750
4218
  }
3751
4219
  declare namespace Client_d_exports$1 {
3752
4220
  export { Client$3 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
@@ -4331,23 +4799,6 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
4331
4799
  identity: undefined;
4332
4800
  generated: undefined;
4333
4801
  }, {}, {}>;
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
4802
  updatedAt: drizzle_orm_pg_core0.PgColumn<{
4352
4803
  name: "updated_at";
4353
4804
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
@@ -5918,58 +6369,6 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
5918
6369
  declare namespace index_d_exports$2 {
5919
6370
  export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains$1 as chains, collectors, consumedEvents, groups, lots, merklePaths, obligationCollateralsV2, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
5920
6371
  }
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
6372
  //#endregion
5974
6373
  //#region src/gatekeeper/morphoRules.d.ts
5975
6374
  declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
@@ -6030,13 +6429,15 @@ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusiv
6030
6429
  type MempoolEVMClientConfig = {
6031
6430
  readonly client: WalletClient;
6032
6431
  readonly mempoolAddress: Address;
6432
+ readonly morphoAddress?: Address;
6033
6433
  readonly blockWindow?: number;
6034
6434
  };
6035
6435
  declare function from(parameters: from.Parameters): from.ReturnType;
6036
6436
  declare namespace from {
6037
6437
  type Parameters = {
6038
6438
  /** The viem client to use. */client: WalletClient; /** The mempool address. */
6039
- mempoolAddress: Address; /** The block window to use for the mempool. Defaults to 100. */
6439
+ mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
6440
+ morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
6040
6441
  blockWindow?: number;
6041
6442
  };
6042
6443
  type ReturnType = Client$2;
@@ -6051,7 +6452,7 @@ declare namespace from {
6051
6452
  */
6052
6453
  declare function add(config: MempoolEVMClientConfig, offers: AddParameters): Promise<Hex>;
6053
6454
  declare namespace add {
6054
- type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError;
6455
+ type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError | MissingMorphoAddressError;
6055
6456
  }
6056
6457
  declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
6057
6458
  offers: Offer[];
@@ -6060,7 +6461,7 @@ declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters)
6060
6461
  declare namespace get {
6061
6462
  type ErrorType = streamOffersReturnType;
6062
6463
  }
6063
- type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError;
6464
+ type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError | MissingMorphoAddressError;
6064
6465
  declare class WalletAccountNotSetError extends BaseError {
6065
6466
  name: string;
6066
6467
  constructor();
@@ -6072,6 +6473,10 @@ declare class ChainIdMismatchError extends BaseError {
6072
6473
  name: string;
6073
6474
  constructor(expected: Id, actual: Id);
6074
6475
  }
6476
+ declare class MissingMorphoAddressError extends BaseError {
6477
+ name: string;
6478
+ constructor();
6479
+ }
6075
6480
  //#endregion
6076
6481
  //#region src/mempool/MempoolClient.d.ts
6077
6482
  type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
@@ -6118,7 +6523,7 @@ declare namespace connect {
6118
6523
  type ErrorType = from.ErrorType;
6119
6524
  }
6120
6525
  declare namespace index_d_exports$1 {
6121
- export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
6526
+ export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, MissingMorphoAddressError, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
6122
6527
  }
6123
6528
  //#endregion
6124
6529
  //#region src/utils/BigMath.d.ts
@@ -6253,5 +6658,5 @@ declare namespace index_d_exports$3 {
6253
6658
  export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
6254
6659
  }
6255
6660
  //#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 };
6661
+ export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, CallbackType, CallbackTypesRequest, CallbackTypesResponse, CallbacksController, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, ConfigContractsController, ConfigRule, ConfigRulesController, ConfigRulesPayload, Database_d_exports as Database, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, Oracle_d_exports as Oracle, Position_d_exports as Position, PositionResponse_d_exports as PositionResponse, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports$1 as RouterClient, RouterStatusResponse, Rules_d_exports as Rules, SuccessPayload, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, UsersController, index_d_exports$3 as Utils, ValidateController, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules, parse, safeParse };
6257
6662
  //# sourceMappingURL=index.node.d.mts.map