@morpho-org/morpho-sdk 10.0.0-next.0 → 10.0.0

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 (282) hide show
  1. package/README.md +104 -12
  2. package/lib/cjs/abis.d.ts +1 -1
  3. package/lib/cjs/abis.js +1 -5
  4. package/lib/cjs/actions/blue/common.js +4 -2
  5. package/lib/cjs/actions/blue/withdrawBuyCallback.js +2 -1
  6. package/lib/cjs/actions/bundles/common.js +20 -14
  7. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +2 -1
  8. package/lib/cjs/actions/midnight/cancelOffers.js +2 -1
  9. package/lib/cjs/actions/midnight/supplyCollateralBatch.js +4 -2
  10. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +2 -1
  11. package/lib/cjs/actions/midnight/takeBorrow.js +2 -1
  12. package/lib/cjs/actions/midnight/takeLend.js +2 -1
  13. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +2 -1
  14. package/lib/cjs/actions/midnight/takeWithdraw.js +2 -1
  15. package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +4 -2
  16. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +2 -11
  17. package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +2 -1
  18. package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +2 -1
  19. package/lib/cjs/actions/vaultV1/inKindRedeem.js +6 -3
  20. package/lib/cjs/actions/vaultV1/migrateToV2.js +1 -1
  21. package/lib/cjs/actions/vaultV2/forceWithdraw.js +4 -2
  22. package/lib/cjs/actions/vaultV2/inKindRedeem.js +4 -2
  23. package/lib/cjs/blue/abis.d.ts +1 -1
  24. package/lib/cjs/blue/abis.js +1 -5
  25. package/lib/cjs/blue/entities.d.ts +4 -4
  26. package/lib/cjs/blue/entities.js +1 -3
  27. package/lib/cjs/blue/errors.d.ts +2 -2
  28. package/lib/cjs/blue/errors.js +1 -5
  29. package/lib/cjs/blue/fetch.d.ts +2 -2
  30. package/lib/cjs/blue/fetch.js +1 -3
  31. package/lib/cjs/blue/utils.d.ts +1 -1
  32. package/lib/cjs/blue/utils.js +1 -2
  33. package/lib/cjs/entities/blue/blue.js +8 -4
  34. package/lib/cjs/entities/index.d.ts +4 -4
  35. package/lib/cjs/entities/index.js +1 -3
  36. package/lib/cjs/entities/midnight/deadline.js +2 -1
  37. package/lib/cjs/entities/midnight/midnight.js +14 -7
  38. package/lib/cjs/entities/midnight/publication.js +73 -44
  39. package/lib/cjs/entities/requirements/assertContractCode.js +4 -2
  40. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +9 -13
  41. package/lib/cjs/entities/requirements/getErc2612Permit.js +10 -5
  42. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +2 -0
  43. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +7 -1
  44. package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.d.ts +21 -0
  45. package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.js +111 -0
  46. package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.d.ts +20 -0
  47. package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.js +76 -0
  48. package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.d.ts +21 -0
  49. package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.js +93 -0
  50. package/lib/cjs/entities/vaultV1/inKindRedeemQuote.d.ts +25 -0
  51. package/lib/cjs/entities/vaultV1/inKindRedeemQuote.js +85 -0
  52. package/lib/cjs/entities/vaultV1/migrateToV2Quote.d.ts +20 -0
  53. package/lib/cjs/entities/vaultV1/migrateToV2Quote.js +37 -0
  54. package/lib/cjs/entities/vaultV1/vaultV1.js +51 -181
  55. package/lib/cjs/entities/vaultV2/forceWithdrawQuote.d.ts +25 -0
  56. package/lib/cjs/entities/vaultV2/forceWithdrawQuote.js +189 -0
  57. package/lib/cjs/entities/vaultV2/inKindRedeemQuote.d.ts +28 -0
  58. package/lib/cjs/entities/vaultV2/inKindRedeemQuote.js +110 -0
  59. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +8 -34
  60. package/lib/cjs/entities/vaultV2/vaultV2.js +62 -429
  61. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +2 -3
  62. package/lib/cjs/entities/vaultV2BlueReallocationData.js +346 -234
  63. package/lib/cjs/errors.d.ts +4 -4
  64. package/lib/cjs/errors.js +6 -7
  65. package/lib/cjs/fetch.d.ts +2 -2
  66. package/lib/cjs/fetch.js +1 -3
  67. package/lib/cjs/helpers/deadShares.js +34 -19
  68. package/lib/cjs/helpers/encodeMidnightCalldata.js +4 -2
  69. package/lib/cjs/helpers/metadata.js +12 -6
  70. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +10 -5
  71. package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +6 -3
  72. package/lib/cjs/helpers/utilization.js +10 -5
  73. package/lib/cjs/helpers/validate.js +12 -6
  74. package/lib/cjs/helpers/validateMidnightBounds.js +2 -1
  75. package/lib/cjs/helpers/validateMidnightCollateralBatch.js +2 -1
  76. package/lib/cjs/helpers/validateMidnightPublication.js +4 -2
  77. package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +44 -22
  78. package/lib/cjs/helpers/validatePositiveInput.js +2 -1
  79. package/lib/cjs/helpers/validateTakeableOffers.js +2 -1
  80. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +14 -7
  81. package/lib/cjs/index.d.ts +2 -2
  82. package/lib/cjs/index.js +10 -1
  83. package/lib/cjs/midnight/errors.d.ts +1 -2
  84. package/lib/cjs/midnight/errors.js +4 -5
  85. package/lib/cjs/transactionPlan/approval.js +12 -1
  86. package/lib/cjs/transactionPlan/deposit.d.ts +22 -0
  87. package/lib/cjs/transactionPlan/deposit.js +139 -0
  88. package/lib/cjs/transactionPlan/error.d.ts +10 -8
  89. package/lib/cjs/transactionPlan/error.js +10 -8
  90. package/lib/cjs/transactionPlan/getTokenPermit.js +2 -1
  91. package/lib/cjs/transactionPlan/index.d.ts +18 -0
  92. package/lib/cjs/transactionPlan/index.js +23 -5
  93. package/lib/cjs/transactionPlan/intent.d.ts +3 -3
  94. package/lib/cjs/transactionPlan/intent.js +14 -7
  95. package/lib/cjs/transactionPlan/permit.d.ts +1 -1
  96. package/lib/cjs/transactionPlan/permit.js +86 -20
  97. package/lib/cjs/transactionPlan/plan.d.ts +16 -6
  98. package/lib/cjs/transactionPlan/plan.js +72 -22
  99. package/lib/cjs/transactionPlan/redeem.d.ts +18 -0
  100. package/lib/cjs/transactionPlan/redeem.js +63 -0
  101. package/lib/cjs/transactionPlan/requirements.d.ts +4 -3
  102. package/lib/cjs/transactionPlan/requirements.js +12 -6
  103. package/lib/cjs/transactionPlan/serde.d.ts +2 -2
  104. package/lib/cjs/transactionPlan/serde.js +41 -15
  105. package/lib/cjs/transactionPlan/shareSpending.d.ts +18 -0
  106. package/lib/cjs/transactionPlan/shareSpending.js +50 -0
  107. package/lib/cjs/transactionPlan/types.d.ts +117 -11
  108. package/lib/cjs/transactionPlan/validateActions.js +11 -1
  109. package/lib/cjs/transactionPlan/validation.js +6 -3
  110. package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +93 -0
  111. package/lib/cjs/transactionPlan/vaultv1/deposit.js +94 -0
  112. package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.d.ts +96 -0
  113. package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.js +203 -0
  114. package/lib/cjs/transactionPlan/vaultv1/migrateToV2.d.ts +94 -0
  115. package/lib/cjs/transactionPlan/vaultv1/migrateToV2.js +217 -0
  116. package/lib/cjs/transactionPlan/vaultv1/redeem.d.ts +69 -0
  117. package/lib/cjs/transactionPlan/vaultv1/redeem.js +78 -0
  118. package/lib/cjs/transactionPlan/vaultv1/withdraw.d.ts +77 -0
  119. package/lib/cjs/transactionPlan/vaultv1/withdraw.js +88 -0
  120. package/lib/cjs/transactionPlan/vaultv2/deposit.d.ts +14 -31
  121. package/lib/cjs/transactionPlan/vaultv2/deposit.js +15 -141
  122. package/lib/cjs/transactionPlan/vaultv2/forceRedeem.d.ts +74 -0
  123. package/lib/cjs/transactionPlan/vaultv2/forceRedeem.js +155 -0
  124. package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.d.ts +98 -0
  125. package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.js +206 -0
  126. package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.d.ts +113 -0
  127. package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.js +206 -0
  128. package/lib/cjs/transactionPlan/vaultv2/redeem.d.ts +84 -0
  129. package/lib/cjs/transactionPlan/vaultv2/redeem.js +86 -0
  130. package/lib/cjs/transactionPlan/vaultv2/withdraw.d.ts +14 -27
  131. package/lib/cjs/transactionPlan/vaultv2/withdraw.js +17 -124
  132. package/lib/cjs/transactionPlan/version.js +2 -1
  133. package/lib/cjs/transactionPlan/withdraw.d.ts +18 -0
  134. package/lib/cjs/transactionPlan/withdraw.js +94 -0
  135. package/lib/cjs/types/action.js +16 -8
  136. package/lib/cjs/types/error.d.ts +8 -1
  137. package/lib/cjs/types/error.js +10 -1
  138. package/lib/cjs/utils.d.ts +2 -2
  139. package/lib/cjs/utils.js +2 -4
  140. package/lib/cjs/version.d.ts +1 -1
  141. package/lib/cjs/version.js +1 -1
  142. package/lib/esm/abis.d.ts +1 -1
  143. package/lib/esm/abis.js +1 -1
  144. package/lib/esm/actions/blue/common.js +4 -2
  145. package/lib/esm/actions/blue/withdrawBuyCallback.js +2 -1
  146. package/lib/esm/actions/bundles/common.js +20 -14
  147. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +2 -1
  148. package/lib/esm/actions/midnight/cancelOffers.js +2 -1
  149. package/lib/esm/actions/midnight/supplyCollateralBatch.js +4 -2
  150. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +2 -1
  151. package/lib/esm/actions/midnight/takeBorrow.js +2 -1
  152. package/lib/esm/actions/midnight/takeLend.js +2 -1
  153. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +2 -1
  154. package/lib/esm/actions/midnight/takeWithdraw.js +2 -1
  155. package/lib/esm/actions/midnight/withdrawCollateralBatch.js +4 -2
  156. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +4 -13
  157. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +2 -1
  158. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +2 -1
  159. package/lib/esm/actions/vaultV1/inKindRedeem.js +6 -3
  160. package/lib/esm/actions/vaultV1/migrateToV2.js +1 -1
  161. package/lib/esm/actions/vaultV2/forceWithdraw.js +4 -2
  162. package/lib/esm/actions/vaultV2/inKindRedeem.js +4 -2
  163. package/lib/esm/blue/abis.d.ts +1 -1
  164. package/lib/esm/blue/abis.js +1 -1
  165. package/lib/esm/blue/entities.d.ts +4 -4
  166. package/lib/esm/blue/entities.js +2 -2
  167. package/lib/esm/blue/errors.d.ts +2 -2
  168. package/lib/esm/blue/errors.js +2 -2
  169. package/lib/esm/blue/fetch.d.ts +2 -2
  170. package/lib/esm/blue/fetch.js +2 -2
  171. package/lib/esm/blue/utils.d.ts +1 -1
  172. package/lib/esm/blue/utils.js +1 -1
  173. package/lib/esm/entities/blue/blue.js +8 -4
  174. package/lib/esm/entities/index.d.ts +4 -4
  175. package/lib/esm/entities/index.js +2 -2
  176. package/lib/esm/entities/midnight/deadline.js +2 -1
  177. package/lib/esm/entities/midnight/midnight.js +14 -7
  178. package/lib/esm/entities/midnight/publication.js +73 -44
  179. package/lib/esm/entities/requirements/assertContractCode.js +4 -2
  180. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +10 -14
  181. package/lib/esm/entities/requirements/getErc2612Permit.js +10 -5
  182. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +2 -0
  183. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +7 -1
  184. package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.d.ts +21 -0
  185. package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.js +108 -0
  186. package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.d.ts +20 -0
  187. package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.js +73 -0
  188. package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.d.ts +21 -0
  189. package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.js +90 -0
  190. package/lib/esm/entities/vaultV1/inKindRedeemQuote.d.ts +25 -0
  191. package/lib/esm/entities/vaultV1/inKindRedeemQuote.js +82 -0
  192. package/lib/esm/entities/vaultV1/migrateToV2Quote.d.ts +20 -0
  193. package/lib/esm/entities/vaultV1/migrateToV2Quote.js +34 -0
  194. package/lib/esm/entities/vaultV1/vaultV1.js +57 -187
  195. package/lib/esm/entities/vaultV2/forceWithdrawQuote.d.ts +25 -0
  196. package/lib/esm/entities/vaultV2/forceWithdrawQuote.js +186 -0
  197. package/lib/esm/entities/vaultV2/inKindRedeemQuote.d.ts +28 -0
  198. package/lib/esm/entities/vaultV2/inKindRedeemQuote.js +107 -0
  199. package/lib/esm/entities/vaultV2/vaultV2.d.ts +8 -34
  200. package/lib/esm/entities/vaultV2/vaultV2.js +70 -437
  201. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +2 -3
  202. package/lib/esm/entities/vaultV2BlueReallocationData.js +346 -234
  203. package/lib/esm/errors.d.ts +4 -4
  204. package/lib/esm/errors.js +4 -4
  205. package/lib/esm/fetch.d.ts +2 -2
  206. package/lib/esm/fetch.js +2 -2
  207. package/lib/esm/helpers/deadShares.js +35 -20
  208. package/lib/esm/helpers/encodeMidnightCalldata.js +4 -2
  209. package/lib/esm/helpers/metadata.js +12 -6
  210. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +10 -5
  211. package/lib/esm/helpers/previewVaultV2InKindRedeem.js +6 -3
  212. package/lib/esm/helpers/utilization.js +10 -5
  213. package/lib/esm/helpers/validate.js +12 -6
  214. package/lib/esm/helpers/validateMidnightBounds.js +2 -1
  215. package/lib/esm/helpers/validateMidnightCollateralBatch.js +2 -1
  216. package/lib/esm/helpers/validateMidnightPublication.js +4 -2
  217. package/lib/esm/helpers/validateMidnightTakeFeasibility.js +44 -22
  218. package/lib/esm/helpers/validatePositiveInput.js +2 -1
  219. package/lib/esm/helpers/validateTakeableOffers.js +2 -1
  220. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +14 -7
  221. package/lib/esm/index.d.ts +2 -2
  222. package/lib/esm/index.js +1 -1
  223. package/lib/esm/midnight/errors.d.ts +1 -2
  224. package/lib/esm/midnight/errors.js +1 -2
  225. package/lib/esm/transactionPlan/approval.js +13 -2
  226. package/lib/esm/transactionPlan/deposit.d.ts +22 -0
  227. package/lib/esm/transactionPlan/deposit.js +135 -0
  228. package/lib/esm/transactionPlan/error.d.ts +10 -8
  229. package/lib/esm/transactionPlan/error.js +10 -8
  230. package/lib/esm/transactionPlan/getTokenPermit.js +2 -1
  231. package/lib/esm/transactionPlan/index.d.ts +18 -0
  232. package/lib/esm/transactionPlan/index.js +9 -0
  233. package/lib/esm/transactionPlan/intent.d.ts +3 -3
  234. package/lib/esm/transactionPlan/intent.js +14 -7
  235. package/lib/esm/transactionPlan/permit.d.ts +1 -1
  236. package/lib/esm/transactionPlan/permit.js +86 -20
  237. package/lib/esm/transactionPlan/plan.d.ts +16 -6
  238. package/lib/esm/transactionPlan/plan.js +68 -18
  239. package/lib/esm/transactionPlan/redeem.d.ts +18 -0
  240. package/lib/esm/transactionPlan/redeem.js +59 -0
  241. package/lib/esm/transactionPlan/requirements.d.ts +4 -3
  242. package/lib/esm/transactionPlan/requirements.js +12 -6
  243. package/lib/esm/transactionPlan/serde.d.ts +2 -2
  244. package/lib/esm/transactionPlan/serde.js +41 -15
  245. package/lib/esm/transactionPlan/shareSpending.d.ts +18 -0
  246. package/lib/esm/transactionPlan/shareSpending.js +47 -0
  247. package/lib/esm/transactionPlan/types.d.ts +117 -11
  248. package/lib/esm/transactionPlan/validateActions.js +11 -1
  249. package/lib/esm/transactionPlan/validation.js +6 -3
  250. package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +93 -0
  251. package/lib/esm/transactionPlan/vaultv1/deposit.js +90 -0
  252. package/lib/esm/transactionPlan/vaultv1/inKindRedeem.d.ts +96 -0
  253. package/lib/esm/transactionPlan/vaultv1/inKindRedeem.js +198 -0
  254. package/lib/esm/transactionPlan/vaultv1/migrateToV2.d.ts +94 -0
  255. package/lib/esm/transactionPlan/vaultv1/migrateToV2.js +212 -0
  256. package/lib/esm/transactionPlan/vaultv1/redeem.d.ts +69 -0
  257. package/lib/esm/transactionPlan/vaultv1/redeem.js +74 -0
  258. package/lib/esm/transactionPlan/vaultv1/withdraw.d.ts +77 -0
  259. package/lib/esm/transactionPlan/vaultv1/withdraw.js +84 -0
  260. package/lib/esm/transactionPlan/vaultv2/deposit.d.ts +14 -31
  261. package/lib/esm/transactionPlan/vaultv2/deposit.js +17 -142
  262. package/lib/esm/transactionPlan/vaultv2/forceRedeem.d.ts +74 -0
  263. package/lib/esm/transactionPlan/vaultv2/forceRedeem.js +150 -0
  264. package/lib/esm/transactionPlan/vaultv2/forceWithdraw.d.ts +98 -0
  265. package/lib/esm/transactionPlan/vaultv2/forceWithdraw.js +201 -0
  266. package/lib/esm/transactionPlan/vaultv2/inKindRedeem.d.ts +113 -0
  267. package/lib/esm/transactionPlan/vaultv2/inKindRedeem.js +201 -0
  268. package/lib/esm/transactionPlan/vaultv2/redeem.d.ts +84 -0
  269. package/lib/esm/transactionPlan/vaultv2/redeem.js +82 -0
  270. package/lib/esm/transactionPlan/vaultv2/withdraw.d.ts +14 -27
  271. package/lib/esm/transactionPlan/vaultv2/withdraw.js +19 -125
  272. package/lib/esm/transactionPlan/version.js +2 -1
  273. package/lib/esm/transactionPlan/withdraw.d.ts +18 -0
  274. package/lib/esm/transactionPlan/withdraw.js +90 -0
  275. package/lib/esm/types/action.js +16 -8
  276. package/lib/esm/types/error.d.ts +8 -1
  277. package/lib/esm/types/error.js +10 -1
  278. package/lib/esm/utils.d.ts +2 -2
  279. package/lib/esm/utils.js +2 -2
  280. package/lib/esm/version.d.ts +1 -1
  281. package/lib/esm/version.js +1 -1
  282. package/package.json +15 -15
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NonIntegerInputError = exports.InvalidCalldataOriginError = exports.TransactionPlanSignatureMismatchError = exports.IncompleteTransactionPlanError = exports.InvalidTransactionPlanError = exports.UnsupportedTransactionPlanActionError = exports.UnsupportedTransactionPlanVersionError = exports.ZeroAccountError = void 0;
4
4
  /**
5
+ * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
5
6
  * Thrown when an operation's account is the zero address.
6
7
  * @example
7
8
  * ```ts
@@ -9,7 +10,6 @@ exports.NonIntegerInputError = exports.InvalidCalldataOriginError = exports.Tran
9
10
  * import { zeroAddress } from "viem";
10
11
  * const error = new ZeroAccountError(zeroAddress);
11
12
  * ```
12
- * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
13
13
  */
14
14
  class ZeroAccountError extends Error {
15
15
  account;
@@ -22,8 +22,8 @@ class ZeroAccountError extends Error {
22
22
  }
23
23
  exports.ZeroAccountError = ZeroAccountError;
24
24
  /**
25
- * A stored plan uses a format version this SDK cannot interpret.
26
25
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
26
+ * A stored plan uses a format version this SDK cannot interpret.
27
27
  */
28
28
  class UnsupportedTransactionPlanVersionError extends Error {
29
29
  version;
@@ -44,8 +44,8 @@ class UnsupportedTransactionPlanVersionError extends Error {
44
44
  }
45
45
  exports.UnsupportedTransactionPlanVersionError = UnsupportedTransactionPlanVersionError;
46
46
  /**
47
- * A selected plan step names an action this SDK cannot build.
48
47
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
48
+ * A selected plan step names an action this SDK cannot build.
49
49
  */
50
50
  class UnsupportedTransactionPlanActionError extends Error {
51
51
  actionType;
@@ -66,8 +66,8 @@ class UnsupportedTransactionPlanActionError extends Error {
66
66
  }
67
67
  exports.UnsupportedTransactionPlanActionError = UnsupportedTransactionPlanActionError;
68
68
  /**
69
- * Restored plan data has an invalid shape or inconsistent references.
70
69
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
70
+ * Restored plan data has an invalid shape or inconsistent references.
71
71
  */
72
72
  class InvalidTransactionPlanError extends Error {
73
73
  /** JSON path of the first rejected value. */
@@ -92,11 +92,13 @@ class InvalidTransactionPlanError extends Error {
92
92
  }
93
93
  exports.InvalidTransactionPlanError = InvalidTransactionPlanError;
94
94
  /**
95
- * A step references a signature request that is absent or has no signature yet.
96
95
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
96
+ * A step references a signature request that is absent or has no signature yet.
97
97
  */
98
98
  class IncompleteTransactionPlanError extends Error {
99
99
  id;
100
+ /** The missing dependency is a signature request. */
101
+ kind = "signature";
100
102
  /**
101
103
  * Identifies the signature request needed to build the transaction.
102
104
  * @param id - Plan-local signature request ID.
@@ -114,8 +116,8 @@ class IncompleteTransactionPlanError extends Error {
114
116
  }
115
117
  exports.IncompleteTransactionPlanError = IncompleteTransactionPlanError;
116
118
  /**
117
- * A plan's signature request disagrees with its referencing action or has no reference.
118
119
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
120
+ * A plan's signature request disagrees with its referencing action or has no reference.
119
121
  */
120
122
  class TransactionPlanSignatureMismatchError extends Error {
121
123
  id;
@@ -138,8 +140,8 @@ class TransactionPlanSignatureMismatchError extends Error {
138
140
  }
139
141
  exports.TransactionPlanSignatureMismatchError = TransactionPlanSignatureMismatchError;
140
142
  /**
141
- * `calldataOrigin` is not a 0x-prefixed hex string holding a whole number of bytes.
142
143
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
144
+ * `calldataOrigin` is not a 0x-prefixed hex string holding a whole number of bytes.
143
145
  */
144
146
  class InvalidCalldataOriginError extends Error {
145
147
  calldataOrigin;
@@ -160,8 +162,8 @@ class InvalidCalldataOriginError extends Error {
160
162
  }
161
163
  exports.InvalidCalldataOriginError = InvalidCalldataOriginError;
162
164
  /**
163
- * A number input that must be an integer is fractional, infinite or not a number.
164
165
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
166
+ * A number input that must be an integer is fractional, infinite or not a number.
165
167
  */
166
168
  class NonIntegerInputError extends Error {
167
169
  field;
@@ -12,7 +12,8 @@ const getErc2612Permit_js_1 = require("../entities/requirements/getErc2612Permit
12
12
  */
13
13
  async function getTokenPermit(client, params) {
14
14
  const { dai } = (0, blue_sdk_1.getChainAddresses)(params.chainId);
15
- if ((0, morpho_ts_1.isDefined)(dai) && (0, viem_1.isAddressEqual)(params.token, dai))
15
+ if ((0, morpho_ts_1.isDefined)(dai) && (0, viem_1.isAddressEqual)(params.token, dai)) {
16
16
  return undefined;
17
+ }
17
18
  return (0, getErc2612Permit_js_1.getErc2612Permit)(client, params);
18
19
  }
@@ -3,7 +3,25 @@ export type { Funding, IntentParams, ReferralFee, } from "./intent.js";
3
3
  export { applySignatures, buildTransaction, buildTransactions, getPendingSignatureRequests, } from "./plan.js";
4
4
  export { parseTransactionPlan, serializeTransactionPlan } from "./serde.js";
5
5
  export type { Action, SignatureRequest, Step, TransactionPlan, } from "./types.js";
6
+ export type { VaultV1DepositPlanParams } from "./vaultv1/deposit.js";
7
+ export { prepareVaultV1Deposit } from "./vaultv1/deposit.js";
8
+ export type { VaultV1InKindRedeemPlanParams } from "./vaultv1/inKindRedeem.js";
9
+ export { prepareVaultV1InKindRedeem } from "./vaultv1/inKindRedeem.js";
10
+ export type { VaultV1MigrateToV2PlanParams } from "./vaultv1/migrateToV2.js";
11
+ export { prepareVaultV1MigrateToV2 } from "./vaultv1/migrateToV2.js";
12
+ export type { VaultV1RedeemPlanParams } from "./vaultv1/redeem.js";
13
+ export { prepareVaultV1Redeem } from "./vaultv1/redeem.js";
14
+ export type { VaultV1WithdrawPlanParams } from "./vaultv1/withdraw.js";
15
+ export { prepareVaultV1Withdraw } from "./vaultv1/withdraw.js";
6
16
  export type { VaultV2DepositPlanParams } from "./vaultv2/deposit.js";
7
17
  export { prepareVaultV2Deposit } from "./vaultv2/deposit.js";
18
+ export type { VaultV2ForceRedeemPlanParams } from "./vaultv2/forceRedeem.js";
19
+ export { prepareVaultV2ForceRedeem } from "./vaultv2/forceRedeem.js";
20
+ export type { VaultV2ForceWithdrawPlanParams } from "./vaultv2/forceWithdraw.js";
21
+ export { prepareVaultV2ForceWithdraw } from "./vaultv2/forceWithdraw.js";
22
+ export type { VaultV2InKindRedeemPlanParams } from "./vaultv2/inKindRedeem.js";
23
+ export { prepareVaultV2InKindRedeem } from "./vaultv2/inKindRedeem.js";
24
+ export type { VaultV2RedeemPlanParams } from "./vaultv2/redeem.js";
25
+ export { prepareVaultV2Redeem } from "./vaultv2/redeem.js";
8
26
  export type { VaultV2WithdrawPlanParams } from "./vaultv2/withdraw.js";
9
27
  export { prepareVaultV2Withdraw } from "./vaultv2/withdraw.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareVaultV2Withdraw = exports.prepareVaultV2Deposit = exports.serializeTransactionPlan = exports.parseTransactionPlan = exports.getPendingSignatureRequests = exports.buildTransactions = exports.buildTransaction = exports.applySignatures = exports.ZeroAccountError = exports.UnsupportedTransactionPlanVersionError = exports.UnsupportedTransactionPlanActionError = exports.TransactionPlanSignatureMismatchError = exports.NonIntegerInputError = exports.InvalidTransactionPlanError = exports.InvalidCalldataOriginError = exports.IncompleteTransactionPlanError = void 0;
3
+ exports.prepareVaultV2Withdraw = exports.prepareVaultV2Redeem = exports.prepareVaultV2InKindRedeem = exports.prepareVaultV2ForceWithdraw = exports.prepareVaultV2ForceRedeem = exports.prepareVaultV2Deposit = exports.prepareVaultV1Withdraw = exports.prepareVaultV1Redeem = exports.prepareVaultV1MigrateToV2 = exports.prepareVaultV1InKindRedeem = exports.prepareVaultV1Deposit = exports.serializeTransactionPlan = exports.parseTransactionPlan = exports.getPendingSignatureRequests = exports.buildTransactions = exports.buildTransaction = exports.applySignatures = exports.ZeroAccountError = exports.UnsupportedTransactionPlanVersionError = exports.UnsupportedTransactionPlanActionError = exports.TransactionPlanSignatureMismatchError = exports.NonIntegerInputError = exports.InvalidTransactionPlanError = exports.InvalidCalldataOriginError = exports.IncompleteTransactionPlanError = void 0;
4
4
  var error_js_1 = require("./error.js");
5
5
  Object.defineProperty(exports, "IncompleteTransactionPlanError", { enumerable: true, get: function () { return error_js_1.IncompleteTransactionPlanError; } });
6
6
  Object.defineProperty(exports, "InvalidCalldataOriginError", { enumerable: true, get: function () { return error_js_1.InvalidCalldataOriginError; } });
@@ -18,7 +18,25 @@ Object.defineProperty(exports, "getPendingSignatureRequests", { enumerable: true
18
18
  var serde_js_1 = require("./serde.js");
19
19
  Object.defineProperty(exports, "parseTransactionPlan", { enumerable: true, get: function () { return serde_js_1.parseTransactionPlan; } });
20
20
  Object.defineProperty(exports, "serializeTransactionPlan", { enumerable: true, get: function () { return serde_js_1.serializeTransactionPlan; } });
21
- var deposit_js_1 = require("./vaultv2/deposit.js");
22
- Object.defineProperty(exports, "prepareVaultV2Deposit", { enumerable: true, get: function () { return deposit_js_1.prepareVaultV2Deposit; } });
23
- var withdraw_js_1 = require("./vaultv2/withdraw.js");
24
- Object.defineProperty(exports, "prepareVaultV2Withdraw", { enumerable: true, get: function () { return withdraw_js_1.prepareVaultV2Withdraw; } });
21
+ var deposit_js_1 = require("./vaultv1/deposit.js");
22
+ Object.defineProperty(exports, "prepareVaultV1Deposit", { enumerable: true, get: function () { return deposit_js_1.prepareVaultV1Deposit; } });
23
+ var inKindRedeem_js_1 = require("./vaultv1/inKindRedeem.js");
24
+ Object.defineProperty(exports, "prepareVaultV1InKindRedeem", { enumerable: true, get: function () { return inKindRedeem_js_1.prepareVaultV1InKindRedeem; } });
25
+ var migrateToV2_js_1 = require("./vaultv1/migrateToV2.js");
26
+ Object.defineProperty(exports, "prepareVaultV1MigrateToV2", { enumerable: true, get: function () { return migrateToV2_js_1.prepareVaultV1MigrateToV2; } });
27
+ var redeem_js_1 = require("./vaultv1/redeem.js");
28
+ Object.defineProperty(exports, "prepareVaultV1Redeem", { enumerable: true, get: function () { return redeem_js_1.prepareVaultV1Redeem; } });
29
+ var withdraw_js_1 = require("./vaultv1/withdraw.js");
30
+ Object.defineProperty(exports, "prepareVaultV1Withdraw", { enumerable: true, get: function () { return withdraw_js_1.prepareVaultV1Withdraw; } });
31
+ var deposit_js_2 = require("./vaultv2/deposit.js");
32
+ Object.defineProperty(exports, "prepareVaultV2Deposit", { enumerable: true, get: function () { return deposit_js_2.prepareVaultV2Deposit; } });
33
+ var forceRedeem_js_1 = require("./vaultv2/forceRedeem.js");
34
+ Object.defineProperty(exports, "prepareVaultV2ForceRedeem", { enumerable: true, get: function () { return forceRedeem_js_1.prepareVaultV2ForceRedeem; } });
35
+ var forceWithdraw_js_1 = require("./vaultv2/forceWithdraw.js");
36
+ Object.defineProperty(exports, "prepareVaultV2ForceWithdraw", { enumerable: true, get: function () { return forceWithdraw_js_1.prepareVaultV2ForceWithdraw; } });
37
+ var inKindRedeem_js_2 = require("./vaultv2/inKindRedeem.js");
38
+ Object.defineProperty(exports, "prepareVaultV2InKindRedeem", { enumerable: true, get: function () { return inKindRedeem_js_2.prepareVaultV2InKindRedeem; } });
39
+ var redeem_js_2 = require("./vaultv2/redeem.js");
40
+ Object.defineProperty(exports, "prepareVaultV2Redeem", { enumerable: true, get: function () { return redeem_js_2.prepareVaultV2Redeem; } });
41
+ var withdraw_js_2 = require("./vaultv2/withdraw.js");
42
+ Object.defineProperty(exports, "prepareVaultV2Withdraw", { enumerable: true, get: function () { return withdraw_js_2.prepareVaultV2Withdraw; } });
@@ -1,7 +1,7 @@
1
1
  import { type Address, type Hex } from "viem";
2
2
  /**
3
- * Which balance pays a deposit: the vault asset, or native currency the bundle wraps.
4
3
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
4
+ * Which balance pays a deposit: the vault asset, or native currency the bundle wraps.
5
5
  */
6
6
  export type Funding = {
7
7
  readonly type: "erc20";
@@ -9,16 +9,16 @@ export type Funding = {
9
9
  readonly type: "native";
10
10
  };
11
11
  /**
12
- * Referral fee in basis points of the gross amount, paid to `recipient`.
13
12
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
13
+ * Referral fee in basis points of the gross amount, paid to `recipient`.
14
14
  */
15
15
  export interface ReferralFee {
16
16
  readonly bps: number;
17
17
  readonly recipient: Address;
18
18
  }
19
19
  /**
20
- * Intent fields shared by every prepare function, mirroring the Actions API intent inputs.
21
20
  * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
21
+ * Intent fields shared by every prepare function, mirroring the Actions API intent inputs.
22
22
  */
23
23
  export interface IntentParams {
24
24
  readonly chainId: number;
@@ -8,8 +8,9 @@ const error_js_1 = require("./error.js");
8
8
  const BASIS_POINTS = 10000n;
9
9
  const WAD_PER_BASIS_POINT = morpho_ts_1.MathLib.WAD / BASIS_POINTS;
10
10
  function toSafeInteger(field, value) {
11
- if (!Number.isSafeInteger(value))
11
+ if (!Number.isSafeInteger(value)) {
12
12
  throw new error_js_1.NonIntegerInputError(field, value);
13
+ }
13
14
  return BigInt(value);
14
15
  }
15
16
  /**
@@ -17,31 +18,37 @@ function toSafeInteger(field, value) {
17
18
  * signature support and calldata origin. Throws on invalid values so a plan never carries them.
18
19
  */
19
20
  function resolveIntent(params, now) {
20
- if (params.account === viem_1.zeroAddress)
21
+ if (params.account === viem_1.zeroAddress) {
21
22
  throw new error_js_1.ZeroAccountError(params.account);
23
+ }
22
24
  const expiresAt = params.expiresAt ?? Number(now + morpho_ts_1.Time.s.from.h(2n));
23
25
  const deadline = toSafeInteger("expiresAt", expiresAt);
24
- if (deadline <= 0n)
26
+ if (deadline <= 0n) {
25
27
  throw new index_js_1.NonPositiveInputError("expiresAt", deadline);
26
- if (deadline <= now)
28
+ }
29
+ if (deadline <= now) {
27
30
  throw new index_js_1.ExpiredDeadlineError(deadline, now);
31
+ }
28
32
  const bps = params.referralFee === undefined
29
33
  ? 0n
30
34
  : toSafeInteger("referralFee.bps", params.referralFee.bps);
31
- if (bps < 0n)
35
+ if (bps < 0n) {
32
36
  throw new index_js_1.NegativeInputError("referralFee.bps", bps);
33
- if (bps > BASIS_POINTS)
37
+ }
38
+ if (bps > BASIS_POINTS) {
34
39
  throw new index_js_1.InputExceedsMaxError({
35
40
  field: "referralFee.bps",
36
41
  value: bps,
37
42
  max: BASIS_POINTS,
38
43
  });
44
+ }
39
45
  const { calldataOrigin } = params;
40
46
  if (calldataOrigin !== undefined &&
41
47
  (!(0, viem_1.isHex)(calldataOrigin, { strict: true }) ||
42
48
  calldataOrigin.length <= 2 ||
43
- calldataOrigin.length % 2 !== 0))
49
+ calldataOrigin.length % 2 !== 0)) {
44
50
  throw new error_js_1.InvalidCalldataOriginError(calldataOrigin);
51
+ }
45
52
  return {
46
53
  expiresAt: Number(deadline),
47
54
  deadline,
@@ -1,4 +1,4 @@
1
- import type { Address } from "viem";
1
+ import { type Address } from "viem";
2
2
  import type { Erc2612RequirementSignature } from "../types/index.js";
3
3
  import type { Action, SignatureRequest } from "./types.js";
4
4
  /** @internal Validates the stored ERC-2612 request shape without verifying its signature. */
@@ -4,6 +4,7 @@ exports.validatePermitPlanRequest = validatePermitPlanRequest;
4
4
  exports.validateSignatureRequest = validateSignatureRequest;
5
5
  exports.getVaultPermit = getVaultPermit;
6
6
  const morpho_ts_1 = require("@morpho-org/morpho-ts");
7
+ const viem_1 = require("viem");
7
8
  const error_js_1 = require("./error.js");
8
9
  const validation_js_1 = require("./validation.js");
9
10
  /** @internal Validates the stored ERC-2612 request shape without verifying its signature. */
@@ -28,17 +29,20 @@ function validatePermitPlanRequest(request, path) {
28
29
  path: `${path}.typedData.domain`,
29
30
  fields: { chainId: "positive safe integer", verifyingContract: "address" },
30
31
  });
31
- for (const field of ["name", "version"])
32
- if (domain[field] !== undefined)
32
+ for (const field of ["name", "version"]) {
33
+ if (domain[field] !== undefined) {
33
34
  (0, validation_js_1.validatePlanField)(domain[field], {
34
35
  path: `${path}.typedData.domain.${field}`,
35
36
  type: "string",
36
37
  });
37
- if (domain.salt !== undefined)
38
+ }
39
+ }
40
+ if (domain.salt !== undefined) {
38
41
  (0, validation_js_1.validatePlanField)(domain.salt, {
39
42
  path: `${path}.typedData.domain.salt`,
40
43
  type: "hex",
41
44
  });
45
+ }
42
46
  const types = (0, validation_js_1.getPlanObject)(typedData.types, `${path}.typedData.types`);
43
47
  (0, validation_js_1.validatePlanField)(types[typedData.primaryType], {
44
48
  path: `${path}.typedData.types.${typedData.primaryType}`,
@@ -66,23 +70,87 @@ function validatePermitPlanRequest(request, path) {
66
70
  deadline: "uint256 bigint",
67
71
  },
68
72
  });
69
- if (request.signature !== undefined)
73
+ if (request.signature !== undefined) {
70
74
  (0, validation_js_1.validatePlanField)(request.signature, {
71
75
  path: `${path}.signature`,
72
76
  type: "hex",
73
77
  });
78
+ }
74
79
  }
75
80
  /** @internal Checks a permit's signing payload against its referencing action and encoding arguments. */
76
81
  function validateSignatureRequest(request, action) {
77
- if (action.type === "erc20Approval" ||
78
- action.signatureRequestIds.tokenPermit !== request.id)
79
- throw new error_js_1.TransactionPlanSignatureMismatchError(request.id, "reference");
80
82
  const { chainId, account } = action.inputs;
81
83
  const { domain, message, primaryType } = request.typedData;
82
- const spender = (0, morpho_ts_1.getChainAddress)(chainId, "bundles.vaultBundlesV1");
83
- const asset = action.type === "vaultV2Deposit"
84
- ? action.inputs.asset
85
- : action.inputs.vault;
84
+ let spenderKey;
85
+ let asset;
86
+ let amountMatches;
87
+ switch (action.type) {
88
+ case "vaultV2ForceRedeem":
89
+ throw new error_js_1.TransactionPlanSignatureMismatchError(request.id, "reference");
90
+ case "erc20Approval":
91
+ throw new error_js_1.TransactionPlanSignatureMismatchError(request.id, "reference");
92
+ case "vaultV2Deposit":
93
+ spenderKey = "bundles.vaultBundlesV1";
94
+ asset = action.inputs.asset;
95
+ amountMatches = request.args.amount === action.inputs.assets;
96
+ break;
97
+ case "vaultV1Deposit":
98
+ spenderKey = "bundles.vaultBundlesV1";
99
+ asset = action.inputs.asset;
100
+ amountMatches = request.args.amount === action.inputs.assets;
101
+ break;
102
+ case "vaultV1Withdraw":
103
+ spenderKey = "bundles.vaultBundlesV1";
104
+ asset = action.inputs.vault;
105
+ amountMatches =
106
+ request.args.amount >= action.inputs.requiredShareAllowance;
107
+ break;
108
+ case "vaultV2Withdraw":
109
+ spenderKey = "bundles.vaultBundlesV1";
110
+ asset = action.inputs.vault;
111
+ amountMatches =
112
+ request.args.amount >= action.inputs.requiredShareAllowance;
113
+ break;
114
+ case "vaultV2Redeem":
115
+ spenderKey = "bundles.vaultBundlesV1";
116
+ asset = action.inputs.vault;
117
+ amountMatches = request.args.amount >= action.inputs.shares;
118
+ break;
119
+ case "vaultV1Redeem":
120
+ spenderKey = "bundles.vaultBundlesV1";
121
+ asset = action.inputs.vault;
122
+ amountMatches = request.args.amount >= action.inputs.shares;
123
+ break;
124
+ case "vaultV2ForceWithdraw":
125
+ spenderKey = "bundles.vaultExitBundlesV1";
126
+ asset = action.inputs.vault;
127
+ amountMatches = request.args.amount === viem_1.maxUint256;
128
+ break;
129
+ case "vaultV1MigrateToV2":
130
+ spenderKey = "bundles.vaultBundlesV1";
131
+ asset = action.inputs.sourceVault;
132
+ amountMatches =
133
+ request.args.amount >= action.inputs.requiredShareAllowance;
134
+ break;
135
+ case "vaultV2InKindRedeem":
136
+ spenderKey = "bundles.vaultExitBundlesV1";
137
+ asset = action.inputs.vault;
138
+ amountMatches = request.args.amount === viem_1.maxUint256;
139
+ break;
140
+ case "vaultV1InKindRedeem":
141
+ spenderKey = "bundles.vaultExitBundlesV1";
142
+ asset = action.inputs.vault;
143
+ amountMatches = request.args.amount === viem_1.maxUint256;
144
+ break;
145
+ default: {
146
+ const _exhaustive = action;
147
+ throw new error_js_1.TransactionPlanSignatureMismatchError(request.id, "reference");
148
+ }
149
+ }
150
+ if (action.signatureRequestIds.tokenPermit !== request.id) {
151
+ throw new error_js_1.TransactionPlanSignatureMismatchError(request.id, "reference");
152
+ }
153
+ const spender = (0, morpho_ts_1.getChainAddress)(chainId, spenderKey);
86
154
  const checks = [
87
155
  ["domain.chainId", domain?.chainId === chainId],
88
156
  [
@@ -106,27 +174,25 @@ function validateSignatureRequest(request, action) {
106
174
  request.args.spender.toLowerCase() === spender.toLowerCase(),
107
175
  ],
108
176
  ["message.value", message?.value === request.args.amount],
109
- [
110
- "value",
111
- action.type === "vaultV2Deposit"
112
- ? request.args.amount === action.inputs.amount
113
- : request.args.amount >= action.inputs.requiredShareAllowance,
114
- ],
177
+ ["value", amountMatches],
115
178
  ["message.nonce", message?.nonce === request.args.nonce],
116
179
  ["message.deadline", message?.deadline === request.args.deadline],
117
180
  ["primaryType", primaryType === "Permit"],
118
181
  ];
119
182
  const mismatch = checks.find(([, matches]) => !matches);
120
- if (mismatch)
183
+ if (mismatch) {
121
184
  throw new error_js_1.TransactionPlanSignatureMismatchError(request.id, mismatch[0]);
185
+ }
122
186
  }
123
187
  /** @internal Rebuilds a token permit from the action's account/asset and its resolved signature requests. */
124
188
  function getVaultPermit(requests, { id, asset, owner, }) {
125
- if (id === undefined)
189
+ if (id === undefined) {
126
190
  return undefined;
191
+ }
127
192
  const request = requests.find((candidate) => candidate.id === id);
128
- if (request?.signature === undefined)
193
+ if (request?.signature === undefined) {
129
194
  throw new error_js_1.IncompleteTransactionPlanError(id);
195
+ }
130
196
  return {
131
197
  action: {
132
198
  type: request.kind,
@@ -2,6 +2,7 @@ import { type Hex } from "viem";
2
2
  import type { Transaction } from "../types/index.js";
3
3
  import type { SignatureRequest, Step, TransactionPlan } from "./types.js";
4
4
  /**
5
+ * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
5
6
  * Validates every request against its actions, verifies supplied ECDSA signatures synchronously,
6
7
  * and attaches serialized signatures by request ID. No client or RPC is used; the EIP-712 domain
7
8
  * binds the signature to its chain. Only low-s compact or serialized ECDSA permits are supported.
@@ -24,13 +25,13 @@ import type { SignatureRequest, Step, TransactionPlan } from "./types.js";
24
25
  * const complete = (plan: TransactionPlan, signature: Hex) =>
25
26
  * applySignatures(plan, [{ id: "vaultV2Deposit:tokenPermit", signature }]);
26
27
  * ```
27
- * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
28
28
  */
29
29
  export declare function applySignatures(plan: TransactionPlan, signatures: readonly {
30
30
  readonly id: string;
31
31
  readonly signature: Hex;
32
32
  }[]): TransactionPlan;
33
33
  /**
34
+ * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
34
35
  * Lists pending signature requests once per request ID after checking each against every referencing action.
35
36
  * Sign each request's typed data with your wallet stack, then verify and attach the results with
36
37
  * {@link applySignatures}.
@@ -45,10 +46,10 @@ export declare function applySignatures(plan: TransactionPlan, signatures: reado
45
46
  * const prompts = (plan: TransactionPlan) =>
46
47
  * getPendingSignatureRequests(plan).map(({ id, kind, typedData }) => ({ id, kind, typedData }));
47
48
  * ```
48
- * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
49
49
  */
50
50
  export declare function getPendingSignatureRequests(plan: TransactionPlan): readonly SignatureRequest[];
51
51
  /**
52
+ * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
52
53
  * Builds one transaction from a step, its fixed inputs and the signatures its action names.
53
54
  * Plans are trusted as given, whether restored or supplied directly. Signature checks establish
54
55
  * only request/action consistency; they do not validate stored fees, recipients, share-price bounds,
@@ -60,11 +61,16 @@ export declare function getPendingSignatureRequests(plan: TransactionPlan): read
60
61
  * @throws {UnsupportedTransactionPlanVersionError} If the plan version is unsupported.
61
62
  * @throws {UnsupportedTransactionPlanActionError} If any plan step or the selected step names an unsupported action type.
62
63
  * @throws {UnsupportedErc20ApprovalSpenderError} If an approval names an unregistered spender.
63
- * @throws {NonPositiveInputError} If a deposit or withdrawal amount, deposit share-price bound or deadline is not positive.
64
+ * @throws {SameVaultMigrationError} If a migration's source and destination vaults are identical.
65
+ * @throws {AmountAndSharesExclusiveError} If a migration supplies both `assets` and `shares`, or neither.
66
+ * @throws {NonPositiveInputError} If a deposit, withdrawal or migration amount, a deposit or migration destination share-price bound, a deadline, force-redeem shares or deallocation amount is not positive.
67
+ * @throws {EmptyDeallocationsError} If a force-redeem step has no deallocations.
68
+ * @throws {EmptyMarketParamsListError} If a Vault V1 in-kind redemption step has no markets.
64
69
  * @throws {ReferralFeePctExceededError} If the action's referral fee is at least WAD.
65
70
  * @throws {ReferralFeeRecipientMissingError} If a positive referral fee has no nonzero recipient.
66
71
  * @throws {IncompleteTransactionPlanError} If a referenced signature request or its signature is missing.
67
72
  * @throws {TransactionPlanSignatureMismatchError} If a referenced permit disagrees with the step's action or its encoding arguments.
73
+ * @throws {BundlesPermitMismatchError} If a signed permit's spender, amount or deadline doesn't match the step.
68
74
  * @example
69
75
  * ```ts
70
76
  * import { buildTransaction, parseTransactionPlan } from "@morpho-org/morpho-sdk";
@@ -73,27 +79,31 @@ export declare function getPendingSignatureRequests(plan: TransactionPlan): read
73
79
  * return plan.steps.map((step) => buildTransaction(plan, step));
74
80
  * };
75
81
  * ```
76
- * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
77
82
  */
78
83
  export declare function buildTransaction(plan: TransactionPlan, step: Step): Readonly<Transaction>;
79
84
  /**
85
+ * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
80
86
  * Builds every step of the plan in order.
81
87
  * @param plan - Plan whose referenced signature requests all carry a signature.
82
88
  * @returns Frozen SDK transactions in step order; discriminate on `action.type` for per-step handling.
83
89
  * @throws {UnsupportedTransactionPlanVersionError} If the plan version is unsupported, including empty plans.
84
90
  * @throws {UnsupportedTransactionPlanActionError} If any plan step names an unsupported action type, before reading requests.
85
91
  * @throws {UnsupportedErc20ApprovalSpenderError} If an approval names an unregistered spender.
86
- * @throws {NonPositiveInputError} If a deposit or withdrawal amount, deposit share-price bound or deadline is not positive.
92
+ * @throws {SameVaultMigrationError} If a migration's source and destination vaults are identical.
93
+ * @throws {AmountAndSharesExclusiveError} If a migration supplies both `assets` and `shares`, or neither.
94
+ * @throws {NonPositiveInputError} If a deposit, withdrawal or migration amount, a deposit or migration destination share-price bound, a deadline, force-redeem shares or deallocation amount is not positive.
95
+ * @throws {EmptyDeallocationsError} If a force-redeem step has no deallocations.
96
+ * @throws {EmptyMarketParamsListError} If a Vault V1 in-kind redemption step has no markets.
87
97
  * @throws {ReferralFeePctExceededError} If an action's referral fee is at least WAD.
88
98
  * @throws {ReferralFeeRecipientMissingError} If a positive referral fee has no nonzero recipient.
89
99
  * @throws {IncompleteTransactionPlanError} If any step references a signature request or signature that is missing.
90
100
  * @throws {TransactionPlanSignatureMismatchError} If a referenced permit disagrees with its action or encoding arguments.
101
+ * @throws {BundlesPermitMismatchError} If a signed permit's spender, amount or deadline doesn't match the step.
91
102
  * @example
92
103
  * ```ts
93
104
  * import { buildTransactions, type TransactionPlan } from "@morpho-org/morpho-sdk";
94
105
  * const submit = (plan: TransactionPlan) => buildTransactions(plan);
95
106
  * // Simulate and send in order from plan.account on plan.chainId.
96
107
  * ```
97
- * @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
98
108
  */
99
109
  export declare function buildTransactions(plan: TransactionPlan): readonly Readonly<Transaction>[];