@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
@@ -4,9 +4,8 @@ import { signAndVerifyTypedData } from "../../../helpers/signAndVerifyTypedData.
4
4
  import { validateDeadline, validateUserAddress, } from "../../../helpers/validate.js";
5
5
  import { ChainIdMismatchError, ExpiredDeadlineError, } from "../../../types/index.js";
6
6
  /**
7
- * Builds a Morpho authorization `Requirement` that, once signed, lets `authorized` operate on
8
- * Morpho on the signer's behalf. Bundler3 consumes the result through `setAuthorizationWithSig`;
9
- * BlueBundlesV1 embeds the same signed authorization in its direct-call struct.
7
+ * Builds a Morpho authorization `Requirement` that, once signed, lets BlueBundlesV1 operate on
8
+ * Morpho on the signer's behalf.
10
9
  *
11
10
  * The returned `Requirement.sign()` produces the EIP-712 signature over Morpho's `Authorization`
12
11
  * typed data, verifies it against the connected account, and returns a deep-frozen
@@ -17,7 +16,7 @@ import { ChainIdMismatchError, ExpiredDeadlineError, } from "../../../types/inde
17
16
  * @param viemClient - Connected viem `Client` whose `chain.id` matches `params.chainId`.
18
17
  * @param params - Authorization encoding parameters.
19
18
  * @param params.owner - Account granting the authorization and signing it (the Morpho `authorizer`).
20
- * @param params.authorized - Operator to authorize, such as GeneralAdapter1 or BlueBundlesV1.
19
+ * @param params.authorized - BlueBundlesV1 operator to authorize.
21
20
  * @param params.chainId - Target chain id.
22
21
  * @param params.nonce - The owner's current Morpho authorization nonce.
23
22
  * @param params.isAuthorized - Grant (`true`, default) or revoke (`false`).
@@ -41,7 +40,7 @@ import { ChainIdMismatchError, ExpiredDeadlineError, } from "../../../types/inde
41
40
  * const client = createWalletClient({ chain: mainnet, transport: http() });
42
41
  * const requirement = await encodeBlueSignatureAuthorization(client, {
43
42
  * owner,
44
- * authorized: generalAdapter1,
43
+ * authorized: blueBundlesV1,
45
44
  * chainId: 1,
46
45
  * nonce: 0n,
47
46
  * });
@@ -11,12 +11,12 @@ interface EncodeErc20ApprovalParams {
11
11
  * Encodes a deep-frozen ERC-20 approval transaction for a supported SDK spender.
12
12
  *
13
13
  * Caps `amount` at the per-chain, per-token maximum from `MAX_TOKEN_APPROVALS` (defaults to
14
- * `maxUint256`). Used by {@link getRequirementsApproval} and {@link getGeneralAdapterRequirementsPermit2}.
14
+ * `maxUint256`). Used by {@link getRequirementsApproval}.
15
15
  *
16
16
  * @param params - Encoding parameters.
17
17
  * @param params.token - ERC-20 token address to approve.
18
- * @param params.spender - Address granted the allowance. Must be GeneralAdapter1, Permit2,
19
- * Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for the chain.
18
+ * @param params.spender - Address granted the allowance. Must be Permit2, Midnight,
19
+ * MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for the chain.
20
20
  * @param params.amount - Allowance amount before per-token cap.
21
21
  * @param params.chainId - The chain the transaction targets (used to resolve supported spenders and the per-token cap).
22
22
  * @returns A deep-frozen `Transaction<ERC20ApprovalAction>` with the capped approval amount.
@@ -28,7 +28,7 @@ interface EncodeErc20ApprovalParams {
28
28
  *
29
29
  * const tx = encodeErc20Approval({
30
30
  * token: USDC,
31
- * spender: generalAdapter1,
31
+ * spender: blueBundlesV1,
32
32
  * amount: 1_000_000n,
33
33
  * chainId: 1,
34
34
  * });
@@ -7,12 +7,12 @@ import { validateRequirementSpender } from "../../../helpers/validateRequirement
7
7
  * Encodes a deep-frozen ERC-20 approval transaction for a supported SDK spender.
8
8
  *
9
9
  * Caps `amount` at the per-chain, per-token maximum from `MAX_TOKEN_APPROVALS` (defaults to
10
- * `maxUint256`). Used by {@link getRequirementsApproval} and {@link getGeneralAdapterRequirementsPermit2}.
10
+ * `maxUint256`). Used by {@link getRequirementsApproval}.
11
11
  *
12
12
  * @param params - Encoding parameters.
13
13
  * @param params.token - ERC-20 token address to approve.
14
- * @param params.spender - Address granted the allowance. Must be GeneralAdapter1, Permit2,
15
- * Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for the chain.
14
+ * @param params.spender - Address granted the allowance. Must be Permit2, Midnight,
15
+ * MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for the chain.
16
16
  * @param params.amount - Allowance amount before per-token cap.
17
17
  * @param params.chainId - The chain the transaction targets (used to resolve supported spenders and the per-token cap).
18
18
  * @returns A deep-frozen `Transaction<ERC20ApprovalAction>` with the capped approval amount.
@@ -24,7 +24,7 @@ import { validateRequirementSpender } from "../../../helpers/validateRequirement
24
24
  *
25
25
  * const tx = encodeErc20Approval({
26
26
  * token: USDC,
27
- * spender: generalAdapter1,
27
+ * spender: blueBundlesV1,
28
28
  * amount: 1_000_000n,
29
29
  * chainId: 1,
30
30
  * });
@@ -38,7 +38,6 @@ export const encodeErc20Approval = (params) => {
38
38
  chainId,
39
39
  spender,
40
40
  allowed: [
41
- "generalAdapter1",
42
41
  "permit2",
43
42
  "midnight",
44
43
  "midnightBundles",
@@ -27,8 +27,8 @@ interface EncodeErc20PermitParams {
27
27
  * @param params - Permit encoding parameters.
28
28
  * @param params.token - ERC-20 token address (must support EIP-2612).
29
29
  * @param params.owner - Account that owns the tokens and signs the permit.
30
- * @param params.spender - Permit spender. Must be GeneralAdapter1, MidnightBundles,
31
- * VaultBundlesV1, or BlueBundlesV1 for the chain.
30
+ * @param params.spender - Permit spender. Must be MidnightBundles, VaultBundlesV1, or
31
+ * BlueBundlesV1 for the chain.
32
32
  * @param params.amount - Permit allowance amount.
33
33
  * @param params.chainId - Target chain id.
34
34
  * @param params.nonce - The owner's current EIP-2612 nonce on `token`.
@@ -38,8 +38,8 @@ interface EncodeErc20PermitParams {
38
38
  * `sign(client, userAddress)` produces the deep-frozen signature.
39
39
  * @throws {ChainIdMismatchError} when `viemClient.chain?.id !== params.chainId`.
40
40
  * @throws {UnsupportedChainIdError} when `chainId` is absent from the address registry.
41
- * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not GeneralAdapter1,
42
- * MidnightBundles, VaultBundlesV1, or BlueBundlesV1 for `chainId`.
41
+ * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not MidnightBundles,
42
+ * VaultBundlesV1, or BlueBundlesV1 for `chainId`.
43
43
  * @throws {NonPositiveInputError} when an explicit `deadline` is not positive.
44
44
  * @throws {InputExceedsMaxError} when an explicit `deadline` exceeds `uint256`.
45
45
  * @throws {ExpiredDeadlineError} when an explicit `deadline` is positive but not in the future.
@@ -58,7 +58,7 @@ interface EncodeErc20PermitParams {
58
58
  * const requirement = await encodeErc20Permit(client, {
59
59
  * token: USDC, // Must implement standard ERC-2612. DAI is routed through Permit2 by requirement helpers.
60
60
  * owner,
61
- * spender: generalAdapter1,
61
+ * spender: blueBundlesV1,
62
62
  * amount: 1_000_000n,
63
63
  * chainId: 1,
64
64
  * nonce: 0n,
@@ -18,8 +18,8 @@ import { ChainIdMismatchError, ExpiredDeadlineError, } from "../../../types/inde
18
18
  * @param params - Permit encoding parameters.
19
19
  * @param params.token - ERC-20 token address (must support EIP-2612).
20
20
  * @param params.owner - Account that owns the tokens and signs the permit.
21
- * @param params.spender - Permit spender. Must be GeneralAdapter1, MidnightBundles,
22
- * VaultBundlesV1, or BlueBundlesV1 for the chain.
21
+ * @param params.spender - Permit spender. Must be MidnightBundles, VaultBundlesV1, or
22
+ * BlueBundlesV1 for the chain.
23
23
  * @param params.amount - Permit allowance amount.
24
24
  * @param params.chainId - Target chain id.
25
25
  * @param params.nonce - The owner's current EIP-2612 nonce on `token`.
@@ -29,8 +29,8 @@ import { ChainIdMismatchError, ExpiredDeadlineError, } from "../../../types/inde
29
29
  * `sign(client, userAddress)` produces the deep-frozen signature.
30
30
  * @throws {ChainIdMismatchError} when `viemClient.chain?.id !== params.chainId`.
31
31
  * @throws {UnsupportedChainIdError} when `chainId` is absent from the address registry.
32
- * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not GeneralAdapter1,
33
- * MidnightBundles, VaultBundlesV1, or BlueBundlesV1 for `chainId`.
32
+ * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not MidnightBundles,
33
+ * VaultBundlesV1, or BlueBundlesV1 for `chainId`.
34
34
  * @throws {NonPositiveInputError} when an explicit `deadline` is not positive.
35
35
  * @throws {InputExceedsMaxError} when an explicit `deadline` exceeds `uint256`.
36
36
  * @throws {ExpiredDeadlineError} when an explicit `deadline` is positive but not in the future.
@@ -49,7 +49,7 @@ import { ChainIdMismatchError, ExpiredDeadlineError, } from "../../../types/inde
49
49
  * const requirement = await encodeErc20Permit(client, {
50
50
  * token: USDC, // Must implement standard ERC-2612. DAI is routed through Permit2 by requirement helpers.
51
51
  * owner,
52
- * spender: generalAdapter1,
52
+ * spender: blueBundlesV1,
53
53
  * amount: 1_000_000n,
54
54
  * chainId: 1,
55
55
  * nonce: 0n,
@@ -67,12 +67,7 @@ export const encodeErc20Permit = async (viemClient, params) => {
67
67
  validateRequirementSpender({
68
68
  chainId,
69
69
  spender,
70
- allowed: [
71
- "generalAdapter1",
72
- "midnightBundles",
73
- "vaultBundlesV1",
74
- "blueBundlesV1",
75
- ],
70
+ allowed: ["midnightBundles", "vaultBundlesV1", "blueBundlesV1"],
76
71
  });
77
72
  const now = Time.timestamp();
78
73
  // Validate an explicit deadline before the token-metadata read: this exported encoder can be
@@ -1,6 +1,5 @@
1
1
  export * from "./encodeBlueSignatureAuthorization.js";
2
2
  export * from "./encodeErc20Approval.js";
3
3
  export * from "./encodeErc20Permit.js";
4
- export * from "./encodeErc20Permit2Approve.js";
5
4
  export * from "./encodeErc20Permit2SignatureTransfer.js";
6
5
  export * from "./encodeVaultSharesPermit.js";
@@ -1,6 +1,5 @@
1
1
  export * from "./encodeBlueSignatureAuthorization.js";
2
2
  export * from "./encodeErc20Approval.js";
3
3
  export * from "./encodeErc20Permit.js";
4
- export * from "./encodeErc20Permit2Approve.js";
5
4
  export * from "./encodeErc20Permit2SignatureTransfer.js";
6
5
  export * from "./encodeVaultSharesPermit.js";
@@ -5,8 +5,8 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
5
5
  * allowance.
6
6
  *
7
7
  * The spender is validated by {@link encodeErc20Approval}. Supported spenders are the chain's
8
- * GeneralAdapter1, Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, and
9
- * BlueBundlesV1 addresses when configured.
8
+ * Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, and BlueBundlesV1
9
+ * addresses when configured.
10
10
  *
11
11
  * Returns an empty array when the allowance already covers `spendAmount`. When the token is in
12
12
  * `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
@@ -19,9 +19,8 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
19
19
  * @param params.args.spendAmount - The amount the bundle will actually pull.
20
20
  * @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
21
21
  * may be `maxUint256` for reusable Permit2 or saturated-share-repay approvals).
22
- * @param params.args.spender - Address that will be granted the approval. Must be GeneralAdapter1,
23
- * Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for
24
- * `chainId`.
22
+ * @param params.args.spender - Address that will be granted the approval. Must be Permit2,
23
+ * Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for `chainId`.
25
24
  * @param params.allowances - The user's current allowance of `address` for `spender`.
26
25
  * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
27
26
  * followed by the new approval. Empty when no approval is needed.
@@ -35,7 +34,7 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
35
34
  * const txs = getRequirementsApproval({
36
35
  * address: USDC,
37
36
  * chainId: 1,
38
- * args: { approvalAmount: 1_000_000n, spendAmount: 1_000_000n, spender: generalAdapter1 },
37
+ * args: { approvalAmount: 1_000_000n, spendAmount: 1_000_000n, spender: blueBundlesV1 },
39
38
  * allowances: 0n,
40
39
  * });
41
40
  * // txs satisfies Readonly<Transaction<ERC20ApprovalAction>>[]
@@ -7,8 +7,8 @@ import { encodeErc20Approval } from "./encode/encodeErc20Approval.js";
7
7
  * allowance.
8
8
  *
9
9
  * The spender is validated by {@link encodeErc20Approval}. Supported spenders are the chain's
10
- * GeneralAdapter1, Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, and
11
- * BlueBundlesV1 addresses when configured.
10
+ * Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, and BlueBundlesV1
11
+ * addresses when configured.
12
12
  *
13
13
  * Returns an empty array when the allowance already covers `spendAmount`. When the token is in
14
14
  * `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
@@ -21,9 +21,8 @@ import { encodeErc20Approval } from "./encode/encodeErc20Approval.js";
21
21
  * @param params.args.spendAmount - The amount the bundle will actually pull.
22
22
  * @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
23
23
  * may be `maxUint256` for reusable Permit2 or saturated-share-repay approvals).
24
- * @param params.args.spender - Address that will be granted the approval. Must be GeneralAdapter1,
25
- * Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for
26
- * `chainId`.
24
+ * @param params.args.spender - Address that will be granted the approval. Must be Permit2,
25
+ * Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for `chainId`.
27
26
  * @param params.allowances - The user's current allowance of `address` for `spender`.
28
27
  * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
29
28
  * followed by the new approval. Empty when no approval is needed.
@@ -37,7 +36,7 @@ import { encodeErc20Approval } from "./encode/encodeErc20Approval.js";
37
36
  * const txs = getRequirementsApproval({
38
37
  * address: USDC,
39
38
  * chainId: 1,
40
- * args: { approvalAmount: 1_000_000n, spendAmount: 1_000_000n, spender: generalAdapter1 },
39
+ * args: { approvalAmount: 1_000_000n, spendAmount: 1_000_000n, spender: blueBundlesV1 },
41
40
  * allowances: 0n,
42
41
  * });
43
42
  * // txs satisfies Readonly<Transaction<ERC20ApprovalAction>>[]
@@ -1,5 +1,4 @@
1
1
  export * from "./blue/index.js";
2
2
  export * from "./encode/index.js";
3
- export * from "./generalAdapter/index.js";
4
3
  export * from "./getRequirementsApproval.js";
5
4
  export * from "./midnight/index.js";
@@ -1,5 +1,4 @@
1
1
  export * from "./blue/index.js";
2
2
  export * from "./encode/index.js";
3
- export * from "./generalAdapter/index.js";
4
3
  export * from "./getRequirementsApproval.js";
5
4
  export * from "./midnight/index.js";
@@ -52,8 +52,7 @@ export interface VaultV1DepositParams {
52
52
  * @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
53
53
  * {@link InputExceedsMaxError}, so either class catches it.
54
54
  * @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
55
- * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit or a
56
- * Permit2 AllowanceTransfer signature is supplied.
55
+ * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit.
57
56
  * @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
58
57
  * @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
59
58
  * @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
@@ -38,8 +38,7 @@ import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets, getBund
38
38
  * @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
39
39
  * {@link InputExceedsMaxError}, so either class catches it.
40
40
  * @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
41
- * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit or a
42
- * Permit2 AllowanceTransfer signature is supplied.
41
+ * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit.
43
42
  * @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
44
43
  * @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
45
44
  * @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
@@ -27,20 +27,22 @@ export interface VaultV1InKindRedeemParams {
27
27
  * @param params.vault.address - Target Vault V1 address.
28
28
  * @param params.args.amount - Asset-denominated amount to exit.
29
29
  * @param params.args.marketParamsList - Ordered markets consumed greedily by the contract.
30
- * @param params.args.userAddress - Expected transaction sender, recorded in action metadata only.
31
- * VaultExitBundlesV1 burns `msg.sender`'s vault shares, so the submitting account must equal this
32
- * address.
30
+ * @param params.args.userAddress - Redeeming account, recorded in action metadata and validated as
31
+ * the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
32
+ * `msg.sender`'s vault shares, so the submitting account must equal this address.
33
33
  * @param params.args.deadline - Permit and bundle deadline.
34
34
  * @param params.args.requirementSignature - Optional bounded Vault V1 shares permit.
35
35
  * @param params.metadata - Optional analytics metadata.
36
36
  * @returns A deep-frozen `Readonly<Transaction<VaultV1InKindRedeemAction>>` with `to`, `value`,
37
37
  * `data`, and the typed action discriminator.
38
38
  * @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
39
- * @throws {InputExceedsMaxError} when `deadline` exceeds `uint256`.
39
+ * @throws {InputExceedsMaxError} when the bundle or permit deadline exceeds `uint256`.
40
40
  * @throws {EmptyMarketParamsListError} when no markets are supplied.
41
41
  * @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
42
42
  * @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
43
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
43
+ * @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind, asset, owner,
44
+ * spender, or signature encoding, or when its signed and action amounts, deadlines, or a supplied
45
+ * action nonce disagree.
44
46
  * @example
45
47
  * ```ts
46
48
  * import { vaultV1InKindRedeem } from "@morpho-org/morpho-sdk";
@@ -4,7 +4,7 @@ import { vaultExitBundlesV1Abi } from "../../abis.js";
4
4
  import { addTransactionMetadata } from "../../helpers/index.js";
5
5
  import { validateDeadline } from "../../helpers/validate.js";
6
6
  import { EmptyMarketParamsListError, NonPositiveInputError, } from "../../types/index.js";
7
- import { getVaultExitBundlesV1PermitStruct } from "../signatures/getVaultExitBundlesV1PermitStruct.js";
7
+ import { getBundlesSharesPermit } from "../bundles/common.js";
8
8
  /**
9
9
  * Prepares a Vault V1 in-kind redemption into Morpho Blue supply positions.
10
10
  *
@@ -16,20 +16,22 @@ import { getVaultExitBundlesV1PermitStruct } from "../signatures/getVaultExitBun
16
16
  * @param params.vault.address - Target Vault V1 address.
17
17
  * @param params.args.amount - Asset-denominated amount to exit.
18
18
  * @param params.args.marketParamsList - Ordered markets consumed greedily by the contract.
19
- * @param params.args.userAddress - Expected transaction sender, recorded in action metadata only.
20
- * VaultExitBundlesV1 burns `msg.sender`'s vault shares, so the submitting account must equal this
21
- * address.
19
+ * @param params.args.userAddress - Redeeming account, recorded in action metadata and validated as
20
+ * the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
21
+ * `msg.sender`'s vault shares, so the submitting account must equal this address.
22
22
  * @param params.args.deadline - Permit and bundle deadline.
23
23
  * @param params.args.requirementSignature - Optional bounded Vault V1 shares permit.
24
24
  * @param params.metadata - Optional analytics metadata.
25
25
  * @returns A deep-frozen `Readonly<Transaction<VaultV1InKindRedeemAction>>` with `to`, `value`,
26
26
  * `data`, and the typed action discriminator.
27
27
  * @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
28
- * @throws {InputExceedsMaxError} when `deadline` exceeds `uint256`.
28
+ * @throws {InputExceedsMaxError} when the bundle or permit deadline exceeds `uint256`.
29
29
  * @throws {EmptyMarketParamsListError} when no markets are supplied.
30
30
  * @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
31
31
  * @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
32
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
32
+ * @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind, asset, owner,
33
+ * spender, or signature encoding, or when its signed and action amounts, deadlines, or a supplied
34
+ * action nonce disagree.
33
35
  * @example
34
36
  * ```ts
35
37
  * import { vaultV1InKindRedeem } from "@morpho-org/morpho-sdk";
@@ -55,9 +57,11 @@ export const vaultV1InKindRedeem = ({ vault, args, metadata, }) => {
55
57
  irm: marketParams.irm,
56
58
  lltv: marketParams.lltv,
57
59
  }));
58
- const sharesPermit = getVaultExitBundlesV1PermitStruct({
60
+ const sharesPermit = getBundlesSharesPermit({
59
61
  vault: vault.address,
60
62
  deadline: args.deadline,
63
+ owner: args.userAddress,
64
+ spender: to,
61
65
  requirementSignature: args.requirementSignature,
62
66
  });
63
67
  let tx = {
@@ -52,8 +52,7 @@ export interface VaultV2DepositParams {
52
52
  * @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
53
53
  * {@link InputExceedsMaxError}, so either class catches it.
54
54
  * @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
55
- * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit or a
56
- * Permit2 AllowanceTransfer signature is supplied.
55
+ * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit.
57
56
  * @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
58
57
  * @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
59
58
  * @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
@@ -38,8 +38,7 @@ import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets, getBund
38
38
  * @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
39
39
  * {@link InputExceedsMaxError}, so either class catches it.
40
40
  * @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
41
- * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit or a
42
- * Permit2 AllowanceTransfer signature is supplied.
41
+ * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit.
43
42
  * @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
44
43
  * @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
45
44
  * @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
@@ -61,7 +61,7 @@ export interface VaultV2ForceWithdrawParams {
61
61
  * @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
62
62
  * @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
63
63
  * @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
64
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind,
64
+ * @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind,
65
65
  * asset, owner, spender, or signature encoding.
66
66
  * @example
67
67
  * ```ts
@@ -4,7 +4,7 @@ import { vaultExitBundlesV1Abi } from "../../abis.js";
4
4
  import { addTransactionMetadata } from "../../helpers/index.js";
5
5
  import { validateDeadline, validateReferralFee, validateUint256Field, } from "../../helpers/validate.js";
6
6
  import { NonPositiveInputError, } from "../../types/index.js";
7
- import { getVaultExitBundlesV1PermitStruct } from "../signatures/getVaultExitBundlesV1PermitStruct.js";
7
+ import { getBundlesSharesPermit } from "../bundles/common.js";
8
8
  /**
9
9
  * Prepares a Vault V2 force withdrawal through VaultExitBundlesV1.
10
10
  *
@@ -48,7 +48,7 @@ import { getVaultExitBundlesV1PermitStruct } from "../signatures/getVaultExitBun
48
48
  * @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
49
49
  * @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
50
50
  * @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
51
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind,
51
+ * @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind,
52
52
  * asset, owner, spender, or signature encoding.
53
53
  * @example
54
54
  * ```ts
@@ -72,7 +72,7 @@ export const vaultV2ForceWithdraw = ({ vault, args, metadata, }) => {
72
72
  validateUint256Field("minSharePriceE27", args.minSharePriceE27);
73
73
  const { referralFeePct, referralFeeRecipient } = validateReferralFee(args);
74
74
  const to = getChainAddress(vault.chainId, "bundles.vaultExitBundlesV1");
75
- const sharesPermit = getVaultExitBundlesV1PermitStruct({
75
+ const sharesPermit = getBundlesSharesPermit({
76
76
  vault: vault.address,
77
77
  deadline: args.deadline,
78
78
  owner: args.userAddress,
@@ -30,19 +30,21 @@ export interface VaultV2InKindRedeemParams {
30
30
  * @param params.args.amount - Penalty-inclusive, asset-denominated amount to exit.
31
31
  * @param params.args.marketParamsList - Ordered markets consumed greedily after idle assets. May be
32
32
  * empty when the vault's idle balance covers `amount`.
33
- * @param params.args.userAddress - Expected transaction sender, recorded in action metadata only.
34
- * VaultExitBundlesV1 burns `msg.sender`'s vault shares, so the submitting account must equal this
35
- * address.
33
+ * @param params.args.userAddress - Redeeming account, recorded in action metadata and validated as
34
+ * the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
35
+ * `msg.sender`'s vault shares, so the submitting account must equal this address.
36
36
  * @param params.args.deadline - Permit and bundle deadline.
37
37
  * @param params.args.requirementSignature - Optional bounded Vault V2 shares permit.
38
38
  * @param params.metadata - Optional analytics metadata.
39
39
  * @returns A deep-frozen `Readonly<Transaction<VaultV2InKindRedeemAction>>` with `to`, `value`,
40
40
  * `data`, and the typed action discriminator.
41
41
  * @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
42
- * @throws {InputExceedsMaxError} when `deadline` exceeds `uint256`.
42
+ * @throws {InputExceedsMaxError} when the bundle or permit deadline exceeds `uint256`.
43
43
  * @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
44
44
  * @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
45
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
45
+ * @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind, asset, owner,
46
+ * spender, or signature encoding, or when its signed and action amounts, deadlines, or a supplied
47
+ * action nonce disagree.
46
48
  * @example
47
49
  * ```ts
48
50
  * import { vaultV2InKindRedeem } from "@morpho-org/morpho-sdk";
@@ -4,7 +4,7 @@ import { vaultExitBundlesV1Abi } from "../../abis.js";
4
4
  import { addTransactionMetadata } from "../../helpers/index.js";
5
5
  import { validateDeadline } from "../../helpers/validate.js";
6
6
  import { NonPositiveInputError, } from "../../types/index.js";
7
- import { getVaultExitBundlesV1PermitStruct } from "../signatures/getVaultExitBundlesV1PermitStruct.js";
7
+ import { getBundlesSharesPermit } from "../bundles/common.js";
8
8
  /**
9
9
  * Prepares a Vault V2 in-kind redemption into idle assets and Morpho Blue supply positions.
10
10
  *
@@ -18,19 +18,21 @@ import { getVaultExitBundlesV1PermitStruct } from "../signatures/getVaultExitBun
18
18
  * @param params.args.amount - Penalty-inclusive, asset-denominated amount to exit.
19
19
  * @param params.args.marketParamsList - Ordered markets consumed greedily after idle assets. May be
20
20
  * empty when the vault's idle balance covers `amount`.
21
- * @param params.args.userAddress - Expected transaction sender, recorded in action metadata only.
22
- * VaultExitBundlesV1 burns `msg.sender`'s vault shares, so the submitting account must equal this
23
- * address.
21
+ * @param params.args.userAddress - Redeeming account, recorded in action metadata and validated as
22
+ * the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
23
+ * `msg.sender`'s vault shares, so the submitting account must equal this address.
24
24
  * @param params.args.deadline - Permit and bundle deadline.
25
25
  * @param params.args.requirementSignature - Optional bounded Vault V2 shares permit.
26
26
  * @param params.metadata - Optional analytics metadata.
27
27
  * @returns A deep-frozen `Readonly<Transaction<VaultV2InKindRedeemAction>>` with `to`, `value`,
28
28
  * `data`, and the typed action discriminator.
29
29
  * @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
30
- * @throws {InputExceedsMaxError} when `deadline` exceeds `uint256`.
30
+ * @throws {InputExceedsMaxError} when the bundle or permit deadline exceeds `uint256`.
31
31
  * @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
32
32
  * @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
33
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
33
+ * @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind, asset, owner,
34
+ * spender, or signature encoding, or when its signed and action amounts, deadlines, or a supplied
35
+ * action nonce disagree.
34
36
  * @example
35
37
  * ```ts
36
38
  * import { vaultV2InKindRedeem } from "@morpho-org/morpho-sdk";
@@ -54,9 +56,11 @@ export const vaultV2InKindRedeem = ({ vault, args, metadata, }) => {
54
56
  irm: marketParams.irm,
55
57
  lltv: marketParams.lltv,
56
58
  }));
57
- const sharesPermit = getVaultExitBundlesV1PermitStruct({
59
+ const sharesPermit = getBundlesSharesPermit({
58
60
  vault: vault.address,
59
61
  deadline: args.deadline,
62
+ owner: args.userAddress,
63
+ spender: to,
60
64
  requirementSignature: args.requirementSignature,
61
65
  });
62
66
  let tx = {
@@ -3,6 +3,7 @@ import { fetchAccrualPosition, fetchPreLiquidationPosition } from "@morpho-org/b
3
3
  declare module "@morpho-org/blue-sdk" {
4
4
  namespace AccrualPosition {
5
5
  let fetch: typeof fetchAccrualPosition;
6
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
7
  let fetchPreLiquidation: typeof fetchPreLiquidationPosition;
7
8
  }
8
9
  }
@@ -10,5 +10,4 @@ import "./augment/Vault.js";
10
10
  import "./augment/VaultConfig.js";
11
11
  import "./augment/VaultMarketAllocation.js";
12
12
  import "./augment/VaultMarketConfig.js";
13
- import "./augment/VaultMarketPublicAllocatorConfig.js";
14
13
  import "./augment/VaultUser.js";
@@ -10,5 +10,4 @@ import "./augment/Vault.js";
10
10
  import "./augment/VaultConfig.js";
11
11
  import "./augment/VaultMarketAllocation.js";
12
12
  import "./augment/VaultMarketConfig.js";
13
- import "./augment/VaultMarketPublicAllocatorConfig.js";
14
13
  import "./augment/VaultUser.js";
@@ -1,6 +1,6 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi,
3
- /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
4
- publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
5
- /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
6
- vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
+ preLiquidationAbi,
5
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
+ preLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
@@ -1,6 +1,6 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi,
3
- /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
4
- publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
5
- /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
6
- vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
+ preLiquidationAbi,
5
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
+ preLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
@@ -1,8 +1,10 @@
1
- export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition, IPreLiquidationParams, IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig,
2
- /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `IVaultV2BlueMarketPublicAllocatorConfig`. */
3
- IVaultMarketPublicAllocatorConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType,
4
- /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `IVaultV2BluePublicAllocatorConfig`. */
5
- VaultPublicAllocatorConfig, } from "@morpho-org/blue-sdk";
6
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position, PreLiquidationParams, PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig,
7
- /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig`. */
8
- VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
1
+ export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ IPreLiquidationParams,
4
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
+ IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
6
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
7
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
8
+ PreLiquidationParams,
9
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
10
+ PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1,3 +1,5 @@
1
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position, PreLiquidationParams, PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig,
2
- /** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `VaultV2BlueMarketPublicAllocatorConfig`. */
3
- VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
1
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ PreLiquidationParams,
4
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
+ PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1,2 +1,4 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError, UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
2
- export { getUnsupportedVaultV2Adapter, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";