@morpho-org/morpho-sdk 5.10.1 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +6 -0
  2. package/lib/cjs/abis.d.ts +17 -2
  3. package/lib/cjs/abis.js +14 -1
  4. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
  5. package/lib/cjs/blue/abis.d.ts +5 -1
  6. package/lib/cjs/blue/abis.js +2 -0
  7. package/lib/cjs/blue/entities.d.ts +8 -2
  8. package/lib/cjs/blue/entities.js +1 -0
  9. package/lib/cjs/blue/errors.d.ts +1 -1
  10. package/lib/cjs/blue/errors.js +2 -1
  11. package/lib/cjs/blue/fetch.d.ts +3 -1
  12. package/lib/cjs/blue/fetch.js +1 -0
  13. package/lib/cjs/entities/blue/blue.d.ts +10 -0
  14. package/lib/cjs/entities/blue/blue.js +9 -2
  15. package/lib/cjs/entities/index.d.ts +8 -2
  16. package/lib/cjs/entities/index.js +1 -0
  17. package/lib/cjs/entities/midnight/midnight.js +5 -13
  18. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +2 -0
  19. package/lib/cjs/entities/vaultV1/vaultV1.js +2 -0
  20. package/lib/cjs/entities/vaultV1ReallocationData.d.ts +6 -0
  21. package/lib/cjs/entities/vaultV1ReallocationData.js +20 -5
  22. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +2 -0
  23. package/lib/cjs/entities/vaultV2/vaultV2.js +3 -1
  24. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
  25. package/lib/cjs/entities/vaultV2BlueReallocationData.js +41 -12
  26. package/lib/cjs/errors.d.ts +1 -1
  27. package/lib/cjs/errors.js +3 -2
  28. package/lib/cjs/fetch.d.ts +3 -1
  29. package/lib/cjs/fetch.js +1 -0
  30. package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +2 -0
  31. package/lib/cjs/helpers/computeVaultV1Reallocations.js +2 -0
  32. package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
  33. package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
  34. package/lib/cjs/helpers/validate.d.ts +30 -8
  35. package/lib/cjs/helpers/validate.js +30 -8
  36. package/lib/cjs/types/action.d.ts +57 -4
  37. package/lib/cjs/types/error.d.ts +1 -1
  38. package/lib/cjs/types/error.js +2 -2
  39. package/lib/cjs/types/sharedLiquidity.d.ts +2 -2
  40. package/lib/esm/abis.d.ts +17 -2
  41. package/lib/esm/abis.js +17 -2
  42. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
  43. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +3 -1
  44. package/lib/esm/blue/abis.d.ts +5 -1
  45. package/lib/esm/blue/abis.js +5 -1
  46. package/lib/esm/blue/entities.d.ts +8 -2
  47. package/lib/esm/blue/entities.js +3 -1
  48. package/lib/esm/blue/errors.d.ts +1 -1
  49. package/lib/esm/blue/errors.js +1 -1
  50. package/lib/esm/blue/fetch.d.ts +3 -1
  51. package/lib/esm/blue/fetch.js +3 -1
  52. package/lib/esm/entities/blue/blue.d.ts +10 -0
  53. package/lib/esm/entities/blue/blue.js +9 -2
  54. package/lib/esm/entities/index.d.ts +8 -2
  55. package/lib/esm/entities/index.js +3 -1
  56. package/lib/esm/entities/midnight/midnight.js +5 -13
  57. package/lib/esm/entities/vaultV1/vaultV1.d.ts +2 -0
  58. package/lib/esm/entities/vaultV1/vaultV1.js +2 -0
  59. package/lib/esm/entities/vaultV1ReallocationData.d.ts +6 -0
  60. package/lib/esm/entities/vaultV1ReallocationData.js +20 -5
  61. package/lib/esm/entities/vaultV2/vaultV2.d.ts +2 -0
  62. package/lib/esm/entities/vaultV2/vaultV2.js +3 -1
  63. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
  64. package/lib/esm/entities/vaultV2BlueReallocationData.js +41 -12
  65. package/lib/esm/errors.d.ts +1 -1
  66. package/lib/esm/errors.js +1 -1
  67. package/lib/esm/fetch.d.ts +3 -1
  68. package/lib/esm/fetch.js +3 -1
  69. package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +2 -0
  70. package/lib/esm/helpers/computeVaultV1Reallocations.js +2 -0
  71. package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
  72. package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
  73. package/lib/esm/helpers/validate.d.ts +30 -8
  74. package/lib/esm/helpers/validate.js +30 -8
  75. package/lib/esm/types/action.d.ts +57 -4
  76. package/lib/esm/types/error.d.ts +1 -1
  77. package/lib/esm/types/error.js +2 -2
  78. package/lib/esm/types/sharedLiquidity.d.ts +2 -2
  79. package/package.json +4 -4
@@ -1146,10 +1146,10 @@ class MidnightOfferRootOfferCountMismatchError extends Error {
1146
1146
  }
1147
1147
  }
1148
1148
  exports.MidnightOfferRootOfferCountMismatchError = MidnightOfferRootOfferCountMismatchError;
1149
- /** Thrown when a Midnight offer-root signature was not prepared by this maker flow. */
1149
+ /** Thrown when a Midnight offer-root signature carries no encoded payload. */
1150
1150
  class UnpreparedMidnightOfferRootSignatureError extends Error {
1151
1151
  constructor() {
1152
- super("Midnight offer root signature was not prepared for this offer tree. Sign this flow's offer-root requirement before building the submit transaction.");
1152
+ super("Midnight offer root signature carries no encoded payload. Sign the offer-root requirement (its signature already includes the payload) before building the submit transaction.");
1153
1153
  }
1154
1154
  }
1155
1155
  exports.UnpreparedMidnightOfferRootSignatureError = UnpreparedMidnightOfferRootSignatureError;
@@ -24,8 +24,8 @@ export interface PublicAllocatorOptions {
24
24
  * The maximum utilization each source market may reach when withdrawing
25
25
  * shared liquidity, scaled by WAD.
26
26
  *
27
- * @deprecated Per-market source ceilings will be removed in the next major.
28
- * Use `defaultMaxWithdrawalUtilization` to configure one ceiling for every source.
27
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major.
28
+ * Use `VaultV2BluePublicAllocatorOptions.maxWithdrawalUtilization` with the Vault V2 planner.
29
29
  */
30
30
  readonly maxWithdrawalUtilization?: Readonly<Record<MarketId, bigint | undefined>>;
31
31
  /**
package/lib/esm/abis.d.ts CHANGED
@@ -7,7 +7,11 @@ adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoA
7
7
  /** @deprecated Use `bluePreLiquidationAbi` or the raw `/blue/abis` subpath. */
8
8
  preLiquidationAbi, preLiquidationFactoryAbi as bluePreLiquidationFactoryAbi,
9
9
  /** @deprecated Use `bluePreLiquidationFactoryAbi` or the raw `/blue/abis` subpath. */
10
- preLiquidationFactoryAbi, publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi, vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
10
+ preLiquidationFactoryAbi,
11
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
12
+ publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
13
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
14
+ vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
11
15
  export { ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi,
12
16
  /** @deprecated Use `midnightEcrecoverRatifierAbi` or the raw `/midnight/abis` subpath. */
13
17
  ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi as midnightSetterRatifierAbi,
@@ -1164,7 +1168,12 @@ export declare const generalAdapter1Abi: readonly [{
1164
1168
  readonly name: "ZeroShares";
1165
1169
  readonly inputs: readonly [];
1166
1170
  }];
1167
- /** ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension. */
1171
+ /**
1172
+ * ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension.
1173
+ *
1174
+ * MORPHO legacy token wrapping entries are deprecated and will be removed in the next major.
1175
+ * Use the current MORPHO token directly. Native-token and stETH wrapping remain supported.
1176
+ */
1168
1177
  export declare const ethereumGeneralAdapter1Abi: readonly [{
1169
1178
  readonly type: "receive";
1170
1179
  readonly stateMutability: "payable";
@@ -1833,10 +1842,12 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
1833
1842
  readonly type: "address";
1834
1843
  readonly internalType: "address";
1835
1844
  }, {
1845
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1836
1846
  readonly name: "morphoToken";
1837
1847
  readonly type: "address";
1838
1848
  readonly internalType: "address";
1839
1849
  }, {
1850
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1840
1851
  readonly name: "morphoWrapper";
1841
1852
  readonly type: "address";
1842
1853
  readonly internalType: "address";
@@ -1844,6 +1855,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
1844
1855
  readonly stateMutability: "nonpayable";
1845
1856
  }, {
1846
1857
  readonly type: "function";
1858
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1847
1859
  readonly name: "MORPHO_TOKEN";
1848
1860
  readonly inputs: readonly [];
1849
1861
  readonly outputs: readonly [{
@@ -1854,6 +1866,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
1854
1866
  readonly stateMutability: "view";
1855
1867
  }, {
1856
1868
  readonly type: "function";
1869
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1857
1870
  readonly name: "MORPHO_WRAPPER";
1858
1871
  readonly inputs: readonly [];
1859
1872
  readonly outputs: readonly [{
@@ -1884,6 +1897,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
1884
1897
  readonly stateMutability: "view";
1885
1898
  }, {
1886
1899
  readonly type: "function";
1900
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1887
1901
  readonly name: "morphoWrapperDepositFor";
1888
1902
  readonly inputs: readonly [{
1889
1903
  readonly name: "receiver";
@@ -1898,6 +1912,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
1898
1912
  readonly stateMutability: "nonpayable";
1899
1913
  }, {
1900
1914
  readonly type: "function";
1915
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1901
1916
  readonly name: "morphoWrapperWithdrawTo";
1902
1917
  readonly inputs: readonly [{
1903
1918
  readonly name: "receiver";
package/lib/esm/abis.js CHANGED
@@ -7,7 +7,11 @@ adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoA
7
7
  /** @deprecated Use `bluePreLiquidationAbi` or the raw `/blue/abis` subpath. */
8
8
  preLiquidationAbi, preLiquidationFactoryAbi as bluePreLiquidationFactoryAbi,
9
9
  /** @deprecated Use `bluePreLiquidationFactoryAbi` or the raw `/blue/abis` subpath. */
10
- preLiquidationFactoryAbi, publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi, vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
10
+ preLiquidationFactoryAbi,
11
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
12
+ publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
13
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
14
+ vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
11
15
  export { ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi,
12
16
  /** @deprecated Use `midnightEcrecoverRatifierAbi` or the raw `/midnight/abis` subpath. */
13
17
  ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi as midnightSetterRatifierAbi,
@@ -1146,7 +1150,12 @@ export const generalAdapter1Abi = [
1146
1150
  inputs: [],
1147
1151
  },
1148
1152
  ];
1149
- /** ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension. */
1153
+ /**
1154
+ * ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension.
1155
+ *
1156
+ * MORPHO legacy token wrapping entries are deprecated and will be removed in the next major.
1157
+ * Use the current MORPHO token directly. Native-token and stETH wrapping remain supported.
1158
+ */
1150
1159
  export const ethereumGeneralAdapter1Abi = [
1151
1160
  ...generalAdapter1Abi,
1152
1161
  {
@@ -1173,11 +1182,13 @@ export const ethereumGeneralAdapter1Abi = [
1173
1182
  internalType: "address",
1174
1183
  },
1175
1184
  {
1185
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1176
1186
  name: "morphoToken",
1177
1187
  type: "address",
1178
1188
  internalType: "address",
1179
1189
  },
1180
1190
  {
1191
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1181
1192
  name: "morphoWrapper",
1182
1193
  type: "address",
1183
1194
  internalType: "address",
@@ -1187,6 +1198,7 @@ export const ethereumGeneralAdapter1Abi = [
1187
1198
  },
1188
1199
  {
1189
1200
  type: "function",
1201
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1190
1202
  name: "MORPHO_TOKEN",
1191
1203
  inputs: [],
1192
1204
  outputs: [
@@ -1200,6 +1212,7 @@ export const ethereumGeneralAdapter1Abi = [
1200
1212
  },
1201
1213
  {
1202
1214
  type: "function",
1215
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1203
1216
  name: "MORPHO_WRAPPER",
1204
1217
  inputs: [],
1205
1218
  outputs: [
@@ -1239,6 +1252,7 @@ export const ethereumGeneralAdapter1Abi = [
1239
1252
  },
1240
1253
  {
1241
1254
  type: "function",
1255
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1242
1256
  name: "morphoWrapperDepositFor",
1243
1257
  inputs: [
1244
1258
  {
@@ -1257,6 +1271,7 @@ export const ethereumGeneralAdapter1Abi = [
1257
1271
  },
1258
1272
  {
1259
1273
  type: "function",
1274
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1260
1275
  name: "morphoWrapperWithdrawTo",
1261
1276
  inputs: [
1262
1277
  {
@@ -2,7 +2,10 @@ import { VaultMarketPublicAllocatorConfig as BlueVaultMarketPublicAllocatorConfi
2
2
  import { fetchVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk-viem";
3
3
  declare module "@morpho-org/blue-sdk" {
4
4
  namespace VaultMarketPublicAllocatorConfig {
5
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `fetchVaultV2BlueMarketPublicAllocatorConfig` from `@morpho-org/morpho-sdk/fetch`. */
5
6
  let fetch: typeof fetchVaultMarketPublicAllocatorConfig;
6
7
  }
7
8
  }
8
- export { BlueVaultMarketPublicAllocatorConfig as VaultMarketPublicAllocatorConfig, };
9
+ export {
10
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig` from `@morpho-org/morpho-sdk/entities`. */
11
+ BlueVaultMarketPublicAllocatorConfig as VaultMarketPublicAllocatorConfig, };
@@ -2,4 +2,6 @@ import { VaultMarketPublicAllocatorConfig as BlueVaultMarketPublicAllocatorConfi
2
2
  import { fetchVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk-viem";
3
3
  BlueVaultMarketPublicAllocatorConfig.fetch =
4
4
  fetchVaultMarketPublicAllocatorConfig;
5
- export { BlueVaultMarketPublicAllocatorConfig as VaultMarketPublicAllocatorConfig, };
5
+ export {
6
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig` from `@morpho-org/morpho-sdk/entities`. */
7
+ BlueVaultMarketPublicAllocatorConfig as VaultMarketPublicAllocatorConfig, };
@@ -1,2 +1,6 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi, publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi, vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi,
3
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
4
+ publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
5
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
6
+ vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
@@ -1,2 +1,6 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi, publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi, vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi,
3
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
4
+ publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
5
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
6
+ vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
@@ -1,2 +1,8 @@
1
- export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition, IPreLiquidationParams, IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultMarketPublicAllocatorConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, VaultPublicAllocatorConfig, } from "@morpho-org/blue-sdk";
2
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position, PreLiquidationParams, PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
1
+ export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition, IPreLiquidationParams, IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig,
2
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `IVaultV2BlueMarketPublicAllocatorConfig`. */
3
+ IVaultMarketPublicAllocatorConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType,
4
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `IVaultV2BluePublicAllocatorConfig`. */
5
+ VaultPublicAllocatorConfig, } from "@morpho-org/blue-sdk";
6
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position, PreLiquidationParams, PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig,
7
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig`. */
8
+ VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1 +1,3 @@
1
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position, PreLiquidationParams, PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
1
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position, PreLiquidationParams, PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig,
2
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig`. */
3
+ VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1,2 +1,2 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError, UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
2
2
  export { getUnsupportedVaultV2Adapter, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,2 +1,2 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError, UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
2
2
  export { getUnsupportedVaultV2Adapter, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1 +1,3 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition, fetchPreLiquidationParams, fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultMarketPublicAllocatorConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition, fetchPreLiquidationParams, fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig,
2
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `fetchVaultV2BlueMarketPublicAllocatorConfig`. */
3
+ fetchVaultMarketPublicAllocatorConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -1 +1,3 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition, fetchPreLiquidationParams, fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultMarketPublicAllocatorConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition, fetchPreLiquidationParams, fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig,
2
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `fetchVaultV2BlueMarketPublicAllocatorConfig`. */
3
+ fetchVaultMarketPublicAllocatorConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -78,6 +78,7 @@ export interface BlueActions {
78
78
  *
79
79
  * @param params - Supply parameters.
80
80
  * @returns Object with `buildTx` and `getRequirements`.
81
+ * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
81
82
  */
82
83
  supply: (params: {
83
84
  userAddress: Address;
@@ -192,6 +193,7 @@ export interface BlueActions {
192
193
  *
193
194
  * @param params - Repay parameters including pre-fetched `positionData`.
194
195
  * @returns Object with `buildTx` and `getRequirements`.
196
+ * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
195
197
  */
196
198
  repay: (params: {
197
199
  userAddress: Address;
@@ -245,6 +247,7 @@ export interface BlueActions {
245
247
  *
246
248
  * @param params - Combined parameters including pre-fetched `positionData`.
247
249
  * @returns Object with `buildTx` and `getRequirements`.
250
+ * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
248
251
  */
249
252
  repayWithdrawCollateral: (params: {
250
253
  userAddress: Address;
@@ -337,6 +340,7 @@ export interface BlueActions {
337
340
  * @param params.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the
338
341
  * target market. Vault V1 inputs are deprecated; prefer Vault V2.
339
342
  * @returns Object with `buildTx` and `getRequirements`.
343
+ * @throws {UnsupportedBlueMarketIrmError} when positive source or target debt requires an unsupported IRM projection.
340
344
  * @throws {BundlerErrors.UnexpectedAction} when a V2 plan is unsupported on the chain.
341
345
  * @throws {InputExceedsMaxError} when a V2 reallocation asset amount exceeds `uint128` or its penalty exceeds WAD.
342
346
  * @throws {InconsistentReallocationPenaltyError} when V2 entries for one vault use different penalties.
@@ -456,6 +460,7 @@ export interface BlueActions {
456
460
  * @returns Array of vault reallocations ready to pass to `borrow()`, `supplyCollateralBorrow()`,
457
461
  * or `withdraw()`. Empty array if no reallocation is needed.
458
462
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to a different chain than this market.
463
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
459
464
  * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation's absolute shortfall on the target market — preventing fee-bearing reallocations from being attached to a call that would still revert onchain.
460
465
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds the target market supply.
461
466
  * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
@@ -482,6 +487,7 @@ export interface BlueActions {
482
487
  * @param params.options - Optional allocator and utilization options.
483
488
  * @returns Vault V1 reallocations ready for a Blue action.
484
489
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
490
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
485
491
  * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation.
486
492
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
487
493
  * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
@@ -505,6 +511,7 @@ export interface BlueActions {
505
511
  * @param params.options - Optional allocator discovery controls and operation to support.
506
512
  * @returns Action-ready reallocations and their post-simulation state.
507
513
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
514
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
508
515
  * @throws {NegativeInputError} when a utilization or penalty limit is negative.
509
516
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
510
517
  * @throws {NonPositiveInputError} when an enabled operation amount is not positive.
@@ -749,6 +756,7 @@ export declare class MorphoBlue implements BlueActions {
749
756
  * @param params.options - Optional allocator and utilization options.
750
757
  * @returns Vault reallocations ready to pass to `borrow`, `supplyCollateralBorrow`, or `withdraw`.
751
758
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to a different chain than this market.
759
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
752
760
  * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation's absolute shortfall on the target market.
753
761
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
754
762
  * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
@@ -775,6 +783,7 @@ export declare class MorphoBlue implements BlueActions {
775
783
  * @param params.options - Optional allocator and utilization options.
776
784
  * @returns Vault V1 reallocations ready for a Blue action.
777
785
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
786
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
778
787
  * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation.
779
788
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
780
789
  * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
@@ -798,6 +807,7 @@ export declare class MorphoBlue implements BlueActions {
798
807
  * @param params.options - Optional allocator discovery controls and operation to support.
799
808
  * @returns Action-ready reallocations and their post-simulation state.
800
809
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
810
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
801
811
  * @throws {NegativeInputError} when a utilization or penalty limit is negative.
802
812
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
803
813
  * @throws {NonPositiveInputError} when an enabled operation amount is not positive.
@@ -806,8 +806,12 @@ export class MorphoBlue {
806
806
  const sourceAccrualTimestamp = MathLib.max(Time.timestamp(), positionData.market.lastUpdate) +
807
807
  (sharesMode ? Time.s.from.h(2n) : 0n);
808
808
  const targetAccrualTimestamp = MathLib.max(Time.timestamp(), target.positionData.market.lastUpdate);
809
- const accruedSource = positionData.market.accrueInterest(sourceAccrualTimestamp);
810
- const accruedTarget = target.positionData.market.accrueInterest(targetAccrualTimestamp);
809
+ const accruedSource = shouldMigrateBorrow || positionData.borrowShares > 0n
810
+ ? positionData.market.accrueInterest(sourceAccrualTimestamp)
811
+ : positionData.market;
812
+ const accruedTarget = shouldMigrateBorrow
813
+ ? target.positionData.market.accrueInterest(targetAccrualTimestamp)
814
+ : target.positionData.market;
811
815
  // Shares burned by the source repay: exact in shares mode, else mirror Morpho's toSharesDown.
812
816
  const repaidShares = sharesMode
813
817
  ? requestedShares
@@ -1112,6 +1116,7 @@ export class MorphoBlue {
1112
1116
  * @param params.options - Optional allocator and utilization options.
1113
1117
  * @returns Vault reallocations ready to pass to `borrow`, `supplyCollateralBorrow`, or `withdraw`.
1114
1118
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to a different chain than this market.
1119
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
1115
1120
  * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation's absolute shortfall on the target market.
1116
1121
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
1117
1122
  * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
@@ -1158,6 +1163,7 @@ export class MorphoBlue {
1158
1163
  * @param params.options - Optional allocator and utilization options.
1159
1164
  * @returns Vault V1 reallocations ready for a Blue action.
1160
1165
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
1166
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
1161
1167
  * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation.
1162
1168
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
1163
1169
  * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
@@ -1183,6 +1189,7 @@ export class MorphoBlue {
1183
1189
  * @param params.options - Optional allocator discovery controls and operation to support.
1184
1190
  * @returns Action-ready reallocations and their post-simulation state.
1185
1191
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
1192
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
1186
1193
  * @throws {NegativeInputError} when a utilization or penalty limit is negative.
1187
1194
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
1188
1195
  * @throws {NonPositiveInputError} when an enabled operation amount is not positive.
@@ -10,7 +10,11 @@ IPosition, IPreLiquidationParams as IBluePreLiquidationParams,
10
10
  /** @deprecated Use `IBluePreLiquidationParams` or the raw Blue subpath. */
11
11
  IPreLiquidationParams, IPreLiquidationPosition as IBluePreLiquidationPosition,
12
12
  /** @deprecated Use `IBluePreLiquidationPosition` or the raw Blue subpath. */
13
- IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultMarketPublicAllocatorConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, VaultPublicAllocatorConfig, } from "@morpho-org/blue-sdk";
13
+ IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig,
14
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `IVaultV2BlueMarketPublicAllocatorConfig`. */
15
+ IVaultMarketPublicAllocatorConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType,
16
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `IVaultV2BluePublicAllocatorConfig`. */
17
+ VaultPublicAllocatorConfig, } from "@morpho-org/blue-sdk";
14
18
  export { AccrualPosition as BlueAccrualPosition,
15
19
  /** @deprecated Use `BlueAccrualPosition` or the raw Blue subpath. */
16
20
  AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket,
@@ -25,7 +29,9 @@ PreLiquidationParams, PreLiquidationPosition as BluePreLiquidationPosition,
25
29
  /** @deprecated Use `BluePreLiquidationPosition` or the raw Blue subpath. */
26
30
  PreLiquidationPosition, Token, User as BlueUser,
27
31
  /** @deprecated Use `BlueUser` or the raw Blue subpath. */
28
- User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
32
+ User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig,
33
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig`. */
34
+ VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
29
35
  export type { BuildOfferParams as MidnightBuildOfferParams, CollateralParams as MidnightCollateralParams, GroupInput as MidnightGroupInput, IAccrualPosition as IMidnightAccrualPosition, ICollateralParams as IMidnightCollateralParams, IGroup as IMidnightGroup, IMarket as IMidnightMarket, IMarketParams as IMidnightMarketParams, IOffer as IMidnightOffer, IPosition as IMidnightPosition, MarketInput as MidnightMarketInput, OfferStruct as MidnightOfferStruct, RatifierTreeInput as MidnightRatifierTreeInput, SettlementFeeCbps as MidnightSettlementFeeCbps, TreeCreateParams as MidnightTreeCreateParams, TreeDescriptor as MidnightTreeDescriptor, TreeInput as MidnightTreeInput, TreeLike as MidnightTreeLike, TreeMempoolValidateParams as MidnightTreeMempoolValidateParams, TreeMempoolValidateRatification as MidnightTreeMempoolValidateRatification, TreeProof as MidnightTreeProof, } from "@morpho-org/midnight-sdk";
30
36
  export { AccrualPosition as MidnightAccrualPosition, Group as MidnightGroup, Market as MidnightMarket, MarketParams as MidnightMarketParams, Offer as MidnightOffer, Position as MidnightPosition, Tree as MidnightTree, } from "@morpho-org/midnight-sdk";
31
37
  export { MorphoBlue } from "./blue/index.js";
@@ -12,7 +12,9 @@ PreLiquidationParams, PreLiquidationPosition as BluePreLiquidationPosition,
12
12
  /** @deprecated Use `BluePreLiquidationPosition` or the raw Blue subpath. */
13
13
  PreLiquidationPosition, Token, User as BlueUser,
14
14
  /** @deprecated Use `BlueUser` or the raw Blue subpath. */
15
- User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
15
+ User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig,
16
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig`. */
17
+ VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
16
18
  export { AccrualPosition as MidnightAccrualPosition, Group as MidnightGroup, Market as MidnightMarket, MarketParams as MidnightMarketParams, Offer as MidnightOffer, Position as MidnightPosition, Tree as MidnightTree, } from "@morpho-org/midnight-sdk";
17
19
  export { MorphoBlue } from "./blue/index.js";
18
20
  export { MorphoMidnight, } from "./midnight/index.js";
@@ -547,7 +547,6 @@ export class MorphoMidnight {
547
547
  }
548
548
  });
549
549
  const midnight = getChainAddress(this.chainId, "midnight");
550
- const signedPayloads = new Map();
551
550
  return {
552
551
  groups: data.groups,
553
552
  root: data.tree.root,
@@ -564,14 +563,12 @@ export class MorphoMidnight {
564
563
  })));
565
564
  requirements.push(...(await this.getRatifierRequirements({
566
565
  offersData: data,
567
- signedPayloads,
568
566
  })));
569
567
  return requirements;
570
568
  },
571
569
  buildTx: (signatures) => this.buildSubmitOffersTx({
572
570
  offersData: data,
573
571
  signatures,
574
- signedPayloads,
575
572
  }),
576
573
  };
577
574
  }
@@ -602,7 +599,6 @@ export class MorphoMidnight {
602
599
  validation: params.validation,
603
600
  });
604
601
  validateOfferSides(data.tree.offers, false);
605
- const signedPayloads = new Map();
606
602
  return {
607
603
  groups: data.groups,
608
604
  root: data.tree.root,
@@ -610,13 +606,11 @@ export class MorphoMidnight {
610
606
  getRequirements: async () => {
611
607
  return await this.getRatifierRequirements({
612
608
  offersData: data,
613
- signedPayloads,
614
609
  });
615
610
  },
616
611
  buildTx: (signatures) => this.buildSubmitOffersTx({
617
612
  offersData: data,
618
613
  signatures,
619
- signedPayloads,
620
614
  }),
621
615
  };
622
616
  }
@@ -674,7 +668,6 @@ export class MorphoMidnight {
674
668
  }
675
669
  }
676
670
  const midnight = getChainAddress(this.chainId, "midnight");
677
- const signedPayloads = new Map();
678
671
  return {
679
672
  groups: data.groups,
680
673
  root: data.tree.root,
@@ -699,7 +692,6 @@ export class MorphoMidnight {
699
692
  }),
700
693
  ...(await this.getRatifierRequirements({
701
694
  offersData: data,
702
- signedPayloads,
703
695
  })),
704
696
  ];
705
697
  return requirements;
@@ -707,7 +699,6 @@ export class MorphoMidnight {
707
699
  buildTx: (signatures) => this.buildSubmitOffersTx({
708
700
  offersData: data,
709
701
  signatures,
710
- signedPayloads,
711
702
  }),
712
703
  };
713
704
  }
@@ -939,7 +930,6 @@ export class MorphoMidnight {
939
930
  signature,
940
931
  });
941
932
  const payload = await Payload.encode(items);
942
- params.signedPayloads.set(signature.toLowerCase(), payload);
943
933
  return deepFreeze({
944
934
  args: {
945
935
  owner: userAddress,
@@ -1007,11 +997,13 @@ export class MorphoMidnight {
1007
997
  actualOffers: signature.action.args.offers,
1008
998
  });
1009
999
  }
1010
- const signedPayload = params.signedPayloads.get(signature.args.signature.toLowerCase());
1011
- if (signedPayload == null) {
1000
+ // The payload is carried on the signature the caller hands to buildTx, so
1001
+ // a prepared offer-root requirement can be signed on one instance and
1002
+ // submitted from another without sharing in-memory state.
1003
+ if (signature.args.payload == null) {
1012
1004
  throw new UnpreparedMidnightOfferRootSignatureError();
1013
1005
  }
1014
- payload = signedPayload;
1006
+ payload = signature.args.payload;
1015
1007
  }
1016
1008
  else {
1017
1009
  selectRequirementSignatures(collectedSignatures, {});
@@ -85,6 +85,7 @@ export interface VaultV1Actions {
85
85
  * @param params.deadline - Optional shared permit/bundle deadline; defaults to two hours from now.
86
86
  * @returns Lazy prerequisite resolution and a synchronous transaction builder.
87
87
  * @throws {ChainIdMismatchError} when the client and entity target different chains.
88
+ * @throws {UnsupportedBlueMarketIrmError} when an allocated market with positive debt uses an unsupported IRM.
88
89
  * @throws {VaultAddressMismatchError} when `vaultData` belongs to another vault.
89
90
  * @throws {NonPositiveInputError} when `amount` is not positive.
90
91
  * @throws {EmptyMarketParamsListError} when the market list is empty.
@@ -152,6 +153,7 @@ export interface VaultV1Actions {
152
153
  * @returns Lazy approval or permit resolution through `getRequirements()` and a synchronous
153
154
  * `buildTx()` returning a deep-frozen `Transaction<VaultV1MigrateToV2Action>`.
154
155
  * @throws {ChainIdMismatchError} when the client and entity target different chains.
156
+ * @throws {UnsupportedBlueMarketIrmError} when an allocated source or target market with positive debt uses an unsupported IRM.
155
157
  * @throws {VaultAddressMismatchError} when `sourceVault` belongs to another vault.
156
158
  * @throws {VaultAssetMismatchError} when the source and target assets differ.
157
159
  * @throws {NonPositiveInputError} when `shares` is not positive or the target projection yields
@@ -156,6 +156,8 @@ export class MorphoVaultV1 {
156
156
  const allocation = vaultData.allocations.get(marketId);
157
157
  if (allocation?.config.enabled !== true)
158
158
  continue;
159
+ if (allocation.position.supplyShares === 0n)
160
+ continue;
159
161
  const market = allocation.position.market.accrueInterest(now);
160
162
  const available = market.toSupplyAssets(allocation.position.supplyShares);
161
163
  const assigned = assignedByMarket.get(marketId) ?? 0n;
@@ -130,10 +130,13 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
130
130
  * Returned `data` normalizes `vault.publicAllocatorConfig.accruedFee` to the
131
131
  * on-chain `reallocateTo` fee semantics: one fee charge per vault with at
132
132
  * least one computed withdrawal.
133
+ * Sources with zero allocator withdrawal capacity and destinations with no deposit capacity
134
+ * are skipped before projecting source interest.
133
135
  *
134
136
  * @param marketId - Target market to supply with shared liquidity.
135
137
  * @param options - Optional allocator discovery options.
136
138
  * @returns Computed source-market withdrawals and the post-reallocation state.
139
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
137
140
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
138
141
  * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
139
142
  * `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
@@ -179,6 +182,7 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
179
182
  * @param marketId - Target market to supply with shared liquidity.
180
183
  * @param options - Optional allocator discovery options.
181
184
  * @returns Computed source-market withdrawals and the post-reallocation state.
185
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
182
186
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
183
187
  * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
184
188
  * `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
@@ -199,6 +203,7 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
199
203
  * @param marketId - Target market that would receive the liquidity.
200
204
  * @param options - Optional allocator discovery options.
201
205
  * @returns Total reallocatable assets in loan-token units; `0n` when none is available.
206
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
202
207
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
203
208
  * @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
204
209
  * `VaultV2BlueReallocationData.getPublicReallocationLiquidity`.
@@ -252,6 +257,7 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
252
257
  * @param utilization - Utilization to bring the market to, scaled by WAD. Defaults to {@link DEFAULT_SUPPLY_TARGET_UTILIZATION}.
253
258
  * @param options - Optional reallocation options (supply target utilization trigger, timestamp, withdrawal caps).
254
259
  * @returns Available liquidity to the given utilization in loan-token units; `0n` when none is available.
260
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
255
261
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
256
262
  * @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
257
263
  * `VaultV2BlueReallocationData.getAvailableLiquidityToUtilization`.