@morpho-org/morpho-sdk 6.0.0-next.2 → 6.0.0-next.4

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 (277) hide show
  1. package/MIGRATION-v5-to-v6.md +88 -32
  2. package/README.md +9 -7
  3. package/lib/cjs/abis.d.ts +7 -2844
  4. package/lib/cjs/abis.js +3 -1951
  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 +1 -9
  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 +2 -2
  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 +6 -2
  25. package/lib/cjs/actions/bundles/common.js +31 -5
  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 +6 -8
  29. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +11 -16
  30. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
  31. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
  32. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  33. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
  34. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +5 -5
  35. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +6 -11
  36. package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
  37. package/lib/cjs/actions/requirements/encode/index.js +0 -1
  38. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
  39. package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
  40. package/lib/cjs/actions/requirements/index.d.ts +0 -1
  41. package/lib/cjs/actions/requirements/index.js +0 -1
  42. package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
  43. package/lib/cjs/actions/vaultV1/deposit.js +1 -2
  44. package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +7 -5
  45. package/lib/cjs/actions/vaultV1/inKindRedeem.js +11 -7
  46. package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
  47. package/lib/cjs/actions/vaultV2/deposit.js +1 -2
  48. package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +1 -1
  49. package/lib/cjs/actions/vaultV2/forceWithdraw.js +3 -3
  50. package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +7 -5
  51. package/lib/cjs/actions/vaultV2/inKindRedeem.js +11 -7
  52. package/lib/cjs/augment/AccrualPosition.d.ts +1 -0
  53. package/lib/cjs/augment.d.ts +0 -1
  54. package/lib/cjs/augment.js +0 -1
  55. package/lib/cjs/blue/abis.d.ts +5 -5
  56. package/lib/cjs/blue/abis.js +3 -7
  57. package/lib/cjs/blue/entities.d.ts +10 -8
  58. package/lib/cjs/blue/entities.js +3 -3
  59. package/lib/cjs/blue/errors.d.ts +4 -2
  60. package/lib/cjs/blue/errors.js +3 -1
  61. package/lib/cjs/blue/fetch.d.ts +5 -3
  62. package/lib/cjs/blue/fetch.js +3 -3
  63. package/lib/cjs/blue/types.d.ts +2 -4
  64. package/lib/cjs/blue/utils.d.ts +6 -4
  65. package/lib/cjs/blue/utils.js +3 -3
  66. package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
  67. package/lib/cjs/client/morphoViemExtension.js +1 -1
  68. package/lib/cjs/constants.d.ts +3 -37
  69. package/lib/cjs/constants.js +1 -39
  70. package/lib/cjs/entities/blue/blue.d.ts +30 -265
  71. package/lib/cjs/entities/blue/blue.js +1 -205
  72. package/lib/cjs/entities/index.d.ts +11 -66
  73. package/lib/cjs/entities/index.js +3 -21
  74. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -2
  75. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -3
  76. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +13 -5
  77. package/lib/cjs/entities/vaultV1/vaultV1.js +16 -10
  78. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +40 -19
  79. package/lib/cjs/entities/vaultV2/vaultV2.js +57 -26
  80. package/lib/cjs/entities/vaultV2BlueReallocationData.js +4 -21
  81. package/lib/cjs/errors.d.ts +5 -47
  82. package/lib/cjs/errors.js +4 -46
  83. package/lib/cjs/fetch.d.ts +5 -17
  84. package/lib/cjs/fetch.js +3 -17
  85. package/lib/cjs/helpers/constant.d.ts +0 -2
  86. package/lib/cjs/helpers/constant.js +0 -2
  87. package/lib/cjs/helpers/index.d.ts +2 -3
  88. package/lib/cjs/helpers/index.js +1 -9
  89. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +11 -5
  90. package/lib/cjs/helpers/slippage.d.ts +1 -103
  91. package/lib/cjs/helpers/slippage.js +0 -150
  92. package/lib/cjs/helpers/utilization.d.ts +12 -10
  93. package/lib/cjs/helpers/utilization.js +27 -12
  94. package/lib/cjs/helpers/validate.d.ts +1 -24
  95. package/lib/cjs/helpers/validate.js +2 -49
  96. package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
  97. package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
  98. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +48 -15
  99. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +48 -15
  100. package/lib/cjs/midnight/errors.d.ts +1 -1
  101. package/lib/cjs/midnight/errors.js +2 -1
  102. package/lib/cjs/types/action.d.ts +17 -65
  103. package/lib/cjs/types/action.js +11 -4
  104. package/lib/cjs/types/error.d.ts +50 -381
  105. package/lib/cjs/types/error.js +64 -395
  106. package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
  107. package/lib/cjs/types.d.ts +2 -18
  108. package/lib/cjs/utils.d.ts +10 -35
  109. package/lib/cjs/utils.js +4 -36
  110. package/lib/esm/abis.d.ts +7 -2844
  111. package/lib/esm/abis.js +7 -1950
  112. package/lib/esm/actions/blue/borrow.d.ts +3 -2
  113. package/lib/esm/actions/blue/borrow.js +3 -2
  114. package/lib/esm/actions/blue/common.js +1 -9
  115. package/lib/esm/actions/blue/refinance.d.ts +2 -2
  116. package/lib/esm/actions/blue/refinance.js +2 -2
  117. package/lib/esm/actions/blue/repay.d.ts +1 -1
  118. package/lib/esm/actions/blue/repay.js +1 -1
  119. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
  120. package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
  121. package/lib/esm/actions/blue/supply.d.ts +2 -2
  122. package/lib/esm/actions/blue/supply.js +2 -2
  123. package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
  124. package/lib/esm/actions/blue/supplyCollateral.js +2 -2
  125. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
  126. package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
  127. package/lib/esm/actions/blue/withdraw.d.ts +3 -3
  128. package/lib/esm/actions/blue/withdraw.js +3 -3
  129. package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
  130. package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
  131. package/lib/esm/actions/bundles/common.d.ts +6 -2
  132. package/lib/esm/actions/bundles/common.js +32 -6
  133. package/lib/esm/actions/index.d.ts +0 -1
  134. package/lib/esm/actions/index.js +0 -1
  135. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -8
  136. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +12 -17
  137. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
  138. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
  139. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  140. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
  141. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +5 -5
  142. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +6 -11
  143. package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
  144. package/lib/esm/actions/requirements/encode/index.js +0 -1
  145. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
  146. package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
  147. package/lib/esm/actions/requirements/index.d.ts +0 -1
  148. package/lib/esm/actions/requirements/index.js +0 -1
  149. package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
  150. package/lib/esm/actions/vaultV1/deposit.js +1 -2
  151. package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +7 -5
  152. package/lib/esm/actions/vaultV1/inKindRedeem.js +11 -7
  153. package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
  154. package/lib/esm/actions/vaultV2/deposit.js +1 -2
  155. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +1 -1
  156. package/lib/esm/actions/vaultV2/forceWithdraw.js +3 -3
  157. package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +7 -5
  158. package/lib/esm/actions/vaultV2/inKindRedeem.js +11 -7
  159. package/lib/esm/augment/AccrualPosition.d.ts +1 -0
  160. package/lib/esm/augment.d.ts +0 -1
  161. package/lib/esm/augment.js +0 -1
  162. package/lib/esm/blue/abis.d.ts +5 -5
  163. package/lib/esm/blue/abis.js +5 -5
  164. package/lib/esm/blue/entities.d.ts +10 -8
  165. package/lib/esm/blue/entities.js +5 -3
  166. package/lib/esm/blue/errors.d.ts +4 -2
  167. package/lib/esm/blue/errors.js +4 -2
  168. package/lib/esm/blue/fetch.d.ts +5 -3
  169. package/lib/esm/blue/fetch.js +5 -3
  170. package/lib/esm/blue/types.d.ts +2 -4
  171. package/lib/esm/blue/utils.d.ts +6 -4
  172. package/lib/esm/blue/utils.js +6 -4
  173. package/lib/esm/client/morphoViemExtension.d.ts +1 -1
  174. package/lib/esm/client/morphoViemExtension.js +1 -1
  175. package/lib/esm/constants.d.ts +3 -37
  176. package/lib/esm/constants.js +3 -37
  177. package/lib/esm/entities/blue/blue.d.ts +30 -265
  178. package/lib/esm/entities/blue/blue.js +4 -208
  179. package/lib/esm/entities/index.d.ts +11 -66
  180. package/lib/esm/entities/index.js +5 -18
  181. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -2
  182. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +8 -3
  183. package/lib/esm/entities/vaultV1/vaultV1.d.ts +13 -5
  184. package/lib/esm/entities/vaultV1/vaultV1.js +19 -13
  185. package/lib/esm/entities/vaultV2/vaultV2.d.ts +40 -19
  186. package/lib/esm/entities/vaultV2/vaultV2.js +61 -30
  187. package/lib/esm/entities/vaultV2BlueReallocationData.js +2 -19
  188. package/lib/esm/errors.d.ts +5 -47
  189. package/lib/esm/errors.js +5 -47
  190. package/lib/esm/fetch.d.ts +5 -17
  191. package/lib/esm/fetch.js +5 -17
  192. package/lib/esm/helpers/constant.d.ts +0 -2
  193. package/lib/esm/helpers/constant.js +0 -2
  194. package/lib/esm/helpers/index.d.ts +2 -3
  195. package/lib/esm/helpers/index.js +2 -3
  196. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +11 -5
  197. package/lib/esm/helpers/slippage.d.ts +1 -103
  198. package/lib/esm/helpers/slippage.js +1 -147
  199. package/lib/esm/helpers/utilization.d.ts +12 -10
  200. package/lib/esm/helpers/utilization.js +26 -11
  201. package/lib/esm/helpers/validate.d.ts +1 -24
  202. package/lib/esm/helpers/validate.js +2 -48
  203. package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
  204. package/lib/esm/helpers/validateRequirementSpender.js +1 -3
  205. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +48 -15
  206. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +48 -15
  207. package/lib/esm/midnight/errors.d.ts +1 -1
  208. package/lib/esm/midnight/errors.js +1 -1
  209. package/lib/esm/types/action.d.ts +17 -65
  210. package/lib/esm/types/action.js +12 -5
  211. package/lib/esm/types/error.d.ts +50 -381
  212. package/lib/esm/types/error.js +58 -377
  213. package/lib/esm/types/sharedLiquidity.d.ts +1 -117
  214. package/lib/esm/types.d.ts +2 -18
  215. package/lib/esm/utils.d.ts +10 -35
  216. package/lib/esm/utils.js +9 -34
  217. package/package.json +6 -17
  218. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
  219. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -88
  220. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  221. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -152
  222. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
  223. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -53
  224. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  225. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
  226. package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
  227. package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
  228. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  229. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
  230. package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  231. package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
  232. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -50
  233. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -45
  234. package/lib/cjs/actions/signatures/index.d.ts +0 -3
  235. package/lib/cjs/actions/signatures/index.js +0 -19
  236. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -11
  237. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
  238. package/lib/cjs/bundler/actions.d.ts +0 -797
  239. package/lib/cjs/bundler/actions.js +0 -1371
  240. package/lib/cjs/bundler/index.d.ts +0 -2
  241. package/lib/cjs/bundler/index.js +0 -18
  242. package/lib/cjs/bundler/types.d.ts +0 -235
  243. package/lib/cjs/bundler/types.js +0 -2
  244. package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -332
  245. package/lib/cjs/entities/vaultV1ReallocationData.js +0 -557
  246. package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -80
  247. package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -245
  248. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
  249. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -84
  250. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  251. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -148
  252. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
  253. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -49
  254. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  255. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
  256. package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
  257. package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
  258. package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  259. package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
  260. package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  261. package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
  262. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -50
  263. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -41
  264. package/lib/esm/actions/signatures/index.d.ts +0 -3
  265. package/lib/esm/actions/signatures/index.js +0 -3
  266. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -11
  267. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -7
  268. package/lib/esm/bundler/actions.d.ts +0 -797
  269. package/lib/esm/bundler/actions.js +0 -1368
  270. package/lib/esm/bundler/index.d.ts +0 -2
  271. package/lib/esm/bundler/index.js +0 -2
  272. package/lib/esm/bundler/types.d.ts +0 -235
  273. package/lib/esm/bundler/types.js +0 -1
  274. package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -332
  275. package/lib/esm/entities/vaultV1ReallocationData.js +0 -559
  276. package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -80
  277. package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -241
@@ -192,23 +192,34 @@ export declare function computeVaultV2ForceWithdrawPlan(params: {
192
192
  * The result is the **denominator of {@link computeMinForceWithdrawSharePrice}** — the largest share
193
193
  * burn the realized exit price is measured against. It takes the max over the two supplied snapshots
194
194
  * because interest lowers the burn while management fees raise it, so neither snapshot alone bounds
195
- * execution. The entity passes both accrued to `now` (execution time): the raw `lastUpdate` snapshot
196
- * underestimates the burn a stale fee-bearing vault realizes — the first withdrawal accrues pending
197
- * management fees before burning shares — which lifts the floor above the faithful price and trips
198
- * `SlippageExceeded`. Accruing to `now`, not the caller-chosen `deadline`, tracks execution without
199
- * letting a long deadline silently weaken the guard; `slippageTolerance` absorbs the residual drift
200
- * until inclusion. Pass distinct snapshots to bound the burn across an accrual window.
195
+ * execution. The entity passes the raw `lastUpdate` snapshot and the same vault accrued to `now`
196
+ * (execution time): the raw snapshot underestimates the burn a stale fee-bearing vault realizes —
197
+ * the first withdrawal accrues pending management fees before burning shares — while the `now`
198
+ * accrual underestimates it when it projects interest the chain has not realized (a wall clock
199
+ * running ahead of the chain, or a capped `maxRate`); either alone would lift the floor above the
200
+ * faithful price and trip `SlippageExceeded`. Accruing to `now`, not the caller-chosen `deadline`,
201
+ * tracks execution without letting a long deadline silently weaken the guard; `slippageTolerance`
202
+ * absorbs the residual drift until inclusion.
201
203
  *
202
- * This is **not** the share allowance to authorize. The price floor's denominator is this bound
203
- * minus `computeVaultV2ForceWithdrawFeeSharesMinted({ vaultData, owner, timestamp: now })`: the
204
- * contract measures the *net* burn, which fee mints to `owner` shrink. The allowance is
205
- * `min(mulDivUp(exitAssets, RAY, minSharePriceE27) + computeVaultV2ForceWithdrawFeeSharesMinted({
206
- * vaultData, owner, timestamp: deadline }), maxUint256)`: the permit pays for the *gross* burn.
204
+ * This is **not** the share allowance to authorize. The contract measures the *net* burn, which
205
+ * fee mints to `owner` shrink, and the raw snapshot mints none while the `now` accrual mints
206
+ * `computeVaultV2ForceWithdrawFeeSharesMinted({ vaultData, owner, timestamp: now })`; so the
207
+ * entity nets each endpoint before taking the max (`max(burnRaw, burnNow - feeSharesNow)`) rather
208
+ * than subtracting the `now` fee from a gross max. The allowance is
209
+ * `min(max(mulDivUp(exitAssets, RAY, max(min(mulDivDown(minSharePriceE27, WAD - slippageTolerance,
210
+ * WAD), minSharePriceE27 - 1), 1)), mulDivUp(exitAssets, RAY, minSharePriceE27) + 1)
211
+ * + computeVaultV2ForceWithdrawFeeSharesMinted({ vaultData, owner, timestamp: deadline }),
212
+ * maxUint256)`: the permit pays for the *gross* burn, covering a burn at least one tolerance step
213
+ * below the floor whenever the floor exceeds one RAY unit and, in any case, at least one share
214
+ * above the burn at the floor, so a price within that headroom below the floor reverts on the
215
+ * contract's `minSharePriceE27` check rather than on the allowance; a deeper drop can still
216
+ * surface as an ERC-20 allowance underflow.
207
217
  *
208
218
  * @param params - Share-bound inputs.
209
219
  * @param params.vaultData - Pre-fetched Vault V2 accrual snapshot.
210
220
  * @param params.deadlineVaultData - The same vault accrued to a second timestamp; the max of the two
211
- * share burns is returned. The entity passes the `now`-accrued snapshot for both.
221
+ * share burns is returned. The entity calls this twice — the raw snapshot for both parameters,
222
+ * then the `now` accrual for both — and nets each result before taking the max.
212
223
  * @param params.plan - Plan from {@link computeVaultV2ForceWithdrawPlan}.
213
224
  * @returns An upper bound, in vault shares, of what the exit burns.
214
225
  * @example
@@ -220,7 +231,12 @@ export declare function computeVaultV2ForceWithdrawPlan(params: {
220
231
  * } from "@morpho-org/morpho-sdk";
221
232
  *
222
233
  * const { vault: nowVaultData } = vaultData.accrueInterest(now);
223
- * const sharesBurnt = computeVaultV2ForceWithdrawSharesBurnt({
234
+ * const sharesBurntRaw = computeVaultV2ForceWithdrawSharesBurnt({
235
+ * vaultData,
236
+ * deadlineVaultData: vaultData,
237
+ * plan,
238
+ * });
239
+ * const sharesBurntNow = computeVaultV2ForceWithdrawSharesBurnt({
224
240
  * vaultData: nowVaultData,
225
241
  * deadlineVaultData: nowVaultData,
226
242
  * plan,
@@ -230,9 +246,26 @@ export declare function computeVaultV2ForceWithdrawPlan(params: {
230
246
  * owner,
231
247
  * timestamp: now,
232
248
  * });
233
- * const sharesBurntForFloor = sharesBurnt - feeSharesNow;
249
+ * const sharesBurntForFloor = MathLib.max(
250
+ * sharesBurntRaw,
251
+ * sharesBurntNow - feeSharesNow,
252
+ * );
253
+ * const allowanceSharePriceE27 = MathLib.max(
254
+ * MathLib.min(
255
+ * MathLib.mulDivDown(
256
+ * minSharePriceE27,
257
+ * MathLib.WAD - slippageTolerance,
258
+ * MathLib.WAD,
259
+ * ),
260
+ * minSharePriceE27 - 1n,
261
+ * ),
262
+ * 1n,
263
+ * );
234
264
  * const requiredShareAllowance = MathLib.min(
235
- * MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) +
265
+ * MathLib.max(
266
+ * MathLib.mulDivUp(exitAssets, MathLib.RAY, allowanceSharePriceE27),
267
+ * MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) + 1n,
268
+ * ) +
236
269
  * computeVaultV2ForceWithdrawFeeSharesMinted({
237
270
  * vaultData,
238
271
  * owner,
@@ -269,23 +269,34 @@ function computeVaultV2ForceWithdrawPlan(params) {
269
269
  * The result is the **denominator of {@link computeMinForceWithdrawSharePrice}** — the largest share
270
270
  * burn the realized exit price is measured against. It takes the max over the two supplied snapshots
271
271
  * because interest lowers the burn while management fees raise it, so neither snapshot alone bounds
272
- * execution. The entity passes both accrued to `now` (execution time): the raw `lastUpdate` snapshot
273
- * underestimates the burn a stale fee-bearing vault realizes — the first withdrawal accrues pending
274
- * management fees before burning shares — which lifts the floor above the faithful price and trips
275
- * `SlippageExceeded`. Accruing to `now`, not the caller-chosen `deadline`, tracks execution without
276
- * letting a long deadline silently weaken the guard; `slippageTolerance` absorbs the residual drift
277
- * until inclusion. Pass distinct snapshots to bound the burn across an accrual window.
272
+ * execution. The entity passes the raw `lastUpdate` snapshot and the same vault accrued to `now`
273
+ * (execution time): the raw snapshot underestimates the burn a stale fee-bearing vault realizes —
274
+ * the first withdrawal accrues pending management fees before burning shares — while the `now`
275
+ * accrual underestimates it when it projects interest the chain has not realized (a wall clock
276
+ * running ahead of the chain, or a capped `maxRate`); either alone would lift the floor above the
277
+ * faithful price and trip `SlippageExceeded`. Accruing to `now`, not the caller-chosen `deadline`,
278
+ * tracks execution without letting a long deadline silently weaken the guard; `slippageTolerance`
279
+ * absorbs the residual drift until inclusion.
278
280
  *
279
- * This is **not** the share allowance to authorize. The price floor's denominator is this bound
280
- * minus `computeVaultV2ForceWithdrawFeeSharesMinted({ vaultData, owner, timestamp: now })`: the
281
- * contract measures the *net* burn, which fee mints to `owner` shrink. The allowance is
282
- * `min(mulDivUp(exitAssets, RAY, minSharePriceE27) + computeVaultV2ForceWithdrawFeeSharesMinted({
283
- * vaultData, owner, timestamp: deadline }), maxUint256)`: the permit pays for the *gross* burn.
281
+ * This is **not** the share allowance to authorize. The contract measures the *net* burn, which
282
+ * fee mints to `owner` shrink, and the raw snapshot mints none while the `now` accrual mints
283
+ * `computeVaultV2ForceWithdrawFeeSharesMinted({ vaultData, owner, timestamp: now })`; so the
284
+ * entity nets each endpoint before taking the max (`max(burnRaw, burnNow - feeSharesNow)`) rather
285
+ * than subtracting the `now` fee from a gross max. The allowance is
286
+ * `min(max(mulDivUp(exitAssets, RAY, max(min(mulDivDown(minSharePriceE27, WAD - slippageTolerance,
287
+ * WAD), minSharePriceE27 - 1), 1)), mulDivUp(exitAssets, RAY, minSharePriceE27) + 1)
288
+ * + computeVaultV2ForceWithdrawFeeSharesMinted({ vaultData, owner, timestamp: deadline }),
289
+ * maxUint256)`: the permit pays for the *gross* burn, covering a burn at least one tolerance step
290
+ * below the floor whenever the floor exceeds one RAY unit and, in any case, at least one share
291
+ * above the burn at the floor, so a price within that headroom below the floor reverts on the
292
+ * contract's `minSharePriceE27` check rather than on the allowance; a deeper drop can still
293
+ * surface as an ERC-20 allowance underflow.
284
294
  *
285
295
  * @param params - Share-bound inputs.
286
296
  * @param params.vaultData - Pre-fetched Vault V2 accrual snapshot.
287
297
  * @param params.deadlineVaultData - The same vault accrued to a second timestamp; the max of the two
288
- * share burns is returned. The entity passes the `now`-accrued snapshot for both.
298
+ * share burns is returned. The entity calls this twice — the raw snapshot for both parameters,
299
+ * then the `now` accrual for both — and nets each result before taking the max.
289
300
  * @param params.plan - Plan from {@link computeVaultV2ForceWithdrawPlan}.
290
301
  * @returns An upper bound, in vault shares, of what the exit burns.
291
302
  * @example
@@ -297,7 +308,12 @@ function computeVaultV2ForceWithdrawPlan(params) {
297
308
  * } from "@morpho-org/morpho-sdk";
298
309
  *
299
310
  * const { vault: nowVaultData } = vaultData.accrueInterest(now);
300
- * const sharesBurnt = computeVaultV2ForceWithdrawSharesBurnt({
311
+ * const sharesBurntRaw = computeVaultV2ForceWithdrawSharesBurnt({
312
+ * vaultData,
313
+ * deadlineVaultData: vaultData,
314
+ * plan,
315
+ * });
316
+ * const sharesBurntNow = computeVaultV2ForceWithdrawSharesBurnt({
301
317
  * vaultData: nowVaultData,
302
318
  * deadlineVaultData: nowVaultData,
303
319
  * plan,
@@ -307,9 +323,26 @@ function computeVaultV2ForceWithdrawPlan(params) {
307
323
  * owner,
308
324
  * timestamp: now,
309
325
  * });
310
- * const sharesBurntForFloor = sharesBurnt - feeSharesNow;
326
+ * const sharesBurntForFloor = MathLib.max(
327
+ * sharesBurntRaw,
328
+ * sharesBurntNow - feeSharesNow,
329
+ * );
330
+ * const allowanceSharePriceE27 = MathLib.max(
331
+ * MathLib.min(
332
+ * MathLib.mulDivDown(
333
+ * minSharePriceE27,
334
+ * MathLib.WAD - slippageTolerance,
335
+ * MathLib.WAD,
336
+ * ),
337
+ * minSharePriceE27 - 1n,
338
+ * ),
339
+ * 1n,
340
+ * );
311
341
  * const requiredShareAllowance = MathLib.min(
312
- * MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) +
342
+ * MathLib.max(
343
+ * MathLib.mulDivUp(exitAssets, MathLib.RAY, allowanceSharePriceE27),
344
+ * MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) + 1n,
345
+ * ) +
313
346
  * computeVaultV2ForceWithdrawFeeSharesMinted({
314
347
  * vaultData,
315
348
  * owner,
@@ -1 +1 @@
1
- export { ChainIdMismatchError, InvalidEcrecoverSignatureVError, InvalidMarketParameterError, InvalidMidnightApiResponseError, InvalidOfferGroupError, InvalidOfferParameterError, InvalidPositionAccrualStateError, InvalidPositionAccrualTimestampError, InvalidPositionLossFactorError, InvalidTickSpacingError, InvalidTreeError, InvalidTreeHeightError, InvalidTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError, PriceGreaterThanOneError, SettlementFeeExceedsPriceError, TickOutOfRangeError, UnknownCollateralIndexError, } from "@morpho-org/midnight-sdk";
1
+ export { ChainIdMismatchError, InvalidEcrecoverSignatureVError, InvalidMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError, InvalidOfferParameterError, InvalidPositionAccrualStateError, InvalidPositionAccrualTimestampError, InvalidPositionLossFactorError, InvalidTickSpacingError, InvalidTreeError, InvalidTreeHeightError, InvalidTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError, PriceGreaterThanOneError, SettlementFeeExceedsPriceError, TickOutOfRangeError, UnknownCollateralIndexError, } from "@morpho-org/midnight-sdk";
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnknownCollateralIndexError = exports.TickOutOfRangeError = exports.SettlementFeeExceedsPriceError = exports.PriceGreaterThanOneError = exports.PayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidTypedDataSignatureError = exports.InvalidTreeHeightError = exports.InvalidTreeError = exports.InvalidTickSpacingError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.InvalidPositionAccrualStateError = exports.InvalidOfferParameterError = exports.InvalidOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMarketParameterError = exports.InvalidEcrecoverSignatureVError = exports.ChainIdMismatchError = void 0;
3
+ exports.UnknownCollateralIndexError = exports.TickOutOfRangeError = exports.SettlementFeeExceedsPriceError = exports.PriceGreaterThanOneError = exports.PayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidTypedDataSignatureError = exports.InvalidTreeHeightError = exports.InvalidTreeError = exports.InvalidTickSpacingError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.InvalidPositionAccrualStateError = exports.InvalidOfferParameterError = exports.InvalidOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMarketParameterError = exports.InvalidEcrecoverSignatureVError = exports.ChainIdMismatchError = void 0;
4
4
  var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
5
  Object.defineProperty(exports, "ChainIdMismatchError", { enumerable: true, get: function () { return midnight_sdk_1.ChainIdMismatchError; } });
6
6
  Object.defineProperty(exports, "InvalidEcrecoverSignatureVError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidEcrecoverSignatureVError; } });
7
7
  Object.defineProperty(exports, "InvalidMarketParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMarketParameterError; } });
8
+ Object.defineProperty(exports, "InvalidMidnightApiQuoteTargetError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMidnightApiQuoteTargetError; } });
8
9
  Object.defineProperty(exports, "InvalidMidnightApiResponseError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMidnightApiResponseError; } });
9
10
  Object.defineProperty(exports, "InvalidOfferGroupError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferGroupError; } });
10
11
  Object.defineProperty(exports, "InvalidOfferParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferParameterError; } });
@@ -417,20 +417,6 @@ export interface Transaction<TAction extends BaseAction = TransactionAction> {
417
417
  readonly data: Hex;
418
418
  readonly action: TAction;
419
419
  }
420
- /**
421
- * Enforces that at least one deposit amount source is provided.
422
- *
423
- * - `amount` alone: standard ERC20 deposit.
424
- * - `nativeAmount` alone: pure native-wrap deposit (vault asset must be wNative).
425
- * - Both: mixed deposit (ERC20 transfer + native wrap).
426
- */
427
- export type DepositAmountArgs = {
428
- amount: bigint;
429
- nativeAmount?: bigint;
430
- } | {
431
- nativeAmount: bigint;
432
- amount?: bigint;
433
- };
434
420
  /** Mutually exclusive ERC-20 or native funding accepted by fixed bundles entrypoints. */
435
421
  export type BundlesFundingArgs = {
436
422
  readonly amount: bigint;
@@ -458,8 +444,7 @@ export type VaultV1MigrateToV2AmountArgs = {
458
444
  * Holds the pre-resolved arguments for an ERC-2612 `permit`: the signed approval
459
445
  * of `amount` of `asset` from `owner` to the permitted spender, bounded by the
460
446
  * `deadline` timestamp and consuming the given `nonce`. The associated
461
- * {@link PermitAction} identifies the permitted spender, including fixed-bundle
462
- * contracts and the GeneralAdapter1 periphery.
447
+ * {@link PermitAction} identifies the permitted fixed-bundle contract.
463
448
  */
464
449
  export interface PermitArgs {
465
450
  readonly owner: Address;
@@ -469,25 +454,10 @@ export interface PermitArgs {
469
454
  readonly amount: bigint;
470
455
  readonly deadline: bigint;
471
456
  }
472
- /**
473
- * Holds the pre-resolved arguments for a Permit2 `permit` bundler call. It
474
- * mirrors {@link PermitArgs} but adds the Permit2 allowance `expiration` (when
475
- * the on-chain allowance lapses) alongside the signature `deadline` (by when the
476
- * signature must be submitted).
477
- */
478
- export interface Permit2Args {
479
- readonly owner: Address;
480
- readonly nonce: bigint;
481
- readonly asset: Address;
482
- readonly signature: Hex;
483
- readonly amount: bigint;
484
- readonly deadline: bigint;
485
- readonly expiration: bigint;
486
- }
487
457
  /**
488
458
  * Signed Morpho Blue authorization payload produced when an integrator opts into offchain
489
- * signatures (`supportSignature: true`). Bundler3 consumes it through `setAuthorizationWithSig`;
490
- * direct BlueBundlesV1 writes encode it into their signed-authorization struct.
459
+ * signatures (`supportSignature: true`). BlueBundlesV1 encodes it into its
460
+ * signed-authorization struct.
491
461
  */
492
462
  export interface AuthorizationSignatureArgs {
493
463
  /** Account granting the authorization (the position owner). */
@@ -527,15 +497,6 @@ export interface PermitAction extends BaseAction<"permit", {
527
497
  */
528
498
  readonly typedData?: RequirementTypedData;
529
499
  }
530
- export interface Permit2Action extends BaseAction<"permit2", {
531
- spender: Address;
532
- amount: bigint;
533
- deadline: bigint;
534
- expiration: bigint;
535
- }> {
536
- /** EIP-712 payload to sign for this Permit2 AllowanceTransfer. See {@link PermitAction.typedData}. */
537
- readonly typedData?: RequirementTypedData;
538
- }
539
500
  /** Signable Permit2 SignatureTransfer requirement for a fixed bundles token pull. */
540
501
  export interface Permit2SignatureTransferAction extends BaseAction<"permit2SignatureTransfer", {
541
502
  readonly spender: Address;
@@ -547,8 +508,7 @@ export interface Permit2SignatureTransferAction extends BaseAction<"permit2Signa
547
508
  readonly typedData?: RequirementTypedData;
548
509
  }
549
510
  /**
550
- * Signable Morpho authorization requirement. Its `authorized` operator is route-specific:
551
- * GeneralAdapter1 for Bundler3 flows or BlueBundlesV1 for direct Blue writes.
511
+ * Signable Morpho authorization requirement for direct BlueBundlesV1 writes.
552
512
  */
553
513
  export interface AuthorizationAction extends BaseAction<"authorization", {
554
514
  authorized: Address;
@@ -575,27 +535,22 @@ export interface MidnightOfferRootSignatureAction extends BaseAction<"midnightOf
575
535
  readonly typedData?: RequirementTypedData;
576
536
  }
577
537
  /** Action metadata supported by signature requirements. */
578
- export type SignatureRequirementAction = PermitAction | Permit2Action | Permit2SignatureTransferAction | AuthorizationAction | MidnightOfferRootSignatureAction;
538
+ export type SignatureRequirementAction = PermitAction | Permit2SignatureTransferAction | AuthorizationAction | MidnightOfferRootSignatureAction;
579
539
  /** Argument payloads returned by signature requirements. */
580
- export type RequirementSignatureArgs = PermitArgs | Permit2Args | AuthorizationSignatureArgs | MidnightOfferRootSignatureArgs;
540
+ export type RequirementSignatureArgs = PermitArgs | AuthorizationSignatureArgs | MidnightOfferRootSignatureArgs;
581
541
  /** A signed ERC-2612 permit requirement. */
582
542
  export interface Erc2612RequirementSignature {
583
543
  readonly args: Readonly<PermitArgs>;
584
544
  readonly action: PermitAction;
585
545
  }
586
- /** A signed Permit2 AllowanceTransfer requirement used by Bundler3. */
587
- export interface Permit2AllowanceRequirementSignature {
588
- readonly args: Readonly<Permit2Args>;
589
- readonly action: Permit2Action;
590
- }
591
- /** A signed ERC-2612 permit or Permit2 AllowanceTransfer requirement. */
592
- export type PermitRequirementSignature = Erc2612RequirementSignature | Permit2AllowanceRequirementSignature;
546
+ /** A signed ERC-2612 permit requirement accepted by vault-share bundle calls. */
547
+ export type PermitRequirementSignature = Erc2612RequirementSignature;
593
548
  /** A signed Permit2 SignatureTransfer requirement used by fixed bundles contracts. */
594
549
  export interface Permit2SignatureTransferRequirementSignature {
595
550
  readonly args: Readonly<PermitArgs>;
596
551
  readonly action: Permit2SignatureTransferAction;
597
552
  }
598
- /** A signed Morpho authorization consumed by Bundler3 or a direct BlueBundlesV1 call. */
553
+ /** A signed Morpho authorization consumed by a direct BlueBundlesV1 call. */
599
554
  export interface AuthorizationRequirementSignature {
600
555
  readonly args: AuthorizationSignatureArgs;
601
556
  readonly action: AuthorizationAction;
@@ -607,7 +562,7 @@ export interface MidnightOfferRootSignature {
607
562
  }
608
563
  /**
609
564
  * The deep-frozen output of `Requirement.sign()`. Discriminated on `action.type`:
610
- * `"permit"` / `"permit2"` carry token-approval args, `"permit2SignatureTransfer"` carries a
565
+ * `"permit"` carries token-approval args, `"permit2SignatureTransfer"` carries a
611
566
  * bundles SignatureTransfer, `"authorization"` carries the signed Morpho authorization,
612
567
  * and Midnight adds `"midnightOfferRootSignature"`.
613
568
  */
@@ -644,20 +599,16 @@ export interface Requirement<TSignatureOrAction extends RequirementSignature | S
644
599
  readonly typedData: RequirementTypedData;
645
600
  };
646
601
  }
647
- /** Bundler3 token signature requirement. */
648
- export type Bundler3TokenSignatureRequirement = Requirement<PermitRequirementSignature>;
649
602
  /** ERC-2612 or Permit2 SignatureTransfer requirement consumed by a fixed bundles contract. */
650
603
  export type BundlesTokenSignatureRequirement = Requirement<BundlesTokenRequirementSignature>;
651
604
  /** Midnight Ecrecover offer-root signature requirement. */
652
605
  export type MidnightOfferRootRequirement = Requirement<MidnightOfferRootSignatureAction, MidnightOfferRootSignatureArgs>;
653
606
  /** Any token signature requirement supported by an SDK transaction route. */
654
- export type TokenSignatureRequirement = Bundler3TokenSignatureRequirement | BundlesTokenSignatureRequirement;
655
- /** Bundler3 token signature result. */
656
- export type Bundler3TokenRequirementSignature = PermitRequirementSignature;
607
+ export type TokenSignatureRequirement = BundlesTokenSignatureRequirement;
657
608
  /** Token signature result consumed by a fixed bundles contract. */
658
609
  export type BundlesTokenRequirementSignature = Erc2612RequirementSignature | Permit2SignatureTransferRequirementSignature;
659
610
  /** Any token signature result supported by an SDK transaction route. */
660
- export type TokenRequirementSignature = Bundler3TokenRequirementSignature | BundlesTokenRequirementSignature;
611
+ export type TokenRequirementSignature = BundlesTokenRequirementSignature;
661
612
  /** Any signature result returned by an action-output signature requirement. */
662
613
  export type AnyRequirementSignature = TokenRequirementSignature | AuthorizationRequirementSignature | MidnightOfferRootSignature;
663
614
  /** Any signature requirement returned by an entity action output. */
@@ -689,10 +640,10 @@ export declare function isRequirementSignature<T extends RequirementSignature =
689
640
  export declare function isRequirementSignature(requirement: CallRequirement | Requirement | undefined): requirement is Requirement;
690
641
  export declare function isRequirementSignature(requirement: ActionRequirement | undefined): requirement is SignatureRequirement;
691
642
  /**
692
- * Narrows a {@link RequirementSignature} to a permit / Permit2 token-approval signature.
643
+ * Narrows a {@link RequirementSignature} to an ERC-2612 permit signature.
693
644
  *
694
645
  * @param signature - The signed requirement to test.
695
- * @returns `true` when `signature.action.type` is `"permit"` or `"permit2"`.
646
+ * @returns `true` when `signature.action.type` is `"permit"`.
696
647
  */
697
648
  export declare function isPermitSignature(signature: RequirementSignature): signature is PermitRequirementSignature;
698
649
  /**
@@ -728,7 +679,7 @@ export declare function isAuthorizationSignature(signature: RequirementSignature
728
679
  export declare function isMidnightOfferRootSignature(signature: RequirementSignature): signature is MidnightOfferRootSignature;
729
680
  /** The typed requirement-signature slots a transaction builder consumes, split from a `buildTx` array. */
730
681
  export interface SelectedRequirementSignatures {
731
- /** The single ERC-2612 or Permit2 AllowanceTransfer signature, when present. */
682
+ /** The single ERC-2612 signature, when present. */
732
683
  readonly permit?: PermitRequirementSignature;
733
684
  /** The single Permit2 SignatureTransfer signature, when present. */
734
685
  readonly permit2SignatureTransfer?: Permit2SignatureTransferRequirementSignature;
@@ -748,12 +699,13 @@ export interface SelectedRequirementSignatures {
748
699
  *
749
700
  * @param signatures - The signatures passed to `buildTx`.
750
701
  * @param accepts - Which signature kinds this operation consumes.
751
- * @param accepts.permit - Whether an ERC-2612 or Permit2 AllowanceTransfer signature is consumed.
702
+ * @param accepts.permit - Whether an ERC-2612 signature is consumed.
752
703
  * @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
753
704
  * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
754
705
  * @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
755
706
  * @returns The accepted signature in each typed slot, when present.
756
707
  * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
708
+ * @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
757
709
  * @throws {UnexpectedRequirementSignatureError} when a signature of a kind the operation does not consume is present.
758
710
  * @example
759
711
  * ```ts
@@ -42,13 +42,13 @@ function isRequirementSignature(requirement) {
42
42
  typeof requirement.sign === "function");
43
43
  }
44
44
  /**
45
- * Narrows a {@link RequirementSignature} to a permit / Permit2 token-approval signature.
45
+ * Narrows a {@link RequirementSignature} to an ERC-2612 permit signature.
46
46
  *
47
47
  * @param signature - The signed requirement to test.
48
- * @returns `true` when `signature.action.type` is `"permit"` or `"permit2"`.
48
+ * @returns `true` when `signature.action.type` is `"permit"`.
49
49
  */
50
50
  function isPermitSignature(signature) {
51
- return (signature.action.type === "permit" || signature.action.type === "permit2");
51
+ return signature.action.type === "permit";
52
52
  }
53
53
  /**
54
54
  * Narrows a {@link RequirementSignature} to a Permit2 SignatureTransfer result.
@@ -98,12 +98,13 @@ function isMidnightOfferRootSignature(signature) {
98
98
  *
99
99
  * @param signatures - The signatures passed to `buildTx`.
100
100
  * @param accepts - Which signature kinds this operation consumes.
101
- * @param accepts.permit - Whether an ERC-2612 or Permit2 AllowanceTransfer signature is consumed.
101
+ * @param accepts.permit - Whether an ERC-2612 signature is consumed.
102
102
  * @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
103
103
  * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
104
104
  * @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
105
105
  * @returns The accepted signature in each typed slot, when present.
106
106
  * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
107
+ * @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
107
108
  * @throws {UnexpectedRequirementSignatureError} when a signature of a kind the operation does not consume is present.
108
109
  * @example
109
110
  * ```ts
@@ -122,6 +123,12 @@ function selectRequirementSignatures(signatures, accepts) {
122
123
  const permit2Transfers = signatures.filter(isPermit2SignatureTransferSignature);
123
124
  const authorizations = signatures.filter(isAuthorizationSignature);
124
125
  const midnightOfferRoots = signatures.filter(isMidnightOfferRootSignature);
126
+ const unsupported = signatures.find((signature) => !isPermitSignature(signature) &&
127
+ !isPermit2SignatureTransferSignature(signature) &&
128
+ !isAuthorizationSignature(signature) &&
129
+ !isMidnightOfferRootSignature(signature));
130
+ if (unsupported != null)
131
+ throw new error_js_1.UnsupportedRequirementSignatureError(unsupported.action.type);
125
132
  if (!accepts.permit && permits.length > 0)
126
133
  throw new error_js_1.UnexpectedRequirementSignatureError("permit");
127
134
  if (!accepts.permit2SignatureTransfer && permit2Transfers.length > 0)