@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,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NegativeSupplyAmountError = exports.NonPositiveMinBorrowSharePriceError = exports.NegativeReallocationFeeError = exports.NegativeNativeAmountError = exports.NegativeSlippageToleranceError = exports.NonPositiveWithdrawAmountError = exports.ZeroSupplyAmountError = exports.NonPositiveWithdrawCollateralAmountError = exports.NonPositiveRepayMaxSharePriceError = exports.NonPositiveRepayAmountError = exports.NonPositiveReallocationAmountError = exports.ZeroCollateralAmountError = exports.NonPositiveBorrowAmountError = exports.ZeroDepositAmountError = exports.NonPositiveMaxSharePriceError = exports.NonPositiveSharesAmountError = exports.NonPositiveAssetAmountError = exports.MaxRepayAssetsBelowRepayAssetsError = exports.ReallocationsRequireBorrowError = exports.UnsupportedAuthorizationOperatorError = exports.ReallocationLoanTokenMismatchError = exports.SameVaultMigrationError = exports.AmountAndSharesExclusiveError = exports.MixedBundlesFundingError = exports.ReferralFeePctExceededError = exports.MissingReferralFeeRecipientError = exports.ReferralFeeRecipientMissingError = exports.NativeFundingAmountMismatchError = exports.Permit2TransferFromNonceAlreadyUsedError = exports.NoUnusedPermit2NonceError = exports.Permit2SignatureTransferNonceAlreadyUsedError = exports.MissingPermit2TransferFromNonceError = exports.MissingPermit2SignatureTransferNonceError = exports.BlueBundlesV1RequirementSignatureMismatchError = exports.BundlesRequirementSignatureMismatchError = exports.VaultExitBundlesV1PermitMismatchError = exports.BundlesPermitMismatchError = exports.VaultIsBlueFeeRecipientError = exports.VaultMorphoMismatchError = exports.InsufficientBlueBalanceForInKindRedeemError = exports.InKindRedeemCoverageError = exports.InKindRedeemZeroDeallocationError = exports.UnsupportedInKindAdapterError = exports.AdapterNotPartOfVaultError = exports.InKindRedeemRequiresSingleAdapterError = exports.ExpiredDeadlineError = exports.EmptyMarketParamsListError = exports.InputExceedsMaxError = exports.NonPositiveInputError = exports.NegativeInputError = void 0;
4
- exports.DisabledReallocationMarketError = exports.MissingPublicAllocatorConfigError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.ShareDivideByZeroError = exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.MutuallyExclusiveRepayAmountsError = exports.TransferAmountNotEqualToAssetsError = exports.UnsortedReallocationWithdrawalsError = exports.InconsistentReallocationPenaltyError = exports.InvalidReallocationSourceTypeError = exports.InvalidReallocationAddressError = exports.MixedReallocationVersionsError = exports.InvalidReallocationShapeError = exports.ReallocationWithdrawalOnTargetMarketError = exports.EmptyReallocationWithdrawalsError = exports.AccrualPositionUserMismatchError = exports.MarketIdMismatchError = exports.MissingMarketPriceError = exports.BorrowExceedsSafeLtvError = exports.NativeAmountOnNonWNativeCollateralError = exports.NativeAmountOnNonWNativeAssetError = exports.VaultAddressMismatchError = exports.ChainWNativeMissingError = exports.NativeAmountOnNonWNativeVaultError = exports.Permit2ExpirationMissingError = exports.DepositSpenderMismatchError = exports.DepositOwnerMismatchError = exports.DepositAssetMismatchError = exports.DepositAmountMismatchError = exports.EmptyDeallocationsError = exports.ExcessiveSlippageToleranceError = exports.MissingAccrualPositionError = exports.UnsupportedMidnightAuthorizationTargetError = exports.UnsupportedErc20ApprovalSpenderError = exports.ApprovalAmountLessThanSpendAmountError = exports.MissingClientPropertyError = exports.CryptoUnavailableError = exports.ChainIdMismatchError = exports.AddressMismatchError = exports.UnexpectedRequirementSignatureError = exports.AmbiguousRequirementSignaturesError = exports.BundlerErrors = exports.NegativeMaxRepaySharePriceError = exports.NegativeBorrowSharesError = exports.NegativeMinSharePriceError = exports.NegativeWithdrawMinSharePriceError = exports.NegativeSupplyMaxSharePriceError = void 0;
5
- exports.RefinanceSharesMissingBorrowAssetsError = exports.RefinanceExceedsBorrowAssetsError = exports.RefinanceExceedsBorrowSharesError = exports.RefinanceExceedsCollateralError = exports.BorrowAmountAndSharesExclusiveError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.VaultAssetMismatchError = exports.ReallocationWithdrawExceedsMarketSupplyError = exports.WithdrawSharesExceedSupplyError = exports.WithdrawExceedsSupplyError = exports.MutuallyExclusiveWithdrawAmountsError = exports.InsufficientMidnightWithdrawableLiquidityError = exports.MidnightRedeemExceedsCreditError = exports.NoMidnightCreditToRedeemError = exports.UnpreparedMidnightOfferRootSignatureError = exports.MidnightOfferRootOfferCountMismatchError = exports.MidnightOfferRootRatifierMismatchError = exports.MidnightOfferRootOwnerMismatchError = exports.MidnightOfferRootMismatchError = exports.MissingMidnightOfferRootSignatureError = exports.UnknownMidnightRatifierError = exports.MidnightTakeableOfferMarketMismatchError = exports.MidnightOfferMarketLoanTokenMismatchError = exports.MidnightMarketAddressMismatchError = exports.MidnightOfferMarketAddressMismatchError = exports.MidnightOfferMarketChainMismatchError = exports.MidnightOfferMakerMismatchError = exports.MidnightOfferSideMismatchError = exports.EmptyMidnightTakeableOffersError = exports.MidnightAmountExceedsMaxOfferCapError = exports.ReallocationAdapterSupplySharesUnderflowError = exports.ReallocationAllocationUnderflowError = exports.UnknownReallocationAdapterError = exports.UnknownReallocationMarketPublicAllocatorConfigError = exports.UnknownReallocationActiveAdaptersError = exports.UnknownReallocationPublicAllocatorConfigError = exports.UnknownReallocationAllocationError = exports.UnknownReallocationPositionError = exports.UnknownReallocationVaultMarketConfigError = exports.UnknownReallocationVaultError = exports.UnknownReallocationMarketError = exports.InsufficientSharedLiquidityError = void 0;
3
+ exports.DepositOwnerMismatchError = exports.DepositAssetMismatchError = exports.DepositAmountMismatchError = exports.EmptyDeallocationsError = exports.ExcessiveSlippageToleranceError = exports.MissingAccrualPositionError = exports.UnsupportedMidnightAuthorizationTargetError = exports.UnsupportedErc20ApprovalSpenderError = exports.ApprovalAmountLessThanSpendAmountError = exports.MissingClientPropertyError = exports.CryptoUnavailableError = exports.ChainIdMismatchError = exports.AddressMismatchError = exports.UnsupportedRequirementSignatureError = exports.UnexpectedRequirementSignatureError = exports.AmbiguousRequirementSignaturesError = exports.MaxRepayAssetsBelowRepayAssetsError = exports.ReallocationsRequireBorrowError = exports.UnsupportedAuthorizationOperatorError = exports.ReallocationLoanTokenMismatchError = exports.SameVaultMigrationError = exports.AmountAndSharesExclusiveError = exports.MixedBundlesFundingError = exports.ReferralFeePctExceededError = exports.ReferralFeeRecipientMissingError = exports.NativeFundingAmountMismatchError = exports.NoUnusedPermit2NonceError = exports.Permit2SignatureTransferNonceAlreadyUsedError = exports.BundlesRequirementSignatureMismatchError = exports.BundlesPermitMismatchError = exports.VaultIsBlueFeeRecipientError = exports.VaultMorphoMismatchError = exports.InsufficientBlueBalanceForInKindRedeemError = exports.InKindRedeemCoverageError = exports.InKindRedeemZeroDeallocationError = exports.VaultV2ForceWithdrawFeeSharesExceedBurnError = exports.VaultV2ForceWithdrawSharePriceBelowFloorError = exports.VaultV2ForceWithdrawZeroSharePriceError = exports.VaultV2ForceWithdrawZeroWithdrawalError = exports.VaultV2ForceWithdrawCoverageError = exports.VaultV2UndecodableLiquidityDataError = exports.VaultV2UnsupportedLiquidityAdapterError = exports.VaultV2UnsupportedExitAdapterError = exports.AdapterNotPartOfVaultError = exports.VaultV2SingleAdapterRequiredError = exports.ExpiredDeadlineError = exports.EmptyMarketParamsListError = exports.InputExceedsMaxError = exports.NonPositiveInputError = exports.NegativeInputError = void 0;
4
+ exports.MutuallyExclusiveWithdrawAmountsError = exports.InsufficientMidnightWithdrawableLiquidityError = exports.MidnightRedeemExceedsCreditError = exports.NoMidnightCreditToRedeemError = exports.UnpreparedMidnightOfferRootSignatureError = exports.MidnightOfferRootOfferCountMismatchError = exports.MidnightOfferRootRatifierMismatchError = exports.MidnightOfferRootOwnerMismatchError = exports.MidnightOfferRootMismatchError = exports.MissingMidnightOfferRootSignatureError = exports.UnknownMidnightRatifierError = exports.MidnightTakeableOfferMarketMismatchError = exports.MidnightOfferMarketLoanTokenMismatchError = exports.MidnightMarketAddressMismatchError = exports.MidnightOfferMarketAddressMismatchError = exports.MidnightOfferMarketChainMismatchError = exports.MidnightOfferMakerMismatchError = exports.MidnightOfferSideMismatchError = exports.EmptyMidnightTakeableOffersError = exports.MidnightAmountExceedsMaxOfferCapError = exports.ReallocationAdapterSupplySharesUnderflowError = exports.ReallocationAllocationUnderflowError = exports.UnknownReallocationAdapterError = exports.UnknownReallocationMarketPublicAllocatorConfigError = exports.UnknownReallocationActiveAdaptersError = exports.UnknownReallocationPublicAllocatorConfigError = exports.UnknownReallocationAllocationError = exports.UnknownReallocationVaultError = exports.UnknownReallocationMarketError = exports.InsufficientSharedLiquidityError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.MutuallyExclusiveRepayAmountsError = exports.InconsistentReallocationPenaltyError = exports.InvalidReallocationSourceTypeError = exports.InvalidReallocationAddressError = exports.InvalidVaultV2BlueReallocationShapeError = exports.ReallocationWithdrawalOnTargetMarketError = exports.AccrualPositionUserMismatchError = exports.MarketIdMismatchError = exports.MissingMarketPriceError = exports.BorrowExceedsSafeLtvError = exports.NativeAmountOnNonWNativeAssetError = exports.VaultAddressMismatchError = exports.ChainWNativeMissingError = exports.NativeAmountOnNonWNativeVaultError = exports.DepositSpenderMismatchError = void 0;
5
+ exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.VaultAssetMismatchError = exports.ReallocationWithdrawExceedsMarketSupplyError = exports.WithdrawSharesExceedSupplyError = exports.WithdrawExceedsSupplyError = void 0;
6
6
  const blue_sdk_1 = require("@morpho-org/blue-sdk");
7
7
  /**
8
8
  * Thrown when a morpho-sdk input that must be non-negative is negative.
@@ -107,8 +107,23 @@ class ExpiredDeadlineError extends Error {
107
107
  }
108
108
  }
109
109
  exports.ExpiredDeadlineError = ExpiredDeadlineError;
110
- /** Thrown when Vault V2 in-kind redemption is attempted with anything other than one adapter. */
111
- class InKindRedeemRequiresSingleAdapterError extends Error {
110
+ /**
111
+ * Thrown when a VaultExitBundlesV1 Vault V2 exit targets a vault without exactly one adapter.
112
+ *
113
+ * Both `vaultExitBundlesV1InKindRedemptionVaultV2` and
114
+ * `vaultExitBundlesV1ForceWithdrawVaultV2` require `adaptersLength() == 1`.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * import { VaultV2SingleAdapterRequiredError } from "@morpho-org/morpho-sdk";
119
+ *
120
+ * const error = new VaultV2SingleAdapterRequiredError(vault, 2);
121
+ * if (error instanceof VaultV2SingleAdapterRequiredError) {
122
+ * console.error(error.vault, error.adapters);
123
+ * }
124
+ * ```
125
+ */
126
+ class VaultV2SingleAdapterRequiredError extends Error {
112
127
  vault;
113
128
  adapters;
114
129
  /**
@@ -116,13 +131,13 @@ class InKindRedeemRequiresSingleAdapterError extends Error {
116
131
  * @param adapters - Number of adapters in the supplied vault snapshot.
117
132
  */
118
133
  constructor(vault, adapters) {
119
- super(`Vault "${vault}" has "${adapters}" adapters. In-kind redemption requires exactly one MorphoMarketV1AdapterV2.`);
134
+ super(`Vault "${vault}" has "${adapters}" adapters. VaultExitBundlesV1 exits require exactly one MorphoMarketV1AdapterV2.`);
120
135
  this.vault = vault;
121
136
  this.adapters = adapters;
122
- this.name = "InKindRedeemRequiresSingleAdapterError";
137
+ this.name = "VaultV2SingleAdapterRequiredError";
123
138
  }
124
139
  }
125
- exports.InKindRedeemRequiresSingleAdapterError = InKindRedeemRequiresSingleAdapterError;
140
+ exports.VaultV2SingleAdapterRequiredError = VaultV2SingleAdapterRequiredError;
126
141
  /** Thrown when a requested in-kind redemption adapter is not part of the Vault V2 snapshot. */
127
142
  class AdapterNotPartOfVaultError extends Error {
128
143
  vault;
@@ -139,19 +154,335 @@ class AdapterNotPartOfVaultError extends Error {
139
154
  }
140
155
  }
141
156
  exports.AdapterNotPartOfVaultError = AdapterNotPartOfVaultError;
142
- /** Thrown when the Vault V2 adapter cannot expose MorphoMarketV1AdapterV2 market shares. */
143
- class UnsupportedInKindAdapterError extends Error {
157
+ /**
158
+ * Thrown when the Vault V2 adapter cannot expose MorphoMarketV1AdapterV2 market shares.
159
+ *
160
+ * VaultExitBundlesV1 casts the adapter to `IMorphoMarketV1AdapterV2`, so a legacy
161
+ * positions-based `MorphoMarketV1Adapter` or a `MorphoVaultV1Adapter` cannot be exited.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * import { VaultV2UnsupportedExitAdapterError } from "@morpho-org/morpho-sdk";
166
+ *
167
+ * const error = new VaultV2UnsupportedExitAdapterError(adapter);
168
+ * if (error instanceof VaultV2UnsupportedExitAdapterError) {
169
+ * console.error(error.adapter);
170
+ * }
171
+ * ```
172
+ */
173
+ class VaultV2UnsupportedExitAdapterError extends Error {
144
174
  adapter;
145
175
  /**
146
176
  * @param adapter - Unsupported Vault V2 adapter address.
147
177
  */
148
178
  constructor(adapter) {
149
- super(`Adapter "${adapter}" does not support Vault V2 in-kind redemption. Use a MorphoMarketV1AdapterV2-backed vault.`);
179
+ super(`Adapter "${adapter}" does not support Vault V2 exits through VaultExitBundlesV1. Use a MorphoMarketV1AdapterV2-backed vault.`);
150
180
  this.adapter = adapter;
151
- this.name = "UnsupportedInKindAdapterError";
181
+ this.name = "VaultV2UnsupportedExitAdapterError";
182
+ }
183
+ }
184
+ exports.VaultV2UnsupportedExitAdapterError = VaultV2UnsupportedExitAdapterError;
185
+ /**
186
+ * Thrown when a Vault V2 exit cannot resolve the vault's configured liquidity adapter.
187
+ *
188
+ * `VaultExitBundlesV1.vaultExitBundlesV1ForceWithdrawVaultV2` casts `liquidityAdapter` to
189
+ * `IMorphoMarketV1AdapterV2` and ABI-decodes `liquidityData` as `MarketParams`. Because the exit
190
+ * also requires `adaptersLength() == 1`, the only resolvable configurations are an unset
191
+ * liquidity adapter or the vault's sole adapter.
192
+ *
193
+ * @example
194
+ * ```ts
195
+ * import { VaultV2UnsupportedLiquidityAdapterError } from "@morpho-org/morpho-sdk";
196
+ *
197
+ * const error = new VaultV2UnsupportedLiquidityAdapterError({
198
+ * vault,
199
+ * liquidityAdapter,
200
+ * adapter,
201
+ * });
202
+ * if (error instanceof VaultV2UnsupportedLiquidityAdapterError) {
203
+ * console.error(error.liquidityAdapter, error.adapter);
204
+ * }
205
+ * ```
206
+ */
207
+ class VaultV2UnsupportedLiquidityAdapterError extends Error {
208
+ /** Vault V2 address. */
209
+ vault;
210
+ /** Liquidity adapter configured on the vault. */
211
+ liquidityAdapter;
212
+ /** Sole adapter the exit targets. */
213
+ adapter;
214
+ /**
215
+ * @param params - Liquidity-adapter mismatch details.
216
+ * @param params.vault - Vault V2 address.
217
+ * @param params.liquidityAdapter - Liquidity adapter configured on the vault.
218
+ * @param params.adapter - Sole adapter the exit targets.
219
+ */
220
+ constructor(params) {
221
+ super(`Vault "${params.vault}" routes liquidity through "${params.liquidityAdapter}", which is neither unset nor its sole adapter "${params.adapter}". Use another exit path until the vault routes liquidity through its sole MorphoMarketV1AdapterV2.`);
222
+ this.vault = params.vault;
223
+ this.liquidityAdapter = params.liquidityAdapter;
224
+ this.adapter = params.adapter;
225
+ this.name = "VaultV2UnsupportedLiquidityAdapterError";
226
+ }
227
+ }
228
+ exports.VaultV2UnsupportedLiquidityAdapterError = VaultV2UnsupportedLiquidityAdapterError;
229
+ /**
230
+ * Thrown when a Vault V2 exit cannot ABI-decode the vault's `liquidityData` as `MarketParams`.
231
+ *
232
+ * Distinct from {@link VaultV2UnsupportedLiquidityAdapterError}: the liquidity adapter *is* the
233
+ * vault's sole adapter, but the market params stored alongside it are unusable, so the contract's
234
+ * `abi.decode` would revert. Only the vault curator can repair this by re-setting the liquidity
235
+ * adapter and data.
236
+ *
237
+ * @example
238
+ * ```ts
239
+ * import { VaultV2UndecodableLiquidityDataError } from "@morpho-org/morpho-sdk";
240
+ *
241
+ * try {
242
+ * vault.forceWithdraw({ exitAssets: 1_000_000n, vaultData, userAddress });
243
+ * } catch (error) {
244
+ * if (error instanceof VaultV2UndecodableLiquidityDataError) {
245
+ * console.error(error.liquidityData, error.cause);
246
+ * }
247
+ * }
248
+ * ```
249
+ */
250
+ class VaultV2UndecodableLiquidityDataError extends Error {
251
+ /** Vault V2 address. */
252
+ vault;
253
+ /** Liquidity adapter configured on the vault. */
254
+ liquidityAdapter;
255
+ /** Raw `liquidityData` that failed to decode. */
256
+ liquidityData;
257
+ /**
258
+ * @param params - Undecodable liquidity-data details.
259
+ * @param params.vault - Vault V2 address.
260
+ * @param params.liquidityAdapter - Liquidity adapter configured on the vault.
261
+ * @param params.liquidityData - Raw `liquidityData` that failed to decode.
262
+ * @param params.cause - Underlying decode failure.
263
+ */
264
+ constructor(params) {
265
+ super(`Vault "${params.vault}" stores liquidity data "${params.liquidityData}" for adapter "${params.liquidityAdapter}" that does not decode as MarketParams. Use another exit path until the vault curator re-sets its liquidity adapter and data.`, { cause: params.cause });
266
+ this.vault = params.vault;
267
+ this.liquidityAdapter = params.liquidityAdapter;
268
+ this.liquidityData = params.liquidityData;
269
+ this.name = "VaultV2UndecodableLiquidityDataError";
152
270
  }
153
271
  }
154
- exports.UnsupportedInKindAdapterError = UnsupportedInKindAdapterError;
272
+ exports.VaultV2UndecodableLiquidityDataError = VaultV2UndecodableLiquidityDataError;
273
+ /**
274
+ * Thrown when the adapter's markets cannot cover a Vault V2 force withdrawal.
275
+ *
276
+ * `vaultExitBundlesV1ForceWithdrawVaultV2` loops over the adapter's market list without a bound,
277
+ * so an under-covered request reverts on-chain with a raw `panic 0x32`. This error surfaces that
278
+ * failure before submission.
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * import { VaultV2ForceWithdrawCoverageError } from "@morpho-org/morpho-sdk";
283
+ *
284
+ * const error = new VaultV2ForceWithdrawCoverageError({
285
+ * required: 100n,
286
+ * covered: 40n,
287
+ * maxExitAssets: 60n,
288
+ * });
289
+ * if (error instanceof VaultV2ForceWithdrawCoverageError) {
290
+ * console.error(error.maxExitAssets);
291
+ * }
292
+ * ```
293
+ */
294
+ class VaultV2ForceWithdrawCoverageError extends Error {
295
+ /** Assets that must be force-deallocated from the adapter's markets. */
296
+ required;
297
+ /** Assets the adapter's markets can actually release. */
298
+ covered;
299
+ /** Largest penalty-inclusive `exitAssets` the current vault state supports. */
300
+ maxExitAssets;
301
+ /**
302
+ * @param params - Coverage values used to explain the rejected exit.
303
+ * @param params.required - Assets that must be force-deallocated.
304
+ * @param params.covered - Assets the adapter's markets can release.
305
+ * @param params.maxExitAssets - Largest supported penalty-inclusive `exitAssets`.
306
+ */
307
+ constructor(params) {
308
+ super(`Force withdrawal requires "${params.required}" force-deallocated assets but the adapter's markets only release "${params.covered}". Reduce exitAssets to at most "${params.maxExitAssets}" or wait for market liquidity.`);
309
+ this.required = params.required;
310
+ this.covered = params.covered;
311
+ this.maxExitAssets = params.maxExitAssets;
312
+ this.name = "VaultV2ForceWithdrawCoverageError";
313
+ }
314
+ }
315
+ exports.VaultV2ForceWithdrawCoverageError = VaultV2ForceWithdrawCoverageError;
316
+ /**
317
+ * Thrown when a Vault V2 force withdrawal would withdraw nothing while still consuming its permit.
318
+ *
319
+ * Happens on a dust `exitAssets` when the vault has no penalty-free liquidity and the
320
+ * penalty-adjusted remainder rounds down to zero.
321
+ *
322
+ * @example
323
+ * ```ts
324
+ * import { VaultV2ForceWithdrawZeroWithdrawalError } from "@morpho-org/morpho-sdk";
325
+ *
326
+ * const error = new VaultV2ForceWithdrawZeroWithdrawalError({
327
+ * vault,
328
+ * exitAssets: 1n,
329
+ * penalty: 20_000000000000000n,
330
+ * });
331
+ * if (error instanceof VaultV2ForceWithdrawZeroWithdrawalError) {
332
+ * console.error(error.exitAssets, error.penalty);
333
+ * }
334
+ * ```
335
+ */
336
+ class VaultV2ForceWithdrawZeroWithdrawalError extends Error {
337
+ /** Vault V2 address. */
338
+ vault;
339
+ /** Positive penalty-inclusive amount requested by the caller. */
340
+ exitAssets;
341
+ /** WAD-scaled force-deallocation penalty applied by the adapter. */
342
+ penalty;
343
+ /**
344
+ * @param params - Values that caused the exit to withdraw nothing.
345
+ * @param params.vault - Vault V2 address.
346
+ * @param params.exitAssets - Positive penalty-inclusive amount requested by the caller.
347
+ * @param params.penalty - WAD-scaled force-deallocation penalty applied by the adapter.
348
+ */
349
+ constructor(params) {
350
+ super(`Vault "${params.vault}" has no penalty-free liquidity, and force-withdraw exitAssets "${params.exitAssets}" rounds to zero withdrawn assets after applying penalty "${params.penalty}". Increase exitAssets or use another exit path.`);
351
+ this.vault = params.vault;
352
+ this.exitAssets = params.exitAssets;
353
+ this.penalty = params.penalty;
354
+ this.name = "VaultV2ForceWithdrawZeroWithdrawalError";
355
+ }
356
+ }
357
+ exports.VaultV2ForceWithdrawZeroWithdrawalError = VaultV2ForceWithdrawZeroWithdrawalError;
358
+ /**
359
+ * Thrown when a Vault V2 force withdrawal's derived share-price floor rounds down to zero.
360
+ *
361
+ * VaultExitBundlesV1 reads `minSharePriceE27 == 0` as "no bound at all", so emitting a rounded-down
362
+ * zero would silently ship an exit with none of the slippage protection this path exists to add.
363
+ * Reaching it means the exit burns more shares than `withdrawnAssets` can price at RAY scale — a
364
+ * vault whose share price has collapsed below `1e-27` assets per share, or a dust exit against one.
365
+ *
366
+ * @example
367
+ * ```ts
368
+ * import { VaultV2ForceWithdrawZeroSharePriceError } from "@morpho-org/morpho-sdk";
369
+ *
370
+ * try {
371
+ * vault.forceWithdraw({ exitAssets, vaultData, userAddress });
372
+ * } catch (error) {
373
+ * if (error instanceof VaultV2ForceWithdrawZeroSharePriceError) {
374
+ * console.error(error.withdrawnAssets, error.sharesBurnt);
375
+ * }
376
+ * }
377
+ * ```
378
+ */
379
+ class VaultV2ForceWithdrawZeroSharePriceError extends Error {
380
+ /** Assets the exit withdraws in total, before the referral fee. */
381
+ withdrawnAssets;
382
+ /** Upper bound of the vault shares the exit burns. */
383
+ sharesBurnt;
384
+ /** WAD-scaled slippage tolerance applied to the floor. */
385
+ slippageTolerance;
386
+ /**
387
+ * @param params - Values whose ratio rounded down to a zero share-price floor.
388
+ * @param params.withdrawnAssets - Assets the exit withdraws in total, before the referral fee.
389
+ * @param params.sharesBurnt - Upper bound of the vault shares the exit burns.
390
+ * @param params.slippageTolerance - WAD-scaled slippage tolerance applied to the floor.
391
+ */
392
+ constructor(params) {
393
+ super(`Force-withdraw share-price floor rounds to zero: withdrawnAssets "${params.withdrawnAssets}" over sharesBurnt "${params.sharesBurnt}" at slippageTolerance "${params.slippageTolerance}". The contract reads a zero floor as no bound at all, so this exit cannot be built safely — increase exitAssets or use another exit path.`);
394
+ this.withdrawnAssets = params.withdrawnAssets;
395
+ this.sharesBurnt = params.sharesBurnt;
396
+ this.slippageTolerance = params.slippageTolerance;
397
+ this.name = "VaultV2ForceWithdrawZeroSharePriceError";
398
+ }
399
+ }
400
+ exports.VaultV2ForceWithdrawZeroSharePriceError = VaultV2ForceWithdrawZeroSharePriceError;
401
+ /**
402
+ * Thrown when a supplied force-withdraw share-price floor is below the SDK safety floor.
403
+ *
404
+ * An override below the floor derived at `MAX_SLIPPAGE_TOLERANCE` would weaken the on-chain
405
+ * share-price protection and let the required share allowance grow without bound, so the entity
406
+ * rejects it instead of encoding it.
407
+ *
408
+ * @example
409
+ * ```ts
410
+ * import { VaultV2ForceWithdrawSharePriceBelowFloorError } from "@morpho-org/morpho-sdk";
411
+ *
412
+ * try {
413
+ * vault.forceWithdraw({ exitAssets, vaultData, userAddress, minSharePriceE27 });
414
+ * } catch (error) {
415
+ * if (error instanceof VaultV2ForceWithdrawSharePriceBelowFloorError) {
416
+ * console.error(error.minSharePriceE27, error.floorE27);
417
+ * }
418
+ * }
419
+ * ```
420
+ */
421
+ class VaultV2ForceWithdrawSharePriceBelowFloorError extends Error {
422
+ /** Supplied force-withdraw share-price floor. */
423
+ minSharePriceE27;
424
+ /** Minimum share-price floor allowed at maximum SDK slippage tolerance. */
425
+ floorE27;
426
+ /**
427
+ * @param params - Supplied and minimum allowed share-price floors.
428
+ * @param params.minSharePriceE27 - Supplied force-withdraw share-price floor.
429
+ * @param params.floorE27 - Minimum floor derived at maximum SDK slippage tolerance.
430
+ */
431
+ constructor(params) {
432
+ super(`Force-withdraw share price floor "${params.minSharePriceE27}" is below the minimum allowed "${params.floorE27}" (max slippage tolerance). Raise minSharePriceE27 or use slippageTolerance.`);
433
+ this.minSharePriceE27 = params.minSharePriceE27;
434
+ this.floorE27 = params.floorE27;
435
+ this.name = "VaultV2ForceWithdrawSharePriceBelowFloorError";
436
+ }
437
+ }
438
+ exports.VaultV2ForceWithdrawSharePriceBelowFloorError = VaultV2ForceWithdrawSharePriceBelowFloorError;
439
+ /**
440
+ * Thrown when fee shares projected to the accepted deadline reach the lower force-withdraw
441
+ * burn bound at that time.
442
+ *
443
+ * VaultExitBundlesV1 measures shares burned after its first withdrawal accrues fees. If the
444
+ * recipient's fee shares are at least the measured burn bound, its share-price check is skipped or
445
+ * reverts due to an underflow.
446
+ *
447
+ * @example
448
+ * ```ts
449
+ * import { VaultV2ForceWithdrawFeeSharesExceedBurnError } from "@morpho-org/morpho-sdk";
450
+ *
451
+ * try {
452
+ * vault.forceWithdraw({ exitAssets, vaultData, userAddress });
453
+ * } catch (error) {
454
+ * if (error instanceof VaultV2ForceWithdrawFeeSharesExceedBurnError) {
455
+ * console.error(error.sharesBurnt, error.feeShares);
456
+ * }
457
+ * }
458
+ * ```
459
+ */
460
+ class VaultV2ForceWithdrawFeeSharesExceedBurnError extends Error {
461
+ /** Vault V2 address being exited. */
462
+ vault;
463
+ /** Fee-recipient account submitting the exit. */
464
+ userAddress;
465
+ /** Lower bound of shares measured as burned by VaultExitBundlesV1. */
466
+ sharesBurnt;
467
+ /** Fee shares projected for `userAddress` at the accepted deadline. */
468
+ feeShares;
469
+ /**
470
+ * @param params - Fee-share and burn-bound values that make the exit unsafe.
471
+ * @param params.vault - Vault V2 address being exited.
472
+ * @param params.userAddress - Fee-recipient account submitting the exit.
473
+ * @param params.sharesBurnt - Lower bound of shares measured as burned by VaultExitBundlesV1.
474
+ * @param params.feeShares - Fee shares projected for `userAddress` at the accepted deadline.
475
+ */
476
+ constructor(params) {
477
+ super(`Vault V2 "${params.vault}" fee-recipient account "${params.userAddress}" accrues "${params.feeShares}" fee shares, reaching the lower force-withdraw share-burn bound "${params.sharesBurnt}". VaultExitBundlesV1's share-price check would be skipped or revert. Increase exitAssets or let the vault accrue first.`);
478
+ this.vault = params.vault;
479
+ this.userAddress = params.userAddress;
480
+ this.sharesBurnt = params.sharesBurnt;
481
+ this.feeShares = params.feeShares;
482
+ this.name = "VaultV2ForceWithdrawFeeSharesExceedBurnError";
483
+ }
484
+ }
485
+ exports.VaultV2ForceWithdrawFeeSharesExceedBurnError = VaultV2ForceWithdrawFeeSharesExceedBurnError;
155
486
  /** Thrown when a Vault V2 in-kind redemption rounds to no deallocated assets. */
156
487
  class InKindRedeemZeroDeallocationError extends Error {
157
488
  /**
@@ -269,19 +600,6 @@ class BundlesPermitMismatchError extends Error {
269
600
  }
270
601
  }
271
602
  exports.BundlesPermitMismatchError = BundlesPermitMismatchError;
272
- /**
273
- * Thrown by the deprecated VaultExitBundlesV1 permit compatibility helper.
274
- *
275
- * @deprecated Use {@link BundlesPermitMismatchError} with `getBundlesSharesPermit`.
276
- */
277
- class VaultExitBundlesV1PermitMismatchError extends BundlesPermitMismatchError {
278
- constructor(params) {
279
- super(params);
280
- this.message = `VaultExitBundlesV1 permit ${params.field} mismatch: expected "${params.expected}", got "${params.actual}". Rebuild and sign the vault-exit permit.`;
281
- this.name = "VaultExitBundlesV1PermitMismatchError";
282
- }
283
- }
284
- exports.VaultExitBundlesV1PermitMismatchError = VaultExitBundlesV1PermitMismatchError;
285
603
  /** Thrown when a signed requirement cannot be safely encoded for a fixed bundles call. */
286
604
  class BundlesRequirementSignatureMismatchError extends Error {
287
605
  /** Field whose signed value or encoding is invalid for the fixed bundles call. */
@@ -306,16 +624,6 @@ class BundlesRequirementSignatureMismatchError extends Error {
306
624
  }
307
625
  }
308
626
  exports.BundlesRequirementSignatureMismatchError = BundlesRequirementSignatureMismatchError;
309
- exports.BlueBundlesV1RequirementSignatureMismatchError = BundlesRequirementSignatureMismatchError;
310
- /** Thrown when Permit2 SignatureTransfer is selected without an explicit unordered nonce. */
311
- class MissingPermit2SignatureTransferNonceError extends Error {
312
- constructor() {
313
- super("Permit2 SignatureTransfer requires an explicit unused permit2Nonce. Generate a unique uint256 nonce, pass it to getRequirements(), and resolve the requirements again.");
314
- this.name = "MissingPermit2SignatureTransferNonceError";
315
- }
316
- }
317
- exports.MissingPermit2SignatureTransferNonceError = MissingPermit2SignatureTransferNonceError;
318
- exports.MissingPermit2TransferFromNonceError = MissingPermit2SignatureTransferNonceError;
319
627
  /** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
320
628
  class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
321
629
  owner;
@@ -332,7 +640,6 @@ class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
332
640
  }
333
641
  }
334
642
  exports.Permit2SignatureTransferNonceAlreadyUsedError = Permit2SignatureTransferNonceAlreadyUsedError;
335
- exports.Permit2TransferFromNonceAlreadyUsedError = Permit2SignatureTransferNonceAlreadyUsedError;
336
643
  /** Thrown when no unused Permit2 unordered nonce exists at or after the requested start nonce. */
337
644
  class NoUnusedPermit2NonceError extends Error {
338
645
  owner;
@@ -373,8 +680,6 @@ class ReferralFeeRecipientMissingError extends Error {
373
680
  }
374
681
  }
375
682
  exports.ReferralFeeRecipientMissingError = ReferralFeeRecipientMissingError;
376
- /** @deprecated Use {@link ReferralFeeRecipientMissingError}. */
377
- exports.MissingReferralFeeRecipientError = ReferralFeeRecipientMissingError;
378
683
  /**
379
684
  * Thrown when a referral fee percentage is outside the contract's `[0, WAD)` range.
380
685
  *
@@ -440,9 +745,7 @@ class ReallocationLoanTokenMismatchError extends Error {
440
745
  }
441
746
  exports.ReallocationLoanTokenMismatchError = ReallocationLoanTokenMismatchError;
442
747
  /**
443
- * Thrown when a Blue authorization operator is not one of the chain's registered Morpho operators
444
- * (GeneralAdapter1 or BlueBundlesV1). Guards the exported authorization builder so a misconfigured
445
- * `authorized` cannot grant an arbitrary address control over the user's Morpho positions.
748
+ * Thrown when a Blue authorization operator is not the chain's registered BlueBundlesV1 contract.
446
749
  */
447
750
  class UnsupportedAuthorizationOperatorError extends Error {
448
751
  authorized;
@@ -452,7 +755,7 @@ class UnsupportedAuthorizationOperatorError extends Error {
452
755
  * @param chainId - Chain whose registry was consulted for the supported operators.
453
756
  */
454
757
  constructor(authorized, chainId) {
455
- super(`Authorization operator "${authorized}" is not a supported Morpho operator on chain ${chainId}. Pass the chain's registered GeneralAdapter1 or BlueBundlesV1 address, or omit \`authorized\` to default to GeneralAdapter1.`);
758
+ super(`Authorization operator "${authorized}" is not supported on chain ${chainId}. Pass the chain's registered BlueBundlesV1 address.`);
456
759
  this.authorized = authorized;
457
760
  this.chainId = chainId;
458
761
  this.name = "UnsupportedAuthorizationOperatorError";
@@ -483,148 +786,6 @@ class MaxRepayAssetsBelowRepayAssetsError extends Error {
483
786
  }
484
787
  }
485
788
  exports.MaxRepayAssetsBelowRepayAssetsError = MaxRepayAssetsBelowRepayAssetsError;
486
- /** @deprecated Use {@link NonPositiveInputError}. */
487
- exports.NonPositiveAssetAmountError = NonPositiveInputError;
488
- /** @deprecated Use {@link NonPositiveInputError}. */
489
- exports.NonPositiveSharesAmountError = NonPositiveInputError;
490
- /** @deprecated Use {@link NonPositiveInputError}. */
491
- exports.NonPositiveMaxSharePriceError = NonPositiveInputError;
492
- /** @deprecated Use {@link NonPositiveInputError}. */
493
- exports.ZeroDepositAmountError = NonPositiveInputError;
494
- /** @deprecated Use {@link NonPositiveInputError}. */
495
- exports.NonPositiveBorrowAmountError = NonPositiveInputError;
496
- /** @deprecated Use {@link NonPositiveInputError}. */
497
- exports.ZeroCollateralAmountError = NonPositiveInputError;
498
- /** @deprecated Use {@link NonPositiveInputError}. */
499
- exports.NonPositiveReallocationAmountError = NonPositiveInputError;
500
- /** @deprecated Use {@link NonPositiveInputError}. */
501
- exports.NonPositiveRepayAmountError = NonPositiveInputError;
502
- /** @deprecated Use {@link NonPositiveInputError}. */
503
- exports.NonPositiveRepayMaxSharePriceError = NonPositiveInputError;
504
- /** @deprecated Use {@link NonPositiveInputError}. */
505
- exports.NonPositiveWithdrawCollateralAmountError = NonPositiveInputError;
506
- /** @deprecated Use {@link NonPositiveInputError}. */
507
- exports.ZeroSupplyAmountError = NonPositiveInputError;
508
- /** @deprecated Use {@link NonPositiveInputError}. */
509
- exports.NonPositiveWithdrawAmountError = NonPositiveInputError;
510
- /** @deprecated Use {@link NegativeInputError}. */
511
- exports.NegativeSlippageToleranceError = NegativeInputError;
512
- /** @deprecated Use {@link NegativeInputError}. */
513
- exports.NegativeNativeAmountError = NegativeInputError;
514
- /** @deprecated Use {@link NegativeInputError}. */
515
- exports.NegativeReallocationFeeError = NegativeInputError;
516
- /** @deprecated Use {@link NegativeInputError}. */
517
- exports.NonPositiveMinBorrowSharePriceError = NegativeInputError;
518
- /** @deprecated Use {@link NegativeInputError}. */
519
- exports.NegativeSupplyAmountError = NegativeInputError;
520
- /** @deprecated Use {@link NegativeInputError}. */
521
- exports.NegativeSupplyMaxSharePriceError = NegativeInputError;
522
- /** @deprecated Use {@link NegativeInputError}. */
523
- exports.NegativeWithdrawMinSharePriceError = NegativeInputError;
524
- /** @deprecated Use {@link NegativeInputError}. */
525
- exports.NegativeMinSharePriceError = NegativeInputError;
526
- /** @deprecated Use {@link NegativeInputError}. */
527
- exports.NegativeBorrowSharesError = NegativeInputError;
528
- /** @deprecated Use {@link NegativeInputError}. */
529
- exports.NegativeMaxRepaySharePriceError = NegativeInputError;
530
- /**
531
- * Typed errors thrown while encoding supported Bundler3 actions.
532
- *
533
- * @remarks
534
- * Import these classes through `@morpho-org/morpho-sdk` when handling
535
- * failures from `BundlerAction`.
536
- */
537
- var BundlerErrors;
538
- (function (BundlerErrors) {
539
- /**
540
- * Thrown when an action that requires an offchain signature is encoded before
541
- * the signature has been attached.
542
- *
543
- * @example
544
- * ```ts
545
- * import { BundlerErrors } from "@morpho-org/morpho-sdk";
546
- *
547
- * if (error instanceof BundlerErrors.MissingSignature) {
548
- * // Attach the missing permit or Permit2 signature, then encode again.
549
- * }
550
- * ```
551
- */
552
- class MissingSignature extends Error {
553
- constructor() {
554
- super("missing signature");
555
- }
556
- }
557
- BundlerErrors.MissingSignature = MissingSignature;
558
- /**
559
- * Thrown when an action is unsupported on the requested chain.
560
- *
561
- * @example
562
- * ```ts
563
- * import { BundlerErrors } from "@morpho-org/morpho-sdk";
564
- *
565
- * if (error instanceof BundlerErrors.UnexpectedAction) {
566
- * // Remove or replace the action for the selected chain.
567
- * }
568
- * ```
569
- */
570
- class UnexpectedAction extends Error {
571
- /**
572
- * @param type - Unsupported Bundler3 action discriminator or name.
573
- * @param chainId - Chain where the action was requested.
574
- */
575
- constructor(type, chainId) {
576
- super(`unexpected action "${type}" on chain "${chainId}"`);
577
- }
578
- }
579
- BundlerErrors.UnexpectedAction = UnexpectedAction;
580
- /**
581
- * Thrown when a Morpho authorization signature names a forbidden `authorized` account
582
- * (for example Bundler3 itself), which would grant operator rights to an unintended address.
583
- *
584
- * @example
585
- * ```ts
586
- * import { BundlerErrors } from "@morpho-org/morpho-sdk";
587
- *
588
- * if (error instanceof BundlerErrors.UnexpectedSignature) {
589
- * // Re-sign the authorization targeting GeneralAdapter1.
590
- * }
591
- * ```
592
- */
593
- class UnexpectedSignature extends Error {
594
- /**
595
- * @param authorized - The forbidden `authorized` address carried by the signature.
596
- */
597
- constructor(authorized) {
598
- super(`unexpected signature authorizing "${authorized}"`);
599
- }
600
- }
601
- BundlerErrors.UnexpectedSignature = UnexpectedSignature;
602
- /**
603
- * Thrown when a skippable Blue Public Allocator call would leave a usable
604
- * token allowance behind after the allocator call reverts.
605
- *
606
- * @example
607
- * ```ts
608
- * import { BundlerErrors } from "@morpho-org/morpho-sdk";
609
- *
610
- * if (error instanceof BundlerErrors.SkippableAllocatorPenalty) {
611
- * // Rebuild the allocator call with skipRevert set to false.
612
- * }
613
- * ```
614
- */
615
- class SkippableAllocatorPenalty extends Error {
616
- penaltyAssets;
617
- /**
618
- * @param penaltyAssets - Exact token amount approved to the allocator.
619
- */
620
- constructor(penaltyAssets) {
621
- super(`Blue Public Allocator calls with penalty assets cannot skip reverts. Rebuild with skipRevert false for penalty amount "${penaltyAssets}".`);
622
- this.penaltyAssets = penaltyAssets;
623
- this.name = "SkippableAllocatorPenalty";
624
- }
625
- }
626
- BundlerErrors.SkippableAllocatorPenalty = SkippableAllocatorPenalty;
627
- })(BundlerErrors || (exports.BundlerErrors = BundlerErrors = {}));
628
789
  /**
629
790
  * Thrown when `buildTx` receives more than one requirement signature of the same kind.
630
791
  *
@@ -672,6 +833,18 @@ class UnexpectedRequirementSignatureError extends Error {
672
833
  }
673
834
  }
674
835
  exports.UnexpectedRequirementSignatureError = UnexpectedRequirementSignatureError;
836
+ /** Thrown when `buildTx` receives a requirement signature whose action type is not supported. */
837
+ class UnsupportedRequirementSignatureError extends Error {
838
+ type;
839
+ /**
840
+ * @param type - The unsupported signature action type.
841
+ */
842
+ constructor(type) {
843
+ super(`Received a requirement signature with unsupported action type "${type}". Re-run getRequirements() and sign the current requirements.`);
844
+ this.type = type;
845
+ }
846
+ }
847
+ exports.UnsupportedRequirementSignatureError = UnsupportedRequirementSignatureError;
675
848
  /** Thrown when a viem client's account address does not match the address required by the call. */
676
849
  class AddressMismatchError extends Error {
677
850
  constructor(clientAddress, argsAddress) {
@@ -711,7 +884,6 @@ exports.ApprovalAmountLessThanSpendAmountError = ApprovalAmountLessThanSpendAmou
711
884
  class UnsupportedErc20ApprovalSpenderError extends Error {
712
885
  constructor(params) {
713
886
  const supported = (params.supportedSpenders ?? [
714
- params.generalAdapter1,
715
887
  params.permit2,
716
888
  params.midnight,
717
889
  params.midnightBundles,
@@ -780,13 +952,6 @@ class DepositSpenderMismatchError extends Error {
780
952
  }
781
953
  }
782
954
  exports.DepositSpenderMismatchError = DepositSpenderMismatchError;
783
- /** Thrown when a `permit2` requirement signature is missing the `expiration` field. */
784
- class Permit2ExpirationMissingError extends Error {
785
- constructor() {
786
- super('Requirement signature with action.type === "permit2" must include args.expiration. Re-sign using the permit2 flow.');
787
- }
788
- }
789
- exports.Permit2ExpirationMissingError = Permit2ExpirationMissingError;
790
955
  /** Thrown when a vault deposit uses `nativeAmount` but the vault asset is not the chain's wNative. */
791
956
  class NativeAmountOnNonWNativeVaultError extends Error {
792
957
  constructor(vaultAsset, wNative) {
@@ -815,8 +980,6 @@ class NativeAmountOnNonWNativeAssetError extends Error {
815
980
  }
816
981
  }
817
982
  exports.NativeAmountOnNonWNativeAssetError = NativeAmountOnNonWNativeAssetError;
818
- /** @deprecated Use {@link NativeAmountOnNonWNativeAssetError}. */
819
- exports.NativeAmountOnNonWNativeCollateralError = NativeAmountOnNonWNativeAssetError;
820
983
  /** Thrown when a borrow exceeds the LLTV-buffered safe maximum for the position. */
821
984
  class BorrowExceedsSafeLtvError extends Error {
822
985
  constructor(borrowAmount, maxSafeBorrow) {
@@ -845,17 +1008,6 @@ class AccrualPositionUserMismatchError extends Error {
845
1008
  }
846
1009
  }
847
1010
  exports.AccrualPositionUserMismatchError = AccrualPositionUserMismatchError;
848
- /**
849
- * Thrown when a reallocation has no withdrawals.
850
- *
851
- * @deprecated Vault V1 PublicAllocator support will be removed in the next major.
852
- */
853
- class EmptyReallocationWithdrawalsError extends Error {
854
- constructor(vault) {
855
- super(`Reallocation withdrawals list cannot be empty for vault: ${vault}`);
856
- }
857
- }
858
- exports.EmptyReallocationWithdrawalsError = EmptyReallocationWithdrawalsError;
859
1011
  /** Thrown when a Public Allocator source references the target Blue market. */
860
1012
  class ReallocationWithdrawalOnTargetMarketError extends Error {
861
1013
  constructor(vault, marketId) {
@@ -870,37 +1022,18 @@ exports.ReallocationWithdrawalOnTargetMarketError = ReallocationWithdrawalOnTarg
870
1022
  *
871
1023
  * @example
872
1024
  * ```ts
873
- * import { InvalidReallocationShapeError } from "@morpho-org/morpho-sdk";
1025
+ * import { InvalidVaultV2BlueReallocationShapeError } from "@morpho-org/morpho-sdk";
874
1026
  *
875
- * const error = new InvalidReallocationShapeError();
1027
+ * const error = new InvalidVaultV2BlueReallocationShapeError();
876
1028
  * ```
877
1029
  */
878
- class InvalidReallocationShapeError extends Error {
1030
+ class InvalidVaultV2BlueReallocationShapeError extends Error {
879
1031
  constructor() {
880
- super("Reallocation entry is not a valid Vault V2 reallocation. High-level Blue writes accept only VaultV2BlueReallocation entries (e.g. from getVaultV2BlueReallocations()); compose Vault V1 reallocations via low-level Bundler3 actions.");
881
- this.name = "InvalidReallocationShapeError";
1032
+ super("Reallocation entry is not a valid Vault V2 reallocation. High-level Blue writes accept only VaultV2BlueReallocation entries (e.g. from getVaultV2BlueReallocations()). Use morpho-sdk v5 if Vault V1 reallocations are required.");
1033
+ this.name = "InvalidVaultV2BlueReallocationShapeError";
882
1034
  }
883
1035
  }
884
- exports.InvalidReallocationShapeError = InvalidReallocationShapeError;
885
- /**
886
- * Thrown when one reallocation plan contains both Vault V1 and Vault V2 entries.
887
- *
888
- * @deprecated Vault V1/V2 mixed-plan support will be removed in the next major. Use Vault V2
889
- * reallocations.
890
- * @example
891
- * ```ts
892
- * import { MixedReallocationVersionsError } from "@morpho-org/morpho-sdk";
893
- *
894
- * const error = new MixedReallocationVersionsError();
895
- * ```
896
- */
897
- class MixedReallocationVersionsError extends Error {
898
- constructor() {
899
- super("Reallocation plans cannot mix Vault V1 and Vault V2 entries. Submit one version per transaction.");
900
- this.name = "MixedReallocationVersionsError";
901
- }
902
- }
903
- exports.MixedReallocationVersionsError = MixedReallocationVersionsError;
1036
+ exports.InvalidVaultV2BlueReallocationShapeError = InvalidVaultV2BlueReallocationShapeError;
904
1037
  /**
905
1038
  * Thrown when a Blue Public Allocator reallocation contains a malformed vault
906
1039
  * or adapter address.
@@ -997,28 +1130,6 @@ class InconsistentReallocationPenaltyError extends Error {
997
1130
  }
998
1131
  }
999
1132
  exports.InconsistentReallocationPenaltyError = InconsistentReallocationPenaltyError;
1000
- /**
1001
- * Thrown when reallocation withdrawals within a vault are not strictly sorted by market id.
1002
- *
1003
- * @deprecated Vault V1 PublicAllocator support will be removed in the next major.
1004
- */
1005
- class UnsortedReallocationWithdrawalsError extends Error {
1006
- constructor(vault, marketId) {
1007
- super(`Reallocation withdrawals must be strictly sorted by market ID for vault ${vault}. Market ${marketId} is out of order.`);
1008
- }
1009
- }
1010
- exports.UnsortedReallocationWithdrawalsError = UnsortedReallocationWithdrawalsError;
1011
- /**
1012
- * Thrown when a market repay in assets mode has `transferAmount !== amount + nativeAmount` — the
1013
- * pre-resolved ERC-20 pull plus the wrapped native must equal the assets repaid, so the bundle
1014
- * neither strands over-pulled loan tokens on `GeneralAdapter1` nor under-funds the repay.
1015
- */
1016
- class TransferAmountNotEqualToAssetsError extends Error {
1017
- constructor(params) {
1018
- super(`Transfer amount ${params.transferAmount} is not equal to repay assets ${params.assets} for market: ${params.market}. In assets mode, transferAmount must equal amount + nativeAmount.`);
1019
- }
1020
- }
1021
- exports.TransferAmountNotEqualToAssetsError = TransferAmountNotEqualToAssetsError;
1022
1133
  /** Thrown when a market repay specifies both `assets` and `shares` as non-zero (modes are mutually exclusive). */
1023
1134
  class MutuallyExclusiveRepayAmountsError extends Error {
1024
1135
  constructor(market) {
@@ -1040,13 +1151,6 @@ class WithdrawMakesPositionUnhealthyError extends Error {
1040
1151
  }
1041
1152
  }
1042
1153
  exports.WithdrawMakesPositionUnhealthyError = WithdrawMakesPositionUnhealthyError;
1043
- /** Thrown when a share-amount conversion would divide by zero (the market has no shares of the relevant kind). */
1044
- class ShareDivideByZeroError extends Error {
1045
- constructor(market) {
1046
- super(`Share divide by zero error for market: ${market}`);
1047
- }
1048
- }
1049
- exports.ShareDivideByZeroError = ShareDivideByZeroError;
1050
1154
  /** Thrown when a repay amount in assets exceeds the borrower's outstanding debt. */
1051
1155
  class RepayExceedsDebtError extends Error {
1052
1156
  constructor(params) {
@@ -1069,33 +1173,7 @@ class RepaySharesExceedDebtError extends Error {
1069
1173
  }
1070
1174
  exports.RepaySharesExceedDebtError = RepaySharesExceedDebtError;
1071
1175
  /**
1072
- * Thrown when a vault selected for reallocation has no configured `PublicAllocator`.
1073
- *
1074
- * @deprecated Vault V1 PublicAllocator support will be removed in the next major.
1075
- */
1076
- class MissingPublicAllocatorConfigError extends Error {
1077
- constructor(vault) {
1078
- super(`Vault ${vault} has no public allocator configured but was selected for reallocation`);
1079
- }
1080
- }
1081
- exports.MissingPublicAllocatorConfigError = MissingPublicAllocatorConfigError;
1082
- /**
1083
- * Thrown when a reallocation attempts to use a disabled vault market.
1084
- *
1085
- * @deprecated Vault V1 PublicAllocator support will be removed in the next major.
1086
- */
1087
- class DisabledReallocationMarketError extends Error {
1088
- vault;
1089
- marketId;
1090
- constructor(vault, marketId) {
1091
- super(`Vault ${vault} has disabled market ${marketId}. Remove it from reallocations or re-enable the market before reallocating.`);
1092
- this.vault = vault;
1093
- this.marketId = marketId;
1094
- }
1095
- }
1096
- exports.DisabledReallocationMarketError = DisabledReallocationMarketError;
1097
- /**
1098
- * Thrown when shared liquidity selected by a Vault V1 or Vault V2 reallocation planner cannot
1176
+ * Thrown when shared liquidity selected by a Vault V2 reallocation planner cannot
1099
1177
  * cover the operation's absolute shortfall on the target market — the resulting
1100
1178
  * `morphoBorrow` or `morphoWithdraw` would still revert onchain.
1101
1179
  *
@@ -1133,44 +1211,6 @@ class UnknownReallocationVaultError extends blue_sdk_1.UnknownDataError {
1133
1211
  }
1134
1212
  }
1135
1213
  exports.UnknownReallocationVaultError = UnknownReallocationVaultError;
1136
- /**
1137
- * Thrown when reallocation state does not contain a requested vault-market config.
1138
- *
1139
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major.
1140
- */
1141
- class UnknownReallocationVaultMarketConfigError extends blue_sdk_1.UnknownDataError {
1142
- vault;
1143
- marketId;
1144
- /**
1145
- * @param vault - Vault address for the missing config.
1146
- * @param marketId - Market id for the missing config.
1147
- */
1148
- constructor(vault, marketId) {
1149
- super(`unknown reallocation config for vault "${vault}" on market "${marketId}"`);
1150
- this.vault = vault;
1151
- this.marketId = marketId;
1152
- }
1153
- }
1154
- exports.UnknownReallocationVaultMarketConfigError = UnknownReallocationVaultMarketConfigError;
1155
- /**
1156
- * Thrown when reallocation state does not contain a requested market position.
1157
- *
1158
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major.
1159
- */
1160
- class UnknownReallocationPositionError extends blue_sdk_1.UnknownDataError {
1161
- user;
1162
- marketId;
1163
- /**
1164
- * @param user - Position owner address.
1165
- * @param marketId - Market id for the missing position.
1166
- */
1167
- constructor(user, marketId) {
1168
- super(`unknown reallocation position of "${user}" on market "${marketId}"`);
1169
- this.user = user;
1170
- this.marketId = marketId;
1171
- }
1172
- }
1173
- exports.UnknownReallocationPositionError = UnknownReallocationPositionError;
1174
1214
  /** Thrown when Vault V2 reallocation state does not contain a requested allocation id. */
1175
1215
  class UnknownReallocationAllocationError extends blue_sdk_1.UnknownDataError {
1176
1216
  vault;
@@ -1359,10 +1399,10 @@ class MidnightOfferRootOfferCountMismatchError extends Error {
1359
1399
  }
1360
1400
  }
1361
1401
  exports.MidnightOfferRootOfferCountMismatchError = MidnightOfferRootOfferCountMismatchError;
1362
- /** Thrown when a Midnight offer-root signature was not prepared by this maker flow. */
1402
+ /** Thrown when a Midnight offer-root signature carries no encoded payload. */
1363
1403
  class UnpreparedMidnightOfferRootSignatureError extends Error {
1364
1404
  constructor() {
1365
- super("Midnight offer root signature was not prepared for this offer tree. Sign this flow's offer-root requirement before building the submit transaction.");
1405
+ super("Midnight offer root signature carries no encoded payload. Sign the offer-root requirement (its signature already includes the payload) before building the submit transaction.");
1366
1406
  }
1367
1407
  }
1368
1408
  exports.UnpreparedMidnightOfferRootSignatureError = UnpreparedMidnightOfferRootSignatureError;
@@ -1409,11 +1449,11 @@ class WithdrawSharesExceedSupplyError extends Error {
1409
1449
  }
1410
1450
  exports.WithdrawSharesExceedSupplyError = WithdrawSharesExceedSupplyError;
1411
1451
  /**
1412
- * Thrown when a Vault V1 or Vault V2 reallocation planner receives a withdraw `amount` greater
1452
+ * Thrown when a Vault V2 reallocation planner receives a withdraw `amount` greater
1413
1453
  * than the target market's current `totalSupplyAssets` — the post-withdraw
1414
1454
  * supply would be negative, making the on-chain `morphoWithdraw` revert
1415
1455
  * regardless of any reallocation. Caught here so callers do not pay
1416
- * PublicAllocator fees on an unreachable operation.
1456
+ * allocator penalties on an unreachable operation.
1417
1457
  */
1418
1458
  class ReallocationWithdrawExceedsMarketSupplyError extends Error {
1419
1459
  params;
@@ -1444,86 +1484,3 @@ class RefinanceTokenMismatchError extends Error {
1444
1484
  }
1445
1485
  }
1446
1486
  exports.RefinanceTokenMismatchError = RefinanceTokenMismatchError;
1447
- /**
1448
- * Thrown when a refinance specifies both `borrowAssets` and `borrowShares` as non-zero (modes are mutually exclusive).
1449
- *
1450
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1451
- * partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1452
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1453
- */
1454
- class BorrowAmountAndSharesExclusiveError extends Error {
1455
- constructor(market) {
1456
- super(`Exactly one of borrowAssets or borrowShares must be non-zero for market: ${market}. Both were provided.`);
1457
- }
1458
- }
1459
- exports.BorrowAmountAndSharesExclusiveError = BorrowAmountAndSharesExclusiveError;
1460
- /**
1461
- * Thrown when a refinance's `collateralAmount` exceeds the source position's available collateral.
1462
- *
1463
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1464
- * partial collateral inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1465
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1466
- */
1467
- class RefinanceExceedsCollateralError extends Error {
1468
- market;
1469
- requested;
1470
- available;
1471
- constructor(params) {
1472
- super(`Refinance collateral amount ${params.requested} exceeds available collateral ${params.available} for market: ${params.market}`);
1473
- this.market = params.market;
1474
- this.requested = params.requested;
1475
- this.available = params.available;
1476
- }
1477
- }
1478
- exports.RefinanceExceedsCollateralError = RefinanceExceedsCollateralError;
1479
- /**
1480
- * Thrown when a refinance's `borrowShares` exceeds the source position's outstanding borrow shares.
1481
- *
1482
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1483
- * partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1484
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1485
- */
1486
- class RefinanceExceedsBorrowSharesError extends Error {
1487
- market;
1488
- requested;
1489
- available;
1490
- constructor(params) {
1491
- super(`Refinance borrow shares ${params.requested} exceed outstanding borrow shares ${params.available} for market: ${params.market}`);
1492
- this.market = params.market;
1493
- this.requested = params.requested;
1494
- this.available = params.available;
1495
- }
1496
- }
1497
- exports.RefinanceExceedsBorrowSharesError = RefinanceExceedsBorrowSharesError;
1498
- /**
1499
- * Thrown when a refinance's `borrowAssets` exceeds the source position's outstanding debt assets.
1500
- *
1501
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1502
- * partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1503
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1504
- */
1505
- class RefinanceExceedsBorrowAssetsError extends Error {
1506
- market;
1507
- requested;
1508
- available;
1509
- constructor(params) {
1510
- super(`Refinance borrow assets ${params.requested} exceed outstanding debt assets ${params.available} for market: ${params.market}`);
1511
- this.market = params.market;
1512
- this.requested = params.requested;
1513
- this.available = params.available;
1514
- }
1515
- }
1516
- exports.RefinanceExceedsBorrowAssetsError = RefinanceExceedsBorrowAssetsError;
1517
- /**
1518
- * Thrown when a refinance in shares mode (`borrowShares > 0n`) omits the `borrowAssets` overshoot for the target borrow leg.
1519
- *
1520
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1521
- * partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1522
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1523
- */
1524
- class RefinanceSharesMissingBorrowAssetsError extends Error {
1525
- constructor(market) {
1526
- super(`Refinance shares mode requires a positive borrowAssets overshoot for the target borrow leg (market: ${market}).`);
1527
- }
1528
- }
1529
- exports.RefinanceSharesMissingBorrowAssetsError = RefinanceSharesMissingBorrowAssetsError;