@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
@@ -97,8 +97,23 @@ export class ExpiredDeadlineError extends Error {
97
97
  this.name = "ExpiredDeadlineError";
98
98
  }
99
99
  }
100
- /** Thrown when Vault V2 in-kind redemption is attempted with anything other than one adapter. */
101
- export class InKindRedeemRequiresSingleAdapterError extends Error {
100
+ /**
101
+ * Thrown when a VaultExitBundlesV1 Vault V2 exit targets a vault without exactly one adapter.
102
+ *
103
+ * Both `vaultExitBundlesV1InKindRedemptionVaultV2` and
104
+ * `vaultExitBundlesV1ForceWithdrawVaultV2` require `adaptersLength() == 1`.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * import { VaultV2SingleAdapterRequiredError } from "@morpho-org/morpho-sdk";
109
+ *
110
+ * const error = new VaultV2SingleAdapterRequiredError(vault, 2);
111
+ * if (error instanceof VaultV2SingleAdapterRequiredError) {
112
+ * console.error(error.vault, error.adapters);
113
+ * }
114
+ * ```
115
+ */
116
+ export class VaultV2SingleAdapterRequiredError extends Error {
102
117
  vault;
103
118
  adapters;
104
119
  /**
@@ -106,10 +121,10 @@ export class InKindRedeemRequiresSingleAdapterError extends Error {
106
121
  * @param adapters - Number of adapters in the supplied vault snapshot.
107
122
  */
108
123
  constructor(vault, adapters) {
109
- super(`Vault "${vault}" has "${adapters}" adapters. In-kind redemption requires exactly one MorphoMarketV1AdapterV2.`);
124
+ super(`Vault "${vault}" has "${adapters}" adapters. VaultExitBundlesV1 exits require exactly one MorphoMarketV1AdapterV2.`);
110
125
  this.vault = vault;
111
126
  this.adapters = adapters;
112
- this.name = "InKindRedeemRequiresSingleAdapterError";
127
+ this.name = "VaultV2SingleAdapterRequiredError";
113
128
  }
114
129
  }
115
130
  /** Thrown when a requested in-kind redemption adapter is not part of the Vault V2 snapshot. */
@@ -127,16 +142,325 @@ export class AdapterNotPartOfVaultError extends Error {
127
142
  this.name = "AdapterNotPartOfVaultError";
128
143
  }
129
144
  }
130
- /** Thrown when the Vault V2 adapter cannot expose MorphoMarketV1AdapterV2 market shares. */
131
- export class UnsupportedInKindAdapterError extends Error {
145
+ /**
146
+ * Thrown when the Vault V2 adapter cannot expose MorphoMarketV1AdapterV2 market shares.
147
+ *
148
+ * VaultExitBundlesV1 casts the adapter to `IMorphoMarketV1AdapterV2`, so a legacy
149
+ * positions-based `MorphoMarketV1Adapter` or a `MorphoVaultV1Adapter` cannot be exited.
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * import { VaultV2UnsupportedExitAdapterError } from "@morpho-org/morpho-sdk";
154
+ *
155
+ * const error = new VaultV2UnsupportedExitAdapterError(adapter);
156
+ * if (error instanceof VaultV2UnsupportedExitAdapterError) {
157
+ * console.error(error.adapter);
158
+ * }
159
+ * ```
160
+ */
161
+ export class VaultV2UnsupportedExitAdapterError extends Error {
132
162
  adapter;
133
163
  /**
134
164
  * @param adapter - Unsupported Vault V2 adapter address.
135
165
  */
136
166
  constructor(adapter) {
137
- super(`Adapter "${adapter}" does not support Vault V2 in-kind redemption. Use a MorphoMarketV1AdapterV2-backed vault.`);
167
+ super(`Adapter "${adapter}" does not support Vault V2 exits through VaultExitBundlesV1. Use a MorphoMarketV1AdapterV2-backed vault.`);
138
168
  this.adapter = adapter;
139
- this.name = "UnsupportedInKindAdapterError";
169
+ this.name = "VaultV2UnsupportedExitAdapterError";
170
+ }
171
+ }
172
+ /**
173
+ * Thrown when a Vault V2 exit cannot resolve the vault's configured liquidity adapter.
174
+ *
175
+ * `VaultExitBundlesV1.vaultExitBundlesV1ForceWithdrawVaultV2` casts `liquidityAdapter` to
176
+ * `IMorphoMarketV1AdapterV2` and ABI-decodes `liquidityData` as `MarketParams`. Because the exit
177
+ * also requires `adaptersLength() == 1`, the only resolvable configurations are an unset
178
+ * liquidity adapter or the vault's sole adapter.
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * import { VaultV2UnsupportedLiquidityAdapterError } from "@morpho-org/morpho-sdk";
183
+ *
184
+ * const error = new VaultV2UnsupportedLiquidityAdapterError({
185
+ * vault,
186
+ * liquidityAdapter,
187
+ * adapter,
188
+ * });
189
+ * if (error instanceof VaultV2UnsupportedLiquidityAdapterError) {
190
+ * console.error(error.liquidityAdapter, error.adapter);
191
+ * }
192
+ * ```
193
+ */
194
+ export class VaultV2UnsupportedLiquidityAdapterError extends Error {
195
+ /** Vault V2 address. */
196
+ vault;
197
+ /** Liquidity adapter configured on the vault. */
198
+ liquidityAdapter;
199
+ /** Sole adapter the exit targets. */
200
+ adapter;
201
+ /**
202
+ * @param params - Liquidity-adapter mismatch details.
203
+ * @param params.vault - Vault V2 address.
204
+ * @param params.liquidityAdapter - Liquidity adapter configured on the vault.
205
+ * @param params.adapter - Sole adapter the exit targets.
206
+ */
207
+ constructor(params) {
208
+ 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.`);
209
+ this.vault = params.vault;
210
+ this.liquidityAdapter = params.liquidityAdapter;
211
+ this.adapter = params.adapter;
212
+ this.name = "VaultV2UnsupportedLiquidityAdapterError";
213
+ }
214
+ }
215
+ /**
216
+ * Thrown when a Vault V2 exit cannot ABI-decode the vault's `liquidityData` as `MarketParams`.
217
+ *
218
+ * Distinct from {@link VaultV2UnsupportedLiquidityAdapterError}: the liquidity adapter *is* the
219
+ * vault's sole adapter, but the market params stored alongside it are unusable, so the contract's
220
+ * `abi.decode` would revert. Only the vault curator can repair this by re-setting the liquidity
221
+ * adapter and data.
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * import { VaultV2UndecodableLiquidityDataError } from "@morpho-org/morpho-sdk";
226
+ *
227
+ * try {
228
+ * vault.forceWithdraw({ exitAssets: 1_000_000n, vaultData, userAddress });
229
+ * } catch (error) {
230
+ * if (error instanceof VaultV2UndecodableLiquidityDataError) {
231
+ * console.error(error.liquidityData, error.cause);
232
+ * }
233
+ * }
234
+ * ```
235
+ */
236
+ export class VaultV2UndecodableLiquidityDataError extends Error {
237
+ /** Vault V2 address. */
238
+ vault;
239
+ /** Liquidity adapter configured on the vault. */
240
+ liquidityAdapter;
241
+ /** Raw `liquidityData` that failed to decode. */
242
+ liquidityData;
243
+ /**
244
+ * @param params - Undecodable liquidity-data details.
245
+ * @param params.vault - Vault V2 address.
246
+ * @param params.liquidityAdapter - Liquidity adapter configured on the vault.
247
+ * @param params.liquidityData - Raw `liquidityData` that failed to decode.
248
+ * @param params.cause - Underlying decode failure.
249
+ */
250
+ constructor(params) {
251
+ 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 });
252
+ this.vault = params.vault;
253
+ this.liquidityAdapter = params.liquidityAdapter;
254
+ this.liquidityData = params.liquidityData;
255
+ this.name = "VaultV2UndecodableLiquidityDataError";
256
+ }
257
+ }
258
+ /**
259
+ * Thrown when the adapter's markets cannot cover a Vault V2 force withdrawal.
260
+ *
261
+ * `vaultExitBundlesV1ForceWithdrawVaultV2` loops over the adapter's market list without a bound,
262
+ * so an under-covered request reverts on-chain with a raw `panic 0x32`. This error surfaces that
263
+ * failure before submission.
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * import { VaultV2ForceWithdrawCoverageError } from "@morpho-org/morpho-sdk";
268
+ *
269
+ * const error = new VaultV2ForceWithdrawCoverageError({
270
+ * required: 100n,
271
+ * covered: 40n,
272
+ * maxExitAssets: 60n,
273
+ * });
274
+ * if (error instanceof VaultV2ForceWithdrawCoverageError) {
275
+ * console.error(error.maxExitAssets);
276
+ * }
277
+ * ```
278
+ */
279
+ export class VaultV2ForceWithdrawCoverageError extends Error {
280
+ /** Assets that must be force-deallocated from the adapter's markets. */
281
+ required;
282
+ /** Assets the adapter's markets can actually release. */
283
+ covered;
284
+ /** Largest penalty-inclusive `exitAssets` the current vault state supports. */
285
+ maxExitAssets;
286
+ /**
287
+ * @param params - Coverage values used to explain the rejected exit.
288
+ * @param params.required - Assets that must be force-deallocated.
289
+ * @param params.covered - Assets the adapter's markets can release.
290
+ * @param params.maxExitAssets - Largest supported penalty-inclusive `exitAssets`.
291
+ */
292
+ constructor(params) {
293
+ 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.`);
294
+ this.required = params.required;
295
+ this.covered = params.covered;
296
+ this.maxExitAssets = params.maxExitAssets;
297
+ this.name = "VaultV2ForceWithdrawCoverageError";
298
+ }
299
+ }
300
+ /**
301
+ * Thrown when a Vault V2 force withdrawal would withdraw nothing while still consuming its permit.
302
+ *
303
+ * Happens on a dust `exitAssets` when the vault has no penalty-free liquidity and the
304
+ * penalty-adjusted remainder rounds down to zero.
305
+ *
306
+ * @example
307
+ * ```ts
308
+ * import { VaultV2ForceWithdrawZeroWithdrawalError } from "@morpho-org/morpho-sdk";
309
+ *
310
+ * const error = new VaultV2ForceWithdrawZeroWithdrawalError({
311
+ * vault,
312
+ * exitAssets: 1n,
313
+ * penalty: 20_000000000000000n,
314
+ * });
315
+ * if (error instanceof VaultV2ForceWithdrawZeroWithdrawalError) {
316
+ * console.error(error.exitAssets, error.penalty);
317
+ * }
318
+ * ```
319
+ */
320
+ export class VaultV2ForceWithdrawZeroWithdrawalError extends Error {
321
+ /** Vault V2 address. */
322
+ vault;
323
+ /** Positive penalty-inclusive amount requested by the caller. */
324
+ exitAssets;
325
+ /** WAD-scaled force-deallocation penalty applied by the adapter. */
326
+ penalty;
327
+ /**
328
+ * @param params - Values that caused the exit to withdraw nothing.
329
+ * @param params.vault - Vault V2 address.
330
+ * @param params.exitAssets - Positive penalty-inclusive amount requested by the caller.
331
+ * @param params.penalty - WAD-scaled force-deallocation penalty applied by the adapter.
332
+ */
333
+ constructor(params) {
334
+ 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.`);
335
+ this.vault = params.vault;
336
+ this.exitAssets = params.exitAssets;
337
+ this.penalty = params.penalty;
338
+ this.name = "VaultV2ForceWithdrawZeroWithdrawalError";
339
+ }
340
+ }
341
+ /**
342
+ * Thrown when a Vault V2 force withdrawal's derived share-price floor rounds down to zero.
343
+ *
344
+ * VaultExitBundlesV1 reads `minSharePriceE27 == 0` as "no bound at all", so emitting a rounded-down
345
+ * zero would silently ship an exit with none of the slippage protection this path exists to add.
346
+ * Reaching it means the exit burns more shares than `withdrawnAssets` can price at RAY scale — a
347
+ * vault whose share price has collapsed below `1e-27` assets per share, or a dust exit against one.
348
+ *
349
+ * @example
350
+ * ```ts
351
+ * import { VaultV2ForceWithdrawZeroSharePriceError } from "@morpho-org/morpho-sdk";
352
+ *
353
+ * try {
354
+ * vault.forceWithdraw({ exitAssets, vaultData, userAddress });
355
+ * } catch (error) {
356
+ * if (error instanceof VaultV2ForceWithdrawZeroSharePriceError) {
357
+ * console.error(error.withdrawnAssets, error.sharesBurnt);
358
+ * }
359
+ * }
360
+ * ```
361
+ */
362
+ export class VaultV2ForceWithdrawZeroSharePriceError extends Error {
363
+ /** Assets the exit withdraws in total, before the referral fee. */
364
+ withdrawnAssets;
365
+ /** Upper bound of the vault shares the exit burns. */
366
+ sharesBurnt;
367
+ /** WAD-scaled slippage tolerance applied to the floor. */
368
+ slippageTolerance;
369
+ /**
370
+ * @param params - Values whose ratio rounded down to a zero share-price floor.
371
+ * @param params.withdrawnAssets - Assets the exit withdraws in total, before the referral fee.
372
+ * @param params.sharesBurnt - Upper bound of the vault shares the exit burns.
373
+ * @param params.slippageTolerance - WAD-scaled slippage tolerance applied to the floor.
374
+ */
375
+ constructor(params) {
376
+ 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.`);
377
+ this.withdrawnAssets = params.withdrawnAssets;
378
+ this.sharesBurnt = params.sharesBurnt;
379
+ this.slippageTolerance = params.slippageTolerance;
380
+ this.name = "VaultV2ForceWithdrawZeroSharePriceError";
381
+ }
382
+ }
383
+ /**
384
+ * Thrown when a supplied force-withdraw share-price floor is below the SDK safety floor.
385
+ *
386
+ * An override below the floor derived at `MAX_SLIPPAGE_TOLERANCE` would weaken the on-chain
387
+ * share-price protection and let the required share allowance grow without bound, so the entity
388
+ * rejects it instead of encoding it.
389
+ *
390
+ * @example
391
+ * ```ts
392
+ * import { VaultV2ForceWithdrawSharePriceBelowFloorError } from "@morpho-org/morpho-sdk";
393
+ *
394
+ * try {
395
+ * vault.forceWithdraw({ exitAssets, vaultData, userAddress, minSharePriceE27 });
396
+ * } catch (error) {
397
+ * if (error instanceof VaultV2ForceWithdrawSharePriceBelowFloorError) {
398
+ * console.error(error.minSharePriceE27, error.floorE27);
399
+ * }
400
+ * }
401
+ * ```
402
+ */
403
+ export class VaultV2ForceWithdrawSharePriceBelowFloorError extends Error {
404
+ /** Supplied force-withdraw share-price floor. */
405
+ minSharePriceE27;
406
+ /** Minimum share-price floor allowed at maximum SDK slippage tolerance. */
407
+ floorE27;
408
+ /**
409
+ * @param params - Supplied and minimum allowed share-price floors.
410
+ * @param params.minSharePriceE27 - Supplied force-withdraw share-price floor.
411
+ * @param params.floorE27 - Minimum floor derived at maximum SDK slippage tolerance.
412
+ */
413
+ constructor(params) {
414
+ super(`Force-withdraw share price floor "${params.minSharePriceE27}" is below the minimum allowed "${params.floorE27}" (max slippage tolerance). Raise minSharePriceE27 or use slippageTolerance.`);
415
+ this.minSharePriceE27 = params.minSharePriceE27;
416
+ this.floorE27 = params.floorE27;
417
+ this.name = "VaultV2ForceWithdrawSharePriceBelowFloorError";
418
+ }
419
+ }
420
+ /**
421
+ * Thrown when fee shares projected to the accepted deadline reach the lower force-withdraw
422
+ * burn bound at that time.
423
+ *
424
+ * VaultExitBundlesV1 measures shares burned after its first withdrawal accrues fees. If the
425
+ * recipient's fee shares are at least the measured burn bound, its share-price check is skipped or
426
+ * reverts due to an underflow.
427
+ *
428
+ * @example
429
+ * ```ts
430
+ * import { VaultV2ForceWithdrawFeeSharesExceedBurnError } from "@morpho-org/morpho-sdk";
431
+ *
432
+ * try {
433
+ * vault.forceWithdraw({ exitAssets, vaultData, userAddress });
434
+ * } catch (error) {
435
+ * if (error instanceof VaultV2ForceWithdrawFeeSharesExceedBurnError) {
436
+ * console.error(error.sharesBurnt, error.feeShares);
437
+ * }
438
+ * }
439
+ * ```
440
+ */
441
+ export class VaultV2ForceWithdrawFeeSharesExceedBurnError extends Error {
442
+ /** Vault V2 address being exited. */
443
+ vault;
444
+ /** Fee-recipient account submitting the exit. */
445
+ userAddress;
446
+ /** Lower bound of shares measured as burned by VaultExitBundlesV1. */
447
+ sharesBurnt;
448
+ /** Fee shares projected for `userAddress` at the accepted deadline. */
449
+ feeShares;
450
+ /**
451
+ * @param params - Fee-share and burn-bound values that make the exit unsafe.
452
+ * @param params.vault - Vault V2 address being exited.
453
+ * @param params.userAddress - Fee-recipient account submitting the exit.
454
+ * @param params.sharesBurnt - Lower bound of shares measured as burned by VaultExitBundlesV1.
455
+ * @param params.feeShares - Fee shares projected for `userAddress` at the accepted deadline.
456
+ */
457
+ constructor(params) {
458
+ 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.`);
459
+ this.vault = params.vault;
460
+ this.userAddress = params.userAddress;
461
+ this.sharesBurnt = params.sharesBurnt;
462
+ this.feeShares = params.feeShares;
463
+ this.name = "VaultV2ForceWithdrawFeeSharesExceedBurnError";
140
464
  }
141
465
  }
142
466
  /** Thrown when a Vault V2 in-kind redemption rounds to no deallocated assets. */
@@ -250,18 +574,6 @@ export class BundlesPermitMismatchError extends Error {
250
574
  this.name = "BundlesPermitMismatchError";
251
575
  }
252
576
  }
253
- /**
254
- * Thrown by the deprecated VaultExitBundlesV1 permit compatibility helper.
255
- *
256
- * @deprecated Use {@link BundlesPermitMismatchError} with `getBundlesSharesPermit`.
257
- */
258
- export class VaultExitBundlesV1PermitMismatchError extends BundlesPermitMismatchError {
259
- constructor(params) {
260
- super(params);
261
- this.message = `VaultExitBundlesV1 permit ${params.field} mismatch: expected "${params.expected}", got "${params.actual}". Rebuild and sign the vault-exit permit.`;
262
- this.name = "VaultExitBundlesV1PermitMismatchError";
263
- }
264
- }
265
577
  /** Thrown when a signed requirement cannot be safely encoded for a fixed bundles call. */
266
578
  export class BundlesRequirementSignatureMismatchError extends Error {
267
579
  /** Field whose signed value or encoding is invalid for the fixed bundles call. */
@@ -285,17 +597,6 @@ export class BundlesRequirementSignatureMismatchError extends Error {
285
597
  this.name = "BundlesRequirementSignatureMismatchError";
286
598
  }
287
599
  }
288
- /** @deprecated Use {@link BundlesRequirementSignatureMismatchError}. */
289
- export { BundlesRequirementSignatureMismatchError as BlueBundlesV1RequirementSignatureMismatchError, };
290
- /** Thrown when Permit2 SignatureTransfer is selected without an explicit unordered nonce. */
291
- export class MissingPermit2SignatureTransferNonceError extends Error {
292
- constructor() {
293
- super("Permit2 SignatureTransfer requires an explicit unused permit2Nonce. Generate a unique uint256 nonce, pass it to getRequirements(), and resolve the requirements again.");
294
- this.name = "MissingPermit2SignatureTransferNonceError";
295
- }
296
- }
297
- /** @deprecated Use {@link MissingPermit2SignatureTransferNonceError}. */
298
- export { MissingPermit2SignatureTransferNonceError as MissingPermit2TransferFromNonceError, };
299
600
  /** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
300
601
  export class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
301
602
  owner;
@@ -326,8 +627,6 @@ export class NoUnusedPermit2NonceError extends Error {
326
627
  this.name = "NoUnusedPermit2NonceError";
327
628
  }
328
629
  }
329
- /** @deprecated Use {@link Permit2SignatureTransferNonceAlreadyUsedError}. */
330
- export { Permit2SignatureTransferNonceAlreadyUsedError as Permit2TransferFromNonceAlreadyUsedError, };
331
630
  /** Thrown when native funding does not exactly match the contract's gross token pull. */
332
631
  export class NativeFundingAmountMismatchError extends Error {
333
632
  nativeAmount;
@@ -350,8 +649,6 @@ export class ReferralFeeRecipientMissingError extends Error {
350
649
  this.name = "ReferralFeeRecipientMissingError";
351
650
  }
352
651
  }
353
- /** @deprecated Use {@link ReferralFeeRecipientMissingError}. */
354
- export const MissingReferralFeeRecipientError = ReferralFeeRecipientMissingError;
355
652
  /**
356
653
  * Thrown when a referral fee percentage is outside the contract's `[0, WAD)` range.
357
654
  *
@@ -412,9 +709,7 @@ export class ReallocationLoanTokenMismatchError extends Error {
412
709
  }
413
710
  }
414
711
  /**
415
- * Thrown when a Blue authorization operator is not one of the chain's registered Morpho operators
416
- * (GeneralAdapter1 or BlueBundlesV1). Guards the exported authorization builder so a misconfigured
417
- * `authorized` cannot grant an arbitrary address control over the user's Morpho positions.
712
+ * Thrown when a Blue authorization operator is not the chain's registered BlueBundlesV1 contract.
418
713
  */
419
714
  export class UnsupportedAuthorizationOperatorError extends Error {
420
715
  authorized;
@@ -424,7 +719,7 @@ export class UnsupportedAuthorizationOperatorError extends Error {
424
719
  * @param chainId - Chain whose registry was consulted for the supported operators.
425
720
  */
426
721
  constructor(authorized, chainId) {
427
- 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.`);
722
+ super(`Authorization operator "${authorized}" is not supported on chain ${chainId}. Pass the chain's registered BlueBundlesV1 address.`);
428
723
  this.authorized = authorized;
429
724
  this.chainId = chainId;
430
725
  this.name = "UnsupportedAuthorizationOperatorError";
@@ -452,148 +747,6 @@ export class MaxRepayAssetsBelowRepayAssetsError extends Error {
452
747
  this.name = "MaxRepayAssetsBelowRepayAssetsError";
453
748
  }
454
749
  }
455
- /** @deprecated Use {@link NonPositiveInputError}. */
456
- export const NonPositiveAssetAmountError = NonPositiveInputError;
457
- /** @deprecated Use {@link NonPositiveInputError}. */
458
- export const NonPositiveSharesAmountError = NonPositiveInputError;
459
- /** @deprecated Use {@link NonPositiveInputError}. */
460
- export const NonPositiveMaxSharePriceError = NonPositiveInputError;
461
- /** @deprecated Use {@link NonPositiveInputError}. */
462
- export const ZeroDepositAmountError = NonPositiveInputError;
463
- /** @deprecated Use {@link NonPositiveInputError}. */
464
- export const NonPositiveBorrowAmountError = NonPositiveInputError;
465
- /** @deprecated Use {@link NonPositiveInputError}. */
466
- export const ZeroCollateralAmountError = NonPositiveInputError;
467
- /** @deprecated Use {@link NonPositiveInputError}. */
468
- export const NonPositiveReallocationAmountError = NonPositiveInputError;
469
- /** @deprecated Use {@link NonPositiveInputError}. */
470
- export const NonPositiveRepayAmountError = NonPositiveInputError;
471
- /** @deprecated Use {@link NonPositiveInputError}. */
472
- export const NonPositiveRepayMaxSharePriceError = NonPositiveInputError;
473
- /** @deprecated Use {@link NonPositiveInputError}. */
474
- export const NonPositiveWithdrawCollateralAmountError = NonPositiveInputError;
475
- /** @deprecated Use {@link NonPositiveInputError}. */
476
- export const ZeroSupplyAmountError = NonPositiveInputError;
477
- /** @deprecated Use {@link NonPositiveInputError}. */
478
- export const NonPositiveWithdrawAmountError = NonPositiveInputError;
479
- /** @deprecated Use {@link NegativeInputError}. */
480
- export const NegativeSlippageToleranceError = NegativeInputError;
481
- /** @deprecated Use {@link NegativeInputError}. */
482
- export const NegativeNativeAmountError = NegativeInputError;
483
- /** @deprecated Use {@link NegativeInputError}. */
484
- export const NegativeReallocationFeeError = NegativeInputError;
485
- /** @deprecated Use {@link NegativeInputError}. */
486
- export const NonPositiveMinBorrowSharePriceError = NegativeInputError;
487
- /** @deprecated Use {@link NegativeInputError}. */
488
- export const NegativeSupplyAmountError = NegativeInputError;
489
- /** @deprecated Use {@link NegativeInputError}. */
490
- export const NegativeSupplyMaxSharePriceError = NegativeInputError;
491
- /** @deprecated Use {@link NegativeInputError}. */
492
- export const NegativeWithdrawMinSharePriceError = NegativeInputError;
493
- /** @deprecated Use {@link NegativeInputError}. */
494
- export const NegativeMinSharePriceError = NegativeInputError;
495
- /** @deprecated Use {@link NegativeInputError}. */
496
- export const NegativeBorrowSharesError = NegativeInputError;
497
- /** @deprecated Use {@link NegativeInputError}. */
498
- export const NegativeMaxRepaySharePriceError = NegativeInputError;
499
- /**
500
- * Typed errors thrown while encoding supported Bundler3 actions.
501
- *
502
- * @remarks
503
- * Import these classes through `@morpho-org/morpho-sdk` when handling
504
- * failures from `BundlerAction`.
505
- */
506
- export var BundlerErrors;
507
- (function (BundlerErrors) {
508
- /**
509
- * Thrown when an action that requires an offchain signature is encoded before
510
- * the signature has been attached.
511
- *
512
- * @example
513
- * ```ts
514
- * import { BundlerErrors } from "@morpho-org/morpho-sdk";
515
- *
516
- * if (error instanceof BundlerErrors.MissingSignature) {
517
- * // Attach the missing permit or Permit2 signature, then encode again.
518
- * }
519
- * ```
520
- */
521
- class MissingSignature extends Error {
522
- constructor() {
523
- super("missing signature");
524
- }
525
- }
526
- BundlerErrors.MissingSignature = MissingSignature;
527
- /**
528
- * Thrown when an action is unsupported on the requested chain.
529
- *
530
- * @example
531
- * ```ts
532
- * import { BundlerErrors } from "@morpho-org/morpho-sdk";
533
- *
534
- * if (error instanceof BundlerErrors.UnexpectedAction) {
535
- * // Remove or replace the action for the selected chain.
536
- * }
537
- * ```
538
- */
539
- class UnexpectedAction extends Error {
540
- /**
541
- * @param type - Unsupported Bundler3 action discriminator or name.
542
- * @param chainId - Chain where the action was requested.
543
- */
544
- constructor(type, chainId) {
545
- super(`unexpected action "${type}" on chain "${chainId}"`);
546
- }
547
- }
548
- BundlerErrors.UnexpectedAction = UnexpectedAction;
549
- /**
550
- * Thrown when a Morpho authorization signature names a forbidden `authorized` account
551
- * (for example Bundler3 itself), which would grant operator rights to an unintended address.
552
- *
553
- * @example
554
- * ```ts
555
- * import { BundlerErrors } from "@morpho-org/morpho-sdk";
556
- *
557
- * if (error instanceof BundlerErrors.UnexpectedSignature) {
558
- * // Re-sign the authorization targeting GeneralAdapter1.
559
- * }
560
- * ```
561
- */
562
- class UnexpectedSignature extends Error {
563
- /**
564
- * @param authorized - The forbidden `authorized` address carried by the signature.
565
- */
566
- constructor(authorized) {
567
- super(`unexpected signature authorizing "${authorized}"`);
568
- }
569
- }
570
- BundlerErrors.UnexpectedSignature = UnexpectedSignature;
571
- /**
572
- * Thrown when a skippable Blue Public Allocator call would leave a usable
573
- * token allowance behind after the allocator call reverts.
574
- *
575
- * @example
576
- * ```ts
577
- * import { BundlerErrors } from "@morpho-org/morpho-sdk";
578
- *
579
- * if (error instanceof BundlerErrors.SkippableAllocatorPenalty) {
580
- * // Rebuild the allocator call with skipRevert set to false.
581
- * }
582
- * ```
583
- */
584
- class SkippableAllocatorPenalty extends Error {
585
- penaltyAssets;
586
- /**
587
- * @param penaltyAssets - Exact token amount approved to the allocator.
588
- */
589
- constructor(penaltyAssets) {
590
- super(`Blue Public Allocator calls with penalty assets cannot skip reverts. Rebuild with skipRevert false for penalty amount "${penaltyAssets}".`);
591
- this.penaltyAssets = penaltyAssets;
592
- this.name = "SkippableAllocatorPenalty";
593
- }
594
- }
595
- BundlerErrors.SkippableAllocatorPenalty = SkippableAllocatorPenalty;
596
- })(BundlerErrors || (BundlerErrors = {}));
597
750
  /**
598
751
  * Thrown when `buildTx` receives more than one requirement signature of the same kind.
599
752
  *
@@ -639,6 +792,17 @@ export class UnexpectedRequirementSignatureError extends Error {
639
792
  super(`Received a ${kind} signature that this operation does not consume. Remove it from the buildTx signatures array.`);
640
793
  }
641
794
  }
795
+ /** Thrown when `buildTx` receives a requirement signature whose action type is not supported. */
796
+ export class UnsupportedRequirementSignatureError extends Error {
797
+ type;
798
+ /**
799
+ * @param type - The unsupported signature action type.
800
+ */
801
+ constructor(type) {
802
+ super(`Received a requirement signature with unsupported action type "${type}". Re-run getRequirements() and sign the current requirements.`);
803
+ this.type = type;
804
+ }
805
+ }
642
806
  /** Thrown when a viem client's account address does not match the address required by the call. */
643
807
  export class AddressMismatchError extends Error {
644
808
  constructor(clientAddress, argsAddress) {
@@ -673,7 +837,6 @@ export class ApprovalAmountLessThanSpendAmountError extends Error {
673
837
  export class UnsupportedErc20ApprovalSpenderError extends Error {
674
838
  constructor(params) {
675
839
  const supported = (params.supportedSpenders ?? [
676
- params.generalAdapter1,
677
840
  params.permit2,
678
841
  params.midnight,
679
842
  params.midnightBundles,
@@ -733,12 +896,6 @@ export class DepositSpenderMismatchError extends Error {
733
896
  super(`Deposit spender "${depositSpender}" does not match requirement signature spender "${signatureSpender}"`);
734
897
  }
735
898
  }
736
- /** Thrown when a `permit2` requirement signature is missing the `expiration` field. */
737
- export class Permit2ExpirationMissingError extends Error {
738
- constructor() {
739
- super('Requirement signature with action.type === "permit2" must include args.expiration. Re-sign using the permit2 flow.');
740
- }
741
- }
742
899
  /** Thrown when a vault deposit uses `nativeAmount` but the vault asset is not the chain's wNative. */
743
900
  export class NativeAmountOnNonWNativeVaultError extends Error {
744
901
  constructor(vaultAsset, wNative) {
@@ -763,8 +920,6 @@ export class NativeAmountOnNonWNativeAssetError extends Error {
763
920
  super(`Cannot use nativeAmount: asset ${asset} is not the wrapped native token ${wNative}`);
764
921
  }
765
922
  }
766
- /** @deprecated Use {@link NativeAmountOnNonWNativeAssetError}. */
767
- export const NativeAmountOnNonWNativeCollateralError = NativeAmountOnNonWNativeAssetError;
768
923
  /** Thrown when a borrow exceeds the LLTV-buffered safe maximum for the position. */
769
924
  export class BorrowExceedsSafeLtvError extends Error {
770
925
  constructor(borrowAmount, maxSafeBorrow) {
@@ -789,16 +944,6 @@ export class AccrualPositionUserMismatchError extends Error {
789
944
  super(`Accrual position user ${positionUser} does not match expected user ${expectedUser}`);
790
945
  }
791
946
  }
792
- /**
793
- * Thrown when a reallocation has no withdrawals.
794
- *
795
- * @deprecated Vault V1 PublicAllocator support will be removed in the next major.
796
- */
797
- export class EmptyReallocationWithdrawalsError extends Error {
798
- constructor(vault) {
799
- super(`Reallocation withdrawals list cannot be empty for vault: ${vault}`);
800
- }
801
- }
802
947
  /** Thrown when a Public Allocator source references the target Blue market. */
803
948
  export class ReallocationWithdrawalOnTargetMarketError extends Error {
804
949
  constructor(vault, marketId) {
@@ -812,33 +957,15 @@ export class ReallocationWithdrawalOnTargetMarketError extends Error {
812
957
  *
813
958
  * @example
814
959
  * ```ts
815
- * import { InvalidReallocationShapeError } from "@morpho-org/morpho-sdk";
960
+ * import { InvalidVaultV2BlueReallocationShapeError } from "@morpho-org/morpho-sdk";
816
961
  *
817
- * const error = new InvalidReallocationShapeError();
962
+ * const error = new InvalidVaultV2BlueReallocationShapeError();
818
963
  * ```
819
964
  */
820
- export class InvalidReallocationShapeError extends Error {
965
+ export class InvalidVaultV2BlueReallocationShapeError extends Error {
821
966
  constructor() {
822
- 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.");
823
- this.name = "InvalidReallocationShapeError";
824
- }
825
- }
826
- /**
827
- * Thrown when one reallocation plan contains both Vault V1 and Vault V2 entries.
828
- *
829
- * @deprecated Vault V1/V2 mixed-plan support will be removed in the next major. Use Vault V2
830
- * reallocations.
831
- * @example
832
- * ```ts
833
- * import { MixedReallocationVersionsError } from "@morpho-org/morpho-sdk";
834
- *
835
- * const error = new MixedReallocationVersionsError();
836
- * ```
837
- */
838
- export class MixedReallocationVersionsError extends Error {
839
- constructor() {
840
- super("Reallocation plans cannot mix Vault V1 and Vault V2 entries. Submit one version per transaction.");
841
- this.name = "MixedReallocationVersionsError";
967
+ 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.");
968
+ this.name = "InvalidVaultV2BlueReallocationShapeError";
842
969
  }
843
970
  }
844
971
  /**
@@ -934,26 +1061,6 @@ export class InconsistentReallocationPenaltyError extends Error {
934
1061
  this.name = "InconsistentReallocationPenaltyError";
935
1062
  }
936
1063
  }
937
- /**
938
- * Thrown when reallocation withdrawals within a vault are not strictly sorted by market id.
939
- *
940
- * @deprecated Vault V1 PublicAllocator support will be removed in the next major.
941
- */
942
- export class UnsortedReallocationWithdrawalsError extends Error {
943
- constructor(vault, marketId) {
944
- super(`Reallocation withdrawals must be strictly sorted by market ID for vault ${vault}. Market ${marketId} is out of order.`);
945
- }
946
- }
947
- /**
948
- * Thrown when a market repay in assets mode has `transferAmount !== amount + nativeAmount` — the
949
- * pre-resolved ERC-20 pull plus the wrapped native must equal the assets repaid, so the bundle
950
- * neither strands over-pulled loan tokens on `GeneralAdapter1` nor under-funds the repay.
951
- */
952
- export class TransferAmountNotEqualToAssetsError extends Error {
953
- constructor(params) {
954
- 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.`);
955
- }
956
- }
957
1064
  /** Thrown when a market repay specifies both `assets` and `shares` as non-zero (modes are mutually exclusive). */
958
1065
  export class MutuallyExclusiveRepayAmountsError extends Error {
959
1066
  constructor(market) {
@@ -972,12 +1079,6 @@ export class WithdrawMakesPositionUnhealthyError extends Error {
972
1079
  super(`Withdrawing ${params.withdrawAmount} collateral would make position unhealthy. Max safe borrow after withdrawal: ${params.maxSafeBorrow}. Actual Borrow assets: ${params.borrowAssets}.`);
973
1080
  }
974
1081
  }
975
- /** Thrown when a share-amount conversion would divide by zero (the market has no shares of the relevant kind). */
976
- export class ShareDivideByZeroError extends Error {
977
- constructor(market) {
978
- super(`Share divide by zero error for market: ${market}`);
979
- }
980
- }
981
1082
  /** Thrown when a repay amount in assets exceeds the borrower's outstanding debt. */
982
1083
  export class RepayExceedsDebtError extends Error {
983
1084
  constructor(params) {
@@ -997,31 +1098,7 @@ export class RepaySharesExceedDebtError extends Error {
997
1098
  }
998
1099
  }
999
1100
  /**
1000
- * Thrown when a vault selected for reallocation has no configured `PublicAllocator`.
1001
- *
1002
- * @deprecated Vault V1 PublicAllocator support will be removed in the next major.
1003
- */
1004
- export class MissingPublicAllocatorConfigError extends Error {
1005
- constructor(vault) {
1006
- super(`Vault ${vault} has no public allocator configured but was selected for reallocation`);
1007
- }
1008
- }
1009
- /**
1010
- * Thrown when a reallocation attempts to use a disabled vault market.
1011
- *
1012
- * @deprecated Vault V1 PublicAllocator support will be removed in the next major.
1013
- */
1014
- export class DisabledReallocationMarketError extends Error {
1015
- vault;
1016
- marketId;
1017
- constructor(vault, marketId) {
1018
- super(`Vault ${vault} has disabled market ${marketId}. Remove it from reallocations or re-enable the market before reallocating.`);
1019
- this.vault = vault;
1020
- this.marketId = marketId;
1021
- }
1022
- }
1023
- /**
1024
- * Thrown when shared liquidity selected by a Vault V1 or Vault V2 reallocation planner cannot
1101
+ * Thrown when shared liquidity selected by a Vault V2 reallocation planner cannot
1025
1102
  * cover the operation's absolute shortfall on the target market — the resulting
1026
1103
  * `morphoBorrow` or `morphoWithdraw` would still revert onchain.
1027
1104
  *
@@ -1056,42 +1133,6 @@ export class UnknownReallocationVaultError extends UnknownDataError {
1056
1133
  this.vault = vault;
1057
1134
  }
1058
1135
  }
1059
- /**
1060
- * Thrown when reallocation state does not contain a requested vault-market config.
1061
- *
1062
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major.
1063
- */
1064
- export class UnknownReallocationVaultMarketConfigError extends UnknownDataError {
1065
- vault;
1066
- marketId;
1067
- /**
1068
- * @param vault - Vault address for the missing config.
1069
- * @param marketId - Market id for the missing config.
1070
- */
1071
- constructor(vault, marketId) {
1072
- super(`unknown reallocation config for vault "${vault}" on market "${marketId}"`);
1073
- this.vault = vault;
1074
- this.marketId = marketId;
1075
- }
1076
- }
1077
- /**
1078
- * Thrown when reallocation state does not contain a requested market position.
1079
- *
1080
- * @deprecated Vault V1 shared-liquidity planning will be removed in the next major.
1081
- */
1082
- export class UnknownReallocationPositionError extends UnknownDataError {
1083
- user;
1084
- marketId;
1085
- /**
1086
- * @param user - Position owner address.
1087
- * @param marketId - Market id for the missing position.
1088
- */
1089
- constructor(user, marketId) {
1090
- super(`unknown reallocation position of "${user}" on market "${marketId}"`);
1091
- this.user = user;
1092
- this.marketId = marketId;
1093
- }
1094
- }
1095
1136
  /** Thrown when Vault V2 reallocation state does not contain a requested allocation id. */
1096
1137
  export class UnknownReallocationAllocationError extends UnknownDataError {
1097
1138
  vault;
@@ -1258,10 +1299,10 @@ export class MidnightOfferRootOfferCountMismatchError extends Error {
1258
1299
  super(`Midnight offer root offer-count mismatch: expected "${params.expectedOffers}", got "${params.actualOffers}". Rebuild the flow and sign again.`);
1259
1300
  }
1260
1301
  }
1261
- /** Thrown when a Midnight offer-root signature was not prepared by this maker flow. */
1302
+ /** Thrown when a Midnight offer-root signature carries no encoded payload. */
1262
1303
  export class UnpreparedMidnightOfferRootSignatureError extends Error {
1263
1304
  constructor() {
1264
- super("Midnight offer root signature was not prepared for this offer tree. Sign this flow's offer-root requirement before building the submit transaction.");
1305
+ 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.");
1265
1306
  }
1266
1307
  }
1267
1308
  /** Thrown when a Midnight redeem flow finds no credit units for the user. */
@@ -1301,11 +1342,11 @@ export class WithdrawSharesExceedSupplyError extends Error {
1301
1342
  }
1302
1343
  }
1303
1344
  /**
1304
- * Thrown when a Vault V1 or Vault V2 reallocation planner receives a withdraw `amount` greater
1345
+ * Thrown when a Vault V2 reallocation planner receives a withdraw `amount` greater
1305
1346
  * than the target market's current `totalSupplyAssets` — the post-withdraw
1306
1347
  * supply would be negative, making the on-chain `morphoWithdraw` revert
1307
1348
  * regardless of any reallocation. Caught here so callers do not pay
1308
- * PublicAllocator fees on an unreachable operation.
1349
+ * allocator penalties on an unreachable operation.
1309
1350
  */
1310
1351
  export class ReallocationWithdrawExceedsMarketSupplyError extends Error {
1311
1352
  params;
@@ -1332,81 +1373,3 @@ export class RefinanceTokenMismatchError extends Error {
1332
1373
  super(`Refinance source market ${sourceMarket} and target market ${targetMarket} must share the same loanToken and collateralToken.`);
1333
1374
  }
1334
1375
  }
1335
- /**
1336
- * Thrown when a refinance specifies both `borrowAssets` and `borrowShares` as non-zero (modes are mutually exclusive).
1337
- *
1338
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1339
- * partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1340
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1341
- */
1342
- export class BorrowAmountAndSharesExclusiveError extends Error {
1343
- constructor(market) {
1344
- super(`Exactly one of borrowAssets or borrowShares must be non-zero for market: ${market}. Both were provided.`);
1345
- }
1346
- }
1347
- /**
1348
- * Thrown when a refinance's `collateralAmount` exceeds the source position's available collateral.
1349
- *
1350
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1351
- * partial collateral inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1352
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1353
- */
1354
- export class RefinanceExceedsCollateralError extends Error {
1355
- market;
1356
- requested;
1357
- available;
1358
- constructor(params) {
1359
- super(`Refinance collateral amount ${params.requested} exceeds available collateral ${params.available} for market: ${params.market}`);
1360
- this.market = params.market;
1361
- this.requested = params.requested;
1362
- this.available = params.available;
1363
- }
1364
- }
1365
- /**
1366
- * Thrown when a refinance's `borrowShares` exceeds the source position's outstanding borrow shares.
1367
- *
1368
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1369
- * partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1370
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1371
- */
1372
- export class RefinanceExceedsBorrowSharesError extends Error {
1373
- market;
1374
- requested;
1375
- available;
1376
- constructor(params) {
1377
- super(`Refinance borrow shares ${params.requested} exceed outstanding borrow shares ${params.available} for market: ${params.market}`);
1378
- this.market = params.market;
1379
- this.requested = params.requested;
1380
- this.available = params.available;
1381
- }
1382
- }
1383
- /**
1384
- * Thrown when a refinance's `borrowAssets` exceeds the source position's outstanding debt assets.
1385
- *
1386
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1387
- * partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1388
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1389
- */
1390
- export class RefinanceExceedsBorrowAssetsError extends Error {
1391
- market;
1392
- requested;
1393
- available;
1394
- constructor(params) {
1395
- super(`Refinance borrow assets ${params.requested} exceed outstanding debt assets ${params.available} for market: ${params.market}`);
1396
- this.market = params.market;
1397
- this.requested = params.requested;
1398
- this.available = params.available;
1399
- }
1400
- }
1401
- /**
1402
- * Thrown when a refinance in shares mode (`borrowShares > 0n`) omits the `borrowAssets` overshoot for the target borrow leg.
1403
- *
1404
- * @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
1405
- * partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
1406
- * compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
1407
- */
1408
- export class RefinanceSharesMissingBorrowAssetsError extends Error {
1409
- constructor(market) {
1410
- super(`Refinance shares mode requires a positive borrowAssets overshoot for the target borrow leg (market: ${market}).`);
1411
- }
1412
- }