@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.3

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 (305) hide show
  1. package/MIGRATION-v5-to-v6.md +199 -34
  2. package/README.md +23 -15
  3. package/lib/cjs/abis.d.ts +3 -2829
  4. package/lib/cjs/abis.js +1 -1938
  5. package/lib/cjs/actions/blue/borrow.d.ts +3 -2
  6. package/lib/cjs/actions/blue/borrow.js +3 -2
  7. package/lib/cjs/actions/blue/common.js +6 -35
  8. package/lib/cjs/actions/blue/refinance.d.ts +2 -2
  9. package/lib/cjs/actions/blue/refinance.js +2 -2
  10. package/lib/cjs/actions/blue/repay.d.ts +1 -1
  11. package/lib/cjs/actions/blue/repay.js +1 -1
  12. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
  13. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
  14. package/lib/cjs/actions/blue/supply.d.ts +2 -2
  15. package/lib/cjs/actions/blue/supply.js +4 -9
  16. package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
  17. package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
  18. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
  19. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
  20. package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
  21. package/lib/cjs/actions/blue/withdraw.js +3 -3
  22. package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
  23. package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
  24. package/lib/cjs/actions/bundles/common.d.ts +38 -4
  25. package/lib/cjs/actions/bundles/common.js +91 -35
  26. package/lib/cjs/actions/index.d.ts +0 -1
  27. package/lib/cjs/actions/index.js +0 -1
  28. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
  29. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +17 -26
  30. package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
  31. package/lib/cjs/actions/requirements/blue/index.js +0 -1
  32. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
  33. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +24 -25
  34. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  35. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
  36. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
  37. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -38
  38. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
  39. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
  40. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
  41. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
  42. package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
  43. package/lib/cjs/actions/requirements/encode/index.js +0 -1
  44. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
  45. package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
  46. package/lib/cjs/actions/requirements/index.d.ts +0 -1
  47. package/lib/cjs/actions/requirements/index.js +0 -1
  48. package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
  49. package/lib/cjs/actions/vaultV1/deposit.js +1 -2
  50. package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -4
  51. package/lib/cjs/actions/vaultV1/inKindRedeem.js +12 -8
  52. package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
  53. package/lib/cjs/actions/vaultV2/deposit.js +1 -2
  54. package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
  55. package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
  56. package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +6 -4
  57. package/lib/cjs/actions/vaultV2/inKindRedeem.js +12 -8
  58. package/lib/cjs/augment.d.ts +0 -1
  59. package/lib/cjs/augment.js +0 -1
  60. package/lib/cjs/blue/abis.d.ts +1 -1
  61. package/lib/cjs/blue/abis.js +1 -5
  62. package/lib/cjs/blue/entities.d.ts +2 -2
  63. package/lib/cjs/blue/entities.js +1 -2
  64. package/lib/cjs/blue/errors.d.ts +1 -1
  65. package/lib/cjs/blue/errors.js +2 -1
  66. package/lib/cjs/blue/fetch.d.ts +1 -1
  67. package/lib/cjs/blue/fetch.js +1 -2
  68. package/lib/cjs/blue/types.d.ts +2 -4
  69. package/lib/cjs/blue/utils.d.ts +1 -3
  70. package/lib/cjs/blue/utils.js +1 -3
  71. package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
  72. package/lib/cjs/client/morphoViemExtension.js +1 -1
  73. package/lib/cjs/constants.d.ts +3 -37
  74. package/lib/cjs/constants.js +1 -39
  75. package/lib/cjs/entities/blue/blue.d.ts +38 -264
  76. package/lib/cjs/entities/blue/blue.js +2 -203
  77. package/lib/cjs/entities/index.d.ts +3 -60
  78. package/lib/cjs/entities/index.js +1 -20
  79. package/lib/cjs/entities/midnight/midnight.js +20 -24
  80. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
  81. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +19 -14
  82. package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
  83. package/lib/cjs/entities/requirements/index.d.ts +1 -0
  84. package/lib/cjs/entities/requirements/index.js +1 -0
  85. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +18 -6
  86. package/lib/cjs/entities/vaultV1/vaultV1.js +25 -8
  87. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +154 -35
  88. package/lib/cjs/entities/vaultV2/vaultV2.js +249 -23
  89. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
  90. package/lib/cjs/entities/vaultV2BlueReallocationData.js +50 -34
  91. package/lib/cjs/errors.d.ts +2 -46
  92. package/lib/cjs/errors.js +2 -46
  93. package/lib/cjs/fetch.d.ts +1 -15
  94. package/lib/cjs/fetch.js +1 -16
  95. package/lib/cjs/helpers/constant.d.ts +0 -2
  96. package/lib/cjs/helpers/constant.js +0 -2
  97. package/lib/cjs/helpers/index.d.ts +4 -3
  98. package/lib/cjs/helpers/index.js +10 -9
  99. package/lib/cjs/helpers/metadata.d.ts +3 -5
  100. package/lib/cjs/helpers/metadata.js +4 -6
  101. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
  102. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
  103. package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
  104. package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
  105. package/lib/cjs/helpers/slippage.d.ts +34 -90
  106. package/lib/cjs/helpers/slippage.js +52 -137
  107. package/lib/cjs/helpers/utilization.d.ts +12 -10
  108. package/lib/cjs/helpers/utilization.js +27 -12
  109. package/lib/cjs/helpers/validate.d.ts +66 -32
  110. package/lib/cjs/helpers/validate.js +84 -57
  111. package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
  112. package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
  113. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
  114. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
  115. package/lib/cjs/types/action.d.ts +102 -68
  116. package/lib/cjs/types/action.js +11 -4
  117. package/lib/cjs/types/error.d.ts +332 -385
  118. package/lib/cjs/types/error.js +369 -412
  119. package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
  120. package/lib/cjs/types.d.ts +2 -18
  121. package/lib/cjs/utils.d.ts +8 -35
  122. package/lib/cjs/utils.js +11 -36
  123. package/lib/esm/abis.d.ts +3 -2829
  124. package/lib/esm/abis.js +3 -1935
  125. package/lib/esm/actions/blue/borrow.d.ts +3 -2
  126. package/lib/esm/actions/blue/borrow.js +3 -2
  127. package/lib/esm/actions/blue/common.js +8 -37
  128. package/lib/esm/actions/blue/refinance.d.ts +2 -2
  129. package/lib/esm/actions/blue/refinance.js +2 -2
  130. package/lib/esm/actions/blue/repay.d.ts +1 -1
  131. package/lib/esm/actions/blue/repay.js +1 -1
  132. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
  133. package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
  134. package/lib/esm/actions/blue/supply.d.ts +2 -2
  135. package/lib/esm/actions/blue/supply.js +6 -11
  136. package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
  137. package/lib/esm/actions/blue/supplyCollateral.js +2 -2
  138. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
  139. package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
  140. package/lib/esm/actions/blue/withdraw.d.ts +3 -3
  141. package/lib/esm/actions/blue/withdraw.js +3 -3
  142. package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
  143. package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
  144. package/lib/esm/actions/bundles/common.d.ts +38 -4
  145. package/lib/esm/actions/bundles/common.js +91 -36
  146. package/lib/esm/actions/index.d.ts +0 -1
  147. package/lib/esm/actions/index.js +0 -1
  148. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
  149. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +20 -29
  150. package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
  151. package/lib/esm/actions/requirements/blue/index.js +0 -1
  152. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
  153. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +25 -26
  154. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  155. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
  156. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
  157. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -39
  158. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
  159. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
  160. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
  161. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
  162. package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
  163. package/lib/esm/actions/requirements/encode/index.js +0 -1
  164. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
  165. package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
  166. package/lib/esm/actions/requirements/index.d.ts +0 -1
  167. package/lib/esm/actions/requirements/index.js +0 -1
  168. package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
  169. package/lib/esm/actions/vaultV1/deposit.js +1 -2
  170. package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -4
  171. package/lib/esm/actions/vaultV1/inKindRedeem.js +12 -8
  172. package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
  173. package/lib/esm/actions/vaultV2/deposit.js +1 -2
  174. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
  175. package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
  176. package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -4
  177. package/lib/esm/actions/vaultV2/inKindRedeem.js +12 -8
  178. package/lib/esm/augment.d.ts +0 -1
  179. package/lib/esm/augment.js +0 -1
  180. package/lib/esm/blue/abis.d.ts +1 -1
  181. package/lib/esm/blue/abis.js +1 -1
  182. package/lib/esm/blue/entities.d.ts +2 -2
  183. package/lib/esm/blue/entities.js +1 -1
  184. package/lib/esm/blue/errors.d.ts +1 -1
  185. package/lib/esm/blue/errors.js +1 -1
  186. package/lib/esm/blue/fetch.d.ts +1 -1
  187. package/lib/esm/blue/fetch.js +1 -1
  188. package/lib/esm/blue/types.d.ts +2 -4
  189. package/lib/esm/blue/utils.d.ts +1 -3
  190. package/lib/esm/blue/utils.js +1 -3
  191. package/lib/esm/client/morphoViemExtension.d.ts +1 -1
  192. package/lib/esm/client/morphoViemExtension.js +1 -1
  193. package/lib/esm/constants.d.ts +3 -37
  194. package/lib/esm/constants.js +3 -37
  195. package/lib/esm/entities/blue/blue.d.ts +38 -264
  196. package/lib/esm/entities/blue/blue.js +5 -206
  197. package/lib/esm/entities/index.d.ts +3 -60
  198. package/lib/esm/entities/index.js +1 -16
  199. package/lib/esm/entities/midnight/midnight.js +20 -24
  200. package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
  201. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +20 -15
  202. package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
  203. package/lib/esm/entities/requirements/index.d.ts +1 -0
  204. package/lib/esm/entities/requirements/index.js +1 -0
  205. package/lib/esm/entities/vaultV1/vaultV1.d.ts +18 -6
  206. package/lib/esm/entities/vaultV1/vaultV1.js +29 -12
  207. package/lib/esm/entities/vaultV2/vaultV2.d.ts +154 -35
  208. package/lib/esm/entities/vaultV2/vaultV2.js +256 -30
  209. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
  210. package/lib/esm/entities/vaultV2BlueReallocationData.js +48 -32
  211. package/lib/esm/errors.d.ts +2 -46
  212. package/lib/esm/errors.js +2 -46
  213. package/lib/esm/fetch.d.ts +1 -15
  214. package/lib/esm/fetch.js +1 -15
  215. package/lib/esm/helpers/constant.d.ts +0 -2
  216. package/lib/esm/helpers/constant.js +0 -2
  217. package/lib/esm/helpers/index.d.ts +4 -3
  218. package/lib/esm/helpers/index.js +4 -3
  219. package/lib/esm/helpers/metadata.d.ts +3 -5
  220. package/lib/esm/helpers/metadata.js +4 -6
  221. package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
  222. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
  223. package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
  224. package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
  225. package/lib/esm/helpers/slippage.d.ts +34 -90
  226. package/lib/esm/helpers/slippage.js +52 -134
  227. package/lib/esm/helpers/utilization.d.ts +12 -10
  228. package/lib/esm/helpers/utilization.js +26 -11
  229. package/lib/esm/helpers/validate.d.ts +66 -32
  230. package/lib/esm/helpers/validate.js +83 -57
  231. package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
  232. package/lib/esm/helpers/validateRequirementSpender.js +1 -3
  233. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
  234. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
  235. package/lib/esm/types/action.d.ts +102 -68
  236. package/lib/esm/types/action.js +12 -5
  237. package/lib/esm/types/error.d.ts +332 -385
  238. package/lib/esm/types/error.js +355 -392
  239. package/lib/esm/types/sharedLiquidity.d.ts +1 -117
  240. package/lib/esm/types.d.ts +2 -18
  241. package/lib/esm/utils.d.ts +8 -35
  242. package/lib/esm/utils.js +7 -34
  243. package/package.json +7 -15
  244. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
  245. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -83
  246. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  247. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -151
  248. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
  249. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -50
  250. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  251. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
  252. package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
  253. package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
  254. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  255. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
  256. package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  257. package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
  258. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
  259. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -43
  260. package/lib/cjs/actions/signatures/index.d.ts +0 -3
  261. package/lib/cjs/actions/signatures/index.js +0 -19
  262. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
  263. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
  264. package/lib/cjs/bundler/actions.d.ts +0 -797
  265. package/lib/cjs/bundler/actions.js +0 -1371
  266. package/lib/cjs/bundler/index.d.ts +0 -2
  267. package/lib/cjs/bundler/index.js +0 -18
  268. package/lib/cjs/bundler/types.d.ts +0 -235
  269. package/lib/cjs/bundler/types.js +0 -2
  270. package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -326
  271. package/lib/cjs/entities/vaultV1ReallocationData.js +0 -542
  272. package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -78
  273. package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -243
  274. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
  275. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -79
  276. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  277. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -147
  278. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
  279. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -46
  280. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  281. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
  282. package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
  283. package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
  284. package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  285. package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
  286. package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  287. package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
  288. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
  289. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -39
  290. package/lib/esm/actions/signatures/index.d.ts +0 -3
  291. package/lib/esm/actions/signatures/index.js +0 -3
  292. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
  293. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -5
  294. package/lib/esm/bundler/actions.d.ts +0 -797
  295. package/lib/esm/bundler/actions.js +0 -1368
  296. package/lib/esm/bundler/index.d.ts +0 -2
  297. package/lib/esm/bundler/index.js +0 -2
  298. package/lib/esm/bundler/types.d.ts +0 -235
  299. package/lib/esm/bundler/types.js +0 -1
  300. package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -326
  301. package/lib/esm/entities/vaultV1ReallocationData.js +0 -544
  302. package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -78
  303. package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -239
  304. /package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
  305. /package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
@@ -1,22 +1,8 @@
1
1
  import { type AccrualPosition, type Market, type MarketParams } from "@morpho-org/blue-sdk";
2
2
  import { type Address } from "viem";
3
3
  import type { FetchParameters } from "../../types/data.js";
4
- import { type ActionOutput, type ActionRequirement, type AssetsOrSharesArgs, type BlueBorrowAction, type BlueRefinanceAction, type BlueRepayAction, type BlueRepayWithdrawCollateralAction, type BlueSupplyAction, type BlueSupplyCollateralAction, type BlueSupplyCollateralBorrowAction, type BlueWithdrawAction, type BlueWithdrawCollateralAction, type MorphoClientType, type ReallocationComputeOptions, type RequirementSignature, type VaultV1Reallocation, type VaultV2BluePublicAllocatorOptions, type VaultV2BlueReallocation } from "../../types/index.js";
5
- import { VaultV1ReallocationData } from "../vaultV1ReallocationData.js";
4
+ import { type ActionOutput, type ActionRequirement, type AssetsOrSharesArgs, type BlueBorrowAction, type BlueRefinanceAction, type BlueRepayAction, type BlueRepayWithdrawCollateralAction, type BlueSupplyAction, type BlueSupplyCollateralAction, type BlueSupplyCollateralBorrowAction, type BlueWithdrawAction, type BlueWithdrawCollateralAction, type MorphoClientType, type RequirementSignature, type VaultV2BluePublicAllocatorOptions, type VaultV2BlueReallocation } from "../../types/index.js";
6
5
  import { VaultV2BlueReallocationData } from "../vaultV2BlueReallocationData.js";
7
- type VaultV1ReallocationsParams = {
8
- readonly reallocationData: VaultV1ReallocationData;
9
- readonly options?: ReallocationComputeOptions;
10
- } & ({
11
- readonly operation: "borrow" | "withdraw";
12
- readonly amount: bigint;
13
- readonly borrowAmount?: never;
14
- } | {
15
- /** @deprecated Pass `{ operation: "borrow", amount }` instead. */
16
- readonly borrowAmount: bigint;
17
- readonly operation?: never;
18
- readonly amount?: never;
19
- });
20
6
  type VaultV2BlueReallocationsParams = {
21
7
  readonly reallocationData: VaultV2BlueReallocationData;
22
8
  readonly options?: VaultV2BluePublicAllocatorOptions & {
@@ -30,7 +16,7 @@ type VaultV2BlueReallocationsParams = {
30
16
  export interface BlueTokenRequirementsParams {
31
17
  /** Prefer ERC-2612 when the funded token exposes a compatible nonce. */
32
18
  readonly useSimplePermit?: boolean;
33
- /** Explicit unused Permit2 SignatureTransfer unordered nonce. */
19
+ /** Explicit unused Permit2 SignatureTransfer unordered nonce; defaults to the lowest unused nonce. */
34
20
  readonly permit2Nonce?: bigint;
35
21
  /**
36
22
  * Classic ERC-20 allowance to set when an approval is needed, enabling a reusable approval (for
@@ -76,8 +62,8 @@ export interface BlueActions {
76
62
  * @throws {ChainWNativeMissingError} when native funding is requested without registered wNative.
77
63
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
78
64
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
79
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
80
- * @throws {MissingPermit2SignatureTransferNonceError} from `getRequirements()` when Permit2 is selected without a nonce.
65
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
66
+ * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
81
67
  * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
82
68
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
83
69
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
@@ -122,7 +108,7 @@ export interface BlueActions {
122
108
  * `getRequirements()` reads only the loan-token allowance and selected ERC-2612 or Permit2
123
109
  * nonce state. Direct approvals and ERC-2612 name BlueBundlesV1 as spender; Permit2 keeps its
124
110
  * ERC-20 approval on canonical Permit2. Native funding is exclusive and skips token requirements.
125
- * The referral fee is deducted from the gross `assets` supplied. This route exposes no Bundler3
111
+ * The referral fee is deducted from the gross `assets` supplied. This route exposes no
126
112
  * share-price bound or `slippageTolerance`.
127
113
  *
128
114
  * @param params.userAddress - User funding and receiving the supply position.
@@ -140,8 +126,8 @@ export interface BlueActions {
140
126
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
141
127
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
142
128
  * @throws {InputExceedsMaxError} when `assets` or `deadline` exceeds `uint256`, when the referral fee is at least WAD, or from `getRequirements()` when an explicit `permit2Nonce` exceeds `uint256`.
143
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
144
- * @throws {MissingPermit2SignatureTransferNonceError} from `getRequirements()` when Permit2 is selected without an explicit nonce.
129
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
130
+ * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
145
131
  * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
146
132
  * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when a classic `approvalAmount` is below the funded `assets`.
147
133
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
@@ -189,7 +175,7 @@ export interface BlueActions {
189
175
  * `getRequirements()` reads Morpho authorization state for BlueBundlesV1. Optional reallocations
190
176
  * are Vault V2-only; their penalties and the referral fee reduce withdrawal proceeds. Shares
191
177
  * mode has neither a saturated full-close sentinel nor an onchain minimum-assets guarantee.
192
- * This route exposes no Bundler3 share-price bound or `slippageTolerance`.
178
+ * This route exposes no share-price bound or `slippageTolerance`.
193
179
  *
194
180
  * @param params.userAddress - User whose supply position is withdrawn.
195
181
  * @param params.positionData - Pre-fetched position used for ownership and balance validation.
@@ -211,9 +197,9 @@ export interface BlueActions {
211
197
  * @throws {WithdrawExceedsSupplyError} when assets exceed the supplied balance.
212
198
  * @throws {WithdrawSharesExceedSupplyError} when shares exceed the owned balance.
213
199
  * @throws {InputExceedsMaxError} when a fee or reallocation exceeds its ABI bound.
214
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
200
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
215
201
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
216
- * @throws {InvalidReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
202
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
217
203
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
218
204
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
219
205
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
@@ -276,6 +262,7 @@ export interface BlueActions {
276
262
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
277
263
  * @returns Lazy Blue authorization resolution and a synchronous deep-frozen transaction.
278
264
  * @throws {ChainIdMismatchError} when the client targets another chain.
265
+ * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
279
266
  * @throws {ExpiredDeadlineError} when the deadline is stale.
280
267
  * @throws {MissingAccrualPositionError} when no position snapshot is provided.
281
268
  * @throws {MarketIdMismatchError} when `positionData` belongs to another market.
@@ -285,9 +272,9 @@ export interface BlueActions {
285
272
  * @throws {NonPositiveInputError} when `borrowAssets` is not positive.
286
273
  * @throws {NegativeInputError} when the borrow, fee, or a reallocation value is negative.
287
274
  * @throws {InputExceedsMaxError} when a fee, penalty, or reallocation exceeds its bound.
288
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
275
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
289
276
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
290
- * @throws {InvalidReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
277
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
291
278
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
292
279
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
293
280
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
@@ -351,6 +338,7 @@ export interface BlueActions {
351
338
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
352
339
  * @returns Lazy token prerequisite resolution and a synchronous deep-frozen transaction.
353
340
  * @throws {ChainIdMismatchError} when the client targets another chain.
341
+ * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
354
342
  * @throws {ExpiredDeadlineError} when the deadline is stale.
355
343
  * @throws {MissingAccrualPositionError} when no position snapshot is provided.
356
344
  * @throws {MarketIdMismatchError} when `positionData` belongs to another market.
@@ -361,12 +349,14 @@ export interface BlueActions {
361
349
  * @throws {RepayExceedsDebtError} when an exact asset repay exceeds current debt.
362
350
  * @throws {RepaySharesExceedDebtError} when non-saturated shares exceed current debt shares.
363
351
  * @throws {InputExceedsMaxError} when a fee is out of bounds or a share quote deadline is too far away.
352
+ * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when a classic
353
+ * `approvalAmount` is below the derived `maxRepayAssets`.
364
354
  * @throws {MaxRepayAssetsBelowRepayAssetsError} when a signed share cap no longer covers the fresh quote.
365
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
355
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
366
356
  * @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
367
357
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
368
358
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
369
- * @throws {MissingPermit2SignatureTransferNonceError} from `getRequirements()` when Permit2 is selected without a nonce.
359
+ * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
370
360
  * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
371
361
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
372
362
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an authorization signature is supplied.
@@ -433,6 +423,7 @@ export interface BlueActions {
433
423
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
434
424
  * @returns Lazy Blue authorization resolution and a synchronous deep-frozen transaction.
435
425
  * @throws {ChainIdMismatchError} when the client targets another chain.
426
+ * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
436
427
  * @throws {ExpiredDeadlineError} when the deadline is stale.
437
428
  * @throws {MissingAccrualPositionError} when no position snapshot is provided.
438
429
  * @throws {MarketIdMismatchError} when `positionData` belongs to another market.
@@ -443,7 +434,7 @@ export interface BlueActions {
443
434
  * @throws {NonPositiveInputError} when `collateralAssets` is not positive.
444
435
  * @throws {NegativeInputError} when collateral or the referral fee is negative.
445
436
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
446
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
437
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
447
438
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple authorization signatures are supplied.
448
439
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when a token signature is supplied.
449
440
  * @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
@@ -492,11 +483,11 @@ export interface BlueActions {
492
483
  * saturated full close; the entity derives `maxRepayAssets` from debt projected through the
493
484
  * requested deadline plus the referral fee, and the contract refunds unused funding. A
494
485
  * previously signed share-mode cap remains valid when it still covers the fresh derived minimum.
495
- * Saturated full-repay requirements use the token's reusable maximum allowance when signatures
496
- * are disabled, while the transaction itself remains bounded by the derived cap.
486
+ * Full-repay requirements fund exactly the derived `maxRepayAssets`; pass `approvalAmount` to
487
+ * request a reusable allowance instead. The transaction remains bounded by the derived cap.
497
488
  * Share-mode deadlines cannot exceed the two-hour quote horizon. Blue authorization is required
498
489
  * only for collateral withdrawal. Pure repay uses `maxLtv = maxUint256`; withdrawals use buffered
499
- * LLTV. No Bundler3 share-price or `slippageTolerance` input exists.
490
+ * LLTV. No share-price or `slippageTolerance` input exists.
500
491
  *
501
492
  * @param params.userAddress - User whose debt and collateral position changes.
502
493
  * @param params.positionData - Pre-fetched position used for repayment and health validation.
@@ -509,6 +500,7 @@ export interface BlueActions {
509
500
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
510
501
  * @returns Lazy funding/authorization resolution and a synchronous deep-frozen transaction builder.
511
502
  * @throws {ChainIdMismatchError} when the client targets another chain.
503
+ * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
512
504
  * @throws {MissingAccrualPositionError} when no position snapshot is provided at runtime.
513
505
  * @throws {MarketIdMismatchError} when `positionData` belongs to another market.
514
506
  * @throws {AccrualPositionUserMismatchError} when `positionData` belongs to another user.
@@ -522,12 +514,14 @@ export interface BlueActions {
522
514
  * @throws {WithdrawMakesPositionUnhealthyError} when the post-repay withdrawal exceeds buffered LLTV.
523
515
  * @throws {ExpiredDeadlineError} when the deadline is stale.
524
516
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD or a share-mode deadline exceeds the funding quote horizon.
517
+ * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when a classic
518
+ * `approvalAmount` is below the derived `maxRepayAssets`.
525
519
  * @throws {MaxRepayAssetsBelowRepayAssetsError} from `buildTx()` when a previously signed share-mode cap no longer covers the fresh derived minimum.
526
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
520
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
527
521
  * @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
528
522
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
529
523
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
530
- * @throws {MissingPermit2SignatureTransferNonceError} from `getRequirements()` when Permit2 is selected without an explicit nonce.
524
+ * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
531
525
  * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
532
526
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple signatures of one kind are supplied.
533
527
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an inactive leg cannot consume a supplied signature.
@@ -592,7 +586,7 @@ export interface BlueActions {
592
586
  * collateral funding requires token approval/signature unless it is exclusively native. Vault V2
593
587
  * reallocations are accepted only with a borrow. Penalties and referral fees reduce borrow
594
588
  * proceeds. The entity uses `maxUint256` for a pure collateral supply and buffered LLTV otherwise.
595
- * No Bundler3 share-price or `slippageTolerance` input exists.
589
+ * No share-price or `slippageTolerance` input exists.
596
590
  *
597
591
  * @param params.userAddress - User whose collateral and debt position changes.
598
592
  * @param params.collateralAssets - Gross collateral supplied, or zero for pure borrow.
@@ -605,6 +599,7 @@ export interface BlueActions {
605
599
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
606
600
  * @returns Lazy funding/authorization resolution and a synchronous deep-frozen transaction builder.
607
601
  * @throws {ChainIdMismatchError} when the client targets another chain.
602
+ * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
608
603
  * @throws {MissingAccrualPositionError} when a borrow has no position snapshot.
609
604
  * @throws {MarketIdMismatchError} when `positionData` belongs to another market.
610
605
  * @throws {AccrualPositionUserMismatchError} when `positionData` belongs to another user.
@@ -618,14 +613,14 @@ export interface BlueActions {
618
613
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
619
614
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
620
615
  * @throws {InputExceedsMaxError} when a fee or reallocation exceeds its ABI bound.
621
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
616
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
622
617
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
623
- * @throws {InvalidReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
618
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
624
619
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
625
620
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
626
621
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
627
622
  * @throws {ReallocationLoanTokenMismatchError} when a source uses another loan token.
628
- * @throws {MissingPermit2SignatureTransferNonceError} from `getRequirements()` when Permit2 is selected without an explicit nonce.
623
+ * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
629
624
  * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
630
625
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple signatures of one kind are supplied.
631
626
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an inactive leg cannot consume a supplied signature.
@@ -693,6 +688,7 @@ export interface BlueActions {
693
688
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
694
689
  * @returns Lazy Blue authorization resolution and a synchronous deep-frozen transaction builder.
695
690
  * @throws {ChainIdMismatchError} when the client targets another chain.
691
+ * @throws {UnsupportedBlueMarketIrmError} when positive source or destination debt requires an unsupported IRM projection.
696
692
  * @throws {MissingAccrualPositionError} when either position snapshot is absent at runtime.
697
693
  * @throws {MarketIdMismatchError} when a position snapshot belongs to another market.
698
694
  * @throws {AccrualPositionUserMismatchError} when a position snapshot belongs to another user.
@@ -704,9 +700,9 @@ export interface BlueActions {
704
700
  * @throws {BorrowExceedsSafeLtvError} when the complete destination exceeds buffered LLTV.
705
701
  * @throws {ExpiredDeadlineError} when the deadline is stale.
706
702
  * @throws {InputExceedsMaxError} when a fee or reallocation exceeds its ABI bound.
707
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
703
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
708
704
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
709
- * @throws {InvalidReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
705
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
710
706
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
711
707
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
712
708
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the destination market.
@@ -764,54 +760,6 @@ export interface BlueActions {
764
760
  readonly referralFeePct?: bigint;
765
761
  readonly referralFeeRecipient?: Address;
766
762
  }) => ActionOutput<BlueRefinanceAction, readonly RequirementSignature[], undefined>;
767
- /**
768
- * Fetches all on-chain data needed to construct a {@link VaultV1ReallocationData}
769
- * for computing vault reallocations via the public allocator.
770
- *
771
- * The target market is refetched internally at `block.number` so the
772
- * reallocation planner always sees a snapshot from the same block as the
773
- * source vaults. A caller-owned market would let stale or adversarial data
774
- * inject unnecessary `reallocateTo` actions (and their PublicAllocator
775
- * fees) into the resulting bundle.
776
- *
777
- * The returned data can be passed to {@link getVaultV1Reallocations} for explicit low-level
778
- * Bundler3 composition.
779
- *
780
- * **Stale data reverts on-chain (fail-safe).**
781
- *
782
- * @param params.vaultAddresses - Addresses of MetaMorpho vaults that allocate to this market.
783
- * @param params.block - The block to fetch data at (number and timestamp).
784
- * @returns A VaultV1ReallocationData instance populated with all required data.
785
- * @throws {ChainIdMismatchError} when the client chain does not match this market.
786
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
787
- * {@link getVaultV2BlueReallocationData}.
788
- */
789
- getVaultV1ReallocationData: (params: {
790
- vaultAddresses: readonly Address[];
791
- block: {
792
- readonly number: bigint;
793
- readonly timestamp: bigint;
794
- };
795
- }) => Promise<VaultV1ReallocationData>;
796
- /**
797
- * Fetches Vault V1 PublicAllocator state using the deprecated unversioned name.
798
- *
799
- * @param params.vaultAddresses - Addresses of MetaMorpho vaults that allocate to this market.
800
- * @param params.block.number - Block number used for every RPC read.
801
- * @param params.block.timestamp - Timestamp corresponding to the fetched block.
802
- * @returns A `VaultV1ReallocationData` snapshot populated from one block.
803
- * @throws {ChainIdMismatchError} when the client chain does not match this market.
804
- * @deprecated Use {@link getVaultV1ReallocationData} for deprecated low-level Bundler3
805
- * planning. Vault V1 shared-liquidity planning will be removed in the next major; use
806
- * {@link getVaultV2BlueReallocationData} for high-level Blue writes.
807
- */
808
- getReallocationData: (params: {
809
- vaultAddresses: readonly Address[];
810
- block: {
811
- readonly number: bigint;
812
- readonly timestamp: bigint;
813
- };
814
- }) => Promise<VaultV1ReallocationData>;
815
763
  /**
816
764
  * Fetches Vault V2 BluePublicAllocator state for this target market.
817
765
  *
@@ -837,68 +785,6 @@ export interface BlueActions {
837
785
  readonly timestamp: bigint;
838
786
  };
839
787
  }) => Promise<VaultV2BlueReallocationData>;
840
- /**
841
- * Computes Vault V1 PublicAllocator reallocations for this market.
842
- *
843
- * Uses the shared-liquidity algorithm to determine which vaults should reallocate liquidity to
844
- * this market via the PublicAllocator, based on the post-operation utilization target.
845
- *
846
- * Pass `{ borrowAmount }` for a borrow (legacy alias, equivalent to `{ operation: "borrow",
847
- * amount }`) or `{ operation: "withdraw", amount }` for a loan-asset withdraw.
848
- *
849
- * @param params.reallocationData - The current on-chain state (from {@link getVaultV1ReallocationData}).
850
- * @param params.operation - The operation driving the reallocation (`"borrow"` or `"withdraw"`).
851
- * Defaults to `"borrow"` when `borrowAmount` is provided.
852
- * @param params.amount - The borrow or withdraw amount used to compute the post-state utilization.
853
- * @param params.borrowAmount - {@deprecated} Equivalent to `{ operation: "borrow", amount }`. Use the
854
- * `operation` + `amount` form on new code.
855
- * @param params.options - Optional reallocation computation options
856
- * (timestamp, utilization targets, reallocatable vaults filter, etc.).
857
- * Pass the fetched block timestamp to compute reallocations at the same block.
858
- * @returns Vault V1 reallocations for explicit low-level Bundler3 composition.
859
- * @throws {ChainIdMismatchError} when `reallocationData` belongs to a different chain than this market.
860
- * @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.
861
- * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds the target market supply.
862
- * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
863
- * @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
864
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
865
- * {@link getVaultV2BlueReallocations}.
866
- * @example
867
- * ```ts
868
- * const reallocations = market.getVaultV1Reallocations({
869
- * reallocationData,
870
- * operation: "borrow",
871
- * amount: 1_000_000n,
872
- * });
873
- * ```
874
- */
875
- getVaultV1Reallocations: (params: VaultV1ReallocationsParams) => readonly VaultV1Reallocation[];
876
- /**
877
- * Computes Vault V1 PublicAllocator reallocations using the deprecated unversioned name.
878
- *
879
- * @param params.reallocationData - State returned by {@link getVaultV1ReallocationData}.
880
- * @param params.operation - The operation driving the reallocation (`"borrow"` or `"withdraw"`).
881
- * @param params.amount - The borrow or withdraw amount used to compute post-state utilization.
882
- * @param params.borrowAmount - Deprecated borrow amount alias.
883
- * @param params.options - Optional allocator and utilization options.
884
- * @returns Vault V1 reallocations for explicit low-level Bundler3 composition.
885
- * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
886
- * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation.
887
- * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
888
- * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
889
- * @throws {UnknownReallocationMarketError} when the target market is absent.
890
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
891
- * {@link getVaultV2BlueReallocations}.
892
- * @example
893
- * ```ts
894
- * const reallocations = market.getReallocations({
895
- * reallocationData,
896
- * operation: "borrow",
897
- * amount: 1_000_000n,
898
- * });
899
- * ```
900
- */
901
- getReallocations: (params: VaultV1ReallocationsParams) => readonly VaultV1Reallocation[];
902
788
  /**
903
789
  * Computes Vault V2 BluePublicAllocator reallocations for this market.
904
790
  *
@@ -906,6 +792,7 @@ export interface BlueActions {
906
792
  * @param params.options - Optional allocator discovery controls and operation to support.
907
793
  * @returns Action-ready reallocations and their post-simulation state.
908
794
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
795
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
909
796
  * @throws {NegativeInputError} when a utilization or penalty limit is negative.
910
797
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
911
798
  * @throws {NonPositiveInputError} when an enabled operation amount is not positive.
@@ -1065,64 +952,6 @@ export declare class MorphoBlue implements BlueActions {
1065
952
  getRequirements: () => Promise<readonly ActionRequirement[]>;
1066
953
  buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<import("../../index.js").Transaction<BlueRefinanceAction>>;
1067
954
  };
1068
- /**
1069
- * Fetches all on-chain inputs needed to compute public allocator reallocations.
1070
- *
1071
- * @param params.vaultAddresses - Vaults to inspect for source-market liquidity.
1072
- * @param params.block.number - Block number used for every RPC read.
1073
- * @param params.block.timestamp - Timestamp corresponding to the fetched block.
1074
- * @returns Reallocation data ready for {@link getVaultV1Reallocations}.
1075
- * @throws {ChainIdMismatchError} when the client chain does not match this market.
1076
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
1077
- * {@link getVaultV2BlueReallocationData}.
1078
- * @example
1079
- * ```ts
1080
- * import { markets, vaults } from "@morpho-org/morpho-test";
1081
- * import { createPublicClient, http } from "viem";
1082
- * import { mainnet } from "viem/chains";
1083
- * import { morphoViemExtension } from "@morpho-org/morpho-sdk";
1084
- * import type { VaultV1ReallocationData } from "@morpho-org/morpho-sdk/entities";
1085
- *
1086
- * const client = createPublicClient({ chain: mainnet, transport: http() })
1087
- * .extend(morphoViemExtension());
1088
- * const market = client.morpho.blue(markets[mainnet.id].usdc_wbtc, mainnet.id);
1089
- * const block = await client.getBlock();
1090
- * const data: VaultV1ReallocationData = await market.getVaultV1ReallocationData({
1091
- * vaultAddresses: [vaults[mainnet.id].steakUsdc.address],
1092
- * block,
1093
- * });
1094
- * ```
1095
- */
1096
- getVaultV1ReallocationData({ vaultAddresses, block, }: {
1097
- vaultAddresses: readonly Address[];
1098
- block: {
1099
- readonly number: bigint;
1100
- readonly timestamp: bigint;
1101
- };
1102
- }): Promise<VaultV1ReallocationData>;
1103
- /**
1104
- * Fetches Vault V1 PublicAllocator state using the deprecated unversioned name.
1105
- *
1106
- * @param params.vaultAddresses - Addresses of MetaMorpho vaults that allocate to this market.
1107
- * @param params.block.number - Block number used for every RPC read.
1108
- * @param params.block.timestamp - Timestamp corresponding to the fetched block.
1109
- * @returns A `VaultV1ReallocationData` snapshot populated from one block.
1110
- * @throws {ChainIdMismatchError} when the client chain does not match this market.
1111
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
1112
- * {@link getVaultV2BlueReallocationData}.
1113
- * @example
1114
- * ```ts
1115
- * const data = await market.getReallocationData({ vaultAddresses, block });
1116
- * // Equivalent to market.getVaultV1ReallocationData({ vaultAddresses, block }).
1117
- * ```
1118
- */
1119
- getReallocationData(params: {
1120
- vaultAddresses: readonly Address[];
1121
- block: {
1122
- readonly number: bigint;
1123
- readonly timestamp: bigint;
1124
- };
1125
- }): Promise<VaultV1ReallocationData>;
1126
955
  /**
1127
956
  * Fetches Vault V2 BluePublicAllocator state for this target market.
1128
957
  *
@@ -1167,62 +996,6 @@ export declare class MorphoBlue implements BlueActions {
1167
996
  readonly timestamp: bigint;
1168
997
  };
1169
998
  }): Promise<VaultV2BlueReallocationData>;
1170
- /**
1171
- * Computes Vault V1 PublicAllocator reallocations for this market.
1172
- *
1173
- * Pass `{ borrowAmount }` for a borrow (legacy alias, equivalent to `{ operation: "borrow", amount }`)
1174
- * or `{ operation, amount }` for a borrow or loan-asset withdraw.
1175
- *
1176
- * @param params - Reallocation computation parameters.
1177
- * @param params.reallocationData - State returned by {@link getVaultV1ReallocationData}.
1178
- * @param params.operation - The operation driving the reallocation (`"borrow"` or `"withdraw"`).
1179
- * @param params.amount - The borrow or withdraw amount used to compute the post-state utilization.
1180
- * @param params.borrowAmount - {@deprecated Pass `{ operation: "borrow", amount }` instead.}
1181
- * @param params.options - Optional allocator and utilization options.
1182
- * @returns Vault V1 reallocations for explicit low-level Bundler3 composition.
1183
- * @throws {ChainIdMismatchError} when `reallocationData` belongs to a different chain than this market.
1184
- * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation's absolute shortfall on the target market.
1185
- * @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
1186
- * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
1187
- * @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
1188
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
1189
- * {@link getVaultV2BlueReallocations}.
1190
- * @example
1191
- * ```ts
1192
- * const reallocations = market.getVaultV1Reallocations({
1193
- * reallocationData,
1194
- * operation: "borrow",
1195
- * amount: 1_000_000n,
1196
- * });
1197
- * ```
1198
- */
1199
- getVaultV1Reallocations(params: VaultV1ReallocationsParams): readonly VaultV1Reallocation[];
1200
- /**
1201
- * Computes Vault V1 PublicAllocator reallocations using the deprecated unversioned name.
1202
- *
1203
- * @param params.reallocationData - State returned by {@link getVaultV1ReallocationData}.
1204
- * @param params.operation - The operation driving the reallocation (`"borrow"` or `"withdraw"`).
1205
- * @param params.amount - The borrow or withdraw amount used to compute post-state utilization.
1206
- * @param params.borrowAmount - Deprecated borrow amount alias.
1207
- * @param params.options - Optional allocator and utilization options.
1208
- * @returns Vault V1 reallocations for explicit low-level Bundler3 composition.
1209
- * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
1210
- * @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation.
1211
- * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
1212
- * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
1213
- * @throws {UnknownReallocationMarketError} when the target market is absent.
1214
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
1215
- * {@link getVaultV2BlueReallocations}.
1216
- * @example
1217
- * ```ts
1218
- * const reallocations = market.getReallocations({
1219
- * reallocationData,
1220
- * operation: "borrow",
1221
- * amount: 1_000_000n,
1222
- * });
1223
- * ```
1224
- */
1225
- getReallocations(params: VaultV1ReallocationsParams): readonly VaultV1Reallocation[];
1226
999
  /**
1227
1000
  * Computes Vault V2 BluePublicAllocator reallocations for this market.
1228
1001
  *
@@ -1230,6 +1003,7 @@ export declare class MorphoBlue implements BlueActions {
1230
1003
  * @param params.options - Optional allocator discovery controls and operation to support.
1231
1004
  * @returns Action-ready reallocations and their post-simulation state.
1232
1005
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
1006
+ * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
1233
1007
  * @throws {NegativeInputError} when a utilization or penalty limit is negative.
1234
1008
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
1235
1009
  * @throws {NonPositiveInputError} when an enabled operation amount is not positive.