@morpho-dev/router 0.8.0 → 0.10.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.
Files changed (30) hide show
  1. package/dist/cli.js +2417 -975
  2. package/dist/drizzle/migrations/0026_add-receiver-if-maker-is-seller.sql +1 -0
  3. package/dist/drizzle/migrations/0027_debt-to-transfers.sql +239 -0
  4. package/dist/drizzle/migrations/0028_obligation_id_and_keys.sql +247 -0
  5. package/dist/drizzle/migrations/0029_collateral-positions.sql +248 -0
  6. package/dist/drizzle/migrations/0030_remove_chain_id_from_offer.sql +37 -0
  7. package/dist/drizzle/migrations/meta/0026_snapshot.json +1454 -0
  8. package/dist/drizzle/migrations/meta/0027_snapshot.json +1581 -0
  9. package/dist/drizzle/migrations/meta/0028_snapshot.json +1632 -0
  10. package/dist/drizzle/migrations/meta/0029_snapshot.json +1619 -0
  11. package/dist/drizzle/migrations/meta/0030_snapshot.json +1652 -0
  12. package/dist/drizzle/migrations/meta/_journal.json +35 -0
  13. package/dist/evm/bytecode/morpho.txt +1 -1
  14. package/dist/index.browser.d.mts +561 -317
  15. package/dist/index.browser.d.mts.map +1 -1
  16. package/dist/index.browser.d.ts +557 -313
  17. package/dist/index.browser.d.ts.map +1 -1
  18. package/dist/index.browser.js +4032 -3816
  19. package/dist/index.browser.js.map +1 -1
  20. package/dist/index.browser.mjs +4026 -3816
  21. package/dist/index.browser.mjs.map +1 -1
  22. package/dist/index.node.d.mts +1067 -447
  23. package/dist/index.node.d.mts.map +1 -1
  24. package/dist/index.node.d.ts +1067 -447
  25. package/dist/index.node.d.ts.map +1 -1
  26. package/dist/index.node.js +2466 -1195
  27. package/dist/index.node.js.map +1 -1
  28. package/dist/index.node.mjs +2439 -1174
  29. package/dist/index.node.mjs.map +1 -1
  30. package/package.json +2 -2
@@ -510,7 +510,7 @@ declare const MorphoV2: readonly [{
510
510
  readonly stateMutability: "nonpayable";
511
511
  readonly inputs: readonly [{
512
512
  readonly type: "address";
513
- readonly name: "recipient";
513
+ readonly name: "feeRecipient";
514
514
  }];
515
515
  readonly outputs: readonly [];
516
516
  }, {
@@ -590,6 +590,15 @@ declare const MorphoV2: readonly [{
590
590
  }, {
591
591
  readonly type: "address";
592
592
  readonly name: "taker";
593
+ }, {
594
+ readonly type: "address";
595
+ readonly name: "takerCallback";
596
+ }, {
597
+ readonly type: "bytes";
598
+ readonly name: "takerCallbackData";
599
+ }, {
600
+ readonly type: "address";
601
+ readonly name: "receiverIfTakerIsSeller";
593
602
  }, {
594
603
  readonly type: "tuple";
595
604
  readonly components: readonly [{
@@ -651,6 +660,9 @@ declare const MorphoV2: readonly [{
651
660
  }, {
652
661
  readonly type: "bytes";
653
662
  readonly name: "callbackData";
663
+ }, {
664
+ readonly type: "address";
665
+ readonly name: "receiverIfMakerIsSeller";
654
666
  }];
655
667
  readonly name: "offer";
656
668
  }, {
@@ -672,12 +684,6 @@ declare const MorphoV2: readonly [{
672
684
  }, {
673
685
  readonly type: "bytes32[]";
674
686
  readonly name: "proof";
675
- }, {
676
- readonly type: "address";
677
- readonly name: "takerCallback";
678
- }, {
679
- readonly type: "bytes";
680
- readonly name: "takerCallbackData";
681
687
  }];
682
688
  readonly outputs: readonly [{
683
689
  readonly type: "uint256";
@@ -799,6 +805,9 @@ declare const MorphoV2: readonly [{
799
805
  }, {
800
806
  readonly type: "address";
801
807
  readonly name: "onBehalf";
808
+ }, {
809
+ readonly type: "address";
810
+ readonly name: "receiver";
802
811
  }];
803
812
  readonly outputs: readonly [{
804
813
  readonly type: "uint256";
@@ -841,6 +850,9 @@ declare const MorphoV2: readonly [{
841
850
  }, {
842
851
  readonly type: "address";
843
852
  readonly name: "onBehalf";
853
+ }, {
854
+ readonly type: "address";
855
+ readonly name: "receiver";
844
856
  }];
845
857
  readonly outputs: readonly [];
846
858
  }, {
@@ -1028,7 +1040,7 @@ declare const MorphoV2: readonly [{
1028
1040
  readonly type: "event";
1029
1041
  readonly inputs: readonly [{
1030
1042
  readonly type: "address";
1031
- readonly name: "recipient";
1043
+ readonly name: "feeRecipient";
1032
1044
  readonly indexed: true;
1033
1045
  }];
1034
1046
  }, {
@@ -1103,6 +1115,9 @@ declare const MorphoV2: readonly [{
1103
1115
  }, {
1104
1116
  readonly type: "bool";
1105
1117
  readonly name: "sellerIsBorrower";
1118
+ }, {
1119
+ readonly type: "address";
1120
+ readonly name: "sellerReceiver";
1106
1121
  }, {
1107
1122
  readonly type: "bytes32";
1108
1123
  readonly name: "group";
@@ -1116,7 +1131,6 @@ declare const MorphoV2: readonly [{
1116
1131
  readonly inputs: readonly [{
1117
1132
  readonly type: "address";
1118
1133
  readonly name: "caller";
1119
- readonly indexed: true;
1120
1134
  }, {
1121
1135
  readonly type: "bytes32";
1122
1136
  readonly name: "id";
@@ -1131,6 +1145,10 @@ declare const MorphoV2: readonly [{
1131
1145
  readonly type: "address";
1132
1146
  readonly name: "onBehalf";
1133
1147
  readonly indexed: true;
1148
+ }, {
1149
+ readonly type: "address";
1150
+ readonly name: "receiver";
1151
+ readonly indexed: true;
1134
1152
  }];
1135
1153
  }, {
1136
1154
  readonly name: "WithdrawCollateral";
@@ -1153,6 +1171,9 @@ declare const MorphoV2: readonly [{
1153
1171
  readonly type: "address";
1154
1172
  readonly name: "onBehalf";
1155
1173
  readonly indexed: true;
1174
+ }, {
1175
+ readonly type: "address";
1176
+ readonly name: "receiver";
1156
1177
  }];
1157
1178
  }];
1158
1179
  type MorphoV2 = typeof MorphoV2;
@@ -1326,7 +1347,7 @@ declare class ReorgError extends BaseError {
1326
1347
  constructor(blockNumber: number);
1327
1348
  }
1328
1349
  declare namespace Chain_d_exports {
1329
- export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name$1 as Name, chainIds, chainNames, chains$2 as chains, getChain, getWhitelistedChains, streamLogs };
1350
+ export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name$1 as Name, chainIds, chainNames, chains$1 as chains, getChain, getWhitelistedChains, streamLogs };
1330
1351
  }
1331
1352
  type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
1332
1353
  morpho: ChainContract;
@@ -1367,7 +1388,7 @@ type Id = (typeof ChainId)[Uppercase<Name$1>];
1367
1388
  declare const chainIds: readonly Id[];
1368
1389
  declare function getChain(chainId: Id): Chain$1 | undefined;
1369
1390
  declare const getWhitelistedChains: () => Chain$1[];
1370
- declare const chains$2: Record<Lowercase<Name$1>, Chain$1>;
1391
+ declare const chains$1: Record<Lowercase<Name$1>, Chain$1>;
1371
1392
  declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
1372
1393
  client: PublicClient;
1373
1394
  contractAddress?: Address;
@@ -1400,7 +1421,7 @@ declare class MissingBlockNumberError extends BaseError {
1400
1421
  constructor();
1401
1422
  }
1402
1423
  declare namespace ChainRegistry_d_exports {
1403
- export { ChainRegistry, create$6 as create };
1424
+ export { ChainRegistry, create$8 as create };
1404
1425
  }
1405
1426
  type ChainRegistry = {
1406
1427
  getById: (chainId: Id) => Chain$1 | undefined;
@@ -1411,7 +1432,7 @@ type ChainRegistry = {
1411
1432
  * @param chains - Array of chain objects to register.
1412
1433
  * @returns A registry for looking up chains by ID. {@link ChainRegistry}
1413
1434
  */
1414
- declare function create$6(chains: Chain$1[]): ChainRegistry;
1435
+ declare function create$8(chains: Chain$1[]): ChainRegistry;
1415
1436
  //#endregion
1416
1437
  //#region src/core/types.d.ts
1417
1438
  /** Combines members of an intersection into a readable type. */
@@ -1445,13 +1466,23 @@ declare class InvalidLLTVError extends BaseError {
1445
1466
  }
1446
1467
  declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
1447
1468
  declare namespace Collateral_d_exports {
1448
- export { Collateral, CollateralSchema, CollateralsSchema, from$16 as from, random$3 as random };
1469
+ export { Collateral, CollateralSchema, CollateralsSchema, abi$1 as abi, from$16 as from, random$3 as random };
1449
1470
  }
1450
1471
  type Collateral = {
1451
1472
  /** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
1452
1473
  lltv: LLTV; /** Oracle contract used to price the collateral. */
1453
1474
  oracle: Address;
1454
1475
  };
1476
+ declare const abi$1: readonly [{
1477
+ readonly type: "address";
1478
+ readonly name: "token";
1479
+ }, {
1480
+ readonly type: "uint256";
1481
+ readonly name: "lltv";
1482
+ }, {
1483
+ readonly type: "address";
1484
+ readonly name: "oracle";
1485
+ }];
1455
1486
  declare const CollateralSchema: z$1.ZodObject<{
1456
1487
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1457
1488
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1565,102 +1596,33 @@ declare class DenominatorIsZeroError extends BaseError {
1565
1596
  readonly name = "ERC4626.DenominatorIsZeroError";
1566
1597
  constructor();
1567
1598
  }
1568
- declare namespace Liquidity_d_exports {
1569
- export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
1599
+ declare namespace Format_d_exports {
1600
+ export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
1570
1601
  }
1602
+ /** The snake case representation of a type with bigint values stringified. */
1603
+ type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
1604
+ /** Make arrays/tuples and object props mutable, deeply. */
1605
+ type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
1606
+ /** Stringifies bigint values to strings and preserves branded primitives. */
1607
+ type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
1608
+ /** Key remapping that also preserves branded primitives. */
1609
+ type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
1610
+ type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
1571
1611
  /**
1572
- * Represents a liquidity pool with a unique ID and amount.
1573
- */
1574
- type LiquidityPool = {
1575
- id: string;
1576
- amount: bigint;
1577
- };
1578
- /**
1579
- * Represents a hierarchical relationship between two liquidity pools.
1580
- */
1581
- type LiquidityLink = {
1582
- parentPoolId: string;
1583
- childPoolId: string;
1584
- priority: number;
1585
- };
1586
- /**
1587
- * Represents the connection between an offer and its liquidity pools.
1588
- */
1589
- type OfferLiquidityPool = {
1590
- offerHash: Hex;
1591
- poolId: string;
1592
- /**
1593
- * The available capacity/liquidity from this pool for this offer.
1594
- * Matches allowance amount from pool below.
1595
- */
1596
- amount: bigint;
1597
- };
1598
- /**
1599
- * Calculate maximum debt capacity from collateral amount.
1600
- * @param amount - Collateral amount
1601
- * @param oraclePrice - Oracle price (scaled to 36 decimals)
1602
- * @param lltv - Loan-to-value ratio (scaled to 18 decimals)
1603
- * @returns Maximum debt capacity
1604
- */
1605
- declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
1606
- /**
1607
- * Generate pool ID for balance pools.
1608
- */
1609
- declare function generateBalancePoolId(parameters: {
1610
- user: Address;
1611
- chainId: Id;
1612
- token: Address;
1613
- }): string;
1614
- /**
1615
- * Generate pool ID for allowance pools.
1616
- */
1617
- declare function generateAllowancePoolId(parameters: {
1618
- user: Address;
1619
- chainId: Id;
1620
- token: Address;
1621
- }): string;
1622
- /**
1623
- * Generate pool ID for obligation collateral pools.
1624
- * Obligation collateral pools represent collateral already deposited in the obligation.
1625
- * These pools are shared across all offers with the same obligation.
1626
- */
1627
- declare function generateObligationCollateralPoolId(parameters: {
1628
- user: Address;
1629
- chainId: Id;
1630
- obligationId: Hex;
1631
- token: Address;
1632
- }): string;
1633
- /**
1634
- * Generate pool ID for debt pools.
1635
- */
1636
- declare function generateDebtPoolId(parameters: {
1637
- user: Address;
1638
- chainId: Id;
1639
- obligationId: Hex;
1640
- }): string;
1641
- /**
1642
- * Generate pool ID for user position in a vault.
1643
- */
1644
- declare function generateUserVaultPositionPoolId(parameters: {
1645
- user: Address;
1646
- chainId: Id;
1647
- vault: Address;
1648
- }): string;
1649
- /**
1650
- * Generate pool ID for vault position in a market.
1612
+ * Formats object keys to snake case.
1613
+ * Preserves ethereum addresses as is.
1614
+ * Converts ethereum addresses to checksummed if used as values.
1615
+ * Stringifies bigint values to strings.
1651
1616
  */
1652
- declare function generateVaultPositionPoolId(parameters: {
1653
- vault: Address;
1654
- chainId: Id;
1655
- marketId: string;
1656
- }): string;
1617
+ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
1657
1618
  /**
1658
- * Generate pool ID for market total liquidity.
1619
+ * Formats a snake case object to its camel case type.
1620
+ * Preserves ethereum addresses as is.
1621
+ * Converts checksummed ethereum addresses to lowercase if used as values.
1622
+ * @warning Does not unstringify bigint values.
1659
1623
  */
1660
- declare function generateMarketLiquidityPoolId(parameters: {
1661
- chainId: Id;
1662
- marketId: string;
1663
- }): string;
1624
+ declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
1625
+ declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
1664
1626
  declare namespace Maturity_d_exports {
1665
1627
  export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$15 as from };
1666
1628
  }
@@ -1709,44 +1671,15 @@ declare class InvalidOptionError extends BaseError {
1709
1671
  readonly name = "Maturity.InvalidOptionError";
1710
1672
  constructor(input: string);
1711
1673
  }
1712
- declare namespace Format_d_exports {
1713
- export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
1714
- }
1715
- /** The snake case representation of a type with bigint values stringified. */
1716
- type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
1717
- /** Make arrays/tuples and object props mutable, deeply. */
1718
- type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
1719
- /** Stringifies bigint values to strings and preserves branded primitives. */
1720
- type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
1721
- /** Key remapping that also preserves branded primitives. */
1722
- type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
1723
- type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
1724
- /**
1725
- * Formats object keys to snake case.
1726
- * Preserves ethereum addresses as is.
1727
- * Converts ethereum addresses to checksummed if used as values.
1728
- * Stringifies bigint values to strings.
1729
- */
1730
- declare function toSnakeCase$1<T>(obj: T): Snake<T>;
1731
- /**
1732
- * Formats a snake case object to its camel case type.
1733
- * Preserves ethereum addresses as is.
1734
- * Converts checksummed ethereum addresses to lowercase if used as values.
1735
- * @warning Does not unstringify bigint values.
1736
- */
1737
- declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
1738
- declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
1739
1674
  declare namespace Obligation_d_exports {
1740
- export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$14 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
1675
+ export { CollateralsAreNotSortedError, InvalidObligationError, Obligation$1 as Obligation, ObligationSchema, abi, from$14 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, key$1 as key, random$2 as random, tupleAbi };
1741
1676
  }
1742
- type Obligation = {
1743
- /** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
1744
- loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1677
+ type Obligation$1 = {
1678
+ /** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1745
1679
  collaterals: Collateral[]; /** The maturity of the obligation. */
1746
1680
  maturity: Maturity;
1747
1681
  };
1748
1682
  declare const ObligationSchema: z$1.ZodObject<{
1749
- chainId: z$1.ZodNumber;
1750
1683
  loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1751
1684
  collaterals: z$1.ZodArray<z$1.ZodObject<{
1752
1685
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1755,6 +1688,49 @@ declare const ObligationSchema: z$1.ZodObject<{
1755
1688
  }, z$1.core.$strip>>;
1756
1689
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
1757
1690
  }, z$1.core.$strip>;
1691
+ declare const abi: readonly [{
1692
+ readonly type: "address";
1693
+ readonly name: "loanToken";
1694
+ }, {
1695
+ readonly type: "tuple[]";
1696
+ readonly name: "collaterals";
1697
+ readonly components: readonly [{
1698
+ readonly type: "address";
1699
+ readonly name: "token";
1700
+ }, {
1701
+ readonly type: "uint256";
1702
+ readonly name: "lltv";
1703
+ }, {
1704
+ readonly type: "address";
1705
+ readonly name: "oracle";
1706
+ }];
1707
+ }, {
1708
+ readonly type: "uint256";
1709
+ readonly name: "maturity";
1710
+ }];
1711
+ declare const tupleAbi: readonly [{
1712
+ readonly type: "tuple";
1713
+ readonly components: readonly [{
1714
+ readonly type: "address";
1715
+ readonly name: "loanToken";
1716
+ }, {
1717
+ readonly type: "tuple[]";
1718
+ readonly name: "collaterals";
1719
+ readonly components: readonly [{
1720
+ readonly type: "address";
1721
+ readonly name: "token";
1722
+ }, {
1723
+ readonly type: "uint256";
1724
+ readonly name: "lltv";
1725
+ }, {
1726
+ readonly type: "address";
1727
+ readonly name: "oracle";
1728
+ }];
1729
+ }, {
1730
+ readonly type: "uint256";
1731
+ readonly name: "maturity";
1732
+ }];
1733
+ }];
1758
1734
  /**
1759
1735
  * Creates an obligation from the given parameters.
1760
1736
  * @constructor
@@ -1765,7 +1741,6 @@ declare const ObligationSchema: z$1.ZodObject<{
1765
1741
  * @example
1766
1742
  * ```ts
1767
1743
  * const obligation = Obligation.from({
1768
- * chainId: 1,
1769
1744
  * loanToken: privateKeyToAccount(generatePrivateKey()).address,
1770
1745
  * collaterals: [
1771
1746
  * Collateral.from({
@@ -1781,12 +1756,11 @@ declare const ObligationSchema: z$1.ZodObject<{
1781
1756
  declare function from$14(parameters: from$14.Parameters): from$14.ReturnType;
1782
1757
  declare namespace from$14 {
1783
1758
  type Parameters = {
1784
- /** The chain id where the liquidity for this obligation is located. */chainId: number; /** The token that is being borrowed for this obligation. */
1785
- loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
1759
+ /** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
1786
1760
  collaterals: from$16.Parameters[] | readonly from$16.Parameters[]; /** The maturity of the obligation. */
1787
1761
  maturity: from$15.Parameters;
1788
1762
  };
1789
- type ReturnType = Obligation;
1763
+ type ReturnType = Obligation$1;
1790
1764
  type ErrorType = InvalidObligationError;
1791
1765
  }
1792
1766
  /**
@@ -1797,30 +1771,27 @@ declare namespace from$14 {
1797
1771
  */
1798
1772
  declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
1799
1773
  declare namespace fromSnakeCase$2 {
1800
- type Parameters = Snake<Omit<Obligation, "chainId"> & {
1801
- chainId: number;
1802
- }>;
1803
- type ReturnType = Obligation;
1774
+ type Parameters = Snake<Obligation$1>;
1775
+ type ReturnType = Obligation$1;
1804
1776
  type ErrorType = InvalidObligationError;
1805
1777
  }
1806
1778
  /**
1807
- * Calculates the obligation id based on the smart contract's Obligation struct.
1808
- * The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals, maturity)).
1779
+ * Calculates a canonical key for an obligation payload.
1780
+ * The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity)).
1809
1781
  * @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
1810
- * @param parameters - {@link id.Parameters}
1811
- * @returns The obligation id as a 32-byte hex string. {@link id.ReturnType}
1782
+ * @param parameters - {@link key.Parameters}
1783
+ * @returns The obligation key as a 32-byte hex string. {@link key.ReturnType}
1812
1784
  *
1813
1785
  * @example
1814
1786
  * ```ts
1815
1787
  * const obligation = Obligation.random();
1816
- * const id = Obligation.id(obligation);
1817
- * console.log(id); // 0x1234567890123456789012345678901234567890123456789012345678901234
1788
+ * const key = Obligation.key(obligation);
1789
+ * console.log(key); // 0x1234567890123456789012345678901234567890123456789012345678901234
1818
1790
  * ```
1819
1791
  */
1820
- declare function id(parameters: id.Parameters): id.ReturnType;
1821
- declare namespace id {
1792
+ declare function key$1(parameters: key$1.Parameters): key$1.ReturnType;
1793
+ declare namespace key$1 {
1822
1794
  type Parameters = {
1823
- chainId: number;
1824
1795
  loanToken: Address;
1825
1796
  collaterals: {
1826
1797
  asset: Address;
@@ -1843,7 +1814,7 @@ declare namespace id {
1843
1814
  */
1844
1815
  declare function random$2(): random$2.ReturnType;
1845
1816
  declare namespace random$2 {
1846
- type ReturnType = Obligation;
1817
+ type ReturnType = Obligation$1;
1847
1818
  }
1848
1819
  /**
1849
1820
  * Creates an obligation from an offer.
@@ -1855,7 +1826,7 @@ declare namespace random$2 {
1855
1826
  declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
1856
1827
  declare namespace fromOffer$1 {
1857
1828
  type Parameters = Offer;
1858
- type ReturnType = Obligation;
1829
+ type ReturnType = Obligation$1;
1859
1830
  }
1860
1831
  declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
1861
1832
  readonly name = "Obligation.InvalidObligationError";
@@ -1865,8 +1836,135 @@ declare class CollateralsAreNotSortedError extends BaseError {
1865
1836
  readonly name = "Obligation.CollateralsAreNotSortedError";
1866
1837
  constructor();
1867
1838
  }
1839
+ declare namespace Id_d_exports {
1840
+ export { Obligation, creationCode, toId };
1841
+ }
1842
+ type Obligation = Obligation$1;
1843
+ /**
1844
+ * Builds the same creation code as `IdLib.creationCode` in Solidity.
1845
+ *
1846
+ * Layout: `prefix (11 bytes) + chainId (32 bytes) + morphoV2 (20 bytes) + abi.encode(obligation)`.
1847
+ *
1848
+ * @param parameters - {@link creationCode.Parameters}
1849
+ * @returns The CREATE2 init code bytes. {@link creationCode.ReturnType}
1850
+ */
1851
+ declare function creationCode(parameters: creationCode.Parameters): creationCode.ReturnType;
1852
+ declare namespace creationCode {
1853
+ type Parameters = {
1854
+ obligation: Obligation;
1855
+ chainId: Id;
1856
+ morphoV2: Address;
1857
+ };
1858
+ type ReturnType = Hex;
1859
+ }
1860
+ /**
1861
+ * Computes the same id as `IdLib.toId` in Solidity.
1862
+ * @param parameters - {@link toId.Parameters}
1863
+ * @returns The obligation id. {@link toId.ReturnType}
1864
+ */
1865
+ declare function toId(parameters: toId.Parameters): toId.ReturnType;
1866
+ declare namespace toId {
1867
+ type Parameters = creationCode.Parameters;
1868
+ type ReturnType = Hex;
1869
+ }
1870
+ declare namespace Liquidity_d_exports {
1871
+ export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
1872
+ }
1873
+ /**
1874
+ * Represents a liquidity pool with a unique ID and amount.
1875
+ */
1876
+ type LiquidityPool = {
1877
+ id: string;
1878
+ amount: bigint;
1879
+ };
1880
+ /**
1881
+ * Represents a hierarchical relationship between two liquidity pools.
1882
+ */
1883
+ type LiquidityLink = {
1884
+ parentPoolId: string;
1885
+ childPoolId: string;
1886
+ priority: number;
1887
+ };
1888
+ /**
1889
+ * Represents the connection between an offer and its liquidity pools.
1890
+ */
1891
+ type OfferLiquidityPool = {
1892
+ offerHash: Hex;
1893
+ poolId: string;
1894
+ /**
1895
+ * The available capacity/liquidity from this pool for this offer.
1896
+ * Matches allowance amount from pool below.
1897
+ */
1898
+ amount: bigint;
1899
+ };
1900
+ /**
1901
+ * Calculate maximum debt capacity from collateral amount.
1902
+ * @param amount - Collateral amount
1903
+ * @param oraclePrice - Oracle price (scaled to 36 decimals)
1904
+ * @param lltv - Loan-to-value ratio (scaled to 18 decimals)
1905
+ * @returns Maximum debt capacity
1906
+ */
1907
+ declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
1908
+ /**
1909
+ * Generate pool ID for balance pools.
1910
+ */
1911
+ declare function generateBalancePoolId(parameters: {
1912
+ user: Address;
1913
+ chainId: Id;
1914
+ token: Address;
1915
+ }): string;
1916
+ /**
1917
+ * Generate pool ID for allowance pools.
1918
+ */
1919
+ declare function generateAllowancePoolId(parameters: {
1920
+ user: Address;
1921
+ chainId: Id;
1922
+ token: Address;
1923
+ }): string;
1924
+ /**
1925
+ * Generate pool ID for obligation collateral pools.
1926
+ * Obligation collateral pools represent collateral already deposited in the obligation.
1927
+ * These pools are shared across all offers with the same obligation.
1928
+ */
1929
+ declare function generateObligationCollateralPoolId(parameters: {
1930
+ user: Address;
1931
+ chainId: Id;
1932
+ obligationId: Hex;
1933
+ token: Address;
1934
+ }): string;
1935
+ /**
1936
+ * Generate pool ID for debt pools.
1937
+ */
1938
+ declare function generateDebtPoolId(parameters: {
1939
+ user: Address;
1940
+ chainId: Id;
1941
+ obligationId: Hex;
1942
+ }): string;
1943
+ /**
1944
+ * Generate pool ID for user position in a vault.
1945
+ */
1946
+ declare function generateUserVaultPositionPoolId(parameters: {
1947
+ user: Address;
1948
+ chainId: Id;
1949
+ vault: Address;
1950
+ }): string;
1951
+ /**
1952
+ * Generate pool ID for vault position in a market.
1953
+ */
1954
+ declare function generateVaultPositionPoolId(parameters: {
1955
+ vault: Address;
1956
+ chainId: Id;
1957
+ marketId: string;
1958
+ }): string;
1959
+ /**
1960
+ * Generate pool ID for market total liquidity.
1961
+ */
1962
+ declare function generateMarketLiquidityPoolId(parameters: {
1963
+ chainId: Id;
1964
+ marketId: string;
1965
+ }): string;
1868
1966
  declare namespace Offer_d_exports {
1869
- 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, takeEvent, toSnakeCase, types };
1967
+ export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, encode$1 as encode, from$13 as from, fromSnakeCase$1 as fromSnakeCase, hash, liquidateEvent, obligationId, random$1 as random, repayEvent, serialize, supplyCollateralEvent, takeEvent, toSnakeCase, withdrawCollateralEvent };
1870
1968
  }
1871
1969
  type Offer = {
1872
1970
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
@@ -1879,14 +1977,14 @@ type Offer = {
1879
1977
  readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
1880
1978
  readonly group: Hex; /** The session. Used for session-based offer management. */
1881
1979
  readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
1882
- readonly buy: boolean; /** The chain id where the liquidity for this offer is located. */
1883
- readonly chainId: Id; /** The token that is being borrowed. */
1980
+ readonly buy: boolean; /** The token that is being borrowed. */
1884
1981
  readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1885
1982
  readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
1886
1983
  readonly callback: {
1887
1984
  readonly address: Address;
1888
1985
  readonly data: Hex;
1889
- };
1986
+ }; /** Receiver of loan token proceeds when maker is seller on `take()`. */
1987
+ readonly receiverIfMakerIsSeller: Address;
1890
1988
  };
1891
1989
  declare enum Status {
1892
1990
  VALID = "VALID",
@@ -1894,6 +1992,7 @@ declare enum Status {
1894
1992
  }
1895
1993
  type Validation = {
1896
1994
  offerHash: Hex;
1995
+ obligationId: Hex;
1897
1996
  status: Status;
1898
1997
  };
1899
1998
  declare const OfferSchema: () => z$1.ZodObject<{
@@ -1908,7 +2007,6 @@ declare const OfferSchema: () => z$1.ZodObject<{
1908
2007
  group: z$1.ZodPipe<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
1909
2008
  session: z$1.ZodPipe<z$1.ZodDefault<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>>>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
1910
2009
  buy: z$1.ZodBoolean;
1911
- chainId: z$1.ZodNumber;
1912
2010
  loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1913
2011
  collaterals: z$1.ZodArray<z$1.ZodObject<{
1914
2012
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1919,6 +2017,7 @@ declare const OfferSchema: () => z$1.ZodObject<{
1919
2017
  address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1920
2018
  data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1921
2019
  }, z$1.core.$strip>;
2020
+ receiverIfMakerIsSeller: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1922
2021
  }, z$1.core.$strip>;
1923
2022
  /**
1924
2023
  * Input type for creating offers. Accepts flexible group types that will be coerced to Hex.
@@ -1931,12 +2030,12 @@ declare const OfferSchema: () => z$1.ZodObject<{
1931
2030
  *
1932
2031
  * All values validated to be non-negative and within bytes32 range.
1933
2032
  */
1934
- type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares"> & {
1935
- chainId: number;
2033
+ type OfferInput = Compute<Omit<Offer, "group" | "session" | "obligationUnits" | "obligationShares" | "receiverIfMakerIsSeller"> & {
1936
2034
  group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
1937
2035
  session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
1938
2036
  obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
1939
- obligationShares?: bigint;
2037
+ obligationShares?: bigint; /** Optional: defaults to maker for backward compatibility. */
2038
+ receiverIfMakerIsSeller?: Address;
1940
2039
  }>;
1941
2040
  /**
1942
2041
  * Creates an offer from a plain object.
@@ -1954,9 +2053,9 @@ declare namespace from$13 {
1954
2053
  * @param input - The offer to create.
1955
2054
  * @returns The created offer.
1956
2055
  */
1957
- declare function fromSnakeCase$1(input: Snake<Omit<Offer, "chainId" | "session"> & {
1958
- chainId: number;
1959
- session: string;
2056
+ declare function fromSnakeCase$1(input: Snake<Omit<Offer, "session" | "receiverIfMakerIsSeller"> & {
2057
+ session?: Hex;
2058
+ receiverIfMakerIsSeller?: Address;
1960
2059
  }>): Offer;
1961
2060
  /**
1962
2061
  * Converts an offer to a snake case object.
@@ -1983,7 +2082,6 @@ declare const serialize: (offer: Offer) => {
1983
2082
  group: `0x${string}`;
1984
2083
  session: `0x${string}`;
1985
2084
  buy: boolean;
1986
- chainId: Id;
1987
2085
  loanToken: `0x${string}`;
1988
2086
  collaterals: {
1989
2087
  asset: `0x${string}`;
@@ -1994,10 +2092,10 @@ declare const serialize: (offer: Offer) => {
1994
2092
  address: `0x${string}`;
1995
2093
  data: `0x${string}`;
1996
2094
  };
2095
+ receiverIfMakerIsSeller: `0x${string}`;
1997
2096
  hash: `0x${string}`;
1998
2097
  };
1999
2098
  type RandomConfig = {
2000
- chains?: Chain$1[];
2001
2099
  loanTokens?: Address[];
2002
2100
  collateralTokens?: Address[];
2003
2101
  assetsDecimals?: Record<Address, number>;
@@ -2016,6 +2114,7 @@ type RandomConfig = {
2016
2114
  address: Address;
2017
2115
  data: Hex;
2018
2116
  };
2117
+ receiverIfMakerIsSeller?: Address;
2019
2118
  collaterals?: readonly Collateral[];
2020
2119
  };
2021
2120
  /**
@@ -2026,93 +2125,28 @@ type RandomConfig = {
2026
2125
  */
2027
2126
  declare function random$1(config?: RandomConfig): Offer;
2028
2127
  /**
2029
- * Creates an EIP-712 domain object.
2030
- * @param chainId - The chain ID.
2031
- * @returns The EIP-712 domain object.
2032
- */
2033
- declare const domain: (chainId: number) => {
2034
- chainId: bigint;
2035
- verifyingContract: "0x0000000000000000000000000000000000000000";
2036
- };
2037
- /**
2038
- * The EIP-712 types for the offer.
2039
- * @warning The ordering of the types should NEVER be changed. The offer hash is computed based on the order of the types.
2040
- * @returns The EIP-712 types.
2128
+ * Computes the canonical chain-agnostic offer hash.
2129
+ * The hash is `keccak256(abi.encode(offer))` using {@link encode}.
2130
+ *
2131
+ * @param offer - Offer payload to hash.
2132
+ * @returns 32-byte offer hash.
2041
2133
  */
2042
- declare const types: {
2043
- readonly EIP712Domain: readonly [{
2044
- readonly name: "chainId";
2045
- readonly type: "uint256";
2046
- }, {
2047
- readonly name: "verifyingContract";
2048
- readonly type: "address";
2049
- }];
2050
- readonly Offer: readonly [{
2051
- readonly name: "maker";
2052
- readonly type: "address";
2053
- }, {
2054
- readonly name: "assets";
2055
- readonly type: "uint256";
2056
- }, {
2057
- readonly name: "obligationUnits";
2058
- readonly type: "uint256";
2059
- }, {
2060
- readonly name: "obligationShares";
2061
- readonly type: "uint256";
2062
- }, {
2063
- readonly name: "tick";
2064
- readonly type: "uint256";
2065
- }, {
2066
- readonly name: "maturity";
2067
- readonly type: "uint256";
2068
- }, {
2069
- readonly name: "expiry";
2070
- readonly type: "uint256";
2071
- }, {
2072
- readonly name: "group";
2073
- readonly type: "bytes32";
2074
- }, {
2075
- readonly name: "session";
2076
- readonly type: "bytes32";
2077
- }, {
2078
- readonly name: "buy";
2079
- readonly type: "bool";
2080
- }, {
2081
- readonly name: "loanToken";
2082
- readonly type: "address";
2083
- }, {
2084
- readonly name: "collaterals";
2085
- readonly type: "Collateral[]";
2086
- }, {
2087
- readonly name: "callback";
2088
- readonly type: "Callback";
2089
- }];
2090
- readonly Collateral: readonly [{
2091
- readonly name: "asset";
2092
- readonly type: "address";
2093
- }, {
2094
- readonly name: "oracle";
2095
- readonly type: "address";
2096
- }, {
2097
- readonly name: "lltv";
2098
- readonly type: "uint256";
2099
- }];
2100
- readonly Callback: readonly [{
2101
- readonly name: "address";
2102
- readonly type: "address";
2103
- }, {
2104
- readonly name: "data";
2105
- readonly type: "bytes";
2106
- }];
2107
- };
2108
2134
  declare function hash(offer: Offer): Hex;
2109
2135
  /**
2110
- * Calculates the obligation id for an offer based on the smart contract's Obligation struct.
2111
- * The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals (sorted by token address), maturity)).
2136
+ * Calculates the onchain obligation id for an offer.
2137
+ * The id is computed with {@link Id.toId}.
2112
2138
  * @param offer - The offer to calculate the obligation id for.
2139
+ * @param parameters - The chain context used by the onchain id function.
2113
2140
  * @returns The obligation id as a 32-byte hex string.
2114
2141
  */
2115
- declare function obligationId(offer: Offer): Hex;
2142
+ declare function obligationId(offer: Offer, parameters: obligationId.Parameters): obligationId.ReturnType;
2143
+ declare namespace obligationId {
2144
+ type Parameters = {
2145
+ chainId: Id;
2146
+ morphoV2: Address;
2147
+ };
2148
+ type ReturnType = Hex;
2149
+ }
2116
2150
  declare function encode$1(offer: Offer): `0x${string}`;
2117
2151
  declare function decode$1(data: Hex): Offer;
2118
2152
  type OfferConsumed = {
@@ -2183,41 +2217,200 @@ declare const takeEvent: {
2183
2217
  readonly name: "sellerIsBorrower";
2184
2218
  readonly type: "bool";
2185
2219
  readonly indexed: false;
2186
- readonly internalType: "bool";
2220
+ readonly internalType: "bool";
2221
+ }, {
2222
+ readonly name: "sellerReceiver";
2223
+ readonly type: "address";
2224
+ readonly indexed: false;
2225
+ readonly internalType: "address";
2226
+ }, {
2227
+ readonly name: "group";
2228
+ readonly type: "bytes32";
2229
+ readonly indexed: false;
2230
+ readonly internalType: "bytes32";
2231
+ }, {
2232
+ readonly name: "consumed";
2233
+ readonly type: "uint256";
2234
+ readonly indexed: false;
2235
+ readonly internalType: "uint256";
2236
+ }];
2237
+ readonly anonymous: false;
2238
+ };
2239
+ /**
2240
+ * ABI for the Consume event emitted by the Obligation contract.
2241
+ */
2242
+ declare const consumedEvent: {
2243
+ readonly type: "event";
2244
+ readonly name: "Consume";
2245
+ readonly inputs: readonly [{
2246
+ readonly name: "user";
2247
+ readonly type: "address";
2248
+ readonly indexed: true;
2249
+ readonly internalType: "address";
2250
+ }, {
2251
+ readonly name: "group";
2252
+ readonly type: "bytes32";
2253
+ readonly indexed: true;
2254
+ readonly internalType: "bytes32";
2255
+ }, {
2256
+ readonly name: "amount";
2257
+ readonly type: "uint256";
2258
+ readonly indexed: false;
2259
+ readonly internalType: "uint256";
2260
+ }];
2261
+ readonly anonymous: false;
2262
+ };
2263
+ /**
2264
+ * ABI for the Repay event emitted by the MorphoV2 contract.
2265
+ */
2266
+ declare const repayEvent: {
2267
+ readonly type: "event";
2268
+ readonly name: "Repay";
2269
+ readonly inputs: readonly [{
2270
+ readonly name: "caller";
2271
+ readonly type: "address";
2272
+ readonly indexed: true;
2273
+ readonly internalType: "address";
2274
+ }, {
2275
+ readonly name: "id";
2276
+ readonly type: "bytes32";
2277
+ readonly indexed: true;
2278
+ readonly internalType: "bytes32";
2279
+ }, {
2280
+ readonly name: "obligationUnits";
2281
+ readonly type: "uint256";
2282
+ readonly indexed: false;
2283
+ readonly internalType: "uint256";
2284
+ }, {
2285
+ readonly name: "onBehalf";
2286
+ readonly type: "address";
2287
+ readonly indexed: true;
2288
+ readonly internalType: "address";
2289
+ }];
2290
+ readonly anonymous: false;
2291
+ };
2292
+ /**
2293
+ * ABI for the Liquidate event emitted by the MorphoV2 contract.
2294
+ */
2295
+ declare const liquidateEvent: {
2296
+ readonly type: "event";
2297
+ readonly name: "Liquidate";
2298
+ readonly inputs: readonly [{
2299
+ readonly name: "caller";
2300
+ readonly type: "address";
2301
+ readonly indexed: true;
2302
+ readonly internalType: "address";
2303
+ }, {
2304
+ readonly name: "id";
2305
+ readonly type: "bytes32";
2306
+ readonly indexed: true;
2307
+ readonly internalType: "bytes32";
2308
+ }, {
2309
+ readonly name: "seizures";
2310
+ readonly type: "tuple[]";
2311
+ readonly indexed: false;
2312
+ readonly internalType: "struct IMorphoV2.Seizure[]";
2313
+ readonly components: readonly [{
2314
+ readonly name: "collateralIndex";
2315
+ readonly type: "uint256";
2316
+ readonly internalType: "uint256";
2317
+ }, {
2318
+ readonly name: "repaid";
2319
+ readonly type: "uint256";
2320
+ readonly internalType: "uint256";
2321
+ }, {
2322
+ readonly name: "seized";
2323
+ readonly type: "uint256";
2324
+ readonly internalType: "uint256";
2325
+ }];
2326
+ }, {
2327
+ readonly name: "borrower";
2328
+ readonly type: "address";
2329
+ readonly indexed: true;
2330
+ readonly internalType: "address";
2331
+ }, {
2332
+ readonly name: "totalRepaid";
2333
+ readonly type: "uint256";
2334
+ readonly indexed: false;
2335
+ readonly internalType: "uint256";
2336
+ }, {
2337
+ readonly name: "badDebt";
2338
+ readonly type: "uint256";
2339
+ readonly indexed: false;
2340
+ readonly internalType: "uint256";
2341
+ }];
2342
+ readonly anonymous: false;
2343
+ };
2344
+ /**
2345
+ * ABI for the SupplyCollateral event emitted by the MorphoV2 contract.
2346
+ */
2347
+ declare const supplyCollateralEvent: {
2348
+ readonly type: "event";
2349
+ readonly name: "SupplyCollateral";
2350
+ readonly inputs: readonly [{
2351
+ readonly name: "caller";
2352
+ readonly type: "address";
2353
+ readonly indexed: false;
2354
+ readonly internalType: "address";
2187
2355
  }, {
2188
- readonly name: "group";
2356
+ readonly name: "id";
2189
2357
  readonly type: "bytes32";
2190
- readonly indexed: false;
2358
+ readonly indexed: true;
2191
2359
  readonly internalType: "bytes32";
2192
2360
  }, {
2193
- readonly name: "consumed";
2361
+ readonly name: "collateral";
2362
+ readonly type: "address";
2363
+ readonly indexed: true;
2364
+ readonly internalType: "address";
2365
+ }, {
2366
+ readonly name: "assets";
2194
2367
  readonly type: "uint256";
2195
2368
  readonly indexed: false;
2196
2369
  readonly internalType: "uint256";
2370
+ }, {
2371
+ readonly name: "onBehalf";
2372
+ readonly type: "address";
2373
+ readonly indexed: true;
2374
+ readonly internalType: "address";
2197
2375
  }];
2198
2376
  readonly anonymous: false;
2199
2377
  };
2200
2378
  /**
2201
- * ABI for the Consume event emitted by the Obligation contract.
2379
+ * ABI for the WithdrawCollateral event emitted by the MorphoV2 contract.
2202
2380
  */
2203
- declare const consumedEvent: {
2381
+ declare const withdrawCollateralEvent: {
2204
2382
  readonly type: "event";
2205
- readonly name: "Consume";
2383
+ readonly name: "WithdrawCollateral";
2206
2384
  readonly inputs: readonly [{
2207
- readonly name: "user";
2385
+ readonly name: "caller";
2208
2386
  readonly type: "address";
2209
- readonly indexed: true;
2387
+ readonly indexed: false;
2210
2388
  readonly internalType: "address";
2211
2389
  }, {
2212
- readonly name: "group";
2390
+ readonly name: "id";
2213
2391
  readonly type: "bytes32";
2214
2392
  readonly indexed: true;
2215
2393
  readonly internalType: "bytes32";
2216
2394
  }, {
2217
- readonly name: "amount";
2395
+ readonly name: "collateral";
2396
+ readonly type: "address";
2397
+ readonly indexed: true;
2398
+ readonly internalType: "address";
2399
+ }, {
2400
+ readonly name: "assets";
2218
2401
  readonly type: "uint256";
2219
2402
  readonly indexed: false;
2220
2403
  readonly internalType: "uint256";
2404
+ }, {
2405
+ readonly name: "onBehalf";
2406
+ readonly type: "address";
2407
+ readonly indexed: true;
2408
+ readonly internalType: "address";
2409
+ }, {
2410
+ readonly name: "receiver";
2411
+ readonly type: "address";
2412
+ readonly indexed: false;
2413
+ readonly internalType: "address";
2221
2414
  }];
2222
2415
  readonly anonymous: false;
2223
2416
  };
@@ -2290,6 +2483,7 @@ declare namespace fromCollateral {
2290
2483
  declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
2291
2484
  declare namespace fromOffer {
2292
2485
  type Parameters = {
2486
+ chainId: Id;
2293
2487
  offer: Offer;
2294
2488
  blockNumber: number;
2295
2489
  price?: bigint | null;
@@ -2306,6 +2500,7 @@ declare namespace fromOffer {
2306
2500
  declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
2307
2501
  declare namespace fromOffers {
2308
2502
  type Parameters = {
2503
+ chainId: Id;
2309
2504
  offers: Offer[];
2310
2505
  blockNumber: number;
2311
2506
  price?: bigint | null;
@@ -2344,7 +2539,7 @@ declare namespace Conversion {
2344
2539
  }): bigint;
2345
2540
  }
2346
2541
  declare namespace Position_d_exports {
2347
- export { Position, Type, from$11 as from };
2542
+ export { Position, Type, from$11 as from, positionTypeId };
2348
2543
  }
2349
2544
  type Position = {
2350
2545
  /** The chain id. */chainId: Id;
@@ -2359,13 +2554,17 @@ type Position = {
2359
2554
  /** The underlying asset of the position.
2360
2555
  * For ERC20 positions, this equals the contract address.
2361
2556
  * For vault positions, this is the vault's underlying asset.
2557
+ * For debt positions, this is the zero address (sentinel).
2558
+ * For collateral positions, this is the collateral token address.
2362
2559
  */
2363
- asset?: Address; /** The block number at which the position was last updated. */
2560
+ asset: Address; /** The block number at which the position was last updated. */
2364
2561
  blockNumber: number;
2365
2562
  };
2366
2563
  declare enum Type {
2367
2564
  ERC20 = "erc20",
2368
- VAULT_V1 = "vault_v1"
2565
+ VAULT_V1 = "vault_v1",
2566
+ DEBT_OF = "debtOf",
2567
+ COLLATERAL_OF = "collateralOf"
2369
2568
  }
2370
2569
  /**
2371
2570
  * @constructor
@@ -2381,32 +2580,38 @@ declare namespace from$11 {
2381
2580
  user: Address;
2382
2581
  type: Type;
2383
2582
  balance?: bigint;
2384
- asset?: Address;
2583
+ asset: Address;
2385
2584
  blockNumber: number;
2386
2585
  };
2387
2586
  type ReturnType = Position;
2388
2587
  }
2588
+ /**
2589
+ * Maps a {@link Type} enum value to its 1-based integer ID used in the database.
2590
+ * @param type - The position type.
2591
+ * @returns The 1-based integer ID.
2592
+ */
2593
+ declare const positionTypeId: (type: Type) => number;
2389
2594
  declare namespace Quote_d_exports {
2390
- export { InvalidQuoteError, Quote, QuoteSchema, from$10 as from, fromSnakeCase, random };
2595
+ export { InvalidQuoteError, Quote, QuoteInput, Side, from$10 as from, fromSnakeCase, random };
2391
2596
  }
2392
- type Quote = {
2597
+ type Side = {
2598
+ /** The best side tick, or null when no active quote exists. */tick: number | null; /** The side price for the obligation. (18 decimals). */
2599
+ price: bigint;
2600
+ };
2601
+ type QuoteInput = {
2393
2602
  /** The obligation id. */obligationId: Hex;
2394
2603
  ask: {
2395
- /** The ask price for the obligation. (18 decimals). */price: bigint;
2604
+ /** The best ask tick, or null when there is no active ask quote. */tick: number | null;
2396
2605
  };
2397
2606
  bid: {
2398
- /** The bid price for the obligation. (18 decimals). */price: bigint;
2607
+ /** The best bid tick, or null when there is no active bid quote. */tick: number | null;
2399
2608
  };
2400
2609
  };
2401
- declare const QuoteSchema: z$1.ZodObject<{
2402
- obligationId: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2403
- ask: z$1.ZodObject<{
2404
- price: z$1.ZodBigInt;
2405
- }, z$1.core.$strip>;
2406
- bid: z$1.ZodObject<{
2407
- price: z$1.ZodBigInt;
2408
- }, z$1.core.$strip>;
2409
- }, z$1.core.$strip>;
2610
+ type Quote = {
2611
+ /** The obligation id. */obligationId: Hex;
2612
+ ask: Side;
2613
+ bid: Side;
2614
+ };
2410
2615
  /**
2411
2616
  * Creates a quote for a given obligation.
2412
2617
  * @constructor
@@ -2416,12 +2621,12 @@ declare const QuoteSchema: z$1.ZodObject<{
2416
2621
  *
2417
2622
  * @example
2418
2623
  * ```ts
2419
- * const quote = Quote.from({ obligationId: "0x123", ask: { price: 100n }, bid: { price: 100n } });
2624
+ * const quote = Quote.from({ obligationId: "0x123", ask: { tick: 500 }, bid: { tick: 510 } });
2420
2625
  * ```
2421
2626
  */
2422
2627
  declare function from$10(parameters: from$10.Parameters): from$10.ReturnType;
2423
2628
  declare namespace from$10 {
2424
- type Parameters = Quote;
2629
+ type Parameters = QuoteInput;
2425
2630
  type ReturnType = Quote;
2426
2631
  type ErrorType = InvalidQuoteError;
2427
2632
  }
@@ -2433,7 +2638,7 @@ declare namespace from$10 {
2433
2638
  */
2434
2639
  declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
2435
2640
  declare namespace fromSnakeCase {
2436
- type Parameters = Snake<Quote>;
2641
+ type Parameters = Snake<QuoteInput>;
2437
2642
  type ReturnType = Quote;
2438
2643
  type ErrorType = from$10.ErrorType;
2439
2644
  }
@@ -2574,6 +2779,8 @@ type Transfer = {
2574
2779
  from: Address;
2575
2780
  to: Address;
2576
2781
  value: bigint;
2782
+ type: Type; /** The underlying asset of the transfer's position. */
2783
+ asset: Address;
2577
2784
  blockNumber: number;
2578
2785
  };
2579
2786
  /**
@@ -2597,6 +2804,8 @@ declare namespace from$8 {
2597
2804
  from: Address;
2598
2805
  to: Address;
2599
2806
  value: bigint;
2807
+ type: Type;
2808
+ asset: Address;
2600
2809
  blockNumber: number;
2601
2810
  };
2602
2811
  type ReturnType = Transfer;
@@ -2793,7 +3002,7 @@ declare class SignatureDomainError extends BaseError {
2793
3002
  }
2794
3003
  //#endregion
2795
3004
  //#region src/indexer/collectors/Collector.d.ts
2796
- declare const names: readonly ["offers", "consumed_events", "positions", "prices"];
3005
+ declare const names: readonly ["offers", "morpho_v2", "positions", "prices"];
2797
3006
  type Name = (typeof names)[number];
2798
3007
  /** A general collector interface. */
2799
3008
  type Collector<name extends Name = Name, client extends PublicClient<Transport, Chain$1> = PublicClient<Transport, Chain$1>> = {
@@ -2892,7 +3101,7 @@ declare function getLogger(): Logger;
2892
3101
  //#region src/database/domains/Offers.d.ts
2893
3102
  type CreateBatch = Readonly<{
2894
3103
  blockNumber: number;
2895
- offers: Offer[];
3104
+ offers: create$7.OfferInput[];
2896
3105
  }>;
2897
3106
  /**
2898
3107
  * Raw row returned by database queries.
@@ -2900,6 +3109,7 @@ type CreateBatch = Readonly<{
2900
3109
  */
2901
3110
  type Row = {
2902
3111
  hash: Hex;
3112
+ obligationId: Hex;
2903
3113
  maker: Address;
2904
3114
  assets: bigint;
2905
3115
  obligationUnits: bigint;
@@ -2918,13 +3128,18 @@ type Row = {
2918
3128
  address: Address;
2919
3129
  data: Hex;
2920
3130
  };
3131
+ receiverIfMakerIsSeller: Address;
2921
3132
  consumed: bigint;
2922
3133
  available: bigint;
2923
3134
  takeable: bigint;
2924
3135
  blockNumber: number;
2925
3136
  };
3137
+ type OfferReference$1 = {
3138
+ hash: Hex;
3139
+ obligationId: Hex;
3140
+ };
2926
3141
  type OffersDomain = {
2927
- /** Insert offers (insert-only). */create: (batches: CreateBatch[]) => Promise<Hex[]>;
3142
+ /** Insert offers (insert-only). */create: (batches: CreateBatch[]) => Promise<OfferReference$1[]>;
2928
3143
  /** Delete multiple offers by hashes or block number greater than or equal to the given value on a given chain.
2929
3144
  * @returns the number of offers deleted.
2930
3145
  */
@@ -2937,18 +3152,6 @@ type OffersDomain = {
2937
3152
  get: (parameters?: GetOffersParams) => Promise<{
2938
3153
  rows: Row[];
2939
3154
  nextCursor: string | null;
2940
- }>; /** Get obligations */
2941
- getObligations: (parameters?: {
2942
- ids?: Hex[];
2943
- chainId?: Id[];
2944
- loanToken?: Address[];
2945
- collateralToken?: Address[];
2946
- maturity?: number[];
2947
- cursor?: string;
2948
- limit?: number;
2949
- }) => Promise<{
2950
- obligations: Obligation[];
2951
- nextCursor: string | null;
2952
3155
  }>; /** Get quotes for given obligations. */
2953
3156
  getQuotes: (parameters: {
2954
3157
  obligationIds: Hex[];
@@ -2961,13 +3164,23 @@ type PaginationParams$1 = {
2961
3164
  type GetOffersParams = {
2962
3165
  /** Filter by maker address */maker?: Address;
2963
3166
  } & PaginationParams$1;
3167
+ declare function create$7(config: {
3168
+ db: Core;
3169
+ }): OffersDomain;
3170
+ declare namespace create$7 {
3171
+ type OfferInput = {
3172
+ offer: Offer;
3173
+ obligationId: Hex;
3174
+ chainId: Id;
3175
+ };
3176
+ }
2964
3177
  //#endregion
2965
3178
  //#region src/database/domains/Book.d.ts
2966
3179
  type BookDomain = {
2967
- /** Get aggregated book levels for a given obligation side. */get: (parameters: get$4.Parameters) => Promise<get$4.ReturnType>; /** Get all offers for a given obligation side with cross-invalidation. */
3180
+ /** Get aggregated book levels for a given obligation side. */get: (parameters: get$5.Parameters) => Promise<get$5.ReturnType>; /** Get all offers for a given obligation side with cross-invalidation. */
2968
3181
  getOffers: (parameters: getOffers$2.Parameters) => Promise<getOffers$2.ReturnType>;
2969
3182
  };
2970
- declare namespace get$4 {
3183
+ declare namespace get$5 {
2971
3184
  type Parameters = {
2972
3185
  /** The side of the offer. */side: "buy" | "sell"; /** The obligationId of the offer. */
2973
3186
  obligationId: Hex; /** Cursor string returned by a previous call, for pagination */
@@ -3003,9 +3216,11 @@ type CallbackInput = {
3003
3216
  contract: Address;
3004
3217
  user: Address;
3005
3218
  amount: bigint;
3219
+ positionTypeId: number;
3006
3220
  };
3007
3221
  type OfferCallbacks = {
3008
3222
  offerHash: Hex;
3223
+ obligationId: Hex;
3009
3224
  callbacks: CallbackInput[];
3010
3225
  };
3011
3226
  type CallbacksDomain = {
@@ -3075,18 +3290,20 @@ type LotsDomain = {
3075
3290
  * Called when offers are created to reserve liquidity on positions.
3076
3291
  * For each (position, group), keeps only the biggest offer by assets.
3077
3292
  * If lot exists and new offer is bigger, grows the lot and shifts higher lots.
3293
+ * Automatically upserts lots_positions bridge rows before inserting lots.
3078
3294
  */
3079
- create: (parameters: create$5.Parameters) => Promise<void>;
3295
+ create: (parameters: create$6.Parameters) => Promise<void>;
3080
3296
  /**
3081
3297
  * Get lots with optional filtering.
3082
3298
  */
3083
- get: (parameters?: get$3.Parameters) => Promise<Lot[]>;
3299
+ get: (parameters?: get$4.Parameters) => Promise<Lot[]>;
3084
3300
  };
3085
- declare namespace create$5 {
3301
+ declare namespace create$6 {
3086
3302
  type OfferLotInfo = {
3087
3303
  positionChainId: Id;
3088
3304
  positionContract: Address;
3089
3305
  positionUser: Address;
3306
+ positionTypeId: number;
3090
3307
  group: string;
3091
3308
  obligationId: string;
3092
3309
  size: bigint;
@@ -3094,7 +3311,7 @@ declare namespace create$5 {
3094
3311
  type Parameters = OfferLotInfo[];
3095
3312
  type ReturnType = undefined;
3096
3313
  }
3097
- declare namespace get$3 {
3314
+ declare namespace get$4 {
3098
3315
  type Parameters = {
3099
3316
  chainId?: Id;
3100
3317
  user?: Address;
@@ -3104,16 +3321,46 @@ declare namespace get$3 {
3104
3321
  };
3105
3322
  type ReturnType = Lot[];
3106
3323
  }
3107
- declare function create$5(db: Core): LotsDomain;
3324
+ declare function create$6(db: Core): LotsDomain;
3108
3325
  //#endregion
3109
3326
  //#region src/database/domains/Obligations.d.ts
3110
3327
  type ObligationsDomain = {
3111
3328
  /**
3112
- * Insert obligations (insert-only).
3113
- * @param obligations - Obligations to insert. {@link Obligation.Obligation}
3329
+ * Insert obligations and their onchain obligation id keys (insert-only).
3330
+ * @param obligations - Obligations to insert.
3331
+ */
3332
+ create: (obligations: create$5.Input[]) => Promise<void>;
3333
+ /**
3334
+ * Get active obligations with optional chain filters.
3335
+ * @param parameters - Optional chain filters.
3336
+ * @returns Matching obligations.
3114
3337
  */
3115
- create: (obligations: Obligation[]) => Promise<void>;
3338
+ get: (parameters?: {
3339
+ chainId?: Id[];
3340
+ }) => Promise<get$3.Output[]>;
3116
3341
  };
3342
+ /**
3343
+ * Create an obligations domain instance.
3344
+ * @param db - Database core instance.
3345
+ * @returns Obligations domain. {@link ObligationsDomain}
3346
+ */
3347
+ declare function create$5(db: Core): ObligationsDomain;
3348
+ declare namespace create$5 {
3349
+ type Input = {
3350
+ obligationId: Hex;
3351
+ chainId: Id;
3352
+ morphoV2: Address;
3353
+ obligation: Obligation$1;
3354
+ };
3355
+ }
3356
+ declare namespace get$3 {
3357
+ type Output = {
3358
+ obligationId: Hex;
3359
+ chainId: Id;
3360
+ morphoV2: Address;
3361
+ obligation: Obligation$1;
3362
+ };
3363
+ }
3117
3364
  //#endregion
3118
3365
  //#region src/database/domains/Offsets.d.ts
3119
3366
  type Offset = {
@@ -3186,7 +3433,7 @@ type PositionsDomain = {
3186
3433
  */
3187
3434
  getByUser: (parameters: getByUser.Parameters) => Promise<getByUser.ReturnType>;
3188
3435
  /**
3189
- * Set all positions to empty after a given block number (inclusive), deletes all transfers linked to the positions.
3436
+ * Set all positions of a given type to empty after a given block number (inclusive), deletes all transfers linked to the positions.
3190
3437
  * @param parameters - {@link setEmptyAfter.Parameters}
3191
3438
  * @returns The number of positions set to empty. {@link setEmptyAfter.ReturnType}
3192
3439
  */
@@ -3209,7 +3456,8 @@ declare namespace get$1 {
3209
3456
  }
3210
3457
  declare namespace getByUser {
3211
3458
  type Parameters = PaginationParams & {
3212
- /** The user address to get positions for. */user: Address;
3459
+ /** The user address to get positions for. */user: Address; /** The type of position to get. Default is all types. */
3460
+ type?: Type;
3213
3461
  };
3214
3462
  type PositionWithReserved = {
3215
3463
  chainId: Id;
@@ -3226,8 +3474,9 @@ declare namespace getByUser {
3226
3474
  }
3227
3475
  declare namespace setEmptyAfter {
3228
3476
  type Parameters = {
3229
- /** The chain id . */chainId: Id; /** The block number after which all positions should be set to empty. (inclusive) */
3230
- blockNumber: number;
3477
+ /** The chain id. */chainId: Id; /** The block number after which all positions should be set to empty. (inclusive) */
3478
+ blockNumber: number; /** The position type to target. */
3479
+ type: Type;
3231
3480
  };
3232
3481
  type ReturnType = number;
3233
3482
  }
@@ -3240,11 +3489,26 @@ type TransfersDomain = {
3240
3489
  * @returns The number of transfers created. {@link create.ReturnType}
3241
3490
  */
3242
3491
  create: (transfers: create$4.Parameters) => Promise<create$4.ReturnType>;
3492
+ /**
3493
+ * Delete transfers by chain, position type, and block number >= given value (for reorg rollback).
3494
+ * Reverses balance deltas on affected positions and cleans up orphan positions.
3495
+ * @param parameters - {@link del.Parameters}
3496
+ * @returns The number of transfers deleted. {@link del.ReturnType}
3497
+ */
3498
+ delete: (parameters: del.Parameters) => Promise<del.ReturnType>;
3243
3499
  };
3244
3500
  declare namespace create$4 {
3245
3501
  type Parameters = Transfer[];
3246
3502
  type ReturnType = number;
3247
3503
  }
3504
+ declare namespace del {
3505
+ type Parameters = {
3506
+ chainId: Id;
3507
+ blockNumberGte: number;
3508
+ positionTypeId: number;
3509
+ };
3510
+ type ReturnType = number;
3511
+ }
3248
3512
  declare const create$4: (db: Core) => TransfersDomain;
3249
3513
  //#endregion
3250
3514
  //#region src/database/domains/Trees.d.ts
@@ -3259,25 +3523,41 @@ type Attestation = {
3259
3523
  /**
3260
3524
  * Input for creating trees with their signatures.
3261
3525
  */
3262
- type CreateInput = {
3263
- tree: Tree;
3526
+ type UpsertInput = {
3527
+ root: Hex;
3264
3528
  signature: Hex;
3265
3529
  };
3530
+ type UpsertPathsInput = {
3531
+ offerHash: Hex;
3532
+ obligationId: Hex;
3533
+ treeRoot: Hex;
3534
+ proof: Hex[];
3535
+ };
3536
+ type OfferReference = {
3537
+ offerHash: Hex;
3538
+ obligationId: Hex;
3539
+ };
3266
3540
  type TreesDomain = {
3267
3541
  /**
3268
- * Creates trees and attestation links in a single transaction.
3542
+ * Creates or updates merkle roots and signatures.
3543
+ *
3544
+ * @param trees - Array of merkle root attestations
3545
+ * @returns Array of tree roots that were upserted
3546
+ */
3547
+ upsert: (trees: UpsertInput[]) => Promise<Hex[]>;
3548
+ /**
3549
+ * Creates or updates merkle proofs for offers.
3269
3550
  *
3270
- * @param trees - Array of decoded trees with signatures (batch insertion)
3271
- * @returns Array of tree roots that were created/upserted
3551
+ * @param paths - Array of offer proof rows
3272
3552
  */
3273
- create: (trees: CreateInput[]) => Promise<Hex[]>;
3553
+ upsertPaths: (paths: UpsertPathsInput[]) => Promise<void>;
3274
3554
  /**
3275
3555
  * Retrieves merkle attestations for execution flow.
3276
3556
  *
3277
- * @param hashes - Array of offer hashes to look up
3278
- * @returns Map of offer hash to attestation (only entries with attestations are included)
3557
+ * @param references - Array of offer references to look up
3558
+ * @returns Map of serialized offer key (`offerHash:obligationId`) to attestation
3279
3559
  */
3280
- getAttestations: (hashes: Hex[]) => Promise<Map<Hex, Attestation>>;
3560
+ getAttestations: (references: OfferReference[]) => Promise<Map<string, Attestation>>;
3281
3561
  };
3282
3562
  //#endregion
3283
3563
  //#region src/database/domains/Validations.d.ts
@@ -3304,6 +3584,36 @@ type ValidationsDomain = {
3304
3584
  */
3305
3585
  upsert: (validations: Validation[]) => Promise<void>;
3306
3586
  };
3587
+ //#endregion
3588
+ //#region src/database/readers/ObligationsListing.d.ts
3589
+ type ListObligationsParameters = {
3590
+ ids?: Hex[];
3591
+ chainId?: Id[];
3592
+ loanToken?: Address[];
3593
+ collateralToken?: Address[];
3594
+ maturity?: number[];
3595
+ sort?: string[];
3596
+ cursor?: string;
3597
+ limit?: number;
3598
+ };
3599
+ type ListedObligation = {
3600
+ obligationId: Hex;
3601
+ chainId: Id;
3602
+ obligation: Obligation$1;
3603
+ quote: Quote;
3604
+ };
3605
+ type ListObligationsResult = {
3606
+ obligations: ListedObligation[];
3607
+ nextCursor: string | null;
3608
+ };
3609
+ type ObligationsListingReader = {
3610
+ /**
3611
+ * Lists obligations with SQL keyset pagination and opaque cursor handling.
3612
+ * @param parameters - Optional filters, sorting, and pagination cursor.
3613
+ * @returns Listed obligations with associated quotes and a next cursor.
3614
+ */
3615
+ list: (parameters?: ListObligationsParameters) => Promise<ListObligationsResult>;
3616
+ };
3307
3617
  declare namespace Database_d_exports {
3308
3618
  export { Core, Database, Driver, WithDomains, connect$2 as connect, getSchemaNamesForMigration };
3309
3619
  }
@@ -3324,7 +3634,13 @@ type Domains = {
3324
3634
  positions: PositionsDomain;
3325
3635
  transfers: TransfersDomain;
3326
3636
  };
3327
- type WithDomains<D extends Driver> = D & Domains;
3637
+ type Readers = {
3638
+ obligations: ObligationsListingReader;
3639
+ };
3640
+ type DatabaseFacade = Domains & {
3641
+ readers: Readers;
3642
+ };
3643
+ type WithDomains<D extends Driver> = D & DatabaseFacade;
3328
3644
  type Core = Omit<WithDomains<Driver>, "transaction"> & {
3329
3645
  transaction<T>(fn: (tx: WithDomains<Driver>) => Promise<T>): Promise<T>;
3330
3646
  };
@@ -3489,7 +3805,10 @@ type GatekeeperClient = {
3489
3805
  statusCode: number;
3490
3806
  body: ConfigRulesPayload;
3491
3807
  }>; /** Validate offers and return decision results. */
3492
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
3808
+ isAllowed: (parameters: {
3809
+ offers: Offer[];
3810
+ chainId: number;
3811
+ }) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
3493
3812
  baseUrl: string;
3494
3813
  };
3495
3814
  type ClientConfig = {
@@ -3944,11 +4263,16 @@ interface paths {
3944
4263
  };
3945
4264
  /**
3946
4265
  * List all obligations
3947
- * @description Returns a list of obligations with their current best ask and bid. Obligations are sorted by their id in ascending order by default.
4266
+ * @description Returns a list of obligations with their current best ask and bid. Sorting is customizable with the sort parameter and defaults to id ascending.
3948
4267
  */
3949
4268
  get: {
3950
4269
  parameters: {
3951
4270
  query?: {
4271
+ /**
4272
+ * @description Sort order as comma-separated fields (`id`, `ask`, `bid`, `maturity`). Prefix with `-` for descending order. Max 3 fields.
4273
+ * @example -ask,bid,maturity
4274
+ */
4275
+ sort?: string;
3952
4276
  /**
3953
4277
  * @description Filter by exact maturity timestamps (comma-separated, unix seconds).
3954
4278
  * @example 1761922800,1764524800
@@ -3975,8 +4299,8 @@ interface paths {
3975
4299
  */
3976
4300
  limit?: number;
3977
4301
  /**
3978
- * @description Obligation id cursor for pagination.
3979
- * @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc
4302
+ * @description Pagination cursor in base64url-encoded format.
4303
+ * @example eyJzb3J0IjpbImlkIl0sImlkIjoiMHgxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAiLCJhc2siOiIwIiwiYmlkIjoiMCIsIm1hdHVyaXR5IjoxNzYxOTIyODAwfQ
3980
4304
  */
3981
4305
  cursor?: string;
3982
4306
  };
@@ -4461,7 +4785,8 @@ interface components {
4461
4785
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
4462
4786
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
4463
4787
  * "callback": "0x0000000000000000000000000000000000000000",
4464
- * "callback_data": "0x"
4788
+ * "callback_data": "0x",
4789
+ * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
4465
4790
  * },
4466
4791
  * "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
4467
4792
  * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
@@ -4505,7 +4830,8 @@ interface components {
4505
4830
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
4506
4831
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
4507
4832
  * "callback": "0x0000000000000000000000000000000000000000",
4508
- * "callback_data": "0x"
4833
+ * "callback_data": "0x",
4834
+ * "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
4509
4835
  * }
4510
4836
  */
4511
4837
  offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
@@ -4551,7 +4877,8 @@ interface components {
4551
4877
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
4552
4878
  session: string; /** @example 0x0000000000000000000000000000000000000000 */
4553
4879
  callback: string; /** @example 0x */
4554
- callback_data: string;
4880
+ callback_data: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
4881
+ receiver_if_maker_is_seller: string;
4555
4882
  };
4556
4883
  ObligationOfferResponse: {
4557
4884
  /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
@@ -4573,7 +4900,7 @@ interface components {
4573
4900
  oracle: string;
4574
4901
  };
4575
4902
  ObligationListResponse: {
4576
- meta: components["schemas"]["Meta"]; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
4903
+ meta: components["schemas"]["Meta"]; /** @example eyJzb3J0IjpbImlkIl0sImlkIjoiMHgxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAiLCJhc2siOiIwIiwiYmlkIjoiMCIsIm1hdHVyaXR5IjoxNzYxOTIyODAwfQ */
4577
4904
  cursor: string | null; /** @description List of obligations with takable offers. */
4578
4905
  data: components["schemas"]["ObligationResponse"][];
4579
4906
  };
@@ -4587,10 +4914,20 @@ interface components {
4587
4914
  bid: components["schemas"]["BidResponse"];
4588
4915
  };
4589
4916
  AskResponse: {
4590
- /** @example 1000000000000000000 */price: string;
4917
+ /**
4918
+ * @description Best ask tick. Null when there is no active ask quote.
4919
+ * @example 500
4920
+ */
4921
+ tick: number | null; /** @example 1000000000000000000 */
4922
+ price: string;
4591
4923
  };
4592
4924
  BidResponse: {
4593
- /** @example 1000000000000000000 */price: string;
4925
+ /**
4926
+ * @description Best bid tick. Null when there is no active bid quote.
4927
+ * @example 500
4928
+ */
4929
+ tick: number | null; /** @example 1000000000000000000 */
4930
+ price: string;
4594
4931
  };
4595
4932
  ObligationSingleSuccessResponse: {
4596
4933
  meta: components["schemas"]["Meta"]; /** @example null */
@@ -4717,7 +5054,12 @@ interface components {
4717
5054
  block_number: number;
4718
5055
  };
4719
5056
  ValidateOffersRequest: {
4720
- /** @description Array of offers in snake_case format. Required, non-empty. */offers: components["schemas"]["ValidateOfferRequest"][];
5057
+ /**
5058
+ * @description Chain id used for chain-scoped validation rules.
5059
+ * @example 1
5060
+ */
5061
+ chain_id: number; /** @description Array of offers in snake_case format. Required, non-empty. */
5062
+ offers: components["schemas"]["ValidateOfferRequest"][];
4721
5063
  };
4722
5064
  ValidateOfferRequest: {
4723
5065
  /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
@@ -4730,8 +5072,7 @@ interface components {
4730
5072
  start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
4731
5073
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
4732
5074
  session: string; /** @example false */
4733
- buy: boolean; /** @example 1 */
4734
- chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
5075
+ buy: boolean; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
4735
5076
  loan_token: string;
4736
5077
  /**
4737
5078
  * @example [
@@ -4749,7 +5090,8 @@ interface components {
4749
5090
  * "data": "0x"
4750
5091
  * }
4751
5092
  */
4752
- callback: components["schemas"]["ValidateCallbackRequest"];
5093
+ callback: components["schemas"]["ValidateCallbackRequest"]; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
5094
+ receiver_if_maker_is_seller: string;
4753
5095
  };
4754
5096
  ValidateCollateralRequest: {
4755
5097
  /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
@@ -4792,15 +5134,18 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
4792
5134
  * Creates an `ObligationResponse` from a `Obligation`.
4793
5135
  * @constructor
4794
5136
  * @param obligation - {@link Obligation}
5137
+ * @param quote - {@link Quote}
5138
+ * @param chainId - The chain id used to compute `id`.
4795
5139
  * @returns The created `ObligationResponse`. {@link ObligationResponse}
4796
5140
  */
4797
- declare function from$3(obligation: Obligation, quote: Quote): ObligationResponse;
5141
+ declare function from$3(obligation: Obligation$1, quote: Quote, chainId: Id): ObligationResponse;
4798
5142
  declare namespace OfferResponse_d_exports {
4799
5143
  export { Input, OfferResponse, from$2 as from };
4800
5144
  }
4801
5145
  type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
4802
5146
  type Input = Readonly<{
4803
5147
  hash: Hex;
5148
+ obligationId: Hex;
4804
5149
  maker: Address;
4805
5150
  assets: bigint;
4806
5151
  obligationUnits: bigint;
@@ -4823,6 +5168,7 @@ type Input = Readonly<{
4823
5168
  address: Address;
4824
5169
  data: Hex;
4825
5170
  };
5171
+ receiverIfMakerIsSeller: Address;
4826
5172
  root?: Hex | undefined;
4827
5173
  proof?: Hex[] | undefined;
4828
5174
  signature?: Hex | undefined;
@@ -4957,6 +5303,7 @@ declare const schemas: {
4957
5303
  loan_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
4958
5304
  collateral_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
4959
5305
  maturities: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
5306
+ sort: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodString>>>;
4960
5307
  limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
4961
5308
  }, z$1.core.$strip>;
4962
5309
  readonly get_obligation: z$1.ZodObject<{
@@ -4972,6 +5319,7 @@ declare const schemas: {
4972
5319
  limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
4973
5320
  }, z$1.core.$strip>;
4974
5321
  readonly validate_offers: z$1.ZodObject<{
5322
+ chain_id: z$1.ZodNumber;
4975
5323
  offers: z$1.ZodArray<z$1.ZodUnknown>;
4976
5324
  }, z$1.core.$strict>;
4977
5325
  readonly get_user_positions: z$1.ZodObject<{
@@ -5103,14 +5451,18 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
5103
5451
  */
5104
5452
  declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
5105
5453
  declare namespace Gatekeeper_d_exports {
5106
- export { Gatekeeper, Rules, create };
5454
+ export { Gatekeeper, Rules, RulesFactory, create };
5107
5455
  }
5108
5456
  type Rules = readonly Rule<Offer, string>[];
5457
+ type RulesFactory = (chainId: Id) => Rules;
5109
5458
  type Gatekeeper = {
5110
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
5459
+ isAllowed: (parameters: {
5460
+ offers: Offer[];
5461
+ chainId: Id;
5462
+ }) => Promise<Result<Offer, string>>;
5111
5463
  };
5112
5464
  type GatekeeperParameters = {
5113
- rules: Rules;
5465
+ rules: RulesFactory;
5114
5466
  };
5115
5467
  /**
5116
5468
  * Create a gatekeeper instance with the provided rules.
@@ -5227,18 +5579,22 @@ declare namespace getOffers {
5227
5579
  }
5228
5580
  declare function getObligations(apiClient: Client$1<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
5229
5581
  declare namespace getObligations {
5582
+ type SortField = "id" | "ask" | "bid" | "maturity";
5583
+ type SortEntry = SortField | `-${SortField}`;
5230
5584
  type Parameters = {
5231
- /** Pagination cursor is a 32-byte hex string. */cursor?: Hex; /** Maximum number of obligations to return. @default 20 */
5585
+ /** Pagination cursor in base64url-encoded format. */cursor?: string; /** Maximum number of obligations to return. @default 20 */
5232
5586
  limit?: number; /** Filter by chain IDs (comma-separated). */
5233
5587
  chainIds?: number[]; /** Filter by loan token addresses (comma-separated). */
5234
5588
  loanTokens?: Address[]; /** Filter by collateral tokens (comma-separated, matches any collateral). */
5235
5589
  collateralTokens?: Address[]; /** Filter by exact maturity timestamps (comma-separated, unix seconds). */
5236
- maturities?: number[];
5590
+ maturities?: number[]; /** Sort order entries in priority order. Prefix with '-' for descending. Max 3 fields. */
5591
+ sort?: SortEntry[];
5237
5592
  };
5238
5593
  type ReturnType = {
5239
5594
  obligations: Compute<{
5240
- /** The obligation id. Uses {@link Obligation.id} to calculate the id.*/id: () => Hex;
5241
- } & Obligation & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
5595
+ /** The obligation id returned by the API. */id: Hex; /** The chain id used to compute the obligation id. */
5596
+ chainId: Id;
5597
+ } & Obligation$1 & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
5242
5598
  cursor: string | null;
5243
5599
  };
5244
5600
  type ErrorType = GetApiErrorType;
@@ -5270,11 +5626,12 @@ declare class HttpGetApiFailedError extends BaseError {
5270
5626
  }
5271
5627
  //#endregion
5272
5628
  //#region src/database/drizzle/VERSION.d.ts
5273
- declare const VERSION: "router_v1.8";
5629
+ declare const VERSION: "router_v1.11";
5274
5630
  //#endregion
5275
5631
  //#region src/database/drizzle/schema.d.ts
5276
5632
  declare enum EnumTableName {
5277
5633
  OBLIGATIONS = "obligations",
5634
+ OBLIGATION_ID_KEYS = "obligation_id_keys",
5278
5635
  GROUPS = "groups",
5279
5636
  CONSUMED_EVENTS = "consumed_events",
5280
5637
  OBLIGATION_COLLATERALS_V2 = "obligation_collaterals_v2",
@@ -5288,20 +5645,21 @@ declare enum EnumTableName {
5288
5645
  COLLECTORS = "collectors",
5289
5646
  CHAINS = "chains",
5290
5647
  LOTS = "lots",
5648
+ LOTS_POSITIONS = "lots_positions",
5291
5649
  OFFSETS = "offsets",
5292
5650
  TREES = "trees",
5293
5651
  MERKLE_PATHS = "merkle_paths"
5294
5652
  }
5295
5653
  declare const TABLE_NAMES: readonly EnumTableName[];
5296
- declare const VERSIONED_TABLE_NAMES: ("\"router_v1.8\".\"obligations\"" | "\"router_v1.8\".\"groups\"" | "\"router_v1.8\".\"consumed_events\"" | "\"router_v1.8\".\"obligation_collaterals_v2\"" | "\"router_v1.8\".\"oracles\"" | "\"router_v1.8\".\"offers\"" | "\"router_v1.8\".\"offers_callbacks\"" | "\"router_v1.8\".\"callbacks\"" | "\"router_v1.8\".\"positions\"" | "\"router_v1.8\".\"transfers\"" | "\"router_v1.8\".\"validations\"" | "\"router_v1.8\".\"collectors\"" | "\"router_v1.8\".\"chains\"" | "\"router_v1.8\".\"lots\"" | "\"router_v1.8\".\"offsets\"" | "\"router_v1.8\".\"trees\"" | "\"router_v1.8\".\"merkle_paths\"")[];
5654
+ declare const VERSIONED_TABLE_NAMES: ("\"router_v1.11\".\"obligations\"" | "\"router_v1.11\".\"obligation_id_keys\"" | "\"router_v1.11\".\"groups\"" | "\"router_v1.11\".\"consumed_events\"" | "\"router_v1.11\".\"obligation_collaterals_v2\"" | "\"router_v1.11\".\"oracles\"" | "\"router_v1.11\".\"offers\"" | "\"router_v1.11\".\"offers_callbacks\"" | "\"router_v1.11\".\"callbacks\"" | "\"router_v1.11\".\"positions\"" | "\"router_v1.11\".\"transfers\"" | "\"router_v1.11\".\"validations\"" | "\"router_v1.11\".\"collectors\"" | "\"router_v1.11\".\"chains\"" | "\"router_v1.11\".\"lots\"" | "\"router_v1.11\".\"lots_positions\"" | "\"router_v1.11\".\"offsets\"" | "\"router_v1.11\".\"trees\"" | "\"router_v1.11\".\"merkle_paths\"")[];
5297
5655
  type TableName = (typeof TABLE_NAMES)[number];
5298
5656
  type VersionedTableName = `"${typeof VERSION}"."${TableName}"`;
5299
5657
  declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5300
5658
  name: EnumTableName.OBLIGATIONS;
5301
- schema: "router_v1.8";
5659
+ schema: "router_v1.11";
5302
5660
  columns: {
5303
- obligationId: drizzle_orm_pg_core0.PgColumn<{
5304
- name: "obligation_id";
5661
+ obligationKey: drizzle_orm_pg_core0.PgColumn<{
5662
+ name: "obligation_key";
5305
5663
  tableName: EnumTableName.OBLIGATIONS;
5306
5664
  dataType: "string";
5307
5665
  columnType: "PgVarchar";
@@ -5319,12 +5677,31 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5319
5677
  }, {}, {
5320
5678
  length: 66;
5321
5679
  }>;
5322
- chainId: drizzle_orm_pg_core0.PgColumn<{
5323
- name: "chain_id";
5680
+ loanToken: drizzle_orm_pg_core0.PgColumn<{
5681
+ name: "loan_token";
5682
+ tableName: EnumTableName.OBLIGATIONS;
5683
+ dataType: "string";
5684
+ columnType: "PgVarchar";
5685
+ data: string;
5686
+ driverParam: string;
5687
+ notNull: true;
5688
+ hasDefault: false;
5689
+ isPrimaryKey: false;
5690
+ isAutoincrement: false;
5691
+ hasRuntimeDefault: false;
5692
+ enumValues: [string, ...string[]];
5693
+ baseColumn: never;
5694
+ identity: undefined;
5695
+ generated: undefined;
5696
+ }, {}, {
5697
+ length: 42;
5698
+ }>;
5699
+ maturity: drizzle_orm_pg_core0.PgColumn<{
5700
+ name: "maturity";
5324
5701
  tableName: EnumTableName.OBLIGATIONS;
5325
5702
  dataType: "number";
5326
- columnType: "PgBigInt53";
5327
- data: Id;
5703
+ columnType: "PgInteger";
5704
+ data: number;
5328
5705
  driverParam: string | number;
5329
5706
  notNull: true;
5330
5707
  hasDefault: false;
@@ -5335,12 +5712,36 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5335
5712
  baseColumn: never;
5336
5713
  identity: undefined;
5337
5714
  generated: undefined;
5715
+ }, {}, {}>;
5716
+ };
5717
+ dialect: "pg";
5718
+ }>;
5719
+ declare const obligationIdKeys: drizzle_orm_pg_core0.PgTableWithColumns<{
5720
+ name: EnumTableName.OBLIGATION_ID_KEYS;
5721
+ schema: "router_v1.11";
5722
+ columns: {
5723
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
5724
+ name: "obligation_id";
5725
+ tableName: EnumTableName.OBLIGATION_ID_KEYS;
5726
+ dataType: "string";
5727
+ columnType: "PgVarchar";
5728
+ data: string;
5729
+ driverParam: string;
5730
+ notNull: true;
5731
+ hasDefault: false;
5732
+ isPrimaryKey: true;
5733
+ isAutoincrement: false;
5734
+ hasRuntimeDefault: false;
5735
+ enumValues: [string, ...string[]];
5736
+ baseColumn: never;
5737
+ identity: undefined;
5738
+ generated: undefined;
5338
5739
  }, {}, {
5339
- $type: Id;
5740
+ length: 66;
5340
5741
  }>;
5341
- loanToken: drizzle_orm_pg_core0.PgColumn<{
5342
- name: "loan_token";
5343
- tableName: EnumTableName.OBLIGATIONS;
5742
+ obligationKey: drizzle_orm_pg_core0.PgColumn<{
5743
+ name: "obligation_key";
5744
+ tableName: EnumTableName.OBLIGATION_ID_KEYS;
5344
5745
  dataType: "string";
5345
5746
  columnType: "PgVarchar";
5346
5747
  data: string;
@@ -5355,14 +5756,14 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5355
5756
  identity: undefined;
5356
5757
  generated: undefined;
5357
5758
  }, {}, {
5358
- length: 42;
5759
+ length: 66;
5359
5760
  }>;
5360
- maturity: drizzle_orm_pg_core0.PgColumn<{
5361
- name: "maturity";
5362
- tableName: EnumTableName.OBLIGATIONS;
5761
+ chainId: drizzle_orm_pg_core0.PgColumn<{
5762
+ name: "chain_id";
5763
+ tableName: EnumTableName.OBLIGATION_ID_KEYS;
5363
5764
  dataType: "number";
5364
- columnType: "PgInteger";
5365
- data: number;
5765
+ columnType: "PgBigInt53";
5766
+ data: Id;
5366
5767
  driverParam: string | number;
5367
5768
  notNull: true;
5368
5769
  hasDefault: false;
@@ -5373,13 +5774,34 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5373
5774
  baseColumn: never;
5374
5775
  identity: undefined;
5375
5776
  generated: undefined;
5376
- }, {}, {}>;
5777
+ }, {}, {
5778
+ $type: Id;
5779
+ }>;
5780
+ morphoV2: drizzle_orm_pg_core0.PgColumn<{
5781
+ name: "morpho_v2";
5782
+ tableName: EnumTableName.OBLIGATION_ID_KEYS;
5783
+ dataType: "string";
5784
+ columnType: "PgVarchar";
5785
+ data: string;
5786
+ driverParam: string;
5787
+ notNull: true;
5788
+ hasDefault: false;
5789
+ isPrimaryKey: false;
5790
+ isAutoincrement: false;
5791
+ hasRuntimeDefault: false;
5792
+ enumValues: [string, ...string[]];
5793
+ baseColumn: never;
5794
+ identity: undefined;
5795
+ generated: undefined;
5796
+ }, {}, {
5797
+ length: 42;
5798
+ }>;
5377
5799
  };
5378
5800
  dialect: "pg";
5379
5801
  }>;
5380
5802
  declare const groups: drizzle_orm_pg_core0.PgTableWithColumns<{
5381
5803
  name: EnumTableName.GROUPS;
5382
- schema: "router_v1.8";
5804
+ schema: "router_v1.11";
5383
5805
  columns: {
5384
5806
  chainId: drizzle_orm_pg_core0.PgColumn<{
5385
5807
  name: "chain_id";
@@ -5494,7 +5916,7 @@ declare const groups: drizzle_orm_pg_core0.PgTableWithColumns<{
5494
5916
  }>;
5495
5917
  declare const consumedEvents: drizzle_orm_pg_core0.PgTableWithColumns<{
5496
5918
  name: EnumTableName.CONSUMED_EVENTS;
5497
- schema: "router_v1.8";
5919
+ schema: "router_v1.11";
5498
5920
  columns: {
5499
5921
  eventId: drizzle_orm_pg_core0.PgColumn<{
5500
5922
  name: "event_id";
@@ -5628,10 +6050,10 @@ declare const consumedEvents: drizzle_orm_pg_core0.PgTableWithColumns<{
5628
6050
  }>;
5629
6051
  declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5630
6052
  name: EnumTableName.OBLIGATION_COLLATERALS_V2;
5631
- schema: "router_v1.8";
6053
+ schema: "router_v1.11";
5632
6054
  columns: {
5633
- obligationId: drizzle_orm_pg_core0.PgColumn<{
5634
- name: "obligation_id";
6055
+ obligationKey: drizzle_orm_pg_core0.PgColumn<{
6056
+ name: "obligation_key";
5635
6057
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
5636
6058
  dataType: "string";
5637
6059
  columnType: "PgVarchar";
@@ -5649,43 +6071,24 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5649
6071
  }, {}, {
5650
6072
  length: 66;
5651
6073
  }>;
5652
- asset: drizzle_orm_pg_core0.PgColumn<{
5653
- name: "asset";
5654
- tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
5655
- dataType: "string";
5656
- columnType: "PgVarchar";
5657
- data: string;
5658
- driverParam: string;
5659
- notNull: true;
5660
- hasDefault: false;
5661
- isPrimaryKey: false;
5662
- isAutoincrement: false;
5663
- hasRuntimeDefault: false;
5664
- enumValues: [string, ...string[]];
5665
- baseColumn: never;
5666
- identity: undefined;
5667
- generated: undefined;
5668
- }, {}, {
5669
- length: 42;
5670
- }>;
5671
- oracleChainId: drizzle_orm_pg_core0.PgColumn<{
5672
- name: "oracle_chain_id";
6074
+ asset: drizzle_orm_pg_core0.PgColumn<{
6075
+ name: "asset";
5673
6076
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
5674
- dataType: "number";
5675
- columnType: "PgBigInt53";
5676
- data: Id;
5677
- driverParam: string | number;
6077
+ dataType: "string";
6078
+ columnType: "PgVarchar";
6079
+ data: string;
6080
+ driverParam: string;
5678
6081
  notNull: true;
5679
6082
  hasDefault: false;
5680
6083
  isPrimaryKey: false;
5681
6084
  isAutoincrement: false;
5682
6085
  hasRuntimeDefault: false;
5683
- enumValues: undefined;
6086
+ enumValues: [string, ...string[]];
5684
6087
  baseColumn: never;
5685
6088
  identity: undefined;
5686
6089
  generated: undefined;
5687
6090
  }, {}, {
5688
- $type: Id;
6091
+ length: 42;
5689
6092
  }>;
5690
6093
  oracleAddress: drizzle_orm_pg_core0.PgColumn<{
5691
6094
  name: "oracle_address";
@@ -5723,6 +6126,23 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5723
6126
  identity: undefined;
5724
6127
  generated: undefined;
5725
6128
  }, {}, {}>;
6129
+ collateralIndex: drizzle_orm_pg_core0.PgColumn<{
6130
+ name: "collateral_index";
6131
+ tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
6132
+ dataType: "number";
6133
+ columnType: "PgInteger";
6134
+ data: number;
6135
+ driverParam: string | number;
6136
+ notNull: true;
6137
+ hasDefault: false;
6138
+ isPrimaryKey: false;
6139
+ isAutoincrement: false;
6140
+ hasRuntimeDefault: false;
6141
+ enumValues: undefined;
6142
+ baseColumn: never;
6143
+ identity: undefined;
6144
+ generated: undefined;
6145
+ }, {}, {}>;
5726
6146
  updatedAt: drizzle_orm_pg_core0.PgColumn<{
5727
6147
  name: "updated_at";
5728
6148
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
@@ -5745,7 +6165,7 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5745
6165
  }>;
5746
6166
  declare const oracles: drizzle_orm_pg_core0.PgTableWithColumns<{
5747
6167
  name: EnumTableName.ORACLES;
5748
- schema: "router_v1.8";
6168
+ schema: "router_v1.11";
5749
6169
  columns: {
5750
6170
  chainId: drizzle_orm_pg_core0.PgColumn<{
5751
6171
  name: "chain_id";
@@ -5841,7 +6261,7 @@ declare const oracles: drizzle_orm_pg_core0.PgTableWithColumns<{
5841
6261
  }>;
5842
6262
  declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
5843
6263
  name: EnumTableName.OFFERS;
5844
- schema: "router_v1.8";
6264
+ schema: "router_v1.11";
5845
6265
  columns: {
5846
6266
  hash: drizzle_orm_pg_core0.PgColumn<{
5847
6267
  name: "hash";
@@ -5852,7 +6272,7 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
5852
6272
  driverParam: string;
5853
6273
  notNull: true;
5854
6274
  hasDefault: false;
5855
- isPrimaryKey: true;
6275
+ isPrimaryKey: false;
5856
6276
  isAutoincrement: false;
5857
6277
  hasRuntimeDefault: false;
5858
6278
  enumValues: [string, ...string[]];
@@ -6129,6 +6549,25 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
6129
6549
  identity: undefined;
6130
6550
  generated: undefined;
6131
6551
  }, {}, {}>;
6552
+ receiverIfMakerIsSeller: drizzle_orm_pg_core0.PgColumn<{
6553
+ name: "receiver_if_maker_is_seller";
6554
+ tableName: EnumTableName.OFFERS;
6555
+ dataType: "string";
6556
+ columnType: "PgVarchar";
6557
+ data: string;
6558
+ driverParam: string;
6559
+ notNull: false;
6560
+ hasDefault: false;
6561
+ isPrimaryKey: false;
6562
+ isAutoincrement: false;
6563
+ hasRuntimeDefault: false;
6564
+ enumValues: [string, ...string[]];
6565
+ baseColumn: never;
6566
+ identity: undefined;
6567
+ generated: undefined;
6568
+ }, {}, {
6569
+ length: 42;
6570
+ }>;
6132
6571
  blockNumber: drizzle_orm_pg_core0.PgColumn<{
6133
6572
  name: "block_number";
6134
6573
  tableName: EnumTableName.OFFERS;
@@ -6168,7 +6607,7 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
6168
6607
  }>;
6169
6608
  declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6170
6609
  name: EnumTableName.OFFERS_CALLBACKS;
6171
- schema: "router_v1.8";
6610
+ schema: "router_v1.11";
6172
6611
  columns: {
6173
6612
  offerHash: drizzle_orm_pg_core0.PgColumn<{
6174
6613
  name: "offer_hash";
@@ -6189,6 +6628,25 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6189
6628
  }, {}, {
6190
6629
  length: 66;
6191
6630
  }>;
6631
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
6632
+ name: "obligation_id";
6633
+ tableName: EnumTableName.OFFERS_CALLBACKS;
6634
+ dataType: "string";
6635
+ columnType: "PgVarchar";
6636
+ data: string;
6637
+ driverParam: string;
6638
+ notNull: true;
6639
+ hasDefault: false;
6640
+ isPrimaryKey: false;
6641
+ isAutoincrement: false;
6642
+ hasRuntimeDefault: false;
6643
+ enumValues: [string, ...string[]];
6644
+ baseColumn: never;
6645
+ identity: undefined;
6646
+ generated: undefined;
6647
+ }, {}, {
6648
+ length: 66;
6649
+ }>;
6192
6650
  callbackId: drizzle_orm_pg_core0.PgColumn<{
6193
6651
  name: "callback_id";
6194
6652
  tableName: EnumTableName.OFFERS_CALLBACKS;
@@ -6213,7 +6671,7 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6213
6671
  }>;
6214
6672
  declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6215
6673
  name: EnumTableName.CALLBACKS;
6216
- schema: "router_v1.8";
6674
+ schema: "router_v1.11";
6217
6675
  columns: {
6218
6676
  id: drizzle_orm_pg_core0.PgColumn<{
6219
6677
  name: "id";
@@ -6291,6 +6749,23 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6291
6749
  }, {}, {
6292
6750
  length: 42;
6293
6751
  }>;
6752
+ positionTypeId: drizzle_orm_pg_core0.PgColumn<{
6753
+ name: "position_type_id";
6754
+ tableName: EnumTableName.CALLBACKS;
6755
+ dataType: "number";
6756
+ columnType: "PgInteger";
6757
+ data: number;
6758
+ driverParam: string | number;
6759
+ notNull: true;
6760
+ hasDefault: false;
6761
+ isPrimaryKey: false;
6762
+ isAutoincrement: false;
6763
+ hasRuntimeDefault: false;
6764
+ enumValues: undefined;
6765
+ baseColumn: never;
6766
+ identity: undefined;
6767
+ generated: undefined;
6768
+ }, {}, {}>;
6294
6769
  amount: drizzle_orm_pg_core0.PgColumn<{
6295
6770
  name: "amount";
6296
6771
  tableName: EnumTableName.CALLBACKS;
@@ -6311,9 +6786,90 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6311
6786
  };
6312
6787
  dialect: "pg";
6313
6788
  }>;
6789
+ declare const lotsPositions: drizzle_orm_pg_core0.PgTableWithColumns<{
6790
+ name: EnumTableName.LOTS_POSITIONS;
6791
+ schema: "router_v1.11";
6792
+ columns: {
6793
+ chainId: drizzle_orm_pg_core0.PgColumn<{
6794
+ name: "chain_id";
6795
+ tableName: EnumTableName.LOTS_POSITIONS;
6796
+ dataType: "number";
6797
+ columnType: "PgBigInt53";
6798
+ data: Id;
6799
+ driverParam: string | number;
6800
+ notNull: true;
6801
+ hasDefault: false;
6802
+ isPrimaryKey: false;
6803
+ isAutoincrement: false;
6804
+ hasRuntimeDefault: false;
6805
+ enumValues: undefined;
6806
+ baseColumn: never;
6807
+ identity: undefined;
6808
+ generated: undefined;
6809
+ }, {}, {
6810
+ $type: Id;
6811
+ }>;
6812
+ contract: drizzle_orm_pg_core0.PgColumn<{
6813
+ name: "contract";
6814
+ tableName: EnumTableName.LOTS_POSITIONS;
6815
+ dataType: "string";
6816
+ columnType: "PgVarchar";
6817
+ data: string;
6818
+ driverParam: string;
6819
+ notNull: true;
6820
+ hasDefault: false;
6821
+ isPrimaryKey: false;
6822
+ isAutoincrement: false;
6823
+ hasRuntimeDefault: false;
6824
+ enumValues: [string, ...string[]];
6825
+ baseColumn: never;
6826
+ identity: undefined;
6827
+ generated: undefined;
6828
+ }, {}, {
6829
+ length: 42;
6830
+ }>;
6831
+ user: drizzle_orm_pg_core0.PgColumn<{
6832
+ name: "user";
6833
+ tableName: EnumTableName.LOTS_POSITIONS;
6834
+ dataType: "string";
6835
+ columnType: "PgVarchar";
6836
+ data: string;
6837
+ driverParam: string;
6838
+ notNull: true;
6839
+ hasDefault: false;
6840
+ isPrimaryKey: false;
6841
+ isAutoincrement: false;
6842
+ hasRuntimeDefault: false;
6843
+ enumValues: [string, ...string[]];
6844
+ baseColumn: never;
6845
+ identity: undefined;
6846
+ generated: undefined;
6847
+ }, {}, {
6848
+ length: 42;
6849
+ }>;
6850
+ positionTypeId: drizzle_orm_pg_core0.PgColumn<{
6851
+ name: "position_type_id";
6852
+ tableName: EnumTableName.LOTS_POSITIONS;
6853
+ dataType: "number";
6854
+ columnType: "PgInteger";
6855
+ data: number;
6856
+ driverParam: string | number;
6857
+ notNull: true;
6858
+ hasDefault: false;
6859
+ isPrimaryKey: false;
6860
+ isAutoincrement: false;
6861
+ hasRuntimeDefault: false;
6862
+ enumValues: undefined;
6863
+ baseColumn: never;
6864
+ identity: undefined;
6865
+ generated: undefined;
6866
+ }, {}, {}>;
6867
+ };
6868
+ dialect: "pg";
6869
+ }>;
6314
6870
  declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
6315
6871
  name: EnumTableName.LOTS;
6316
- schema: "router_v1.8";
6872
+ schema: "router_v1.11";
6317
6873
  columns: {
6318
6874
  chainId: drizzle_orm_pg_core0.PgColumn<{
6319
6875
  name: "chain_id";
@@ -6449,7 +7005,7 @@ declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
6449
7005
  }>;
6450
7006
  declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
6451
7007
  name: EnumTableName.OFFSETS;
6452
- schema: "router_v1.8";
7008
+ schema: "router_v1.11";
6453
7009
  columns: {
6454
7010
  chainId: drizzle_orm_pg_core0.PgColumn<{
6455
7011
  name: "chain_id";
@@ -6569,7 +7125,7 @@ declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
6569
7125
  declare const PositionTypes: drizzle_orm_pg_core0.PgEnum<[Type, ...Type[]]>;
6570
7126
  declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
6571
7127
  name: "position_types";
6572
- schema: "router_v1.8";
7128
+ schema: "router_v1.11";
6573
7129
  columns: {
6574
7130
  id: drizzle_orm_pg_core0.PgColumn<{
6575
7131
  name: "id";
@@ -6610,7 +7166,7 @@ declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
6610
7166
  }>;
6611
7167
  declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6612
7168
  name: EnumTableName.POSITIONS;
6613
- schema: "router_v1.8";
7169
+ schema: "router_v1.11";
6614
7170
  columns: {
6615
7171
  chainId: drizzle_orm_pg_core0.PgColumn<{
6616
7172
  name: "chain_id";
@@ -6648,7 +7204,7 @@ declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6648
7204
  identity: undefined;
6649
7205
  generated: undefined;
6650
7206
  }, {}, {
6651
- length: 42;
7207
+ length: 66;
6652
7208
  }>;
6653
7209
  user: drizzle_orm_pg_core0.PgColumn<{
6654
7210
  name: "user";
@@ -6710,7 +7266,7 @@ declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6710
7266
  columnType: "PgVarchar";
6711
7267
  data: string;
6712
7268
  driverParam: string;
6713
- notNull: false;
7269
+ notNull: true;
6714
7270
  hasDefault: false;
6715
7271
  isPrimaryKey: false;
6716
7272
  isAutoincrement: false;
@@ -6761,7 +7317,7 @@ declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6761
7317
  }>;
6762
7318
  declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6763
7319
  name: EnumTableName.TRANSFERS;
6764
- schema: "router_v1.8";
7320
+ schema: "router_v1.11";
6765
7321
  columns: {
6766
7322
  eventId: drizzle_orm_pg_core0.PgColumn<{
6767
7323
  name: "event_id";
@@ -6818,7 +7374,7 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6818
7374
  identity: undefined;
6819
7375
  generated: undefined;
6820
7376
  }, {}, {
6821
- length: 42;
7377
+ length: 66;
6822
7378
  }>;
6823
7379
  from: drizzle_orm_pg_core0.PgColumn<{
6824
7380
  name: "from";
@@ -6875,6 +7431,42 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6875
7431
  identity: undefined;
6876
7432
  generated: undefined;
6877
7433
  }, {}, {}>;
7434
+ positionTypeId: drizzle_orm_pg_core0.PgColumn<{
7435
+ name: "position_type_id";
7436
+ tableName: EnumTableName.TRANSFERS;
7437
+ dataType: "number";
7438
+ columnType: "PgInteger";
7439
+ data: number;
7440
+ driverParam: string | number;
7441
+ notNull: true;
7442
+ hasDefault: false;
7443
+ isPrimaryKey: false;
7444
+ isAutoincrement: false;
7445
+ hasRuntimeDefault: false;
7446
+ enumValues: undefined;
7447
+ baseColumn: never;
7448
+ identity: undefined;
7449
+ generated: undefined;
7450
+ }, {}, {}>;
7451
+ asset: drizzle_orm_pg_core0.PgColumn<{
7452
+ name: "asset";
7453
+ tableName: EnumTableName.TRANSFERS;
7454
+ dataType: "string";
7455
+ columnType: "PgVarchar";
7456
+ data: string;
7457
+ driverParam: string;
7458
+ notNull: true;
7459
+ hasDefault: false;
7460
+ isPrimaryKey: false;
7461
+ isAutoincrement: false;
7462
+ hasRuntimeDefault: false;
7463
+ enumValues: [string, ...string[]];
7464
+ baseColumn: never;
7465
+ identity: undefined;
7466
+ generated: undefined;
7467
+ }, {}, {
7468
+ length: 42;
7469
+ }>;
6878
7470
  blockNumber: drizzle_orm_pg_core0.PgColumn<{
6879
7471
  name: "block_number";
6880
7472
  tableName: EnumTableName.TRANSFERS;
@@ -6915,7 +7507,7 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6915
7507
  declare const StatusCode: drizzle_orm_pg_core0.PgEnum<[Status, ...Status[]]>;
6916
7508
  declare const status: drizzle_orm_pg_core0.PgTableWithColumns<{
6917
7509
  name: "status";
6918
- schema: "router_v1.8";
7510
+ schema: "router_v1.11";
6919
7511
  columns: {
6920
7512
  id: drizzle_orm_pg_core0.PgColumn<{
6921
7513
  name: "id";
@@ -6956,7 +7548,7 @@ declare const status: drizzle_orm_pg_core0.PgTableWithColumns<{
6956
7548
  }>;
6957
7549
  declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
6958
7550
  name: "validations";
6959
- schema: "router_v1.8";
7551
+ schema: "router_v1.11";
6960
7552
  columns: {
6961
7553
  offerHash: drizzle_orm_pg_core0.PgColumn<{
6962
7554
  name: "offer_hash";
@@ -6967,7 +7559,26 @@ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
6967
7559
  driverParam: string;
6968
7560
  notNull: true;
6969
7561
  hasDefault: false;
6970
- isPrimaryKey: true;
7562
+ isPrimaryKey: false;
7563
+ isAutoincrement: false;
7564
+ hasRuntimeDefault: false;
7565
+ enumValues: [string, ...string[]];
7566
+ baseColumn: never;
7567
+ identity: undefined;
7568
+ generated: undefined;
7569
+ }, {}, {
7570
+ length: 66;
7571
+ }>;
7572
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
7573
+ name: "obligation_id";
7574
+ tableName: "validations";
7575
+ dataType: "string";
7576
+ columnType: "PgVarchar";
7577
+ data: string;
7578
+ driverParam: string;
7579
+ notNull: true;
7580
+ hasDefault: false;
7581
+ isPrimaryKey: false;
6971
7582
  isAutoincrement: false;
6972
7583
  hasRuntimeDefault: false;
6973
7584
  enumValues: [string, ...string[]];
@@ -7016,7 +7627,7 @@ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
7016
7627
  }>;
7017
7628
  declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7018
7629
  name: EnumTableName.COLLECTORS;
7019
- schema: "router_v1.8";
7630
+ schema: "router_v1.11";
7020
7631
  columns: {
7021
7632
  chainId: drizzle_orm_pg_core0.PgColumn<{
7022
7633
  name: "chain_id";
@@ -7042,7 +7653,7 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7042
7653
  tableName: EnumTableName.COLLECTORS;
7043
7654
  dataType: "string";
7044
7655
  columnType: "PgText";
7045
- data: "offers" | "consumed_events" | "positions" | "prices";
7656
+ data: "morpho_v2" | "offers" | "positions" | "prices";
7046
7657
  driverParam: string;
7047
7658
  notNull: true;
7048
7659
  hasDefault: false;
@@ -7054,7 +7665,7 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7054
7665
  identity: undefined;
7055
7666
  generated: undefined;
7056
7667
  }, {}, {
7057
- $type: "offers" | "consumed_events" | "positions" | "prices";
7668
+ $type: "morpho_v2" | "offers" | "positions" | "prices";
7058
7669
  }>;
7059
7670
  blockNumber: drizzle_orm_pg_core0.PgColumn<{
7060
7671
  name: "block_number";
@@ -7110,9 +7721,9 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7110
7721
  };
7111
7722
  dialect: "pg";
7112
7723
  }>;
7113
- declare const chains$1: drizzle_orm_pg_core0.PgTableWithColumns<{
7724
+ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
7114
7725
  name: EnumTableName.CHAINS;
7115
- schema: "router_v1.8";
7726
+ schema: "router_v1.11";
7116
7727
  columns: {
7117
7728
  chainId: drizzle_orm_pg_core0.PgColumn<{
7118
7729
  name: "chain_id";
@@ -7189,7 +7800,7 @@ declare const chains$1: drizzle_orm_pg_core0.PgTableWithColumns<{
7189
7800
  }>;
7190
7801
  declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
7191
7802
  name: EnumTableName.TREES;
7192
- schema: "router_v1.8";
7803
+ schema: "router_v1.11";
7193
7804
  columns: {
7194
7805
  root: drizzle_orm_pg_core0.PgColumn<{
7195
7806
  name: "root";
@@ -7251,7 +7862,7 @@ declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
7251
7862
  }>;
7252
7863
  declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
7253
7864
  name: EnumTableName.MERKLE_PATHS;
7254
- schema: "router_v1.8";
7865
+ schema: "router_v1.11";
7255
7866
  columns: {
7256
7867
  offerHash: drizzle_orm_pg_core0.PgColumn<{
7257
7868
  name: "offer_hash";
@@ -7262,7 +7873,26 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
7262
7873
  driverParam: string;
7263
7874
  notNull: true;
7264
7875
  hasDefault: false;
7265
- isPrimaryKey: true;
7876
+ isPrimaryKey: false;
7877
+ isAutoincrement: false;
7878
+ hasRuntimeDefault: false;
7879
+ enumValues: [string, ...string[]];
7880
+ baseColumn: never;
7881
+ identity: undefined;
7882
+ generated: undefined;
7883
+ }, {}, {
7884
+ length: 66;
7885
+ }>;
7886
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
7887
+ name: "obligation_id";
7888
+ tableName: EnumTableName.MERKLE_PATHS;
7889
+ dataType: "string";
7890
+ columnType: "PgVarchar";
7891
+ data: string;
7892
+ driverParam: string;
7893
+ notNull: true;
7894
+ hasDefault: false;
7895
+ isPrimaryKey: false;
7266
7896
  isAutoincrement: false;
7267
7897
  hasRuntimeDefault: false;
7268
7898
  enumValues: [string, ...string[]];
@@ -7329,29 +7959,17 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
7329
7959
  dialect: "pg";
7330
7960
  }>;
7331
7961
  declare namespace index_d_exports$2 {
7332
- 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 };
7962
+ export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, lots, lotsPositions, merklePaths, obligationCollateralsV2, obligationIdKeys, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
7333
7963
  }
7334
7964
  //#endregion
7335
7965
  //#region src/gatekeeper/morphoRules.d.ts
7336
- 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, "loan_token"> | Rule<Offer, "collateral_token"> | Rule<Offer, "oracle">)[];
7966
+ declare const morphoRules: (parameters: {
7967
+ chains: Chain$1[];
7968
+ chainId: Id;
7969
+ }) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "loan_token"> | Rule<Offer, "collateral_token"> | Rule<Offer, "oracle">)[];
7337
7970
  declare namespace Rules_d_exports {
7338
- export { ValidityParameters, amountMutualExclusivity, callback, chains, collateralToken, loanToken, maturity, oracle, sameMaker, validity };
7971
+ export { amountMutualExclusivity, callback, collateralToken, loanToken, maturity, oracle, sameMaker };
7339
7972
  }
7340
- type ValidityParameters = {
7341
- client: PublicClient<Transport, Chain$1>;
7342
- };
7343
- /**
7344
- * set of rules to validate offers.
7345
- *
7346
- * @param _parameters - Validity parameters with chain and client
7347
- * @returns Array of validation rules to evaluate against offers
7348
- */
7349
- declare function validity(_parameters: ValidityParameters): Rule<Offer, "expiry">[];
7350
- declare const chains: ({
7351
- chains
7352
- }: {
7353
- chains: Chain$1[];
7354
- }) => Rule<Offer, "chain_ids">;
7355
7973
  declare const maturity: ({
7356
7974
  maturities
7357
7975
  }: {
@@ -7369,9 +7987,11 @@ declare const callback: ({
7369
7987
  * @returns The issue that was found. If the offer is valid, this will be undefined.
7370
7988
  */
7371
7989
  declare const loanToken: ({
7372
- assetsByChainId
7990
+ assetsByChainId,
7991
+ chainId
7373
7992
  }: {
7374
7993
  assetsByChainId: Partial<Record<Id, Address[]>>;
7994
+ chainId: Id;
7375
7995
  }) => Rule<Offer, "loan_token">;
7376
7996
  /**
7377
7997
  * A validation rule that checks if the offer's collateral tokens are allowed for its chain.
@@ -7379,9 +7999,11 @@ declare const loanToken: ({
7379
7999
  * @returns The issue that was found. If the offer is valid, this will be undefined.
7380
8000
  */
7381
8001
  declare const collateralToken: ({
7382
- collateralAssetsByChainId
8002
+ collateralAssetsByChainId,
8003
+ chainId
7383
8004
  }: {
7384
8005
  collateralAssetsByChainId: Partial<Record<Id, Address[]>>;
8006
+ chainId: Id;
7385
8007
  }) => Rule<Offer, "collateral_token">;
7386
8008
  /**
7387
8009
  * A validation rule that checks if the offer's oracle addresses are allowed for its chain.
@@ -7389,9 +8011,11 @@ declare const collateralToken: ({
7389
8011
  * @returns The issue that was found. If the offer is valid, this will be undefined.
7390
8012
  */
7391
8013
  declare const oracle: ({
7392
- oraclesByChainId
8014
+ oraclesByChainId,
8015
+ chainId
7393
8016
  }: {
7394
8017
  oraclesByChainId: Partial<Record<Id, Address[]>>;
8018
+ chainId: Id;
7395
8019
  }) => Rule<Offer, "oracle">;
7396
8020
  /**
7397
8021
  * A batch validation rule that ensures all offers in a tree have the same maker address.
@@ -7433,7 +8057,7 @@ declare namespace from {
7433
8057
  */
7434
8058
  declare function add(config: MempoolEVMClientConfig, offers: AddParameters): Promise<Hex>;
7435
8059
  declare namespace add {
7436
- type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError | MissingMorphoAddressError;
8060
+ type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | MissingMorphoAddressError;
7437
8061
  }
7438
8062
  declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
7439
8063
  offers: Offer[];
@@ -7442,7 +8066,7 @@ declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters)
7442
8066
  declare namespace get {
7443
8067
  type ErrorType = streamOffersReturnType;
7444
8068
  }
7445
- type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError | MissingMorphoAddressError;
8069
+ type streamOffersReturnType = WalletAccountNotSetError | MissingMorphoAddressError;
7446
8070
  declare class WalletAccountNotSetError extends BaseError {
7447
8071
  name: string;
7448
8072
  constructor();
@@ -7450,10 +8074,6 @@ declare class WalletAccountNotSetError extends BaseError {
7450
8074
  declare class ViemClientError extends BaseError {
7451
8075
  name: string;
7452
8076
  }
7453
- declare class ChainIdMismatchError extends BaseError {
7454
- name: string;
7455
- constructor(expected: Id, actual: Id);
7456
- }
7457
8077
  declare class MissingMorphoAddressError extends BaseError {
7458
8078
  name: string;
7459
8079
  constructor();
@@ -7504,7 +8124,7 @@ declare namespace connect {
7504
8124
  type ErrorType = from.ErrorType;
7505
8125
  }
7506
8126
  declare namespace index_d_exports$1 {
7507
- export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, MissingMorphoAddressError, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
8127
+ export { AddParameters, Client$2 as Client, GetParameters, MissingMorphoAddressError, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
7508
8128
  }
7509
8129
  //#endregion
7510
8130
  //#region src/utils/BigMath.d.ts
@@ -7639,5 +8259,5 @@ declare namespace index_d_exports$3 {
7639
8259
  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 };
7640
8260
  }
7641
8261
  //#endregion
7642
- 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, 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, Tick_d_exports as Tick, 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 };
8262
+ 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, 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, Id_d_exports as Id, 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, Tick_d_exports as Tick, 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 };
7643
8263
  //# sourceMappingURL=index.node.d.ts.map