@morpho-dev/router 0.2.1 → 0.3.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.
@@ -275,7 +275,7 @@ declare const Morpho: readonly [{
275
275
  readonly stateMutability: "view";
276
276
  }];
277
277
  declare namespace Callback_d_exports {
278
- export { CallbackType, decode$3 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$3 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
278
+ export { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, decode$3 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$3 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
279
279
  }
280
280
  declare enum CallbackType {
281
281
  BuyWithEmptyCallback = "buy_with_empty_callback",
@@ -287,7 +287,16 @@ declare function decode$3(type: CallbackType, data: Hex): {
287
287
  contract: Address;
288
288
  amount: bigint;
289
289
  }[];
290
- declare function encode$3(type: CallbackType, data: any): Hex;
290
+ type BuyVaultV1CallbackData = {
291
+ vaults: Address[];
292
+ amounts: bigint[];
293
+ };
294
+ type SellERC20CallbackData = {
295
+ collaterals: Address[];
296
+ amounts: bigint[];
297
+ };
298
+ declare function encode$3(type: CallbackType.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
299
+ declare function encode$3(type: CallbackType.SellERC20Callback, data: SellERC20CallbackData): Hex;
291
300
  declare function decodeBuyVaultV1Callback(data: Hex): Array<{
292
301
  contract: Address;
293
302
  amount: bigint;
@@ -636,7 +645,7 @@ declare class InvalidOptionError extends BaseError {
636
645
  constructor(input: string);
637
646
  }
638
647
  declare namespace Offer_d_exports {
639
- export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferHashSchema, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$2 as decode, domain, encode$2 as encode, from$12 as from, fromSnakeCase$2 as fromSnakeCase, hash, obligationId, random$2 as random, sign, signatureMsg, toSnakeCase, types };
648
+ export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferHashSchema, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$2 as decode, domain, encode$2 as encode, from$12 as from, fromSnakeCase$2 as fromSnakeCase, hash, obligationId, random$2 as random, serialize, sign, signatureMsg, toSnakeCase, types };
640
649
  }
641
650
  type Offer = {
642
651
  /** The address that made the offer. */
@@ -745,6 +754,37 @@ declare function fromSnakeCase$2(input: Snake<Omit<Offer, "chainId" | "hash"> &
745
754
  * @returns The converted offer.
746
755
  */
747
756
  declare function toSnakeCase(offer: Offer): Snake<Offer>;
757
+ /**
758
+ * Serializes an offer for merkle tree encoding.
759
+ * Converts BigInt fields to strings for JSON compatibility.
760
+ *
761
+ * @param offer - Offer to serialize
762
+ * @returns JSON-serializable offer object
763
+ */
764
+ declare const serialize: (offer: Offer) => {
765
+ offering: `0x${string}`;
766
+ assets: string;
767
+ rate: string;
768
+ maturity: number;
769
+ expiry: number;
770
+ start: number;
771
+ nonce: string;
772
+ buy: boolean;
773
+ chainId: Id;
774
+ loanToken: `0x${string}`;
775
+ collaterals: {
776
+ asset: `0x${string}`;
777
+ oracle: `0x${string}`;
778
+ lltv: string;
779
+ }[];
780
+ callback: {
781
+ address: `0x${string}`;
782
+ data: `0x${string}`;
783
+ gasLimit: string;
784
+ };
785
+ signature: `0x${string}` | undefined;
786
+ hash: `0x${string}`;
787
+ };
748
788
  type RandomConfig = {
749
789
  chains?: Chain$1[];
750
790
  loanTokens?: Address[];
@@ -1376,46 +1416,148 @@ declare namespace from$7 {
1376
1416
  type ReturnType = Transfer;
1377
1417
  }
1378
1418
  declare namespace Tree_d_exports {
1379
- export { Tree, VERSION$1 as VERSION, decode$1 as decode, encode$1 as encode, from$6 as from };
1419
+ export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION$1 as VERSION, decode$1 as decode, encode$1 as encode, encodeUnsigned, from$6 as from, proofs };
1380
1420
  }
1421
+ /**
1422
+ * A merkle tree of offers built from offer hashes.
1423
+ * Constructed via {@link from}. The tree root can be signed for onchain broadcast.
1424
+ */
1381
1425
  type Tree = Compute<StandardMerkleTree<[Hex]> & {
1426
+ /** The offers in the tree. */
1382
1427
  offers: Offer[];
1428
+ /** The root of the tree. */
1383
1429
  root: Hex;
1384
1430
  }>;
1431
+ type Proof = {
1432
+ /** The offer that the proof is for. */
1433
+ offer: Offer;
1434
+ /** The merkle proof path for the offer. */
1435
+ path: Hex[];
1436
+ };
1385
1437
  declare const VERSION$1 = 1;
1386
1438
  /**
1387
1439
  * Builds a Merkle tree from a list of offers.
1388
1440
  *
1389
1441
  * Leaves are the offer `hash` values as `bytes32` and are deterministically
1390
- * ordered in ascending lexicographic order so that the resulting root is stable
1391
- * regardless of the input order.
1442
+ * ordered following the StandardMerkleTree leaf ordering so that the resulting
1443
+ * root is stable regardless of the input order.
1392
1444
  *
1393
1445
  * @param offers - Offers to include in the tree.
1394
1446
  * @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
1447
+ * @throws {TreeError} If tree building fails due to offer inconsistencies.
1395
1448
  */
1396
1449
  declare const from$6: (offers: Offer[]) => Tree;
1397
1450
  /**
1398
- * Encodes an `Tree` into a Hex string with a version byte prefix and gzipped payload.
1451
+ * Generates merkle proofs for all offers in a tree.
1399
1452
  *
1400
- * - Layout: `0x{vv}{zip...}` where `{vv}` is one-byte version as two hex chars.
1401
- * - Payload is gzip(JSON.stringify([root, ...offers])) with bigint stringified.
1453
+ * Each proof allows independent verification that an offer is included in the tree
1454
+ * without requiring the full tree. Proofs are ordered by StandardMerkleTree leaf ordering.
1402
1455
  *
1403
- * @param tree - The offer Merkle tree to encode.
1404
- * @returns Hex string starting with `0x{vv}` followed by gzipped payload bytes.
1405
- * @throws Error if the given `root` does not match the offers.
1456
+ * @param tree - The {@link Tree} to generate proofs for.
1457
+ * @returns Array of proofs - {@link Proof}
1406
1458
  */
1407
- declare const encode$1: (tree: Tree) => Hex;
1459
+ declare const proofs: (tree: Tree) => Proof[];
1408
1460
  /**
1409
- * Decodes a Hex string produced by {@link encode} back into an `Tree`.
1461
+ * Encodes a merkle tree with signature into hex calldata for onchain broadcast.
1462
+ *
1463
+ * Layout: `0x{vv}{gzip([...offers])}{root}{signature}` where:
1464
+ * - `{vv}`: 1-byte version (currently 0x01)
1465
+ * - `{gzip([...offers])}`: gzipped JSON array of serialized offers
1466
+ * - `{root}`: 32-byte merkle root
1467
+ * - `{signature}`: 65-byte EIP-191 signature over raw root bytes
1468
+ *
1469
+ * Validates signature authenticity and root integrity before encoding.
1470
+ *
1471
+ * @example
1472
+ * ```typescript
1473
+ * const tree = Tree.from(offers);
1474
+ * const signature = await wallet.signMessage({ message: { raw: tree.root } });
1475
+ * const calldata = await Tree.encode(tree, signature);
1476
+ * await broadcast(calldata);
1477
+ * ```
1410
1478
  *
1411
- * - Ensures the first byte version matches {@link VERSION}.
1412
- * - Decompresses with gunzip, parses JSON, validates offers, and re-checks the root.
1479
+ * @example
1480
+ * Manual construction (for advanced users):
1481
+ * ```typescript
1482
+ * const tree = Tree.from(offers);
1483
+ * const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
1484
+ * const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
1485
+ * const signature = await wallet.signMessage({ message: { raw: tree.root } });
1486
+ * const calldata = `${partial}${signature.slice(2)}`;
1487
+ * ```
1413
1488
  *
1414
- * @param encoded - Hex string in the form `0x{vv}{zip...}`.
1415
- * @returns A validated `Tree` rebuilt from the offers.
1416
- * @throws Error if the version is invalid or the root does not match the offers.
1489
+ * @param tree - Merkle tree of offers
1490
+ * @param signature - EIP-191 signature over raw root bytes
1491
+ * @returns Hex-encoded calldata ready for onchain broadcast
1492
+ * @throws {EncodeError} If signature verification fails or root mismatch
1417
1493
  */
1418
- declare const decode$1: (encoded: Hex) => Tree;
1494
+ declare const encode$1: (tree: Tree, signature: Hex) => Promise<Hex>;
1495
+ /**
1496
+ * Encodes a merkle tree without a signature into hex payload for client-side signing.
1497
+ *
1498
+ * Layout: `0x{vv}{gzip([...offers])}{root}` where:
1499
+ * - `{vv}`: 1-byte version (currently 0x01)
1500
+ * - `{gzip([...offers])}`: gzipped JSON array of serialized offers
1501
+ * - `{root}`: 32-byte merkle root
1502
+ *
1503
+ * Validates root integrity before encoding.
1504
+ *
1505
+ * @param tree - Merkle tree of offers
1506
+ * @returns Hex-encoded unsigned payload
1507
+ * @throws {EncodeError} If root mismatch
1508
+ */
1509
+ declare const encodeUnsigned: (tree: Tree) => Hex;
1510
+ /**
1511
+ * Decodes hex calldata into a validated merkle tree.
1512
+ *
1513
+ * Validates signature before decompression for fail-fast rejection of invalid payloads.
1514
+ * Returns the tree with separately validated signature and recovered signer address.
1515
+ *
1516
+ * Validation order:
1517
+ * 1. Version check
1518
+ * 2. Signature verification (fail-fast, before decompression)
1519
+ * 3. Decompression (only if signature valid)
1520
+ * 4. Root verification (computed from offers vs embedded root)
1521
+ *
1522
+ * @example
1523
+ * ```typescript
1524
+ * const { tree, signature, signer } = await Tree.decode(calldata);
1525
+ * console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
1526
+ * ```
1527
+ *
1528
+ * @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
1529
+ * @returns Validated tree, signature, and recovered signer address
1530
+ * @throws {DecodeError} If version invalid, signature invalid, or root mismatch
1531
+ */
1532
+ declare const decode$1: (encoded: Hex) => Promise<{
1533
+ tree: Tree;
1534
+ signature: Hex;
1535
+ signer: Address;
1536
+ }>;
1537
+ /**
1538
+ * Error thrown during tree building operations.
1539
+ * Indicates structural issues with the tree (missing offers, inconsistent state).
1540
+ */
1541
+ declare class TreeError extends BaseError {
1542
+ name: string;
1543
+ constructor(reason: string);
1544
+ }
1545
+ /**
1546
+ * Error thrown during tree encoding.
1547
+ * Indicates validation failures (signature, root mismatch, mixed makers).
1548
+ */
1549
+ declare class EncodeError extends BaseError {
1550
+ name: string;
1551
+ constructor(reason: string);
1552
+ }
1553
+ /**
1554
+ * Error thrown during tree decoding.
1555
+ * Indicates payload corruption, version mismatch, or validation failures.
1556
+ */
1557
+ declare class DecodeError extends BaseError {
1558
+ name: string;
1559
+ constructor(reason: string);
1560
+ }
1419
1561
  declare namespace Logger_d_exports {
1420
1562
  export { LogEntry, LogFn, LogLevel, LogLevelValues, Logger, defaultLogger, getLogger, runWithLogger, silentLogger };
1421
1563
  }
@@ -1441,11 +1583,11 @@ declare function getLogger(): Logger;
1441
1583
  //#region src/database/domains/Book.d.ts
1442
1584
  type BookDomain = {
1443
1585
  /** Get aggregated book levels for a given obligation side. */
1444
- get: (parameters: get$2.Parameters) => Promise<get$2.ReturnType>;
1586
+ get: (parameters: get$4.Parameters) => Promise<get$4.ReturnType>;
1445
1587
  /** Get all offers for a given obligation side with cross-invalidation. */
1446
1588
  getOffers: (parameters: getOffers$2.Parameters) => Promise<getOffers$2.ReturnType>;
1447
1589
  };
1448
- declare namespace get$2 {
1590
+ declare namespace get$4 {
1449
1591
  type Parameters = {
1450
1592
  /** The side of the offer. */
1451
1593
  side: "buy" | "sell";
@@ -1598,7 +1740,7 @@ declare function run<T, Name$2 extends string, Rules$1 extends readonly Rule<T,
1598
1740
  chunkSize?: number;
1599
1741
  }): Promise<Result<T, RuleNames<Rules$1>>>;
1600
1742
  declare namespace Gatekeeper_d_exports {
1601
- export { Gatekeeper, Rules, create$4 as create };
1743
+ export { Gatekeeper, Rules, create$5 as create };
1602
1744
  }
1603
1745
  type Rules = readonly Rule<Offer, string>[];
1604
1746
  type Gatekeeper = {
@@ -1608,7 +1750,7 @@ type Gatekeeper = {
1608
1750
  type GatekeeperParameters = {
1609
1751
  rules: Rules;
1610
1752
  };
1611
- declare function create$4(parameters: GatekeeperParameters): Gatekeeper;
1753
+ declare function create$5(parameters: GatekeeperParameters): Gatekeeper;
1612
1754
  declare namespace GateConfig_d_exports {
1613
1755
  export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
1614
1756
  }
@@ -1663,9 +1805,9 @@ declare const assets$1: Record<string, Address[]>;
1663
1805
  declare const configs: Record<Name$1, GateConfig>;
1664
1806
  //#endregion
1665
1807
  //#region src/gatekeeper/morphoRules.d.ts
1666
- declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
1808
+ declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token"> | Rule<Offer, "mixed_maker">)[];
1667
1809
  declare namespace Rules_d_exports {
1668
- export { ValidityParameters, callback, chains$1 as chains, maturity, token, validity };
1810
+ export { ValidityParameters, callback, chains$1 as chains, maturity, sameMaker, token, validity };
1669
1811
  }
1670
1812
  type ValidityParameters = {
1671
1813
  client: PublicClient<Transport, Chain$1>;
@@ -1704,8 +1846,14 @@ declare const token: ({
1704
1846
  }: {
1705
1847
  assets: Address[];
1706
1848
  }) => Rule<Offer, "token">;
1849
+ /**
1850
+ * A batch validation rule that ensures all offers in a tree have the same maker (offering address).
1851
+ * Returns an issue only for the first non-conforming offer.
1852
+ * This rule is signing-agnostic; signer verification is handled at the collector level.
1853
+ */
1854
+ declare const sameMaker: () => Rule<Offer, "mixed_maker">;
1707
1855
  declare namespace Indexer_d_exports {
1708
- export { Indexer, IndexerConfig, create$3 as create, from$5 as from };
1856
+ export { Indexer, IndexerConfig, create$4 as create, from$5 as from };
1709
1857
  }
1710
1858
  type Indexer = {
1711
1859
  start: () => () => void;
@@ -1724,7 +1872,7 @@ type IndexerConfig<client extends PublicClient<Transport, Chain$1, Account | und
1724
1872
  retryDelayMs?: number;
1725
1873
  };
1726
1874
  declare function from$5<client extends PublicClient<Transport, Chain$1, Account | undefined>>(config: IndexerConfig<client>): Indexer;
1727
- declare function create$3<client extends PublicClient<Transport, Chain$1, Account | undefined>>(params: {
1875
+ declare function create$4<client extends PublicClient<Transport, Chain$1, Account | undefined>>(params: {
1728
1876
  db: Database;
1729
1877
  collectors: Collector[];
1730
1878
  client: client;
@@ -1782,6 +1930,50 @@ type ConsumedDomain = {
1782
1930
  }) => Promise<number>;
1783
1931
  };
1784
1932
  //#endregion
1933
+ //#region src/database/domains/Lots.d.ts
1934
+ type Lot = {
1935
+ chainId: Id;
1936
+ user: Address;
1937
+ contract: Address;
1938
+ group: string;
1939
+ lower: bigint;
1940
+ upper: bigint;
1941
+ };
1942
+ type LotsDomain = {
1943
+ /**
1944
+ * Create or update lots for offers.
1945
+ * Called when offers are created to reserve liquidity on positions.
1946
+ * For each (position, group), keeps only the biggest offer by assets.
1947
+ * If lot exists and new offer is bigger, grows the lot and shifts higher lots.
1948
+ */
1949
+ create: (parameters: create$3.Parameters) => Promise<void>;
1950
+ /**
1951
+ * Get lots with optional filtering.
1952
+ */
1953
+ get: (parameters?: get$3.Parameters) => Promise<Lot[]>;
1954
+ };
1955
+ declare namespace create$3 {
1956
+ type OfferLotInfo = {
1957
+ positionChainId: Id;
1958
+ positionContract: Address;
1959
+ positionUser: Address;
1960
+ group: string;
1961
+ size: bigint;
1962
+ };
1963
+ type Parameters = OfferLotInfo[];
1964
+ type ReturnType = undefined;
1965
+ }
1966
+ declare namespace get$3 {
1967
+ type Parameters = {
1968
+ chainId?: Id;
1969
+ user?: Address;
1970
+ contract?: Address;
1971
+ group?: string;
1972
+ };
1973
+ type ReturnType = Lot[];
1974
+ }
1975
+ declare function create$3(db: Core): LotsDomain;
1976
+ //#endregion
1785
1977
  //#region src/database/domains/Offers.d.ts
1786
1978
  type OffersDomain = {
1787
1979
  /** Create multiple offer. */
@@ -1826,6 +2018,30 @@ type GetOffersParams = {
1826
2018
  offering?: Address;
1827
2019
  } & PaginationParams$1;
1828
2020
  //#endregion
2021
+ //#region src/database/domains/Offsets.d.ts
2022
+ type Offset = {
2023
+ chainId: Id;
2024
+ user: Address;
2025
+ contract: Address;
2026
+ group: string;
2027
+ value: bigint;
2028
+ };
2029
+ type OffsetsDomain = {
2030
+ /**
2031
+ * Get offsets with optional filtering.
2032
+ */
2033
+ get: (parameters?: get$2.Parameters) => Promise<Offset[]>;
2034
+ };
2035
+ declare namespace get$2 {
2036
+ type Parameters = {
2037
+ chainId?: Id;
2038
+ user?: Address;
2039
+ contract?: Address;
2040
+ group?: string;
2041
+ };
2042
+ type ReturnType = Offset[];
2043
+ }
2044
+ //#endregion
1829
2045
  //#region src/database/domains/Oracles.d.ts
1830
2046
  type OraclesDomain = {
1831
2047
  /**
@@ -1916,6 +2132,39 @@ declare namespace create$2 {
1916
2132
  }
1917
2133
  declare const create$2: (db: Core) => TransfersDomain;
1918
2134
  //#endregion
2135
+ //#region src/database/domains/Trees.d.ts
2136
+ /**
2137
+ * Attestation data for a single offer, containing the merkle root, signature, and proof.
2138
+ */
2139
+ type Attestation = {
2140
+ root: Hex;
2141
+ signature: Hex;
2142
+ proof: Hex[];
2143
+ };
2144
+ /**
2145
+ * Input for creating trees with their signatures.
2146
+ */
2147
+ type CreateInput = {
2148
+ tree: Tree;
2149
+ signature: Hex;
2150
+ };
2151
+ type TreesDomain = {
2152
+ /**
2153
+ * Creates trees, offers, and attestation links in a single transaction.
2154
+ *
2155
+ * @param trees - Array of decoded trees with signatures (batch insertion)
2156
+ * @returns Array of tree roots that were created/upserted
2157
+ */
2158
+ create: (trees: CreateInput[]) => Promise<Hex[]>;
2159
+ /**
2160
+ * Retrieves merkle attestations for execution flow.
2161
+ *
2162
+ * @param hashes - Array of offer hashes to look up
2163
+ * @returns Map of offer hash to attestation (only entries with attestations are included)
2164
+ */
2165
+ getAttestations: (hashes: Hex[]) => Promise<Map<Hex, Attestation>>;
2166
+ };
2167
+ //#endregion
1919
2168
  //#region src/database/domains/Validations.d.ts
1920
2169
  type GetParams = {
1921
2170
  status?: Status;
@@ -1950,7 +2199,10 @@ type Domains = {
1950
2199
  offers: OffersDomain;
1951
2200
  chains: ChainsDomain;
1952
2201
  consumed: ConsumedDomain;
2202
+ lots: LotsDomain;
2203
+ offsets: OffsetsDomain;
1953
2204
  oracles: OraclesDomain;
2205
+ trees: TreesDomain;
1954
2206
  validations: ValidationsDomain;
1955
2207
  positions: PositionsDomain;
1956
2208
  transfers: TransfersDomain;
@@ -2455,10 +2707,11 @@ interface paths {
2455
2707
  put?: never;
2456
2708
  /**
2457
2709
  * Validate offers
2458
- * @description Validates offers against router validation rules. Returns validation status for each offer.
2710
+ * @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
2459
2711
  *
2460
2712
  * **Available validation rules:**
2461
2713
  * - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
2714
+ * - **mixed_maker**: Validates that all offers in a batch have the same maker (offering address)
2462
2715
  * - **chain_ids**: Validates that offer chain is one of: [109111114]
2463
2716
  * - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
2464
2717
  * - **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]
@@ -2483,7 +2736,7 @@ interface paths {
2483
2736
  [name: string]: unknown;
2484
2737
  };
2485
2738
  content: {
2486
- "application/json": components["schemas"]["ValidateOffersListResponse"];
2739
+ "application/json": components["schemas"]["ValidationSuccessResponse"];
2487
2740
  };
2488
2741
  };
2489
2742
  /** @description Bad Request */
@@ -2578,10 +2831,15 @@ interface components {
2578
2831
  * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
2579
2832
  * "gas_limit": "500000"
2580
2833
  * },
2581
- * "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400",
2582
2834
  * "consumed": "0",
2583
2835
  * "takeable": "369216000000000000000000",
2584
- * "block_number": 2942933377146801
2836
+ * "block_number": 2942933377146801,
2837
+ * "root": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
2838
+ * "proof": [
2839
+ * "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
2840
+ * "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
2841
+ * ],
2842
+ * "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400"
2585
2843
  * }
2586
2844
  * ]
2587
2845
  */
@@ -2634,6 +2892,15 @@ interface components {
2634
2892
  consumed: string;
2635
2893
  /** @example 2942933377146801 */
2636
2894
  block_number: number;
2895
+ /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
2896
+ root: string | null;
2897
+ /**
2898
+ * @example [
2899
+ * "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
2900
+ * "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
2901
+ * ]
2902
+ */
2903
+ proof: string[] | null;
2637
2904
  /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
2638
2905
  signature: string | null;
2639
2906
  };
@@ -2765,13 +3032,8 @@ interface components {
2765
3032
  updated_at: string;
2766
3033
  };
2767
3034
  ValidateOffersRequest: {
2768
- /** @description Array of offers in snake_case format. Mutually exclusive with 'calldata'. */
2769
- offers?: components["schemas"]["ValidateOfferRequest"][];
2770
- /**
2771
- * @description Encoded tree calldata as a hex string (0x-prefixed). Mutually exclusive with 'offers'.
2772
- * @example 0x01...
2773
- */
2774
- calldata?: string;
3035
+ /** @description Array of offers in snake_case format. Required, non-empty. */
3036
+ offers: components["schemas"]["ValidateOfferRequest"][];
2775
3037
  };
2776
3038
  ValidateOfferRequest: {
2777
3039
  /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
@@ -2813,22 +3075,24 @@ interface components {
2813
3075
  */
2814
3076
  callback: components["schemas"]["OfferCallbackResponse"];
2815
3077
  };
2816
- ValidateOffersListResponse: {
3078
+ ValidationSuccessResponse: {
2817
3079
  meta: components["schemas"]["Meta"];
2818
3080
  /** @example null */
2819
3081
  cursor: string | null;
2820
- /** @description Validation results for each offer. */
2821
- data: components["schemas"]["ValidateOfferResultResponse"][];
3082
+ /** @description Payload and root for client-side signing. */
3083
+ data: components["schemas"]["ValidationSuccessDataResponse"];
2822
3084
  };
2823
- ValidateOfferResultResponse: {
2824
- /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
2825
- offer_hash: string;
2826
- /** @example false */
2827
- valid: boolean;
2828
- /** @example parse_error */
2829
- rule: string | null;
2830
- /** @example Invalid offer. 'offering': invalid address */
2831
- message: string | null;
3085
+ ValidationSuccessDataResponse: {
3086
+ /**
3087
+ * @description Unsigned payload: version (1B) + gzip(offers) + root (32B).
3088
+ * @example 0x01789c...
3089
+ */
3090
+ payload: string;
3091
+ /**
3092
+ * @description Merkle tree root to sign with EIP-191.
3093
+ * @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427
3094
+ */
3095
+ root: string;
2832
3096
  };
2833
3097
  };
2834
3098
  responses: never;
@@ -2856,9 +3120,10 @@ type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["
2856
3120
  * Creates an `OfferResponse` from an `Offer`.
2857
3121
  * @constructor
2858
3122
  * @param offer - {@link Offer}
3123
+ * @param attestation - {@link Attestation}
2859
3124
  * @returns The created `OfferResponse`. {@link OfferResponse}
2860
3125
  */
2861
- declare function from$1(offer: Offer): OfferResponse;
3126
+ declare function from$1(offer: Offer, attestation?: Attestation): OfferResponse;
2862
3127
  //#endregion
2863
3128
  //#region src/api/Schema/openapi.d.ts
2864
3129
  declare class BooksController {
@@ -2917,9 +3182,8 @@ declare const schemas: {
2917
3182
  limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
2918
3183
  }, z$1.core.$strip>;
2919
3184
  readonly validate_offers: z$1.ZodObject<{
2920
- offers: z$1.ZodAny;
2921
- calldata: z$1.ZodOptional<z$1.ZodString>;
2922
- }, z$1.core.$strip>;
3185
+ offers: z$1.ZodArray<z$1.ZodUnknown>;
3186
+ }, z$1.core.$strict>;
2923
3187
  };
2924
3188
  type Action = keyof typeof schemas;
2925
3189
  declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
@@ -2989,18 +3253,22 @@ declare function getObligations$1(queryParameters: object, db: Database): Promis
2989
3253
  declare function getOffers$1(queryParameters: object, db: Database): Promise<Payload<OfferResponse[]>>;
2990
3254
  //#endregion
2991
3255
  //#region src/api/Controllers/validateOffers.d.ts
2992
- type ValidateOfferResult = {
2993
- offer_hash: Hex;
2994
- valid: true;
2995
- } | {
2996
- offer_hash: Hex;
2997
- valid: false;
3256
+ type ValidationIssue = {
3257
+ index: number;
2998
3258
  rule: string;
2999
3259
  message: string;
3000
3260
  };
3001
- declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<Payload<ValidateOfferResult[]>>;
3261
+ type ValidateOffersSuccessPayload = SuccessPayload<{
3262
+ payload: Hex;
3263
+ root: Hex;
3264
+ }>;
3265
+ type ValidateOffersIssuesPayload = SuccessPayload<{
3266
+ issues: ValidationIssue[];
3267
+ }>;
3268
+ type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
3269
+ declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload>;
3002
3270
  declare namespace index_d_exports$4 {
3003
- export { ValidateOfferResult, getBook, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getSwaggerJson, validateOffers };
3271
+ export { ValidationIssue, getBook, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getSwaggerJson, validateOffers };
3004
3272
  }
3005
3273
  declare namespace RouterApi_d_exports {
3006
3274
  export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, RouterApi, RouterStatusResponse, RuleInfo, ValidateController, create, from$4 as from, parse, safeParse };
@@ -3084,7 +3352,12 @@ declare namespace getOffers {
3084
3352
  limit?: number;
3085
3353
  };
3086
3354
  type ReturnType = {
3087
- offers: Offer[];
3355
+ offers: Compute<Offer & {
3356
+ /** 32-byte merkle root. */
3357
+ root?: Hex;
3358
+ /** Sibling hashes for the merkle proof. */
3359
+ proof?: Hex[];
3360
+ }>[];
3088
3361
  /** The pagination cursor. */
3089
3362
  cursor: string | null;
3090
3363
  };
@@ -3152,9 +3425,13 @@ declare enum EnumTableName {
3152
3425
  VALIDATIONS = "validations",
3153
3426
  COLLECTORS = "collectors",
3154
3427
  CHAINS = "chains",
3428
+ LOTS = "lots",
3429
+ OFFSETS = "offsets",
3430
+ TREES = "trees",
3431
+ MERKLE_PATHS = "merkle_paths",
3155
3432
  }
3156
3433
  declare const TABLE_NAMES: readonly EnumTableName[];
3157
- declare const VERSIONED_TABLE_NAMES: ("\"router_v1.6\".\"obligations\"" | "\"router_v1.6\".\"groups\"" | "\"router_v1.6\".\"consumed_events\"" | "\"router_v1.6\".\"obligation_collaterals_v2\"" | "\"router_v1.6\".\"oracles\"" | "\"router_v1.6\".\"offers\"" | "\"router_v1.6\".\"offers_callbacks\"" | "\"router_v1.6\".\"callbacks\"" | "\"router_v1.6\".\"positions\"" | "\"router_v1.6\".\"transfers\"" | "\"router_v1.6\".\"validations\"" | "\"router_v1.6\".\"collectors\"" | "\"router_v1.6\".\"chains\"")[];
3434
+ declare const VERSIONED_TABLE_NAMES: ("\"router_v1.6\".\"obligations\"" | "\"router_v1.6\".\"groups\"" | "\"router_v1.6\".\"consumed_events\"" | "\"router_v1.6\".\"obligation_collaterals_v2\"" | "\"router_v1.6\".\"oracles\"" | "\"router_v1.6\".\"offers\"" | "\"router_v1.6\".\"offers_callbacks\"" | "\"router_v1.6\".\"callbacks\"" | "\"router_v1.6\".\"positions\"" | "\"router_v1.6\".\"transfers\"" | "\"router_v1.6\".\"validations\"" | "\"router_v1.6\".\"collectors\"" | "\"router_v1.6\".\"chains\"" | "\"router_v1.6\".\"lots\"" | "\"router_v1.6\".\"offsets\"" | "\"router_v1.6\".\"trees\"" | "\"router_v1.6\".\"merkle_paths\"")[];
3158
3435
  type TableName = (typeof TABLE_NAMES)[number];
3159
3436
  type VersionedTableName = `"${typeof VERSION}"."${TableName}"`;
3160
3437
  declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
@@ -4155,6 +4432,223 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
4155
4432
  };
4156
4433
  dialect: "pg";
4157
4434
  }>;
4435
+ declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
4436
+ name: EnumTableName.LOTS;
4437
+ schema: "router_v1.6";
4438
+ columns: {
4439
+ chainId: drizzle_orm_pg_core0.PgColumn<{
4440
+ name: "chain_id";
4441
+ tableName: EnumTableName.LOTS;
4442
+ dataType: "number";
4443
+ columnType: "PgBigInt53";
4444
+ data: Id;
4445
+ driverParam: string | number;
4446
+ notNull: true;
4447
+ hasDefault: false;
4448
+ isPrimaryKey: false;
4449
+ isAutoincrement: false;
4450
+ hasRuntimeDefault: false;
4451
+ enumValues: undefined;
4452
+ baseColumn: never;
4453
+ identity: undefined;
4454
+ generated: undefined;
4455
+ }, {}, {
4456
+ $type: Id;
4457
+ }>;
4458
+ user: drizzle_orm_pg_core0.PgColumn<{
4459
+ name: "user";
4460
+ tableName: EnumTableName.LOTS;
4461
+ dataType: "string";
4462
+ columnType: "PgVarchar";
4463
+ data: string;
4464
+ driverParam: string;
4465
+ notNull: true;
4466
+ hasDefault: false;
4467
+ isPrimaryKey: false;
4468
+ isAutoincrement: false;
4469
+ hasRuntimeDefault: false;
4470
+ enumValues: [string, ...string[]];
4471
+ baseColumn: never;
4472
+ identity: undefined;
4473
+ generated: undefined;
4474
+ }, {}, {
4475
+ length: 42;
4476
+ }>;
4477
+ contract: drizzle_orm_pg_core0.PgColumn<{
4478
+ name: "contract";
4479
+ tableName: EnumTableName.LOTS;
4480
+ dataType: "string";
4481
+ columnType: "PgVarchar";
4482
+ data: string;
4483
+ driverParam: string;
4484
+ notNull: true;
4485
+ hasDefault: false;
4486
+ isPrimaryKey: false;
4487
+ isAutoincrement: false;
4488
+ hasRuntimeDefault: false;
4489
+ enumValues: [string, ...string[]];
4490
+ baseColumn: never;
4491
+ identity: undefined;
4492
+ generated: undefined;
4493
+ }, {}, {
4494
+ length: 42;
4495
+ }>;
4496
+ group: drizzle_orm_pg_core0.PgColumn<{
4497
+ name: "group";
4498
+ tableName: EnumTableName.LOTS;
4499
+ dataType: "string";
4500
+ columnType: "PgVarchar";
4501
+ data: string;
4502
+ driverParam: string;
4503
+ notNull: true;
4504
+ hasDefault: false;
4505
+ isPrimaryKey: false;
4506
+ isAutoincrement: false;
4507
+ hasRuntimeDefault: false;
4508
+ enumValues: [string, ...string[]];
4509
+ baseColumn: never;
4510
+ identity: undefined;
4511
+ generated: undefined;
4512
+ }, {}, {
4513
+ length: 66;
4514
+ }>;
4515
+ lower: drizzle_orm_pg_core0.PgColumn<{
4516
+ name: "lower";
4517
+ tableName: EnumTableName.LOTS;
4518
+ dataType: "string";
4519
+ columnType: "PgNumeric";
4520
+ data: string;
4521
+ driverParam: string;
4522
+ notNull: true;
4523
+ hasDefault: false;
4524
+ isPrimaryKey: false;
4525
+ isAutoincrement: false;
4526
+ hasRuntimeDefault: false;
4527
+ enumValues: undefined;
4528
+ baseColumn: never;
4529
+ identity: undefined;
4530
+ generated: undefined;
4531
+ }, {}, {}>;
4532
+ upper: drizzle_orm_pg_core0.PgColumn<{
4533
+ name: "upper";
4534
+ tableName: EnumTableName.LOTS;
4535
+ dataType: "string";
4536
+ columnType: "PgNumeric";
4537
+ data: string;
4538
+ driverParam: string;
4539
+ notNull: true;
4540
+ hasDefault: false;
4541
+ isPrimaryKey: false;
4542
+ isAutoincrement: false;
4543
+ hasRuntimeDefault: false;
4544
+ enumValues: undefined;
4545
+ baseColumn: never;
4546
+ identity: undefined;
4547
+ generated: undefined;
4548
+ }, {}, {}>;
4549
+ };
4550
+ dialect: "pg";
4551
+ }>;
4552
+ declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
4553
+ name: EnumTableName.OFFSETS;
4554
+ schema: "router_v1.6";
4555
+ columns: {
4556
+ chainId: drizzle_orm_pg_core0.PgColumn<{
4557
+ name: "chain_id";
4558
+ tableName: EnumTableName.OFFSETS;
4559
+ dataType: "number";
4560
+ columnType: "PgBigInt53";
4561
+ data: Id;
4562
+ driverParam: string | number;
4563
+ notNull: true;
4564
+ hasDefault: false;
4565
+ isPrimaryKey: false;
4566
+ isAutoincrement: false;
4567
+ hasRuntimeDefault: false;
4568
+ enumValues: undefined;
4569
+ baseColumn: never;
4570
+ identity: undefined;
4571
+ generated: undefined;
4572
+ }, {}, {
4573
+ $type: Id;
4574
+ }>;
4575
+ user: drizzle_orm_pg_core0.PgColumn<{
4576
+ name: "user";
4577
+ tableName: EnumTableName.OFFSETS;
4578
+ dataType: "string";
4579
+ columnType: "PgVarchar";
4580
+ data: string;
4581
+ driverParam: string;
4582
+ notNull: true;
4583
+ hasDefault: false;
4584
+ isPrimaryKey: false;
4585
+ isAutoincrement: false;
4586
+ hasRuntimeDefault: false;
4587
+ enumValues: [string, ...string[]];
4588
+ baseColumn: never;
4589
+ identity: undefined;
4590
+ generated: undefined;
4591
+ }, {}, {
4592
+ length: 42;
4593
+ }>;
4594
+ contract: drizzle_orm_pg_core0.PgColumn<{
4595
+ name: "contract";
4596
+ tableName: EnumTableName.OFFSETS;
4597
+ dataType: "string";
4598
+ columnType: "PgVarchar";
4599
+ data: string;
4600
+ driverParam: string;
4601
+ notNull: true;
4602
+ hasDefault: false;
4603
+ isPrimaryKey: false;
4604
+ isAutoincrement: false;
4605
+ hasRuntimeDefault: false;
4606
+ enumValues: [string, ...string[]];
4607
+ baseColumn: never;
4608
+ identity: undefined;
4609
+ generated: undefined;
4610
+ }, {}, {
4611
+ length: 42;
4612
+ }>;
4613
+ group: drizzle_orm_pg_core0.PgColumn<{
4614
+ name: "group";
4615
+ tableName: EnumTableName.OFFSETS;
4616
+ dataType: "string";
4617
+ columnType: "PgVarchar";
4618
+ data: string;
4619
+ driverParam: string;
4620
+ notNull: true;
4621
+ hasDefault: false;
4622
+ isPrimaryKey: false;
4623
+ isAutoincrement: false;
4624
+ hasRuntimeDefault: false;
4625
+ enumValues: [string, ...string[]];
4626
+ baseColumn: never;
4627
+ identity: undefined;
4628
+ generated: undefined;
4629
+ }, {}, {
4630
+ length: 66;
4631
+ }>;
4632
+ value: drizzle_orm_pg_core0.PgColumn<{
4633
+ name: "value";
4634
+ tableName: EnumTableName.OFFSETS;
4635
+ dataType: "string";
4636
+ columnType: "PgNumeric";
4637
+ data: string;
4638
+ driverParam: string;
4639
+ notNull: true;
4640
+ hasDefault: false;
4641
+ isPrimaryKey: false;
4642
+ isAutoincrement: false;
4643
+ hasRuntimeDefault: false;
4644
+ enumValues: undefined;
4645
+ baseColumn: never;
4646
+ identity: undefined;
4647
+ generated: undefined;
4648
+ }, {}, {}>;
4649
+ };
4650
+ dialect: "pg";
4651
+ }>;
4158
4652
  declare const PositionTypes: drizzle_orm_pg_core0.PgEnum<[Type, ...Type[]]>;
4159
4653
  declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
4160
4654
  name: "position_types";
@@ -4776,8 +5270,149 @@ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
4776
5270
  };
4777
5271
  dialect: "pg";
4778
5272
  }>;
5273
+ declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
5274
+ name: EnumTableName.TREES;
5275
+ schema: "router_v1.6";
5276
+ columns: {
5277
+ root: drizzle_orm_pg_core0.PgColumn<{
5278
+ name: "root";
5279
+ tableName: EnumTableName.TREES;
5280
+ dataType: "string";
5281
+ columnType: "PgVarchar";
5282
+ data: string;
5283
+ driverParam: string;
5284
+ notNull: true;
5285
+ hasDefault: false;
5286
+ isPrimaryKey: true;
5287
+ isAutoincrement: false;
5288
+ hasRuntimeDefault: false;
5289
+ enumValues: [string, ...string[]];
5290
+ baseColumn: never;
5291
+ identity: undefined;
5292
+ generated: undefined;
5293
+ }, {}, {
5294
+ length: 66;
5295
+ }>;
5296
+ rootSignature: drizzle_orm_pg_core0.PgColumn<{
5297
+ name: "root_signature";
5298
+ tableName: EnumTableName.TREES;
5299
+ dataType: "string";
5300
+ columnType: "PgVarchar";
5301
+ data: string;
5302
+ driverParam: string;
5303
+ notNull: true;
5304
+ hasDefault: false;
5305
+ isPrimaryKey: false;
5306
+ isAutoincrement: false;
5307
+ hasRuntimeDefault: false;
5308
+ enumValues: [string, ...string[]];
5309
+ baseColumn: never;
5310
+ identity: undefined;
5311
+ generated: undefined;
5312
+ }, {}, {
5313
+ length: 132;
5314
+ }>;
5315
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
5316
+ name: "created_at";
5317
+ tableName: EnumTableName.TREES;
5318
+ dataType: "date";
5319
+ columnType: "PgTimestamp";
5320
+ data: Date;
5321
+ driverParam: string;
5322
+ notNull: true;
5323
+ hasDefault: true;
5324
+ isPrimaryKey: false;
5325
+ isAutoincrement: false;
5326
+ hasRuntimeDefault: false;
5327
+ enumValues: undefined;
5328
+ baseColumn: never;
5329
+ identity: undefined;
5330
+ generated: undefined;
5331
+ }, {}, {}>;
5332
+ };
5333
+ dialect: "pg";
5334
+ }>;
5335
+ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
5336
+ name: EnumTableName.MERKLE_PATHS;
5337
+ schema: "router_v1.6";
5338
+ columns: {
5339
+ offerHash: drizzle_orm_pg_core0.PgColumn<{
5340
+ name: "offer_hash";
5341
+ tableName: EnumTableName.MERKLE_PATHS;
5342
+ dataType: "string";
5343
+ columnType: "PgVarchar";
5344
+ data: string;
5345
+ driverParam: string;
5346
+ notNull: true;
5347
+ hasDefault: false;
5348
+ isPrimaryKey: true;
5349
+ isAutoincrement: false;
5350
+ hasRuntimeDefault: false;
5351
+ enumValues: [string, ...string[]];
5352
+ baseColumn: never;
5353
+ identity: undefined;
5354
+ generated: undefined;
5355
+ }, {}, {
5356
+ length: 66;
5357
+ }>;
5358
+ treeRoot: drizzle_orm_pg_core0.PgColumn<{
5359
+ name: "tree_root";
5360
+ tableName: EnumTableName.MERKLE_PATHS;
5361
+ dataType: "string";
5362
+ columnType: "PgVarchar";
5363
+ data: string;
5364
+ driverParam: string;
5365
+ notNull: true;
5366
+ hasDefault: false;
5367
+ isPrimaryKey: false;
5368
+ isAutoincrement: false;
5369
+ hasRuntimeDefault: false;
5370
+ enumValues: [string, ...string[]];
5371
+ baseColumn: never;
5372
+ identity: undefined;
5373
+ generated: undefined;
5374
+ }, {}, {
5375
+ length: 66;
5376
+ }>;
5377
+ proofNodes: drizzle_orm_pg_core0.PgColumn<{
5378
+ name: "proof_nodes";
5379
+ tableName: EnumTableName.MERKLE_PATHS;
5380
+ dataType: "string";
5381
+ columnType: "PgText";
5382
+ data: string;
5383
+ driverParam: string;
5384
+ notNull: true;
5385
+ hasDefault: false;
5386
+ isPrimaryKey: false;
5387
+ isAutoincrement: false;
5388
+ hasRuntimeDefault: false;
5389
+ enumValues: [string, ...string[]];
5390
+ baseColumn: never;
5391
+ identity: undefined;
5392
+ generated: undefined;
5393
+ }, {}, {}>;
5394
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
5395
+ name: "created_at";
5396
+ tableName: EnumTableName.MERKLE_PATHS;
5397
+ dataType: "date";
5398
+ columnType: "PgTimestamp";
5399
+ data: Date;
5400
+ driverParam: string;
5401
+ notNull: true;
5402
+ hasDefault: true;
5403
+ isPrimaryKey: false;
5404
+ isAutoincrement: false;
5405
+ hasRuntimeDefault: false;
5406
+ enumValues: undefined;
5407
+ baseColumn: never;
5408
+ identity: undefined;
5409
+ generated: undefined;
5410
+ }, {}, {}>;
5411
+ };
5412
+ dialect: "pg";
5413
+ }>;
4779
5414
  declare namespace index_d_exports$2 {
4780
- export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, obligationCollateralsV2, obligations, offers, offersCallbacks, oracles, positionTypes, positions, status, transfers, validations };
5415
+ export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, lots, merklePaths, obligationCollateralsV2, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
4781
5416
  }
4782
5417
  declare namespace Cursor_d_exports {
4783
5418
  export { Cursor, decode, encode, validate };
@@ -4969,6 +5604,41 @@ declare function poll<data>(fn: ({
4969
5604
  }: {
4970
5605
  interval: () => Promise<number>;
4971
5606
  }): () => boolean;
5607
+ declare namespace Random_d_exports {
5608
+ export { address, bool, bytes, float, hex, int, seed, withSeed };
5609
+ }
5610
+ /**
5611
+ * Runs a function with a deterministic RNG derived from the given seed.
5612
+ */
5613
+ declare function withSeed<T>(seed: string, fn: () => T): T;
5614
+ /**
5615
+ * Seeds the global RNG for deterministic test runs.
5616
+ */
5617
+ declare function seed(seed: string): void;
5618
+ /**
5619
+ * Returns a deterministic random float in [0, 1).
5620
+ */
5621
+ declare function float(): number;
5622
+ /**
5623
+ * Returns a deterministic random integer in [min, maxExclusive).
5624
+ */
5625
+ declare function int(maxExclusive: number, min?: number): number;
5626
+ /**
5627
+ * Returns a deterministic random boolean.
5628
+ */
5629
+ declare function bool(probability?: number): boolean;
5630
+ /**
5631
+ * Returns deterministic random bytes.
5632
+ */
5633
+ declare function bytes(length: number): Uint8Array;
5634
+ /**
5635
+ * Returns a deterministic random hex string for the given byte length.
5636
+ */
5637
+ declare function hex(byteLength: number): Hex;
5638
+ /**
5639
+ * Returns a deterministic random address.
5640
+ */
5641
+ declare function address(): Address;
4972
5642
  //#endregion
4973
5643
  //#region src/utils/retry.d.ts
4974
5644
  declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
@@ -4981,7 +5651,7 @@ declare function max(): number;
4981
5651
  //#region src/utils/wait.d.ts
4982
5652
  declare function wait(time: number): Promise<unknown>;
4983
5653
  declare namespace index_d_exports$3 {
4984
- export { BaseError, GlobalErrorType, ReorgError, Snake, time_d_exports as Time, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
5654
+ export { BaseError, GlobalErrorType, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
4985
5655
  }
4986
5656
  //#endregion
4987
5657
  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, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, Cursor_d_exports as Cursor, Database_d_exports as Database, ERC4626_d_exports as ERC4626, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, OpenApiOptions, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports as RouterClient, RouterStatusResponse, RuleInfo, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$3 as Utils, ValidateController, Gate_d_exports as Validation, morphoRules, parse, safeParse };