@morpho-org/morpho-sdk 5.10.1 → 5.12.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 +5 -5
package/README.md CHANGED
@@ -9,6 +9,12 @@
9
9
 
10
10
  Build transactions for Morpho's **VaultV1** (MetaMorpho), **VaultV2**, **Blue**, and **Midnight** fixed-rate markets on every chain where Morpho is deployed. Custom deployments can be added with `registerCustomAddresses` from `@morpho-org/morpho-sdk/addresses`.
11
11
 
12
+ ## Deprecated flows
13
+
14
+ All Vault V1 PublicAllocator surfaces are deprecated, including raw ABIs, addresses, configs, fetchers, planning APIs, and Bundler3 composition. Use Vault V2 BluePublicAllocator APIs: `getVaultV2BlueReallocationData()` fetches the state and `getVaultV2BlueReallocations()` prepares a plan for a Blue action.
15
+
16
+ The legacy `morphoToken` address and MORPHO wrapping entries in `ethereumGeneralAdapter1Abi` are also deprecated. Use the current MORPHO token directly. Deprecated APIs remain available until the next major release; general Vault V1 operations and other token wrapping flows remain supported.
17
+
12
18
  ## Installation
13
19
 
14
20
  ```bash
package/lib/cjs/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/cjs/abis.js CHANGED
@@ -30,9 +30,11 @@ Object.defineProperty(exports, "preLiquidationAbi", { enumerable: true, get: fun
30
30
  Object.defineProperty(exports, "bluePreLiquidationFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.preLiquidationFactoryAbi; } });
31
31
  /** @deprecated Use `bluePreLiquidationFactoryAbi` or the raw `/blue/abis` subpath. */
32
32
  Object.defineProperty(exports, "preLiquidationFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.preLiquidationFactoryAbi; } });
33
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
33
34
  Object.defineProperty(exports, "publicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.publicAllocatorAbi; } });
34
35
  Object.defineProperty(exports, "vaultV1AdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterAbi; } });
35
36
  Object.defineProperty(exports, "vaultV1AdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterFactoryAbi; } });
37
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
36
38
  Object.defineProperty(exports, "vaultV1PublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1PublicAllocatorAbi; } });
37
39
  Object.defineProperty(exports, "vaultV2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2Abi; } });
38
40
  Object.defineProperty(exports, "vaultV2BluePublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2BluePublicAllocatorAbi; } });
@@ -1182,7 +1184,12 @@ exports.generalAdapter1Abi = [
1182
1184
  inputs: [],
1183
1185
  },
1184
1186
  ];
1185
- /** ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension. */
1187
+ /**
1188
+ * ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension.
1189
+ *
1190
+ * MORPHO legacy token wrapping entries are deprecated and will be removed in the next major.
1191
+ * Use the current MORPHO token directly. Native-token and stETH wrapping remain supported.
1192
+ */
1186
1193
  exports.ethereumGeneralAdapter1Abi = [
1187
1194
  ...exports.generalAdapter1Abi,
1188
1195
  {
@@ -1209,11 +1216,13 @@ exports.ethereumGeneralAdapter1Abi = [
1209
1216
  internalType: "address",
1210
1217
  },
1211
1218
  {
1219
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1212
1220
  name: "morphoToken",
1213
1221
  type: "address",
1214
1222
  internalType: "address",
1215
1223
  },
1216
1224
  {
1225
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1217
1226
  name: "morphoWrapper",
1218
1227
  type: "address",
1219
1228
  internalType: "address",
@@ -1223,6 +1232,7 @@ exports.ethereumGeneralAdapter1Abi = [
1223
1232
  },
1224
1233
  {
1225
1234
  type: "function",
1235
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1226
1236
  name: "MORPHO_TOKEN",
1227
1237
  inputs: [],
1228
1238
  outputs: [
@@ -1236,6 +1246,7 @@ exports.ethereumGeneralAdapter1Abi = [
1236
1246
  },
1237
1247
  {
1238
1248
  type: "function",
1249
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1239
1250
  name: "MORPHO_WRAPPER",
1240
1251
  inputs: [],
1241
1252
  outputs: [
@@ -1275,6 +1286,7 @@ exports.ethereumGeneralAdapter1Abi = [
1275
1286
  },
1276
1287
  {
1277
1288
  type: "function",
1289
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1278
1290
  name: "morphoWrapperDepositFor",
1279
1291
  inputs: [
1280
1292
  {
@@ -1293,6 +1305,7 @@ exports.ethereumGeneralAdapter1Abi = [
1293
1305
  },
1294
1306
  {
1295
1307
  type: "function",
1308
+ /** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
1296
1309
  name: "morphoWrapperWithdrawTo",
1297
1310
  inputs: [
1298
1311
  {
@@ -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, };
@@ -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";
@@ -21,9 +21,11 @@ Object.defineProperty(exports, "permissionedErc20WrapperAbi", { enumerable: true
21
21
  Object.defineProperty(exports, "permit2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.permit2Abi; } });
22
22
  Object.defineProperty(exports, "preLiquidationAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.preLiquidationAbi; } });
23
23
  Object.defineProperty(exports, "preLiquidationFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.preLiquidationFactoryAbi; } });
24
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
24
25
  Object.defineProperty(exports, "publicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.publicAllocatorAbi; } });
25
26
  Object.defineProperty(exports, "vaultV1AdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterAbi; } });
26
27
  Object.defineProperty(exports, "vaultV1AdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterFactoryAbi; } });
28
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
27
29
  Object.defineProperty(exports, "vaultV1PublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1PublicAllocatorAbi; } });
28
30
  Object.defineProperty(exports, "vaultV2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2Abi; } });
29
31
  Object.defineProperty(exports, "vaultV2BluePublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2BluePublicAllocatorAbi; } });
@@ -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";
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "Vault", { enumerable: true, get: function () { r
24
24
  Object.defineProperty(exports, "VaultConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultConfig; } });
25
25
  Object.defineProperty(exports, "VaultMarketAllocation", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketAllocation; } });
26
26
  Object.defineProperty(exports, "VaultMarketConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketConfig; } });
27
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig`. */
27
28
  Object.defineProperty(exports, "VaultMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketPublicAllocatorConfig; } });
28
29
  Object.defineProperty(exports, "VaultToken", { enumerable: true, get: function () { return blue_sdk_1.VaultToken; } });
29
30
  Object.defineProperty(exports, "VaultUser", { enumerable: true, get: function () { return blue_sdk_1.VaultUser; } });
@@ -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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedPermitDomainExtensionsError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
3
+ exports.UnsupportedPermitDomainExtensionsError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
4
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
6
6
  Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return blue_sdk_1.DivisionByZeroError; } });
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "UnknownTokenError", { enumerable: true, get: fun
18
18
  Object.defineProperty(exports, "UnknownTokenPriceError", { enumerable: true, get: function () { return blue_sdk_1.UnknownTokenPriceError; } });
19
19
  Object.defineProperty(exports, "UnknownVaultConfigError", { enumerable: true, get: function () { return blue_sdk_1.UnknownVaultConfigError; } });
20
20
  Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedChainIdError; } });
21
+ Object.defineProperty(exports, "UnsupportedMarketIrmError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedMarketIrmError; } });
21
22
  Object.defineProperty(exports, "UnsupportedPreLiquidationParamsError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedPreLiquidationParamsError; } });
22
23
  Object.defineProperty(exports, "UnsupportedVaultV2AdapterError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedVaultV2AdapterError; } });
23
24
  Object.defineProperty(exports, "VaultV2Errors", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Errors; } });
@@ -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";
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "fetchVault", { enumerable: true, get: function (
21
21
  Object.defineProperty(exports, "fetchVaultConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultConfig; } });
22
22
  Object.defineProperty(exports, "fetchVaultMarketAllocation", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketAllocation; } });
23
23
  Object.defineProperty(exports, "fetchVaultMarketConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketConfig; } });
24
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `fetchVaultV2BlueMarketPublicAllocatorConfig`. */
24
25
  Object.defineProperty(exports, "fetchVaultMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketPublicAllocatorConfig; } });
25
26
  Object.defineProperty(exports, "fetchVaultUser", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultUser; } });
26
27
  Object.defineProperty(exports, "fetchVaultV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2; } });
@@ -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.
@@ -809,8 +809,12 @@ class MorphoBlue {
809
809
  const sourceAccrualTimestamp = blue_sdk_1.MathLib.max(morpho_ts_1.Time.timestamp(), positionData.market.lastUpdate) +
810
810
  (sharesMode ? morpho_ts_1.Time.s.from.h(2n) : 0n);
811
811
  const targetAccrualTimestamp = blue_sdk_1.MathLib.max(morpho_ts_1.Time.timestamp(), target.positionData.market.lastUpdate);
812
- const accruedSource = positionData.market.accrueInterest(sourceAccrualTimestamp);
813
- const accruedTarget = target.positionData.market.accrueInterest(targetAccrualTimestamp);
812
+ const accruedSource = shouldMigrateBorrow || positionData.borrowShares > 0n
813
+ ? positionData.market.accrueInterest(sourceAccrualTimestamp)
814
+ : positionData.market;
815
+ const accruedTarget = shouldMigrateBorrow
816
+ ? target.positionData.market.accrueInterest(targetAccrualTimestamp)
817
+ : target.positionData.market;
814
818
  // Shares burned by the source repay: exact in shares mode, else mirror Morpho's toSharesDown.
815
819
  const repaidShares = sharesMode
816
820
  ? requestedShares
@@ -1115,6 +1119,7 @@ class MorphoBlue {
1115
1119
  * @param params.options - Optional allocator and utilization options.
1116
1120
  * @returns Vault reallocations ready to pass to `borrow`, `supplyCollateralBorrow`, or `withdraw`.
1117
1121
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to a different chain than this market.
1122
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
1118
1123
  * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation's absolute shortfall on the target market.
1119
1124
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
1120
1125
  * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
@@ -1161,6 +1166,7 @@ class MorphoBlue {
1161
1166
  * @param params.options - Optional allocator and utilization options.
1162
1167
  * @returns Vault V1 reallocations ready for a Blue action.
1163
1168
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
1169
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
1164
1170
  * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation.
1165
1171
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
1166
1172
  * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
@@ -1186,6 +1192,7 @@ class MorphoBlue {
1186
1192
  * @param params.options - Optional allocator discovery controls and operation to support.
1187
1193
  * @returns Action-ready reallocations and their post-simulation state.
1188
1194
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
1195
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
1189
1196
  * @throws {NegativeInputError} when a utilization or penalty limit is negative.
1190
1197
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
1191
1198
  * @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";
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "Vault", { enumerable: true, get: function () { r
39
39
  Object.defineProperty(exports, "VaultConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultConfig; } });
40
40
  Object.defineProperty(exports, "VaultMarketAllocation", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketAllocation; } });
41
41
  Object.defineProperty(exports, "VaultMarketConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketConfig; } });
42
+ /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig`. */
42
43
  Object.defineProperty(exports, "VaultMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketPublicAllocatorConfig; } });
43
44
  Object.defineProperty(exports, "VaultToken", { enumerable: true, get: function () { return blue_sdk_1.VaultToken; } });
44
45
  Object.defineProperty(exports, "VaultUser", { enumerable: true, get: function () { return blue_sdk_1.VaultUser; } });
@@ -550,7 +550,6 @@ class MorphoMidnight {
550
550
  }
551
551
  });
552
552
  const midnight = (0, morpho_ts_1.getChainAddress)(this.chainId, "midnight");
553
- const signedPayloads = new Map();
554
553
  return {
555
554
  groups: data.groups,
556
555
  root: data.tree.root,
@@ -567,14 +566,12 @@ class MorphoMidnight {
567
566
  })));
568
567
  requirements.push(...(await this.getRatifierRequirements({
569
568
  offersData: data,
570
- signedPayloads,
571
569
  })));
572
570
  return requirements;
573
571
  },
574
572
  buildTx: (signatures) => this.buildSubmitOffersTx({
575
573
  offersData: data,
576
574
  signatures,
577
- signedPayloads,
578
575
  }),
579
576
  };
580
577
  }
@@ -605,7 +602,6 @@ class MorphoMidnight {
605
602
  validation: params.validation,
606
603
  });
607
604
  (0, validateOfferSides_js_1.validateOfferSides)(data.tree.offers, false);
608
- const signedPayloads = new Map();
609
605
  return {
610
606
  groups: data.groups,
611
607
  root: data.tree.root,
@@ -613,13 +609,11 @@ class MorphoMidnight {
613
609
  getRequirements: async () => {
614
610
  return await this.getRatifierRequirements({
615
611
  offersData: data,
616
- signedPayloads,
617
612
  });
618
613
  },
619
614
  buildTx: (signatures) => this.buildSubmitOffersTx({
620
615
  offersData: data,
621
616
  signatures,
622
- signedPayloads,
623
617
  }),
624
618
  };
625
619
  }
@@ -677,7 +671,6 @@ class MorphoMidnight {
677
671
  }
678
672
  }
679
673
  const midnight = (0, morpho_ts_1.getChainAddress)(this.chainId, "midnight");
680
- const signedPayloads = new Map();
681
674
  return {
682
675
  groups: data.groups,
683
676
  root: data.tree.root,
@@ -702,7 +695,6 @@ class MorphoMidnight {
702
695
  }),
703
696
  ...(await this.getRatifierRequirements({
704
697
  offersData: data,
705
- signedPayloads,
706
698
  })),
707
699
  ];
708
700
  return requirements;
@@ -710,7 +702,6 @@ class MorphoMidnight {
710
702
  buildTx: (signatures) => this.buildSubmitOffersTx({
711
703
  offersData: data,
712
704
  signatures,
713
- signedPayloads,
714
705
  }),
715
706
  };
716
707
  }
@@ -942,7 +933,6 @@ class MorphoMidnight {
942
933
  signature,
943
934
  });
944
935
  const payload = await midnight_sdk_1.Payload.encode(items);
945
- params.signedPayloads.set(signature.toLowerCase(), payload);
946
936
  return (0, morpho_ts_1.deepFreeze)({
947
937
  args: {
948
938
  owner: userAddress,
@@ -1010,11 +1000,13 @@ class MorphoMidnight {
1010
1000
  actualOffers: signature.action.args.offers,
1011
1001
  });
1012
1002
  }
1013
- const signedPayload = params.signedPayloads.get(signature.args.signature.toLowerCase());
1014
- if (signedPayload == null) {
1003
+ // The payload is carried on the signature the caller hands to buildTx, so
1004
+ // a prepared offer-root requirement can be signed on one instance and
1005
+ // submitted from another without sharing in-memory state.
1006
+ if (signature.args.payload == null) {
1015
1007
  throw new index_js_4.UnpreparedMidnightOfferRootSignatureError();
1016
1008
  }
1017
- payload = signedPayload;
1009
+ payload = signature.args.payload;
1018
1010
  }
1019
1011
  else {
1020
1012
  (0, index_js_4.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
@@ -159,6 +159,8 @@ class MorphoVaultV1 {
159
159
  const allocation = vaultData.allocations.get(marketId);
160
160
  if (allocation?.config.enabled !== true)
161
161
  continue;
162
+ if (allocation.position.supplyShares === 0n)
163
+ continue;
162
164
  const market = allocation.position.market.accrueInterest(now);
163
165
  const available = market.toSupplyAssets(allocation.position.supplyShares);
164
166
  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`.