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