@morpho-dev/router 0.9.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.
@@ -1346,7 +1346,7 @@ declare class ReorgError extends BaseError {
1346
1346
  constructor(blockNumber: number);
1347
1347
  }
1348
1348
  declare namespace Chain_d_exports {
1349
- export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name$1 as Name, chainIds, chainNames, chains$2 as chains, getChain, getWhitelistedChains, streamLogs };
1349
+ export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name$1 as Name, chainIds, chainNames, chains$1 as chains, getChain, getWhitelistedChains, streamLogs };
1350
1350
  }
1351
1351
  type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
1352
1352
  morpho: ChainContract;
@@ -1387,7 +1387,7 @@ type Id = (typeof ChainId)[Uppercase<Name$1>];
1387
1387
  declare const chainIds: readonly Id[];
1388
1388
  declare function getChain(chainId: Id): Chain$1 | undefined;
1389
1389
  declare const getWhitelistedChains: () => Chain$1[];
1390
- declare const chains$2: Record<Lowercase<Name$1>, Chain$1>;
1390
+ declare const chains$1: Record<Lowercase<Name$1>, Chain$1>;
1391
1391
  declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
1392
1392
  client: PublicClient;
1393
1393
  contractAddress?: Address;
@@ -1420,7 +1420,7 @@ declare class MissingBlockNumberError extends BaseError {
1420
1420
  constructor();
1421
1421
  }
1422
1422
  declare namespace ChainRegistry_d_exports {
1423
- export { ChainRegistry, create$6 as create };
1423
+ export { ChainRegistry, create$8 as create };
1424
1424
  }
1425
1425
  type ChainRegistry = {
1426
1426
  getById: (chainId: Id) => Chain$1 | undefined;
@@ -1431,7 +1431,7 @@ type ChainRegistry = {
1431
1431
  * @param chains - Array of chain objects to register.
1432
1432
  * @returns A registry for looking up chains by ID. {@link ChainRegistry}
1433
1433
  */
1434
- declare function create$6(chains: Chain$1[]): ChainRegistry;
1434
+ declare function create$8(chains: Chain$1[]): ChainRegistry;
1435
1435
  //#endregion
1436
1436
  //#region src/core/types.d.ts
1437
1437
  /** Combines members of an intersection into a readable type. */
@@ -1465,13 +1465,23 @@ declare class InvalidLLTVError extends BaseError {
1465
1465
  }
1466
1466
  declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
1467
1467
  declare namespace Collateral_d_exports {
1468
- export { Collateral, CollateralSchema, CollateralsSchema, from$16 as from, random$3 as random };
1468
+ export { Collateral, CollateralSchema, CollateralsSchema, abi$1 as abi, from$16 as from, random$3 as random };
1469
1469
  }
1470
1470
  type Collateral = {
1471
1471
  /** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
1472
1472
  lltv: LLTV; /** Oracle contract used to price the collateral. */
1473
1473
  oracle: Address;
1474
1474
  };
1475
+ declare const abi$1: readonly [{
1476
+ readonly type: "address";
1477
+ readonly name: "token";
1478
+ }, {
1479
+ readonly type: "uint256";
1480
+ readonly name: "lltv";
1481
+ }, {
1482
+ readonly type: "address";
1483
+ readonly name: "oracle";
1484
+ }];
1475
1485
  declare const CollateralSchema: z$1.ZodObject<{
1476
1486
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1477
1487
  oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1585,102 +1595,33 @@ declare class DenominatorIsZeroError extends BaseError {
1585
1595
  readonly name = "ERC4626.DenominatorIsZeroError";
1586
1596
  constructor();
1587
1597
  }
1588
- declare namespace Liquidity_d_exports {
1589
- export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
1598
+ declare namespace Format_d_exports {
1599
+ export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
1590
1600
  }
1601
+ /** The snake case representation of a type with bigint values stringified. */
1602
+ type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
1603
+ /** Make arrays/tuples and object props mutable, deeply. */
1604
+ 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;
1605
+ /** Stringifies bigint values to strings and preserves branded primitives. */
1606
+ 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;
1607
+ /** Key remapping that also preserves branded primitives. */
1608
+ 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;
1609
+ 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;
1591
1610
  /**
1592
- * Represents a liquidity pool with a unique ID and amount.
1593
- */
1594
- type LiquidityPool = {
1595
- id: string;
1596
- amount: bigint;
1597
- };
1598
- /**
1599
- * Represents a hierarchical relationship between two liquidity pools.
1600
- */
1601
- type LiquidityLink = {
1602
- parentPoolId: string;
1603
- childPoolId: string;
1604
- priority: number;
1605
- };
1606
- /**
1607
- * Represents the connection between an offer and its liquidity pools.
1608
- */
1609
- type OfferLiquidityPool = {
1610
- offerHash: Hex;
1611
- poolId: string;
1612
- /**
1613
- * The available capacity/liquidity from this pool for this offer.
1614
- * Matches allowance amount from pool below.
1615
- */
1616
- amount: bigint;
1617
- };
1618
- /**
1619
- * Calculate maximum debt capacity from collateral amount.
1620
- * @param amount - Collateral amount
1621
- * @param oraclePrice - Oracle price (scaled to 36 decimals)
1622
- * @param lltv - Loan-to-value ratio (scaled to 18 decimals)
1623
- * @returns Maximum debt capacity
1624
- */
1625
- declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
1626
- /**
1627
- * Generate pool ID for balance pools.
1628
- */
1629
- declare function generateBalancePoolId(parameters: {
1630
- user: Address;
1631
- chainId: Id;
1632
- token: Address;
1633
- }): string;
1634
- /**
1635
- * Generate pool ID for allowance pools.
1636
- */
1637
- declare function generateAllowancePoolId(parameters: {
1638
- user: Address;
1639
- chainId: Id;
1640
- token: Address;
1641
- }): string;
1642
- /**
1643
- * Generate pool ID for obligation collateral pools.
1644
- * Obligation collateral pools represent collateral already deposited in the obligation.
1645
- * These pools are shared across all offers with the same obligation.
1646
- */
1647
- declare function generateObligationCollateralPoolId(parameters: {
1648
- user: Address;
1649
- chainId: Id;
1650
- obligationId: Hex;
1651
- token: Address;
1652
- }): string;
1653
- /**
1654
- * Generate pool ID for debt pools.
1655
- */
1656
- declare function generateDebtPoolId(parameters: {
1657
- user: Address;
1658
- chainId: Id;
1659
- obligationId: Hex;
1660
- }): string;
1661
- /**
1662
- * Generate pool ID for user position in a vault.
1663
- */
1664
- declare function generateUserVaultPositionPoolId(parameters: {
1665
- user: Address;
1666
- chainId: Id;
1667
- vault: Address;
1668
- }): string;
1669
- /**
1670
- * Generate pool ID for vault position in a market.
1611
+ * Formats object keys to snake case.
1612
+ * Preserves ethereum addresses as is.
1613
+ * Converts ethereum addresses to checksummed if used as values.
1614
+ * Stringifies bigint values to strings.
1671
1615
  */
1672
- declare function generateVaultPositionPoolId(parameters: {
1673
- vault: Address;
1674
- chainId: Id;
1675
- marketId: string;
1676
- }): string;
1616
+ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
1677
1617
  /**
1678
- * Generate pool ID for market total liquidity.
1618
+ * Formats a snake case object to its camel case type.
1619
+ * Preserves ethereum addresses as is.
1620
+ * Converts checksummed ethereum addresses to lowercase if used as values.
1621
+ * @warning Does not unstringify bigint values.
1679
1622
  */
1680
- declare function generateMarketLiquidityPoolId(parameters: {
1681
- chainId: Id;
1682
- marketId: string;
1683
- }): string;
1623
+ declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
1624
+ declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
1684
1625
  declare namespace Maturity_d_exports {
1685
1626
  export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$15 as from };
1686
1627
  }
@@ -1729,44 +1670,15 @@ declare class InvalidOptionError extends BaseError {
1729
1670
  readonly name = "Maturity.InvalidOptionError";
1730
1671
  constructor(input: string);
1731
1672
  }
1732
- declare namespace Format_d_exports {
1733
- export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
1734
- }
1735
- /** The snake case representation of a type with bigint values stringified. */
1736
- type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
1737
- /** Make arrays/tuples and object props mutable, deeply. */
1738
- 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;
1739
- /** Stringifies bigint values to strings and preserves branded primitives. */
1740
- 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;
1741
- /** Key remapping that also preserves branded primitives. */
1742
- 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;
1743
- 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;
1744
- /**
1745
- * Formats object keys to snake case.
1746
- * Preserves ethereum addresses as is.
1747
- * Converts ethereum addresses to checksummed if used as values.
1748
- * Stringifies bigint values to strings.
1749
- */
1750
- declare function toSnakeCase$1<T>(obj: T): Snake<T>;
1751
- /**
1752
- * Formats a snake case object to its camel case type.
1753
- * Preserves ethereum addresses as is.
1754
- * Converts checksummed ethereum addresses to lowercase if used as values.
1755
- * @warning Does not unstringify bigint values.
1756
- */
1757
- declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
1758
- declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
1759
1673
  declare namespace Obligation_d_exports {
1760
- export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$14 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
1674
+ 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 };
1761
1675
  }
1762
- type Obligation = {
1763
- /** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
1764
- loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1676
+ type Obligation$1 = {
1677
+ /** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1765
1678
  collaterals: Collateral[]; /** The maturity of the obligation. */
1766
1679
  maturity: Maturity;
1767
1680
  };
1768
1681
  declare const ObligationSchema: z$1.ZodObject<{
1769
- chainId: z$1.ZodNumber;
1770
1682
  loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1771
1683
  collaterals: z$1.ZodArray<z$1.ZodObject<{
1772
1684
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1775,6 +1687,49 @@ declare const ObligationSchema: z$1.ZodObject<{
1775
1687
  }, z$1.core.$strip>>;
1776
1688
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
1777
1689
  }, z$1.core.$strip>;
1690
+ declare const abi: readonly [{
1691
+ readonly type: "address";
1692
+ readonly name: "loanToken";
1693
+ }, {
1694
+ readonly type: "tuple[]";
1695
+ readonly name: "collaterals";
1696
+ readonly components: readonly [{
1697
+ readonly type: "address";
1698
+ readonly name: "token";
1699
+ }, {
1700
+ readonly type: "uint256";
1701
+ readonly name: "lltv";
1702
+ }, {
1703
+ readonly type: "address";
1704
+ readonly name: "oracle";
1705
+ }];
1706
+ }, {
1707
+ readonly type: "uint256";
1708
+ readonly name: "maturity";
1709
+ }];
1710
+ declare const tupleAbi: readonly [{
1711
+ readonly type: "tuple";
1712
+ readonly components: readonly [{
1713
+ readonly type: "address";
1714
+ readonly name: "loanToken";
1715
+ }, {
1716
+ readonly type: "tuple[]";
1717
+ readonly name: "collaterals";
1718
+ readonly components: readonly [{
1719
+ readonly type: "address";
1720
+ readonly name: "token";
1721
+ }, {
1722
+ readonly type: "uint256";
1723
+ readonly name: "lltv";
1724
+ }, {
1725
+ readonly type: "address";
1726
+ readonly name: "oracle";
1727
+ }];
1728
+ }, {
1729
+ readonly type: "uint256";
1730
+ readonly name: "maturity";
1731
+ }];
1732
+ }];
1778
1733
  /**
1779
1734
  * Creates an obligation from the given parameters.
1780
1735
  * @constructor
@@ -1785,7 +1740,6 @@ declare const ObligationSchema: z$1.ZodObject<{
1785
1740
  * @example
1786
1741
  * ```ts
1787
1742
  * const obligation = Obligation.from({
1788
- * chainId: 1,
1789
1743
  * loanToken: privateKeyToAccount(generatePrivateKey()).address,
1790
1744
  * collaterals: [
1791
1745
  * Collateral.from({
@@ -1801,12 +1755,11 @@ declare const ObligationSchema: z$1.ZodObject<{
1801
1755
  declare function from$14(parameters: from$14.Parameters): from$14.ReturnType;
1802
1756
  declare namespace from$14 {
1803
1757
  type Parameters = {
1804
- /** The chain id where the liquidity for this obligation is located. */chainId: number; /** The token that is being borrowed for this obligation. */
1805
- loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
1758
+ /** 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. */
1806
1759
  collaterals: from$16.Parameters[] | readonly from$16.Parameters[]; /** The maturity of the obligation. */
1807
1760
  maturity: from$15.Parameters;
1808
1761
  };
1809
- type ReturnType = Obligation;
1762
+ type ReturnType = Obligation$1;
1810
1763
  type ErrorType = InvalidObligationError;
1811
1764
  }
1812
1765
  /**
@@ -1817,30 +1770,27 @@ declare namespace from$14 {
1817
1770
  */
1818
1771
  declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
1819
1772
  declare namespace fromSnakeCase$2 {
1820
- type Parameters = Snake<Omit<Obligation, "chainId"> & {
1821
- chainId: number;
1822
- }>;
1823
- type ReturnType = Obligation;
1773
+ type Parameters = Snake<Obligation$1>;
1774
+ type ReturnType = Obligation$1;
1824
1775
  type ErrorType = InvalidObligationError;
1825
1776
  }
1826
1777
  /**
1827
- * Calculates the obligation id based on the smart contract's Obligation struct.
1828
- * The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals, maturity)).
1778
+ * Calculates a canonical key for an obligation payload.
1779
+ * The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity)).
1829
1780
  * @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
1830
- * @param parameters - {@link id.Parameters}
1831
- * @returns The obligation id as a 32-byte hex string. {@link id.ReturnType}
1781
+ * @param parameters - {@link key.Parameters}
1782
+ * @returns The obligation key as a 32-byte hex string. {@link key.ReturnType}
1832
1783
  *
1833
1784
  * @example
1834
1785
  * ```ts
1835
1786
  * const obligation = Obligation.random();
1836
- * const id = Obligation.id(obligation);
1837
- * console.log(id); // 0x1234567890123456789012345678901234567890123456789012345678901234
1787
+ * const key = Obligation.key(obligation);
1788
+ * console.log(key); // 0x1234567890123456789012345678901234567890123456789012345678901234
1838
1789
  * ```
1839
1790
  */
1840
- declare function id(parameters: id.Parameters): id.ReturnType;
1841
- declare namespace id {
1791
+ declare function key$1(parameters: key$1.Parameters): key$1.ReturnType;
1792
+ declare namespace key$1 {
1842
1793
  type Parameters = {
1843
- chainId: number;
1844
1794
  loanToken: Address;
1845
1795
  collaterals: {
1846
1796
  asset: Address;
@@ -1863,7 +1813,7 @@ declare namespace id {
1863
1813
  */
1864
1814
  declare function random$2(): random$2.ReturnType;
1865
1815
  declare namespace random$2 {
1866
- type ReturnType = Obligation;
1816
+ type ReturnType = Obligation$1;
1867
1817
  }
1868
1818
  /**
1869
1819
  * Creates an obligation from an offer.
@@ -1875,7 +1825,7 @@ declare namespace random$2 {
1875
1825
  declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
1876
1826
  declare namespace fromOffer$1 {
1877
1827
  type Parameters = Offer;
1878
- type ReturnType = Obligation;
1828
+ type ReturnType = Obligation$1;
1879
1829
  }
1880
1830
  declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
1881
1831
  readonly name = "Obligation.InvalidObligationError";
@@ -1885,8 +1835,135 @@ declare class CollateralsAreNotSortedError extends BaseError {
1885
1835
  readonly name = "Obligation.CollateralsAreNotSortedError";
1886
1836
  constructor();
1887
1837
  }
1838
+ declare namespace Id_d_exports {
1839
+ export { Obligation, creationCode, toId };
1840
+ }
1841
+ type Obligation = Obligation$1;
1842
+ /**
1843
+ * Builds the same creation code as `IdLib.creationCode` in Solidity.
1844
+ *
1845
+ * Layout: `prefix (11 bytes) + chainId (32 bytes) + morphoV2 (20 bytes) + abi.encode(obligation)`.
1846
+ *
1847
+ * @param parameters - {@link creationCode.Parameters}
1848
+ * @returns The CREATE2 init code bytes. {@link creationCode.ReturnType}
1849
+ */
1850
+ declare function creationCode(parameters: creationCode.Parameters): creationCode.ReturnType;
1851
+ declare namespace creationCode {
1852
+ type Parameters = {
1853
+ obligation: Obligation;
1854
+ chainId: Id;
1855
+ morphoV2: Address;
1856
+ };
1857
+ type ReturnType = Hex;
1858
+ }
1859
+ /**
1860
+ * Computes the same id as `IdLib.toId` in Solidity.
1861
+ * @param parameters - {@link toId.Parameters}
1862
+ * @returns The obligation id. {@link toId.ReturnType}
1863
+ */
1864
+ declare function toId(parameters: toId.Parameters): toId.ReturnType;
1865
+ declare namespace toId {
1866
+ type Parameters = creationCode.Parameters;
1867
+ type ReturnType = Hex;
1868
+ }
1869
+ declare namespace Liquidity_d_exports {
1870
+ export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
1871
+ }
1872
+ /**
1873
+ * Represents a liquidity pool with a unique ID and amount.
1874
+ */
1875
+ type LiquidityPool = {
1876
+ id: string;
1877
+ amount: bigint;
1878
+ };
1879
+ /**
1880
+ * Represents a hierarchical relationship between two liquidity pools.
1881
+ */
1882
+ type LiquidityLink = {
1883
+ parentPoolId: string;
1884
+ childPoolId: string;
1885
+ priority: number;
1886
+ };
1887
+ /**
1888
+ * Represents the connection between an offer and its liquidity pools.
1889
+ */
1890
+ type OfferLiquidityPool = {
1891
+ offerHash: Hex;
1892
+ poolId: string;
1893
+ /**
1894
+ * The available capacity/liquidity from this pool for this offer.
1895
+ * Matches allowance amount from pool below.
1896
+ */
1897
+ amount: bigint;
1898
+ };
1899
+ /**
1900
+ * Calculate maximum debt capacity from collateral amount.
1901
+ * @param amount - Collateral amount
1902
+ * @param oraclePrice - Oracle price (scaled to 36 decimals)
1903
+ * @param lltv - Loan-to-value ratio (scaled to 18 decimals)
1904
+ * @returns Maximum debt capacity
1905
+ */
1906
+ declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
1907
+ /**
1908
+ * Generate pool ID for balance pools.
1909
+ */
1910
+ declare function generateBalancePoolId(parameters: {
1911
+ user: Address;
1912
+ chainId: Id;
1913
+ token: Address;
1914
+ }): string;
1915
+ /**
1916
+ * Generate pool ID for allowance pools.
1917
+ */
1918
+ declare function generateAllowancePoolId(parameters: {
1919
+ user: Address;
1920
+ chainId: Id;
1921
+ token: Address;
1922
+ }): string;
1923
+ /**
1924
+ * Generate pool ID for obligation collateral pools.
1925
+ * Obligation collateral pools represent collateral already deposited in the obligation.
1926
+ * These pools are shared across all offers with the same obligation.
1927
+ */
1928
+ declare function generateObligationCollateralPoolId(parameters: {
1929
+ user: Address;
1930
+ chainId: Id;
1931
+ obligationId: Hex;
1932
+ token: Address;
1933
+ }): string;
1934
+ /**
1935
+ * Generate pool ID for debt pools.
1936
+ */
1937
+ declare function generateDebtPoolId(parameters: {
1938
+ user: Address;
1939
+ chainId: Id;
1940
+ obligationId: Hex;
1941
+ }): string;
1942
+ /**
1943
+ * Generate pool ID for user position in a vault.
1944
+ */
1945
+ declare function generateUserVaultPositionPoolId(parameters: {
1946
+ user: Address;
1947
+ chainId: Id;
1948
+ vault: Address;
1949
+ }): string;
1950
+ /**
1951
+ * Generate pool ID for vault position in a market.
1952
+ */
1953
+ declare function generateVaultPositionPoolId(parameters: {
1954
+ vault: Address;
1955
+ chainId: Id;
1956
+ marketId: string;
1957
+ }): string;
1958
+ /**
1959
+ * Generate pool ID for market total liquidity.
1960
+ */
1961
+ declare function generateMarketLiquidityPoolId(parameters: {
1962
+ chainId: Id;
1963
+ marketId: string;
1964
+ }): string;
1888
1965
  declare namespace Offer_d_exports {
1889
- 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 };
1966
+ 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 };
1890
1967
  }
1891
1968
  type Offer = {
1892
1969
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
@@ -1899,8 +1976,7 @@ type Offer = {
1899
1976
  readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
1900
1977
  readonly group: Hex; /** The session. Used for session-based offer management. */
1901
1978
  readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
1902
- readonly buy: boolean; /** The chain id where the liquidity for this offer is located. */
1903
- readonly chainId: Id; /** The token that is being borrowed. */
1979
+ readonly buy: boolean; /** The token that is being borrowed. */
1904
1980
  readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
1905
1981
  readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
1906
1982
  readonly callback: {
@@ -1915,6 +1991,7 @@ declare enum Status {
1915
1991
  }
1916
1992
  type Validation = {
1917
1993
  offerHash: Hex;
1994
+ obligationId: Hex;
1918
1995
  status: Status;
1919
1996
  };
1920
1997
  declare const OfferSchema: () => z$1.ZodObject<{
@@ -1929,7 +2006,6 @@ declare const OfferSchema: () => z$1.ZodObject<{
1929
2006
  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>>;
1930
2007
  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>>;
1931
2008
  buy: z$1.ZodBoolean;
1932
- chainId: z$1.ZodNumber;
1933
2009
  loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1934
2010
  collaterals: z$1.ZodArray<z$1.ZodObject<{
1935
2011
  asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
@@ -1953,8 +2029,7 @@ declare const OfferSchema: () => z$1.ZodObject<{
1953
2029
  *
1954
2030
  * All values validated to be non-negative and within bytes32 range.
1955
2031
  */
1956
- type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares" | "receiverIfMakerIsSeller"> & {
1957
- chainId: number;
2032
+ type OfferInput = Compute<Omit<Offer, "group" | "session" | "obligationUnits" | "obligationShares" | "receiverIfMakerIsSeller"> & {
1958
2033
  group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
1959
2034
  session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
1960
2035
  obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
@@ -2006,7 +2081,6 @@ declare const serialize: (offer: Offer) => {
2006
2081
  group: `0x${string}`;
2007
2082
  session: `0x${string}`;
2008
2083
  buy: boolean;
2009
- chainId: Id;
2010
2084
  loanToken: `0x${string}`;
2011
2085
  collaterals: {
2012
2086
  asset: `0x${string}`;
@@ -2021,7 +2095,6 @@ declare const serialize: (offer: Offer) => {
2021
2095
  hash: `0x${string}`;
2022
2096
  };
2023
2097
  type RandomConfig = {
2024
- chains?: Chain$1[];
2025
2098
  loanTokens?: Address[];
2026
2099
  collateralTokens?: Address[];
2027
2100
  assetsDecimals?: Record<Address, number>;
@@ -2051,116 +2124,180 @@ type RandomConfig = {
2051
2124
  */
2052
2125
  declare function random$1(config?: RandomConfig): Offer;
2053
2126
  /**
2054
- * Creates an EIP-712 domain object.
2055
- * @param chainId - The chain ID.
2056
- * @returns The EIP-712 domain object.
2127
+ * Computes the canonical chain-agnostic offer hash.
2128
+ * The hash is `keccak256(abi.encode(offer))` using {@link encode}.
2129
+ *
2130
+ * @param offer - Offer payload to hash.
2131
+ * @returns 32-byte offer hash.
2057
2132
  */
2058
- declare const domain: (chainId: number) => {
2059
- chainId: bigint;
2060
- verifyingContract: "0x0000000000000000000000000000000000000000";
2133
+ declare function hash(offer: Offer): Hex;
2134
+ /**
2135
+ * Calculates the onchain obligation id for an offer.
2136
+ * The id is computed with {@link Id.toId}.
2137
+ * @param offer - The offer to calculate the obligation id for.
2138
+ * @param parameters - The chain context used by the onchain id function.
2139
+ * @returns The obligation id as a 32-byte hex string.
2140
+ */
2141
+ declare function obligationId(offer: Offer, parameters: obligationId.Parameters): obligationId.ReturnType;
2142
+ declare namespace obligationId {
2143
+ type Parameters = {
2144
+ chainId: Id;
2145
+ morphoV2: Address;
2146
+ };
2147
+ type ReturnType = Hex;
2148
+ }
2149
+ declare function encode$1(offer: Offer): `0x${string}`;
2150
+ declare function decode$1(data: Hex): Offer;
2151
+ type OfferConsumed = {
2152
+ id: string;
2153
+ chainId: Id;
2154
+ maker: Address;
2155
+ group: Hex;
2156
+ amount: bigint;
2157
+ blockNumber: number;
2061
2158
  };
2062
2159
  /**
2063
- * The EIP-712 types for the offer.
2064
- * @warning The ordering of the types should NEVER be changed. The offer hash is computed based on the order of the types.
2065
- * @returns The EIP-712 types.
2160
+ * ABI for the Take event emitted by the Morpho V2 contract.
2066
2161
  */
2067
- declare const types: {
2068
- readonly EIP712Domain: readonly [{
2069
- readonly name: "chainId";
2070
- readonly type: "uint256";
2071
- }, {
2072
- readonly name: "verifyingContract";
2162
+ declare const takeEvent: {
2163
+ readonly type: "event";
2164
+ readonly name: "Take";
2165
+ readonly inputs: readonly [{
2166
+ readonly name: "caller";
2073
2167
  readonly type: "address";
2074
- }];
2075
- readonly Offer: readonly [{
2168
+ readonly indexed: false;
2169
+ readonly internalType: "address";
2170
+ }, {
2171
+ readonly name: "id";
2172
+ readonly type: "bytes32";
2173
+ readonly indexed: true;
2174
+ readonly internalType: "bytes32";
2175
+ }, {
2076
2176
  readonly name: "maker";
2077
2177
  readonly type: "address";
2178
+ readonly indexed: true;
2179
+ readonly internalType: "address";
2078
2180
  }, {
2079
- readonly name: "assets";
2080
- readonly type: "uint256";
2181
+ readonly name: "taker";
2182
+ readonly type: "address";
2183
+ readonly indexed: true;
2184
+ readonly internalType: "address";
2081
2185
  }, {
2082
- readonly name: "obligationUnits";
2083
- readonly type: "uint256";
2186
+ readonly name: "offerIsBuy";
2187
+ readonly type: "bool";
2188
+ readonly indexed: false;
2189
+ readonly internalType: "bool";
2084
2190
  }, {
2085
- readonly name: "obligationShares";
2191
+ readonly name: "buyerAssets";
2086
2192
  readonly type: "uint256";
2193
+ readonly indexed: false;
2194
+ readonly internalType: "uint256";
2087
2195
  }, {
2088
- readonly name: "tick";
2196
+ readonly name: "sellerAssets";
2089
2197
  readonly type: "uint256";
2198
+ readonly indexed: false;
2199
+ readonly internalType: "uint256";
2090
2200
  }, {
2091
- readonly name: "maturity";
2201
+ readonly name: "obligationUnits";
2092
2202
  readonly type: "uint256";
2203
+ readonly indexed: false;
2204
+ readonly internalType: "uint256";
2093
2205
  }, {
2094
- readonly name: "expiry";
2206
+ readonly name: "obligationShares";
2095
2207
  readonly type: "uint256";
2208
+ readonly indexed: false;
2209
+ readonly internalType: "uint256";
2096
2210
  }, {
2097
- readonly name: "group";
2098
- readonly type: "bytes32";
2099
- }, {
2100
- readonly name: "session";
2101
- readonly type: "bytes32";
2211
+ readonly name: "buyerIsLender";
2212
+ readonly type: "bool";
2213
+ readonly indexed: false;
2214
+ readonly internalType: "bool";
2102
2215
  }, {
2103
- readonly name: "buy";
2216
+ readonly name: "sellerIsBorrower";
2104
2217
  readonly type: "bool";
2218
+ readonly indexed: false;
2219
+ readonly internalType: "bool";
2105
2220
  }, {
2106
- readonly name: "loanToken";
2221
+ readonly name: "sellerReceiver";
2107
2222
  readonly type: "address";
2223
+ readonly indexed: false;
2224
+ readonly internalType: "address";
2108
2225
  }, {
2109
- readonly name: "collaterals";
2110
- readonly type: "Collateral[]";
2111
- }, {
2112
- readonly name: "callback";
2113
- readonly type: "Callback";
2226
+ readonly name: "group";
2227
+ readonly type: "bytes32";
2228
+ readonly indexed: false;
2229
+ readonly internalType: "bytes32";
2114
2230
  }, {
2115
- readonly name: "receiverIfMakerIsSeller";
2116
- readonly type: "address";
2231
+ readonly name: "consumed";
2232
+ readonly type: "uint256";
2233
+ readonly indexed: false;
2234
+ readonly internalType: "uint256";
2117
2235
  }];
2118
- readonly Collateral: readonly [{
2119
- readonly name: "asset";
2236
+ readonly anonymous: false;
2237
+ };
2238
+ /**
2239
+ * ABI for the Consume event emitted by the Obligation contract.
2240
+ */
2241
+ declare const consumedEvent: {
2242
+ readonly type: "event";
2243
+ readonly name: "Consume";
2244
+ readonly inputs: readonly [{
2245
+ readonly name: "user";
2120
2246
  readonly type: "address";
2247
+ readonly indexed: true;
2248
+ readonly internalType: "address";
2121
2249
  }, {
2122
- readonly name: "oracle";
2123
- readonly type: "address";
2250
+ readonly name: "group";
2251
+ readonly type: "bytes32";
2252
+ readonly indexed: true;
2253
+ readonly internalType: "bytes32";
2124
2254
  }, {
2125
- readonly name: "lltv";
2255
+ readonly name: "amount";
2126
2256
  readonly type: "uint256";
2257
+ readonly indexed: false;
2258
+ readonly internalType: "uint256";
2127
2259
  }];
2128
- readonly Callback: readonly [{
2129
- readonly name: "address";
2130
- readonly type: "address";
2131
- }, {
2132
- readonly name: "data";
2133
- readonly type: "bytes";
2134
- }];
2260
+ readonly anonymous: false;
2135
2261
  };
2136
- declare function hash(offer: Offer): Hex;
2137
2262
  /**
2138
- * Calculates the obligation id for an offer based on the smart contract's Obligation struct.
2139
- * The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals (sorted by token address), maturity)).
2140
- * @param offer - The offer to calculate the obligation id for.
2141
- * @returns The obligation id as a 32-byte hex string.
2263
+ * ABI for the Repay event emitted by the MorphoV2 contract.
2142
2264
  */
2143
- declare function obligationId(offer: Offer): Hex;
2144
- declare function encode$1(offer: Offer): `0x${string}`;
2145
- declare function decode$1(data: Hex): Offer;
2146
- type OfferConsumed = {
2147
- id: string;
2148
- chainId: Id;
2149
- maker: Address;
2150
- group: Hex;
2151
- amount: bigint;
2152
- blockNumber: number;
2265
+ declare const repayEvent: {
2266
+ readonly type: "event";
2267
+ readonly name: "Repay";
2268
+ readonly inputs: readonly [{
2269
+ readonly name: "caller";
2270
+ readonly type: "address";
2271
+ readonly indexed: true;
2272
+ readonly internalType: "address";
2273
+ }, {
2274
+ readonly name: "id";
2275
+ readonly type: "bytes32";
2276
+ readonly indexed: true;
2277
+ readonly internalType: "bytes32";
2278
+ }, {
2279
+ readonly name: "obligationUnits";
2280
+ readonly type: "uint256";
2281
+ readonly indexed: false;
2282
+ readonly internalType: "uint256";
2283
+ }, {
2284
+ readonly name: "onBehalf";
2285
+ readonly type: "address";
2286
+ readonly indexed: true;
2287
+ readonly internalType: "address";
2288
+ }];
2289
+ readonly anonymous: false;
2153
2290
  };
2154
2291
  /**
2155
- * ABI for the Take event emitted by the Morpho V2 contract.
2292
+ * ABI for the Liquidate event emitted by the MorphoV2 contract.
2156
2293
  */
2157
- declare const takeEvent: {
2294
+ declare const liquidateEvent: {
2158
2295
  readonly type: "event";
2159
- readonly name: "Take";
2296
+ readonly name: "Liquidate";
2160
2297
  readonly inputs: readonly [{
2161
2298
  readonly name: "caller";
2162
2299
  readonly type: "address";
2163
- readonly indexed: false;
2300
+ readonly indexed: true;
2164
2301
  readonly internalType: "address";
2165
2302
  }, {
2166
2303
  readonly name: "id";
@@ -2168,89 +2305,111 @@ declare const takeEvent: {
2168
2305
  readonly indexed: true;
2169
2306
  readonly internalType: "bytes32";
2170
2307
  }, {
2171
- readonly name: "maker";
2172
- readonly type: "address";
2173
- readonly indexed: true;
2174
- readonly internalType: "address";
2308
+ readonly name: "seizures";
2309
+ readonly type: "tuple[]";
2310
+ readonly indexed: false;
2311
+ readonly internalType: "struct IMorphoV2.Seizure[]";
2312
+ readonly components: readonly [{
2313
+ readonly name: "collateralIndex";
2314
+ readonly type: "uint256";
2315
+ readonly internalType: "uint256";
2316
+ }, {
2317
+ readonly name: "repaid";
2318
+ readonly type: "uint256";
2319
+ readonly internalType: "uint256";
2320
+ }, {
2321
+ readonly name: "seized";
2322
+ readonly type: "uint256";
2323
+ readonly internalType: "uint256";
2324
+ }];
2175
2325
  }, {
2176
- readonly name: "taker";
2326
+ readonly name: "borrower";
2177
2327
  readonly type: "address";
2178
2328
  readonly indexed: true;
2179
2329
  readonly internalType: "address";
2180
2330
  }, {
2181
- readonly name: "offerIsBuy";
2182
- readonly type: "bool";
2183
- readonly indexed: false;
2184
- readonly internalType: "bool";
2185
- }, {
2186
- readonly name: "buyerAssets";
2187
- readonly type: "uint256";
2188
- readonly indexed: false;
2189
- readonly internalType: "uint256";
2190
- }, {
2191
- readonly name: "sellerAssets";
2192
- readonly type: "uint256";
2193
- readonly indexed: false;
2194
- readonly internalType: "uint256";
2195
- }, {
2196
- readonly name: "obligationUnits";
2331
+ readonly name: "totalRepaid";
2197
2332
  readonly type: "uint256";
2198
2333
  readonly indexed: false;
2199
2334
  readonly internalType: "uint256";
2200
2335
  }, {
2201
- readonly name: "obligationShares";
2336
+ readonly name: "badDebt";
2202
2337
  readonly type: "uint256";
2203
2338
  readonly indexed: false;
2204
2339
  readonly internalType: "uint256";
2205
- }, {
2206
- readonly name: "buyerIsLender";
2207
- readonly type: "bool";
2208
- readonly indexed: false;
2209
- readonly internalType: "bool";
2210
- }, {
2211
- readonly name: "sellerIsBorrower";
2212
- readonly type: "bool";
2213
- readonly indexed: false;
2214
- readonly internalType: "bool";
2215
- }, {
2216
- readonly name: "sellerReceiver";
2340
+ }];
2341
+ readonly anonymous: false;
2342
+ };
2343
+ /**
2344
+ * ABI for the SupplyCollateral event emitted by the MorphoV2 contract.
2345
+ */
2346
+ declare const supplyCollateralEvent: {
2347
+ readonly type: "event";
2348
+ readonly name: "SupplyCollateral";
2349
+ readonly inputs: readonly [{
2350
+ readonly name: "caller";
2217
2351
  readonly type: "address";
2218
2352
  readonly indexed: false;
2219
2353
  readonly internalType: "address";
2220
2354
  }, {
2221
- readonly name: "group";
2355
+ readonly name: "id";
2222
2356
  readonly type: "bytes32";
2223
- readonly indexed: false;
2357
+ readonly indexed: true;
2224
2358
  readonly internalType: "bytes32";
2225
2359
  }, {
2226
- readonly name: "consumed";
2360
+ readonly name: "collateral";
2361
+ readonly type: "address";
2362
+ readonly indexed: true;
2363
+ readonly internalType: "address";
2364
+ }, {
2365
+ readonly name: "assets";
2227
2366
  readonly type: "uint256";
2228
2367
  readonly indexed: false;
2229
2368
  readonly internalType: "uint256";
2369
+ }, {
2370
+ readonly name: "onBehalf";
2371
+ readonly type: "address";
2372
+ readonly indexed: true;
2373
+ readonly internalType: "address";
2230
2374
  }];
2231
2375
  readonly anonymous: false;
2232
2376
  };
2233
2377
  /**
2234
- * ABI for the Consume event emitted by the Obligation contract.
2378
+ * ABI for the WithdrawCollateral event emitted by the MorphoV2 contract.
2235
2379
  */
2236
- declare const consumedEvent: {
2380
+ declare const withdrawCollateralEvent: {
2237
2381
  readonly type: "event";
2238
- readonly name: "Consume";
2382
+ readonly name: "WithdrawCollateral";
2239
2383
  readonly inputs: readonly [{
2240
- readonly name: "user";
2384
+ readonly name: "caller";
2241
2385
  readonly type: "address";
2242
- readonly indexed: true;
2386
+ readonly indexed: false;
2243
2387
  readonly internalType: "address";
2244
2388
  }, {
2245
- readonly name: "group";
2389
+ readonly name: "id";
2246
2390
  readonly type: "bytes32";
2247
2391
  readonly indexed: true;
2248
2392
  readonly internalType: "bytes32";
2249
2393
  }, {
2250
- readonly name: "amount";
2394
+ readonly name: "collateral";
2395
+ readonly type: "address";
2396
+ readonly indexed: true;
2397
+ readonly internalType: "address";
2398
+ }, {
2399
+ readonly name: "assets";
2251
2400
  readonly type: "uint256";
2252
2401
  readonly indexed: false;
2253
2402
  readonly internalType: "uint256";
2403
+ }, {
2404
+ readonly name: "onBehalf";
2405
+ readonly type: "address";
2406
+ readonly indexed: true;
2407
+ readonly internalType: "address";
2408
+ }, {
2409
+ readonly name: "receiver";
2410
+ readonly type: "address";
2411
+ readonly indexed: false;
2412
+ readonly internalType: "address";
2254
2413
  }];
2255
2414
  readonly anonymous: false;
2256
2415
  };
@@ -2323,6 +2482,7 @@ declare namespace fromCollateral {
2323
2482
  declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
2324
2483
  declare namespace fromOffer {
2325
2484
  type Parameters = {
2485
+ chainId: Id;
2326
2486
  offer: Offer;
2327
2487
  blockNumber: number;
2328
2488
  price?: bigint | null;
@@ -2339,6 +2499,7 @@ declare namespace fromOffer {
2339
2499
  declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
2340
2500
  declare namespace fromOffers {
2341
2501
  type Parameters = {
2502
+ chainId: Id;
2342
2503
  offers: Offer[];
2343
2504
  blockNumber: number;
2344
2505
  price?: bigint | null;
@@ -2377,7 +2538,7 @@ declare namespace Conversion {
2377
2538
  }): bigint;
2378
2539
  }
2379
2540
  declare namespace Position_d_exports {
2380
- export { Position, Type, from$11 as from };
2541
+ export { Position, Type, from$11 as from, positionTypeId };
2381
2542
  }
2382
2543
  type Position = {
2383
2544
  /** The chain id. */chainId: Id;
@@ -2392,13 +2553,17 @@ type Position = {
2392
2553
  /** The underlying asset of the position.
2393
2554
  * For ERC20 positions, this equals the contract address.
2394
2555
  * For vault positions, this is the vault's underlying asset.
2556
+ * For debt positions, this is the zero address (sentinel).
2557
+ * For collateral positions, this is the collateral token address.
2395
2558
  */
2396
- asset?: Address; /** The block number at which the position was last updated. */
2559
+ asset: Address; /** The block number at which the position was last updated. */
2397
2560
  blockNumber: number;
2398
2561
  };
2399
2562
  declare enum Type {
2400
2563
  ERC20 = "erc20",
2401
- VAULT_V1 = "vault_v1"
2564
+ VAULT_V1 = "vault_v1",
2565
+ DEBT_OF = "debtOf",
2566
+ COLLATERAL_OF = "collateralOf"
2402
2567
  }
2403
2568
  /**
2404
2569
  * @constructor
@@ -2414,11 +2579,17 @@ declare namespace from$11 {
2414
2579
  user: Address;
2415
2580
  type: Type;
2416
2581
  balance?: bigint;
2417
- asset?: Address;
2582
+ asset: Address;
2418
2583
  blockNumber: number;
2419
2584
  };
2420
2585
  type ReturnType = Position;
2421
2586
  }
2587
+ /**
2588
+ * Maps a {@link Type} enum value to its 1-based integer ID used in the database.
2589
+ * @param type - The position type.
2590
+ * @returns The 1-based integer ID.
2591
+ */
2592
+ declare const positionTypeId: (type: Type) => number;
2422
2593
  declare namespace Quote_d_exports {
2423
2594
  export { InvalidQuoteError, Quote, QuoteInput, Side, from$10 as from, fromSnakeCase, random };
2424
2595
  }
@@ -2607,6 +2778,8 @@ type Transfer = {
2607
2778
  from: Address;
2608
2779
  to: Address;
2609
2780
  value: bigint;
2781
+ type: Type; /** The underlying asset of the transfer's position. */
2782
+ asset: Address;
2610
2783
  blockNumber: number;
2611
2784
  };
2612
2785
  /**
@@ -2630,6 +2803,8 @@ declare namespace from$8 {
2630
2803
  from: Address;
2631
2804
  to: Address;
2632
2805
  value: bigint;
2806
+ type: Type;
2807
+ asset: Address;
2633
2808
  blockNumber: number;
2634
2809
  };
2635
2810
  type ReturnType = Transfer;
@@ -2826,7 +3001,7 @@ declare class SignatureDomainError extends BaseError {
2826
3001
  }
2827
3002
  //#endregion
2828
3003
  //#region src/indexer/collectors/Collector.d.ts
2829
- declare const names: readonly ["offers", "consumed_events", "positions", "prices"];
3004
+ declare const names: readonly ["offers", "morpho_v2", "positions", "prices"];
2830
3005
  type Name = (typeof names)[number];
2831
3006
  /** A general collector interface. */
2832
3007
  type Collector<name extends Name = Name, client extends PublicClient<Transport, Chain$1> = PublicClient<Transport, Chain$1>> = {
@@ -2925,7 +3100,7 @@ declare function getLogger(): Logger;
2925
3100
  //#region src/database/domains/Offers.d.ts
2926
3101
  type CreateBatch = Readonly<{
2927
3102
  blockNumber: number;
2928
- offers: Offer[];
3103
+ offers: create$7.OfferInput[];
2929
3104
  }>;
2930
3105
  /**
2931
3106
  * Raw row returned by database queries.
@@ -2933,6 +3108,7 @@ type CreateBatch = Readonly<{
2933
3108
  */
2934
3109
  type Row = {
2935
3110
  hash: Hex;
3111
+ obligationId: Hex;
2936
3112
  maker: Address;
2937
3113
  assets: bigint;
2938
3114
  obligationUnits: bigint;
@@ -2957,8 +3133,12 @@ type Row = {
2957
3133
  takeable: bigint;
2958
3134
  blockNumber: number;
2959
3135
  };
3136
+ type OfferReference$1 = {
3137
+ hash: Hex;
3138
+ obligationId: Hex;
3139
+ };
2960
3140
  type OffersDomain = {
2961
- /** Insert offers (insert-only). */create: (batches: CreateBatch[]) => Promise<Hex[]>;
3141
+ /** Insert offers (insert-only). */create: (batches: CreateBatch[]) => Promise<OfferReference$1[]>;
2962
3142
  /** Delete multiple offers by hashes or block number greater than or equal to the given value on a given chain.
2963
3143
  * @returns the number of offers deleted.
2964
3144
  */
@@ -2983,13 +3163,23 @@ type PaginationParams$1 = {
2983
3163
  type GetOffersParams = {
2984
3164
  /** Filter by maker address */maker?: Address;
2985
3165
  } & PaginationParams$1;
3166
+ declare function create$7(config: {
3167
+ db: Core;
3168
+ }): OffersDomain;
3169
+ declare namespace create$7 {
3170
+ type OfferInput = {
3171
+ offer: Offer;
3172
+ obligationId: Hex;
3173
+ chainId: Id;
3174
+ };
3175
+ }
2986
3176
  //#endregion
2987
3177
  //#region src/database/domains/Book.d.ts
2988
3178
  type BookDomain = {
2989
- /** 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. */
3179
+ /** 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. */
2990
3180
  getOffers: (parameters: getOffers$2.Parameters) => Promise<getOffers$2.ReturnType>;
2991
3181
  };
2992
- declare namespace get$4 {
3182
+ declare namespace get$5 {
2993
3183
  type Parameters = {
2994
3184
  /** The side of the offer. */side: "buy" | "sell"; /** The obligationId of the offer. */
2995
3185
  obligationId: Hex; /** Cursor string returned by a previous call, for pagination */
@@ -3025,9 +3215,11 @@ type CallbackInput = {
3025
3215
  contract: Address;
3026
3216
  user: Address;
3027
3217
  amount: bigint;
3218
+ positionTypeId: number;
3028
3219
  };
3029
3220
  type OfferCallbacks = {
3030
3221
  offerHash: Hex;
3222
+ obligationId: Hex;
3031
3223
  callbacks: CallbackInput[];
3032
3224
  };
3033
3225
  type CallbacksDomain = {
@@ -3097,18 +3289,20 @@ type LotsDomain = {
3097
3289
  * Called when offers are created to reserve liquidity on positions.
3098
3290
  * For each (position, group), keeps only the biggest offer by assets.
3099
3291
  * If lot exists and new offer is bigger, grows the lot and shifts higher lots.
3292
+ * Automatically upserts lots_positions bridge rows before inserting lots.
3100
3293
  */
3101
- create: (parameters: create$5.Parameters) => Promise<void>;
3294
+ create: (parameters: create$6.Parameters) => Promise<void>;
3102
3295
  /**
3103
3296
  * Get lots with optional filtering.
3104
3297
  */
3105
- get: (parameters?: get$3.Parameters) => Promise<Lot[]>;
3298
+ get: (parameters?: get$4.Parameters) => Promise<Lot[]>;
3106
3299
  };
3107
- declare namespace create$5 {
3300
+ declare namespace create$6 {
3108
3301
  type OfferLotInfo = {
3109
3302
  positionChainId: Id;
3110
3303
  positionContract: Address;
3111
3304
  positionUser: Address;
3305
+ positionTypeId: number;
3112
3306
  group: string;
3113
3307
  obligationId: string;
3114
3308
  size: bigint;
@@ -3116,7 +3310,7 @@ declare namespace create$5 {
3116
3310
  type Parameters = OfferLotInfo[];
3117
3311
  type ReturnType = undefined;
3118
3312
  }
3119
- declare namespace get$3 {
3313
+ declare namespace get$4 {
3120
3314
  type Parameters = {
3121
3315
  chainId?: Id;
3122
3316
  user?: Address;
@@ -3126,15 +3320,15 @@ declare namespace get$3 {
3126
3320
  };
3127
3321
  type ReturnType = Lot[];
3128
3322
  }
3129
- declare function create$5(db: Core): LotsDomain;
3323
+ declare function create$6(db: Core): LotsDomain;
3130
3324
  //#endregion
3131
3325
  //#region src/database/domains/Obligations.d.ts
3132
3326
  type ObligationsDomain = {
3133
3327
  /**
3134
- * Insert obligations (insert-only).
3135
- * @param obligations - Obligations to insert. {@link Obligation.Obligation}
3328
+ * Insert obligations and their onchain obligation id keys (insert-only).
3329
+ * @param obligations - Obligations to insert.
3136
3330
  */
3137
- create: (obligations: Obligation[]) => Promise<void>;
3331
+ create: (obligations: create$5.Input[]) => Promise<void>;
3138
3332
  /**
3139
3333
  * Get active obligations with optional chain filters.
3140
3334
  * @param parameters - Optional chain filters.
@@ -3142,8 +3336,30 @@ type ObligationsDomain = {
3142
3336
  */
3143
3337
  get: (parameters?: {
3144
3338
  chainId?: Id[];
3145
- }) => Promise<Obligation[]>;
3339
+ }) => Promise<get$3.Output[]>;
3146
3340
  };
3341
+ /**
3342
+ * Create an obligations domain instance.
3343
+ * @param db - Database core instance.
3344
+ * @returns Obligations domain. {@link ObligationsDomain}
3345
+ */
3346
+ declare function create$5(db: Core): ObligationsDomain;
3347
+ declare namespace create$5 {
3348
+ type Input = {
3349
+ obligationId: Hex;
3350
+ chainId: Id;
3351
+ morphoV2: Address;
3352
+ obligation: Obligation$1;
3353
+ };
3354
+ }
3355
+ declare namespace get$3 {
3356
+ type Output = {
3357
+ obligationId: Hex;
3358
+ chainId: Id;
3359
+ morphoV2: Address;
3360
+ obligation: Obligation$1;
3361
+ };
3362
+ }
3147
3363
  //#endregion
3148
3364
  //#region src/database/domains/Offsets.d.ts
3149
3365
  type Offset = {
@@ -3216,7 +3432,7 @@ type PositionsDomain = {
3216
3432
  */
3217
3433
  getByUser: (parameters: getByUser.Parameters) => Promise<getByUser.ReturnType>;
3218
3434
  /**
3219
- * Set all positions to empty after a given block number (inclusive), deletes all transfers linked to the positions.
3435
+ * Set all positions of a given type to empty after a given block number (inclusive), deletes all transfers linked to the positions.
3220
3436
  * @param parameters - {@link setEmptyAfter.Parameters}
3221
3437
  * @returns The number of positions set to empty. {@link setEmptyAfter.ReturnType}
3222
3438
  */
@@ -3239,7 +3455,8 @@ declare namespace get$1 {
3239
3455
  }
3240
3456
  declare namespace getByUser {
3241
3457
  type Parameters = PaginationParams & {
3242
- /** The user address to get positions for. */user: Address;
3458
+ /** The user address to get positions for. */user: Address; /** The type of position to get. Default is all types. */
3459
+ type?: Type;
3243
3460
  };
3244
3461
  type PositionWithReserved = {
3245
3462
  chainId: Id;
@@ -3256,8 +3473,9 @@ declare namespace getByUser {
3256
3473
  }
3257
3474
  declare namespace setEmptyAfter {
3258
3475
  type Parameters = {
3259
- /** The chain id . */chainId: Id; /** The block number after which all positions should be set to empty. (inclusive) */
3260
- blockNumber: number;
3476
+ /** The chain id. */chainId: Id; /** The block number after which all positions should be set to empty. (inclusive) */
3477
+ blockNumber: number; /** The position type to target. */
3478
+ type: Type;
3261
3479
  };
3262
3480
  type ReturnType = number;
3263
3481
  }
@@ -3270,11 +3488,26 @@ type TransfersDomain = {
3270
3488
  * @returns The number of transfers created. {@link create.ReturnType}
3271
3489
  */
3272
3490
  create: (transfers: create$4.Parameters) => Promise<create$4.ReturnType>;
3491
+ /**
3492
+ * Delete transfers by chain, position type, and block number >= given value (for reorg rollback).
3493
+ * Reverses balance deltas on affected positions and cleans up orphan positions.
3494
+ * @param parameters - {@link del.Parameters}
3495
+ * @returns The number of transfers deleted. {@link del.ReturnType}
3496
+ */
3497
+ delete: (parameters: del.Parameters) => Promise<del.ReturnType>;
3273
3498
  };
3274
3499
  declare namespace create$4 {
3275
3500
  type Parameters = Transfer[];
3276
3501
  type ReturnType = number;
3277
3502
  }
3503
+ declare namespace del {
3504
+ type Parameters = {
3505
+ chainId: Id;
3506
+ blockNumberGte: number;
3507
+ positionTypeId: number;
3508
+ };
3509
+ type ReturnType = number;
3510
+ }
3278
3511
  declare const create$4: (db: Core) => TransfersDomain;
3279
3512
  //#endregion
3280
3513
  //#region src/database/domains/Trees.d.ts
@@ -3289,25 +3522,41 @@ type Attestation = {
3289
3522
  /**
3290
3523
  * Input for creating trees with their signatures.
3291
3524
  */
3292
- type CreateInput = {
3293
- tree: Tree;
3525
+ type UpsertInput = {
3526
+ root: Hex;
3294
3527
  signature: Hex;
3295
3528
  };
3529
+ type UpsertPathsInput = {
3530
+ offerHash: Hex;
3531
+ obligationId: Hex;
3532
+ treeRoot: Hex;
3533
+ proof: Hex[];
3534
+ };
3535
+ type OfferReference = {
3536
+ offerHash: Hex;
3537
+ obligationId: Hex;
3538
+ };
3296
3539
  type TreesDomain = {
3297
3540
  /**
3298
- * Creates trees and attestation links in a single transaction.
3541
+ * Creates or updates merkle roots and signatures.
3542
+ *
3543
+ * @param trees - Array of merkle root attestations
3544
+ * @returns Array of tree roots that were upserted
3545
+ */
3546
+ upsert: (trees: UpsertInput[]) => Promise<Hex[]>;
3547
+ /**
3548
+ * Creates or updates merkle proofs for offers.
3299
3549
  *
3300
- * @param trees - Array of decoded trees with signatures (batch insertion)
3301
- * @returns Array of tree roots that were created/upserted
3550
+ * @param paths - Array of offer proof rows
3302
3551
  */
3303
- create: (trees: CreateInput[]) => Promise<Hex[]>;
3552
+ upsertPaths: (paths: UpsertPathsInput[]) => Promise<void>;
3304
3553
  /**
3305
3554
  * Retrieves merkle attestations for execution flow.
3306
3555
  *
3307
- * @param hashes - Array of offer hashes to look up
3308
- * @returns Map of offer hash to attestation (only entries with attestations are included)
3556
+ * @param references - Array of offer references to look up
3557
+ * @returns Map of serialized offer key (`offerHash:obligationId`) to attestation
3309
3558
  */
3310
- getAttestations: (hashes: Hex[]) => Promise<Map<Hex, Attestation>>;
3559
+ getAttestations: (references: OfferReference[]) => Promise<Map<string, Attestation>>;
3311
3560
  };
3312
3561
  //#endregion
3313
3562
  //#region src/database/domains/Validations.d.ts
@@ -3347,7 +3596,9 @@ type ListObligationsParameters = {
3347
3596
  limit?: number;
3348
3597
  };
3349
3598
  type ListedObligation = {
3350
- obligation: Obligation;
3599
+ obligationId: Hex;
3600
+ chainId: Id;
3601
+ obligation: Obligation$1;
3351
3602
  quote: Quote;
3352
3603
  };
3353
3604
  type ListObligationsResult = {
@@ -3553,7 +3804,10 @@ type GatekeeperClient = {
3553
3804
  statusCode: number;
3554
3805
  body: ConfigRulesPayload;
3555
3806
  }>; /** Validate offers and return decision results. */
3556
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
3807
+ isAllowed: (parameters: {
3808
+ offers: Offer[];
3809
+ chainId: number;
3810
+ }) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
3557
3811
  baseUrl: string;
3558
3812
  };
3559
3813
  type ClientConfig = {
@@ -4799,7 +5053,12 @@ interface components {
4799
5053
  block_number: number;
4800
5054
  };
4801
5055
  ValidateOffersRequest: {
4802
- /** @description Array of offers in snake_case format. Required, non-empty. */offers: components["schemas"]["ValidateOfferRequest"][];
5056
+ /**
5057
+ * @description Chain id used for chain-scoped validation rules.
5058
+ * @example 1
5059
+ */
5060
+ chain_id: number; /** @description Array of offers in snake_case format. Required, non-empty. */
5061
+ offers: components["schemas"]["ValidateOfferRequest"][];
4803
5062
  };
4804
5063
  ValidateOfferRequest: {
4805
5064
  /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
@@ -4812,8 +5071,7 @@ interface components {
4812
5071
  start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
4813
5072
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
4814
5073
  session: string; /** @example false */
4815
- buy: boolean; /** @example 1 */
4816
- chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
5074
+ buy: boolean; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
4817
5075
  loan_token: string;
4818
5076
  /**
4819
5077
  * @example [
@@ -4876,15 +5134,17 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
4876
5134
  * @constructor
4877
5135
  * @param obligation - {@link Obligation}
4878
5136
  * @param quote - {@link Quote}
5137
+ * @param chainId - The chain id used to compute `id`.
4879
5138
  * @returns The created `ObligationResponse`. {@link ObligationResponse}
4880
5139
  */
4881
- declare function from$3(obligation: Obligation, quote: Quote): ObligationResponse;
5140
+ declare function from$3(obligation: Obligation$1, quote: Quote, chainId: Id): ObligationResponse;
4882
5141
  declare namespace OfferResponse_d_exports {
4883
5142
  export { Input, OfferResponse, from$2 as from };
4884
5143
  }
4885
5144
  type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
4886
5145
  type Input = Readonly<{
4887
5146
  hash: Hex;
5147
+ obligationId: Hex;
4888
5148
  maker: Address;
4889
5149
  assets: bigint;
4890
5150
  obligationUnits: bigint;
@@ -5058,6 +5318,7 @@ declare const schemas: {
5058
5318
  limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
5059
5319
  }, z$1.core.$strip>;
5060
5320
  readonly validate_offers: z$1.ZodObject<{
5321
+ chain_id: z$1.ZodNumber;
5061
5322
  offers: z$1.ZodArray<z$1.ZodUnknown>;
5062
5323
  }, z$1.core.$strict>;
5063
5324
  readonly get_user_positions: z$1.ZodObject<{
@@ -5189,14 +5450,18 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
5189
5450
  */
5190
5451
  declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
5191
5452
  declare namespace Gatekeeper_d_exports {
5192
- export { Gatekeeper, Rules, create };
5453
+ export { Gatekeeper, Rules, RulesFactory, create };
5193
5454
  }
5194
5455
  type Rules = readonly Rule<Offer, string>[];
5456
+ type RulesFactory = (chainId: Id) => Rules;
5195
5457
  type Gatekeeper = {
5196
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
5458
+ isAllowed: (parameters: {
5459
+ offers: Offer[];
5460
+ chainId: Id;
5461
+ }) => Promise<Result<Offer, string>>;
5197
5462
  };
5198
5463
  type GatekeeperParameters = {
5199
- rules: Rules;
5464
+ rules: RulesFactory;
5200
5465
  };
5201
5466
  /**
5202
5467
  * Create a gatekeeper instance with the provided rules.
@@ -5326,8 +5591,9 @@ declare namespace getObligations {
5326
5591
  };
5327
5592
  type ReturnType = {
5328
5593
  obligations: Compute<{
5329
- /** The obligation id. Uses {@link Obligation.id} to calculate the id.*/id: () => Hex;
5330
- } & Obligation & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
5594
+ /** The obligation id returned by the API. */id: Hex; /** The chain id used to compute the obligation id. */
5595
+ chainId: Id;
5596
+ } & Obligation$1 & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
5331
5597
  cursor: string | null;
5332
5598
  };
5333
5599
  type ErrorType = GetApiErrorType;
@@ -5359,11 +5625,12 @@ declare class HttpGetApiFailedError extends BaseError {
5359
5625
  }
5360
5626
  //#endregion
5361
5627
  //#region src/database/drizzle/VERSION.d.ts
5362
- declare const VERSION: "router_v1.8";
5628
+ declare const VERSION: "router_v1.11";
5363
5629
  //#endregion
5364
5630
  //#region src/database/drizzle/schema.d.ts
5365
5631
  declare enum EnumTableName {
5366
5632
  OBLIGATIONS = "obligations",
5633
+ OBLIGATION_ID_KEYS = "obligation_id_keys",
5367
5634
  GROUPS = "groups",
5368
5635
  CONSUMED_EVENTS = "consumed_events",
5369
5636
  OBLIGATION_COLLATERALS_V2 = "obligation_collaterals_v2",
@@ -5377,20 +5644,21 @@ declare enum EnumTableName {
5377
5644
  COLLECTORS = "collectors",
5378
5645
  CHAINS = "chains",
5379
5646
  LOTS = "lots",
5647
+ LOTS_POSITIONS = "lots_positions",
5380
5648
  OFFSETS = "offsets",
5381
5649
  TREES = "trees",
5382
5650
  MERKLE_PATHS = "merkle_paths"
5383
5651
  }
5384
5652
  declare const TABLE_NAMES: readonly EnumTableName[];
5385
- 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\"")[];
5653
+ 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\"")[];
5386
5654
  type TableName = (typeof TABLE_NAMES)[number];
5387
5655
  type VersionedTableName = `"${typeof VERSION}"."${TableName}"`;
5388
5656
  declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5389
5657
  name: EnumTableName.OBLIGATIONS;
5390
- schema: "router_v1.8";
5658
+ schema: "router_v1.11";
5391
5659
  columns: {
5392
- obligationId: drizzle_orm_pg_core0.PgColumn<{
5393
- name: "obligation_id";
5660
+ obligationKey: drizzle_orm_pg_core0.PgColumn<{
5661
+ name: "obligation_key";
5394
5662
  tableName: EnumTableName.OBLIGATIONS;
5395
5663
  dataType: "string";
5396
5664
  columnType: "PgVarchar";
@@ -5408,12 +5676,31 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5408
5676
  }, {}, {
5409
5677
  length: 66;
5410
5678
  }>;
5411
- chainId: drizzle_orm_pg_core0.PgColumn<{
5412
- name: "chain_id";
5679
+ loanToken: drizzle_orm_pg_core0.PgColumn<{
5680
+ name: "loan_token";
5681
+ tableName: EnumTableName.OBLIGATIONS;
5682
+ dataType: "string";
5683
+ columnType: "PgVarchar";
5684
+ data: string;
5685
+ driverParam: string;
5686
+ notNull: true;
5687
+ hasDefault: false;
5688
+ isPrimaryKey: false;
5689
+ isAutoincrement: false;
5690
+ hasRuntimeDefault: false;
5691
+ enumValues: [string, ...string[]];
5692
+ baseColumn: never;
5693
+ identity: undefined;
5694
+ generated: undefined;
5695
+ }, {}, {
5696
+ length: 42;
5697
+ }>;
5698
+ maturity: drizzle_orm_pg_core0.PgColumn<{
5699
+ name: "maturity";
5413
5700
  tableName: EnumTableName.OBLIGATIONS;
5414
5701
  dataType: "number";
5415
- columnType: "PgBigInt53";
5416
- data: Id;
5702
+ columnType: "PgInteger";
5703
+ data: number;
5417
5704
  driverParam: string | number;
5418
5705
  notNull: true;
5419
5706
  hasDefault: false;
@@ -5424,12 +5711,36 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5424
5711
  baseColumn: never;
5425
5712
  identity: undefined;
5426
5713
  generated: undefined;
5714
+ }, {}, {}>;
5715
+ };
5716
+ dialect: "pg";
5717
+ }>;
5718
+ declare const obligationIdKeys: drizzle_orm_pg_core0.PgTableWithColumns<{
5719
+ name: EnumTableName.OBLIGATION_ID_KEYS;
5720
+ schema: "router_v1.11";
5721
+ columns: {
5722
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
5723
+ name: "obligation_id";
5724
+ tableName: EnumTableName.OBLIGATION_ID_KEYS;
5725
+ dataType: "string";
5726
+ columnType: "PgVarchar";
5727
+ data: string;
5728
+ driverParam: string;
5729
+ notNull: true;
5730
+ hasDefault: false;
5731
+ isPrimaryKey: true;
5732
+ isAutoincrement: false;
5733
+ hasRuntimeDefault: false;
5734
+ enumValues: [string, ...string[]];
5735
+ baseColumn: never;
5736
+ identity: undefined;
5737
+ generated: undefined;
5427
5738
  }, {}, {
5428
- $type: Id;
5739
+ length: 66;
5429
5740
  }>;
5430
- loanToken: drizzle_orm_pg_core0.PgColumn<{
5431
- name: "loan_token";
5432
- tableName: EnumTableName.OBLIGATIONS;
5741
+ obligationKey: drizzle_orm_pg_core0.PgColumn<{
5742
+ name: "obligation_key";
5743
+ tableName: EnumTableName.OBLIGATION_ID_KEYS;
5433
5744
  dataType: "string";
5434
5745
  columnType: "PgVarchar";
5435
5746
  data: string;
@@ -5444,31 +5755,52 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5444
5755
  identity: undefined;
5445
5756
  generated: undefined;
5446
5757
  }, {}, {
5447
- length: 42;
5758
+ length: 66;
5448
5759
  }>;
5449
- maturity: drizzle_orm_pg_core0.PgColumn<{
5450
- name: "maturity";
5451
- tableName: EnumTableName.OBLIGATIONS;
5760
+ chainId: drizzle_orm_pg_core0.PgColumn<{
5761
+ name: "chain_id";
5762
+ tableName: EnumTableName.OBLIGATION_ID_KEYS;
5452
5763
  dataType: "number";
5453
- columnType: "PgInteger";
5454
- data: number;
5764
+ columnType: "PgBigInt53";
5765
+ data: Id;
5455
5766
  driverParam: string | number;
5456
5767
  notNull: true;
5457
5768
  hasDefault: false;
5458
5769
  isPrimaryKey: false;
5459
5770
  isAutoincrement: false;
5460
5771
  hasRuntimeDefault: false;
5461
- enumValues: undefined;
5772
+ enumValues: undefined;
5773
+ baseColumn: never;
5774
+ identity: undefined;
5775
+ generated: undefined;
5776
+ }, {}, {
5777
+ $type: Id;
5778
+ }>;
5779
+ morphoV2: drizzle_orm_pg_core0.PgColumn<{
5780
+ name: "morpho_v2";
5781
+ tableName: EnumTableName.OBLIGATION_ID_KEYS;
5782
+ dataType: "string";
5783
+ columnType: "PgVarchar";
5784
+ data: string;
5785
+ driverParam: string;
5786
+ notNull: true;
5787
+ hasDefault: false;
5788
+ isPrimaryKey: false;
5789
+ isAutoincrement: false;
5790
+ hasRuntimeDefault: false;
5791
+ enumValues: [string, ...string[]];
5462
5792
  baseColumn: never;
5463
5793
  identity: undefined;
5464
5794
  generated: undefined;
5465
- }, {}, {}>;
5795
+ }, {}, {
5796
+ length: 42;
5797
+ }>;
5466
5798
  };
5467
5799
  dialect: "pg";
5468
5800
  }>;
5469
5801
  declare const groups: drizzle_orm_pg_core0.PgTableWithColumns<{
5470
5802
  name: EnumTableName.GROUPS;
5471
- schema: "router_v1.8";
5803
+ schema: "router_v1.11";
5472
5804
  columns: {
5473
5805
  chainId: drizzle_orm_pg_core0.PgColumn<{
5474
5806
  name: "chain_id";
@@ -5583,7 +5915,7 @@ declare const groups: drizzle_orm_pg_core0.PgTableWithColumns<{
5583
5915
  }>;
5584
5916
  declare const consumedEvents: drizzle_orm_pg_core0.PgTableWithColumns<{
5585
5917
  name: EnumTableName.CONSUMED_EVENTS;
5586
- schema: "router_v1.8";
5918
+ schema: "router_v1.11";
5587
5919
  columns: {
5588
5920
  eventId: drizzle_orm_pg_core0.PgColumn<{
5589
5921
  name: "event_id";
@@ -5717,10 +6049,10 @@ declare const consumedEvents: drizzle_orm_pg_core0.PgTableWithColumns<{
5717
6049
  }>;
5718
6050
  declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5719
6051
  name: EnumTableName.OBLIGATION_COLLATERALS_V2;
5720
- schema: "router_v1.8";
6052
+ schema: "router_v1.11";
5721
6053
  columns: {
5722
- obligationId: drizzle_orm_pg_core0.PgColumn<{
5723
- name: "obligation_id";
6054
+ obligationKey: drizzle_orm_pg_core0.PgColumn<{
6055
+ name: "obligation_key";
5724
6056
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
5725
6057
  dataType: "string";
5726
6058
  columnType: "PgVarchar";
@@ -5757,25 +6089,6 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5757
6089
  }, {}, {
5758
6090
  length: 42;
5759
6091
  }>;
5760
- oracleChainId: drizzle_orm_pg_core0.PgColumn<{
5761
- name: "oracle_chain_id";
5762
- tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
5763
- dataType: "number";
5764
- columnType: "PgBigInt53";
5765
- data: Id;
5766
- driverParam: string | number;
5767
- notNull: true;
5768
- hasDefault: false;
5769
- isPrimaryKey: false;
5770
- isAutoincrement: false;
5771
- hasRuntimeDefault: false;
5772
- enumValues: undefined;
5773
- baseColumn: never;
5774
- identity: undefined;
5775
- generated: undefined;
5776
- }, {}, {
5777
- $type: Id;
5778
- }>;
5779
6092
  oracleAddress: drizzle_orm_pg_core0.PgColumn<{
5780
6093
  name: "oracle_address";
5781
6094
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
@@ -5812,6 +6125,23 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5812
6125
  identity: undefined;
5813
6126
  generated: undefined;
5814
6127
  }, {}, {}>;
6128
+ collateralIndex: drizzle_orm_pg_core0.PgColumn<{
6129
+ name: "collateral_index";
6130
+ tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
6131
+ dataType: "number";
6132
+ columnType: "PgInteger";
6133
+ data: number;
6134
+ driverParam: string | number;
6135
+ notNull: true;
6136
+ hasDefault: false;
6137
+ isPrimaryKey: false;
6138
+ isAutoincrement: false;
6139
+ hasRuntimeDefault: false;
6140
+ enumValues: undefined;
6141
+ baseColumn: never;
6142
+ identity: undefined;
6143
+ generated: undefined;
6144
+ }, {}, {}>;
5815
6145
  updatedAt: drizzle_orm_pg_core0.PgColumn<{
5816
6146
  name: "updated_at";
5817
6147
  tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
@@ -5834,7 +6164,7 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5834
6164
  }>;
5835
6165
  declare const oracles: drizzle_orm_pg_core0.PgTableWithColumns<{
5836
6166
  name: EnumTableName.ORACLES;
5837
- schema: "router_v1.8";
6167
+ schema: "router_v1.11";
5838
6168
  columns: {
5839
6169
  chainId: drizzle_orm_pg_core0.PgColumn<{
5840
6170
  name: "chain_id";
@@ -5930,7 +6260,7 @@ declare const oracles: drizzle_orm_pg_core0.PgTableWithColumns<{
5930
6260
  }>;
5931
6261
  declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
5932
6262
  name: EnumTableName.OFFERS;
5933
- schema: "router_v1.8";
6263
+ schema: "router_v1.11";
5934
6264
  columns: {
5935
6265
  hash: drizzle_orm_pg_core0.PgColumn<{
5936
6266
  name: "hash";
@@ -5941,7 +6271,7 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
5941
6271
  driverParam: string;
5942
6272
  notNull: true;
5943
6273
  hasDefault: false;
5944
- isPrimaryKey: true;
6274
+ isPrimaryKey: false;
5945
6275
  isAutoincrement: false;
5946
6276
  hasRuntimeDefault: false;
5947
6277
  enumValues: [string, ...string[]];
@@ -6276,7 +6606,7 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
6276
6606
  }>;
6277
6607
  declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6278
6608
  name: EnumTableName.OFFERS_CALLBACKS;
6279
- schema: "router_v1.8";
6609
+ schema: "router_v1.11";
6280
6610
  columns: {
6281
6611
  offerHash: drizzle_orm_pg_core0.PgColumn<{
6282
6612
  name: "offer_hash";
@@ -6297,6 +6627,25 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6297
6627
  }, {}, {
6298
6628
  length: 66;
6299
6629
  }>;
6630
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
6631
+ name: "obligation_id";
6632
+ tableName: EnumTableName.OFFERS_CALLBACKS;
6633
+ dataType: "string";
6634
+ columnType: "PgVarchar";
6635
+ data: string;
6636
+ driverParam: string;
6637
+ notNull: true;
6638
+ hasDefault: false;
6639
+ isPrimaryKey: false;
6640
+ isAutoincrement: false;
6641
+ hasRuntimeDefault: false;
6642
+ enumValues: [string, ...string[]];
6643
+ baseColumn: never;
6644
+ identity: undefined;
6645
+ generated: undefined;
6646
+ }, {}, {
6647
+ length: 66;
6648
+ }>;
6300
6649
  callbackId: drizzle_orm_pg_core0.PgColumn<{
6301
6650
  name: "callback_id";
6302
6651
  tableName: EnumTableName.OFFERS_CALLBACKS;
@@ -6321,7 +6670,7 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6321
6670
  }>;
6322
6671
  declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6323
6672
  name: EnumTableName.CALLBACKS;
6324
- schema: "router_v1.8";
6673
+ schema: "router_v1.11";
6325
6674
  columns: {
6326
6675
  id: drizzle_orm_pg_core0.PgColumn<{
6327
6676
  name: "id";
@@ -6399,6 +6748,23 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6399
6748
  }, {}, {
6400
6749
  length: 42;
6401
6750
  }>;
6751
+ positionTypeId: drizzle_orm_pg_core0.PgColumn<{
6752
+ name: "position_type_id";
6753
+ tableName: EnumTableName.CALLBACKS;
6754
+ dataType: "number";
6755
+ columnType: "PgInteger";
6756
+ data: number;
6757
+ driverParam: string | number;
6758
+ notNull: true;
6759
+ hasDefault: false;
6760
+ isPrimaryKey: false;
6761
+ isAutoincrement: false;
6762
+ hasRuntimeDefault: false;
6763
+ enumValues: undefined;
6764
+ baseColumn: never;
6765
+ identity: undefined;
6766
+ generated: undefined;
6767
+ }, {}, {}>;
6402
6768
  amount: drizzle_orm_pg_core0.PgColumn<{
6403
6769
  name: "amount";
6404
6770
  tableName: EnumTableName.CALLBACKS;
@@ -6419,9 +6785,90 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6419
6785
  };
6420
6786
  dialect: "pg";
6421
6787
  }>;
6788
+ declare const lotsPositions: drizzle_orm_pg_core0.PgTableWithColumns<{
6789
+ name: EnumTableName.LOTS_POSITIONS;
6790
+ schema: "router_v1.11";
6791
+ columns: {
6792
+ chainId: drizzle_orm_pg_core0.PgColumn<{
6793
+ name: "chain_id";
6794
+ tableName: EnumTableName.LOTS_POSITIONS;
6795
+ dataType: "number";
6796
+ columnType: "PgBigInt53";
6797
+ data: Id;
6798
+ driverParam: string | number;
6799
+ notNull: true;
6800
+ hasDefault: false;
6801
+ isPrimaryKey: false;
6802
+ isAutoincrement: false;
6803
+ hasRuntimeDefault: false;
6804
+ enumValues: undefined;
6805
+ baseColumn: never;
6806
+ identity: undefined;
6807
+ generated: undefined;
6808
+ }, {}, {
6809
+ $type: Id;
6810
+ }>;
6811
+ contract: drizzle_orm_pg_core0.PgColumn<{
6812
+ name: "contract";
6813
+ tableName: EnumTableName.LOTS_POSITIONS;
6814
+ dataType: "string";
6815
+ columnType: "PgVarchar";
6816
+ data: string;
6817
+ driverParam: string;
6818
+ notNull: true;
6819
+ hasDefault: false;
6820
+ isPrimaryKey: false;
6821
+ isAutoincrement: false;
6822
+ hasRuntimeDefault: false;
6823
+ enumValues: [string, ...string[]];
6824
+ baseColumn: never;
6825
+ identity: undefined;
6826
+ generated: undefined;
6827
+ }, {}, {
6828
+ length: 42;
6829
+ }>;
6830
+ user: drizzle_orm_pg_core0.PgColumn<{
6831
+ name: "user";
6832
+ tableName: EnumTableName.LOTS_POSITIONS;
6833
+ dataType: "string";
6834
+ columnType: "PgVarchar";
6835
+ data: string;
6836
+ driverParam: string;
6837
+ notNull: true;
6838
+ hasDefault: false;
6839
+ isPrimaryKey: false;
6840
+ isAutoincrement: false;
6841
+ hasRuntimeDefault: false;
6842
+ enumValues: [string, ...string[]];
6843
+ baseColumn: never;
6844
+ identity: undefined;
6845
+ generated: undefined;
6846
+ }, {}, {
6847
+ length: 42;
6848
+ }>;
6849
+ positionTypeId: drizzle_orm_pg_core0.PgColumn<{
6850
+ name: "position_type_id";
6851
+ tableName: EnumTableName.LOTS_POSITIONS;
6852
+ dataType: "number";
6853
+ columnType: "PgInteger";
6854
+ data: number;
6855
+ driverParam: string | number;
6856
+ notNull: true;
6857
+ hasDefault: false;
6858
+ isPrimaryKey: false;
6859
+ isAutoincrement: false;
6860
+ hasRuntimeDefault: false;
6861
+ enumValues: undefined;
6862
+ baseColumn: never;
6863
+ identity: undefined;
6864
+ generated: undefined;
6865
+ }, {}, {}>;
6866
+ };
6867
+ dialect: "pg";
6868
+ }>;
6422
6869
  declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
6423
6870
  name: EnumTableName.LOTS;
6424
- schema: "router_v1.8";
6871
+ schema: "router_v1.11";
6425
6872
  columns: {
6426
6873
  chainId: drizzle_orm_pg_core0.PgColumn<{
6427
6874
  name: "chain_id";
@@ -6557,7 +7004,7 @@ declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
6557
7004
  }>;
6558
7005
  declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
6559
7006
  name: EnumTableName.OFFSETS;
6560
- schema: "router_v1.8";
7007
+ schema: "router_v1.11";
6561
7008
  columns: {
6562
7009
  chainId: drizzle_orm_pg_core0.PgColumn<{
6563
7010
  name: "chain_id";
@@ -6677,7 +7124,7 @@ declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
6677
7124
  declare const PositionTypes: drizzle_orm_pg_core0.PgEnum<[Type, ...Type[]]>;
6678
7125
  declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
6679
7126
  name: "position_types";
6680
- schema: "router_v1.8";
7127
+ schema: "router_v1.11";
6681
7128
  columns: {
6682
7129
  id: drizzle_orm_pg_core0.PgColumn<{
6683
7130
  name: "id";
@@ -6718,7 +7165,7 @@ declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
6718
7165
  }>;
6719
7166
  declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6720
7167
  name: EnumTableName.POSITIONS;
6721
- schema: "router_v1.8";
7168
+ schema: "router_v1.11";
6722
7169
  columns: {
6723
7170
  chainId: drizzle_orm_pg_core0.PgColumn<{
6724
7171
  name: "chain_id";
@@ -6756,7 +7203,7 @@ declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6756
7203
  identity: undefined;
6757
7204
  generated: undefined;
6758
7205
  }, {}, {
6759
- length: 42;
7206
+ length: 66;
6760
7207
  }>;
6761
7208
  user: drizzle_orm_pg_core0.PgColumn<{
6762
7209
  name: "user";
@@ -6818,7 +7265,7 @@ declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6818
7265
  columnType: "PgVarchar";
6819
7266
  data: string;
6820
7267
  driverParam: string;
6821
- notNull: false;
7268
+ notNull: true;
6822
7269
  hasDefault: false;
6823
7270
  isPrimaryKey: false;
6824
7271
  isAutoincrement: false;
@@ -6869,7 +7316,7 @@ declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6869
7316
  }>;
6870
7317
  declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6871
7318
  name: EnumTableName.TRANSFERS;
6872
- schema: "router_v1.8";
7319
+ schema: "router_v1.11";
6873
7320
  columns: {
6874
7321
  eventId: drizzle_orm_pg_core0.PgColumn<{
6875
7322
  name: "event_id";
@@ -6926,7 +7373,7 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6926
7373
  identity: undefined;
6927
7374
  generated: undefined;
6928
7375
  }, {}, {
6929
- length: 42;
7376
+ length: 66;
6930
7377
  }>;
6931
7378
  from: drizzle_orm_pg_core0.PgColumn<{
6932
7379
  name: "from";
@@ -6983,6 +7430,42 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6983
7430
  identity: undefined;
6984
7431
  generated: undefined;
6985
7432
  }, {}, {}>;
7433
+ positionTypeId: drizzle_orm_pg_core0.PgColumn<{
7434
+ name: "position_type_id";
7435
+ tableName: EnumTableName.TRANSFERS;
7436
+ dataType: "number";
7437
+ columnType: "PgInteger";
7438
+ data: number;
7439
+ driverParam: string | number;
7440
+ notNull: true;
7441
+ hasDefault: false;
7442
+ isPrimaryKey: false;
7443
+ isAutoincrement: false;
7444
+ hasRuntimeDefault: false;
7445
+ enumValues: undefined;
7446
+ baseColumn: never;
7447
+ identity: undefined;
7448
+ generated: undefined;
7449
+ }, {}, {}>;
7450
+ asset: drizzle_orm_pg_core0.PgColumn<{
7451
+ name: "asset";
7452
+ tableName: EnumTableName.TRANSFERS;
7453
+ dataType: "string";
7454
+ columnType: "PgVarchar";
7455
+ data: string;
7456
+ driverParam: string;
7457
+ notNull: true;
7458
+ hasDefault: false;
7459
+ isPrimaryKey: false;
7460
+ isAutoincrement: false;
7461
+ hasRuntimeDefault: false;
7462
+ enumValues: [string, ...string[]];
7463
+ baseColumn: never;
7464
+ identity: undefined;
7465
+ generated: undefined;
7466
+ }, {}, {
7467
+ length: 42;
7468
+ }>;
6986
7469
  blockNumber: drizzle_orm_pg_core0.PgColumn<{
6987
7470
  name: "block_number";
6988
7471
  tableName: EnumTableName.TRANSFERS;
@@ -7023,7 +7506,7 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
7023
7506
  declare const StatusCode: drizzle_orm_pg_core0.PgEnum<[Status, ...Status[]]>;
7024
7507
  declare const status: drizzle_orm_pg_core0.PgTableWithColumns<{
7025
7508
  name: "status";
7026
- schema: "router_v1.8";
7509
+ schema: "router_v1.11";
7027
7510
  columns: {
7028
7511
  id: drizzle_orm_pg_core0.PgColumn<{
7029
7512
  name: "id";
@@ -7064,7 +7547,7 @@ declare const status: drizzle_orm_pg_core0.PgTableWithColumns<{
7064
7547
  }>;
7065
7548
  declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
7066
7549
  name: "validations";
7067
- schema: "router_v1.8";
7550
+ schema: "router_v1.11";
7068
7551
  columns: {
7069
7552
  offerHash: drizzle_orm_pg_core0.PgColumn<{
7070
7553
  name: "offer_hash";
@@ -7075,7 +7558,26 @@ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
7075
7558
  driverParam: string;
7076
7559
  notNull: true;
7077
7560
  hasDefault: false;
7078
- isPrimaryKey: true;
7561
+ isPrimaryKey: false;
7562
+ isAutoincrement: false;
7563
+ hasRuntimeDefault: false;
7564
+ enumValues: [string, ...string[]];
7565
+ baseColumn: never;
7566
+ identity: undefined;
7567
+ generated: undefined;
7568
+ }, {}, {
7569
+ length: 66;
7570
+ }>;
7571
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
7572
+ name: "obligation_id";
7573
+ tableName: "validations";
7574
+ dataType: "string";
7575
+ columnType: "PgVarchar";
7576
+ data: string;
7577
+ driverParam: string;
7578
+ notNull: true;
7579
+ hasDefault: false;
7580
+ isPrimaryKey: false;
7079
7581
  isAutoincrement: false;
7080
7582
  hasRuntimeDefault: false;
7081
7583
  enumValues: [string, ...string[]];
@@ -7124,7 +7626,7 @@ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
7124
7626
  }>;
7125
7627
  declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7126
7628
  name: EnumTableName.COLLECTORS;
7127
- schema: "router_v1.8";
7629
+ schema: "router_v1.11";
7128
7630
  columns: {
7129
7631
  chainId: drizzle_orm_pg_core0.PgColumn<{
7130
7632
  name: "chain_id";
@@ -7150,7 +7652,7 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7150
7652
  tableName: EnumTableName.COLLECTORS;
7151
7653
  dataType: "string";
7152
7654
  columnType: "PgText";
7153
- data: "offers" | "consumed_events" | "positions" | "prices";
7655
+ data: "morpho_v2" | "offers" | "positions" | "prices";
7154
7656
  driverParam: string;
7155
7657
  notNull: true;
7156
7658
  hasDefault: false;
@@ -7162,7 +7664,7 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7162
7664
  identity: undefined;
7163
7665
  generated: undefined;
7164
7666
  }, {}, {
7165
- $type: "offers" | "consumed_events" | "positions" | "prices";
7667
+ $type: "morpho_v2" | "offers" | "positions" | "prices";
7166
7668
  }>;
7167
7669
  blockNumber: drizzle_orm_pg_core0.PgColumn<{
7168
7670
  name: "block_number";
@@ -7218,9 +7720,9 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7218
7720
  };
7219
7721
  dialect: "pg";
7220
7722
  }>;
7221
- declare const chains$1: drizzle_orm_pg_core0.PgTableWithColumns<{
7723
+ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
7222
7724
  name: EnumTableName.CHAINS;
7223
- schema: "router_v1.8";
7725
+ schema: "router_v1.11";
7224
7726
  columns: {
7225
7727
  chainId: drizzle_orm_pg_core0.PgColumn<{
7226
7728
  name: "chain_id";
@@ -7297,7 +7799,7 @@ declare const chains$1: drizzle_orm_pg_core0.PgTableWithColumns<{
7297
7799
  }>;
7298
7800
  declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
7299
7801
  name: EnumTableName.TREES;
7300
- schema: "router_v1.8";
7802
+ schema: "router_v1.11";
7301
7803
  columns: {
7302
7804
  root: drizzle_orm_pg_core0.PgColumn<{
7303
7805
  name: "root";
@@ -7359,7 +7861,7 @@ declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
7359
7861
  }>;
7360
7862
  declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
7361
7863
  name: EnumTableName.MERKLE_PATHS;
7362
- schema: "router_v1.8";
7864
+ schema: "router_v1.11";
7363
7865
  columns: {
7364
7866
  offerHash: drizzle_orm_pg_core0.PgColumn<{
7365
7867
  name: "offer_hash";
@@ -7370,7 +7872,26 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
7370
7872
  driverParam: string;
7371
7873
  notNull: true;
7372
7874
  hasDefault: false;
7373
- isPrimaryKey: true;
7875
+ isPrimaryKey: false;
7876
+ isAutoincrement: false;
7877
+ hasRuntimeDefault: false;
7878
+ enumValues: [string, ...string[]];
7879
+ baseColumn: never;
7880
+ identity: undefined;
7881
+ generated: undefined;
7882
+ }, {}, {
7883
+ length: 66;
7884
+ }>;
7885
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
7886
+ name: "obligation_id";
7887
+ tableName: EnumTableName.MERKLE_PATHS;
7888
+ dataType: "string";
7889
+ columnType: "PgVarchar";
7890
+ data: string;
7891
+ driverParam: string;
7892
+ notNull: true;
7893
+ hasDefault: false;
7894
+ isPrimaryKey: false;
7374
7895
  isAutoincrement: false;
7375
7896
  hasRuntimeDefault: false;
7376
7897
  enumValues: [string, ...string[]];
@@ -7437,29 +7958,17 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
7437
7958
  dialect: "pg";
7438
7959
  }>;
7439
7960
  declare namespace index_d_exports$2 {
7440
- 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 };
7961
+ 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 };
7441
7962
  }
7442
7963
  //#endregion
7443
7964
  //#region src/gatekeeper/morphoRules.d.ts
7444
- 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">)[];
7965
+ declare const morphoRules: (parameters: {
7966
+ chains: Chain$1[];
7967
+ chainId: Id;
7968
+ }) => (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">)[];
7445
7969
  declare namespace Rules_d_exports {
7446
- export { ValidityParameters, amountMutualExclusivity, callback, chains, collateralToken, loanToken, maturity, oracle, sameMaker, validity };
7970
+ export { amountMutualExclusivity, callback, collateralToken, loanToken, maturity, oracle, sameMaker };
7447
7971
  }
7448
- type ValidityParameters = {
7449
- client: PublicClient<Transport, Chain$1>;
7450
- };
7451
- /**
7452
- * set of rules to validate offers.
7453
- *
7454
- * @param _parameters - Validity parameters with chain and client
7455
- * @returns Array of validation rules to evaluate against offers
7456
- */
7457
- declare function validity(_parameters: ValidityParameters): Rule<Offer, "expiry">[];
7458
- declare const chains: ({
7459
- chains
7460
- }: {
7461
- chains: Chain$1[];
7462
- }) => Rule<Offer, "chain_ids">;
7463
7972
  declare const maturity: ({
7464
7973
  maturities
7465
7974
  }: {
@@ -7477,9 +7986,11 @@ declare const callback: ({
7477
7986
  * @returns The issue that was found. If the offer is valid, this will be undefined.
7478
7987
  */
7479
7988
  declare const loanToken: ({
7480
- assetsByChainId
7989
+ assetsByChainId,
7990
+ chainId
7481
7991
  }: {
7482
7992
  assetsByChainId: Partial<Record<Id, Address[]>>;
7993
+ chainId: Id;
7483
7994
  }) => Rule<Offer, "loan_token">;
7484
7995
  /**
7485
7996
  * A validation rule that checks if the offer's collateral tokens are allowed for its chain.
@@ -7487,9 +7998,11 @@ declare const loanToken: ({
7487
7998
  * @returns The issue that was found. If the offer is valid, this will be undefined.
7488
7999
  */
7489
8000
  declare const collateralToken: ({
7490
- collateralAssetsByChainId
8001
+ collateralAssetsByChainId,
8002
+ chainId
7491
8003
  }: {
7492
8004
  collateralAssetsByChainId: Partial<Record<Id, Address[]>>;
8005
+ chainId: Id;
7493
8006
  }) => Rule<Offer, "collateral_token">;
7494
8007
  /**
7495
8008
  * A validation rule that checks if the offer's oracle addresses are allowed for its chain.
@@ -7497,9 +8010,11 @@ declare const collateralToken: ({
7497
8010
  * @returns The issue that was found. If the offer is valid, this will be undefined.
7498
8011
  */
7499
8012
  declare const oracle: ({
7500
- oraclesByChainId
8013
+ oraclesByChainId,
8014
+ chainId
7501
8015
  }: {
7502
8016
  oraclesByChainId: Partial<Record<Id, Address[]>>;
8017
+ chainId: Id;
7503
8018
  }) => Rule<Offer, "oracle">;
7504
8019
  /**
7505
8020
  * A batch validation rule that ensures all offers in a tree have the same maker address.
@@ -7541,7 +8056,7 @@ declare namespace from {
7541
8056
  */
7542
8057
  declare function add(config: MempoolEVMClientConfig, offers: AddParameters): Promise<Hex>;
7543
8058
  declare namespace add {
7544
- type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError | MissingMorphoAddressError;
8059
+ type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | MissingMorphoAddressError;
7545
8060
  }
7546
8061
  declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
7547
8062
  offers: Offer[];
@@ -7550,7 +8065,7 @@ declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters)
7550
8065
  declare namespace get {
7551
8066
  type ErrorType = streamOffersReturnType;
7552
8067
  }
7553
- type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError | MissingMorphoAddressError;
8068
+ type streamOffersReturnType = WalletAccountNotSetError | MissingMorphoAddressError;
7554
8069
  declare class WalletAccountNotSetError extends BaseError {
7555
8070
  name: string;
7556
8071
  constructor();
@@ -7558,10 +8073,6 @@ declare class WalletAccountNotSetError extends BaseError {
7558
8073
  declare class ViemClientError extends BaseError {
7559
8074
  name: string;
7560
8075
  }
7561
- declare class ChainIdMismatchError extends BaseError {
7562
- name: string;
7563
- constructor(expected: Id, actual: Id);
7564
- }
7565
8076
  declare class MissingMorphoAddressError extends BaseError {
7566
8077
  name: string;
7567
8078
  constructor();
@@ -7612,7 +8123,7 @@ declare namespace connect {
7612
8123
  type ErrorType = from.ErrorType;
7613
8124
  }
7614
8125
  declare namespace index_d_exports$1 {
7615
- export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, MissingMorphoAddressError, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
8126
+ export { AddParameters, Client$2 as Client, GetParameters, MissingMorphoAddressError, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
7616
8127
  }
7617
8128
  //#endregion
7618
8129
  //#region src/utils/BigMath.d.ts
@@ -7747,5 +8258,5 @@ declare namespace index_d_exports$3 {
7747
8258
  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 };
7748
8259
  }
7749
8260
  //#endregion
7750
- 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 };
8261
+ 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 };
7751
8262
  //# sourceMappingURL=index.node.d.mts.map