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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/MIGRATION-v5-to-v6.md +83 -29
  2. package/README.md +9 -7
  3. package/lib/cjs/abis.d.ts +3 -2844
  4. package/lib/cjs/abis.js +1 -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 +23 -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 +6 -5
  45. package/lib/cjs/actions/vaultV1/inKindRedeem.js +10 -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 +6 -5
  51. package/lib/cjs/actions/vaultV2/inKindRedeem.js +10 -7
  52. package/lib/cjs/augment.d.ts +0 -1
  53. package/lib/cjs/augment.js +0 -1
  54. package/lib/cjs/blue/abis.d.ts +1 -5
  55. package/lib/cjs/blue/abis.js +1 -7
  56. package/lib/cjs/blue/entities.d.ts +2 -8
  57. package/lib/cjs/blue/entities.js +1 -3
  58. package/lib/cjs/blue/fetch.d.ts +1 -3
  59. package/lib/cjs/blue/fetch.js +1 -3
  60. package/lib/cjs/blue/types.d.ts +2 -4
  61. package/lib/cjs/blue/utils.d.ts +1 -3
  62. package/lib/cjs/blue/utils.js +1 -3
  63. package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
  64. package/lib/cjs/client/morphoViemExtension.js +1 -1
  65. package/lib/cjs/constants.d.ts +3 -37
  66. package/lib/cjs/constants.js +1 -39
  67. package/lib/cjs/entities/blue/blue.d.ts +30 -265
  68. package/lib/cjs/entities/blue/blue.js +1 -205
  69. package/lib/cjs/entities/index.d.ts +3 -66
  70. package/lib/cjs/entities/index.js +1 -21
  71. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -2
  72. package/lib/cjs/entities/vaultV1/vaultV1.js +12 -7
  73. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +22 -9
  74. package/lib/cjs/entities/vaultV2/vaultV2.js +28 -15
  75. package/lib/cjs/entities/vaultV2BlueReallocationData.js +4 -21
  76. package/lib/cjs/errors.d.ts +2 -46
  77. package/lib/cjs/errors.js +1 -46
  78. package/lib/cjs/fetch.d.ts +1 -17
  79. package/lib/cjs/fetch.js +1 -17
  80. package/lib/cjs/helpers/constant.d.ts +0 -2
  81. package/lib/cjs/helpers/constant.js +0 -2
  82. package/lib/cjs/helpers/index.d.ts +2 -3
  83. package/lib/cjs/helpers/index.js +1 -9
  84. package/lib/cjs/helpers/slippage.d.ts +1 -103
  85. package/lib/cjs/helpers/slippage.js +0 -150
  86. package/lib/cjs/helpers/utilization.d.ts +12 -10
  87. package/lib/cjs/helpers/utilization.js +27 -12
  88. package/lib/cjs/helpers/validate.d.ts +1 -24
  89. package/lib/cjs/helpers/validate.js +2 -49
  90. package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
  91. package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
  92. package/lib/cjs/types/action.d.ts +17 -65
  93. package/lib/cjs/types/action.js +11 -4
  94. package/lib/cjs/types/error.d.ts +50 -381
  95. package/lib/cjs/types/error.js +64 -395
  96. package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
  97. package/lib/cjs/types.d.ts +2 -18
  98. package/lib/cjs/utils.d.ts +6 -35
  99. package/lib/cjs/utils.js +2 -36
  100. package/lib/esm/abis.d.ts +3 -2844
  101. package/lib/esm/abis.js +3 -1950
  102. package/lib/esm/actions/blue/borrow.d.ts +3 -2
  103. package/lib/esm/actions/blue/borrow.js +3 -2
  104. package/lib/esm/actions/blue/common.js +1 -9
  105. package/lib/esm/actions/blue/refinance.d.ts +2 -2
  106. package/lib/esm/actions/blue/refinance.js +2 -2
  107. package/lib/esm/actions/blue/repay.d.ts +1 -1
  108. package/lib/esm/actions/blue/repay.js +1 -1
  109. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
  110. package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
  111. package/lib/esm/actions/blue/supply.d.ts +2 -2
  112. package/lib/esm/actions/blue/supply.js +2 -2
  113. package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
  114. package/lib/esm/actions/blue/supplyCollateral.js +2 -2
  115. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
  116. package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
  117. package/lib/esm/actions/blue/withdraw.d.ts +3 -3
  118. package/lib/esm/actions/blue/withdraw.js +3 -3
  119. package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
  120. package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
  121. package/lib/esm/actions/bundles/common.d.ts +6 -2
  122. package/lib/esm/actions/bundles/common.js +24 -6
  123. package/lib/esm/actions/index.d.ts +0 -1
  124. package/lib/esm/actions/index.js +0 -1
  125. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -8
  126. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +12 -17
  127. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
  128. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
  129. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  130. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
  131. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +5 -5
  132. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +6 -11
  133. package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
  134. package/lib/esm/actions/requirements/encode/index.js +0 -1
  135. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
  136. package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
  137. package/lib/esm/actions/requirements/index.d.ts +0 -1
  138. package/lib/esm/actions/requirements/index.js +0 -1
  139. package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
  140. package/lib/esm/actions/vaultV1/deposit.js +1 -2
  141. package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -5
  142. package/lib/esm/actions/vaultV1/inKindRedeem.js +10 -7
  143. package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
  144. package/lib/esm/actions/vaultV2/deposit.js +1 -2
  145. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +1 -1
  146. package/lib/esm/actions/vaultV2/forceWithdraw.js +3 -3
  147. package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -5
  148. package/lib/esm/actions/vaultV2/inKindRedeem.js +10 -7
  149. package/lib/esm/augment.d.ts +0 -1
  150. package/lib/esm/augment.js +0 -1
  151. package/lib/esm/blue/abis.d.ts +1 -5
  152. package/lib/esm/blue/abis.js +1 -5
  153. package/lib/esm/blue/entities.d.ts +2 -8
  154. package/lib/esm/blue/entities.js +1 -3
  155. package/lib/esm/blue/fetch.d.ts +1 -3
  156. package/lib/esm/blue/fetch.js +1 -3
  157. package/lib/esm/blue/types.d.ts +2 -4
  158. package/lib/esm/blue/utils.d.ts +1 -3
  159. package/lib/esm/blue/utils.js +1 -3
  160. package/lib/esm/client/morphoViemExtension.d.ts +1 -1
  161. package/lib/esm/client/morphoViemExtension.js +1 -1
  162. package/lib/esm/constants.d.ts +3 -37
  163. package/lib/esm/constants.js +3 -37
  164. package/lib/esm/entities/blue/blue.d.ts +30 -265
  165. package/lib/esm/entities/blue/blue.js +4 -208
  166. package/lib/esm/entities/index.d.ts +3 -66
  167. package/lib/esm/entities/index.js +1 -18
  168. package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -2
  169. package/lib/esm/entities/vaultV1/vaultV1.js +15 -10
  170. package/lib/esm/entities/vaultV2/vaultV2.d.ts +22 -9
  171. package/lib/esm/entities/vaultV2/vaultV2.js +32 -19
  172. package/lib/esm/entities/vaultV2BlueReallocationData.js +2 -19
  173. package/lib/esm/errors.d.ts +2 -46
  174. package/lib/esm/errors.js +2 -46
  175. package/lib/esm/fetch.d.ts +1 -17
  176. package/lib/esm/fetch.js +1 -17
  177. package/lib/esm/helpers/constant.d.ts +0 -2
  178. package/lib/esm/helpers/constant.js +0 -2
  179. package/lib/esm/helpers/index.d.ts +2 -3
  180. package/lib/esm/helpers/index.js +2 -3
  181. package/lib/esm/helpers/slippage.d.ts +1 -103
  182. package/lib/esm/helpers/slippage.js +1 -147
  183. package/lib/esm/helpers/utilization.d.ts +12 -10
  184. package/lib/esm/helpers/utilization.js +26 -11
  185. package/lib/esm/helpers/validate.d.ts +1 -24
  186. package/lib/esm/helpers/validate.js +2 -48
  187. package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
  188. package/lib/esm/helpers/validateRequirementSpender.js +1 -3
  189. package/lib/esm/types/action.d.ts +17 -65
  190. package/lib/esm/types/action.js +12 -5
  191. package/lib/esm/types/error.d.ts +50 -381
  192. package/lib/esm/types/error.js +58 -377
  193. package/lib/esm/types/sharedLiquidity.d.ts +1 -117
  194. package/lib/esm/types.d.ts +2 -18
  195. package/lib/esm/utils.d.ts +6 -35
  196. package/lib/esm/utils.js +5 -34
  197. package/package.json +5 -13
  198. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
  199. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -88
  200. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  201. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -152
  202. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
  203. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -53
  204. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  205. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
  206. package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
  207. package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
  208. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  209. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
  210. package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  211. package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
  212. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -50
  213. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -45
  214. package/lib/cjs/actions/signatures/index.d.ts +0 -3
  215. package/lib/cjs/actions/signatures/index.js +0 -19
  216. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -11
  217. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
  218. package/lib/cjs/bundler/actions.d.ts +0 -797
  219. package/lib/cjs/bundler/actions.js +0 -1371
  220. package/lib/cjs/bundler/index.d.ts +0 -2
  221. package/lib/cjs/bundler/index.js +0 -18
  222. package/lib/cjs/bundler/types.d.ts +0 -235
  223. package/lib/cjs/bundler/types.js +0 -2
  224. package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -332
  225. package/lib/cjs/entities/vaultV1ReallocationData.js +0 -557
  226. package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -80
  227. package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -245
  228. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
  229. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -84
  230. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  231. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -148
  232. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
  233. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -49
  234. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  235. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
  236. package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
  237. package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
  238. package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  239. package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
  240. package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  241. package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
  242. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -50
  243. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -41
  244. package/lib/esm/actions/signatures/index.d.ts +0 -3
  245. package/lib/esm/actions/signatures/index.js +0 -3
  246. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -11
  247. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -7
  248. package/lib/esm/bundler/actions.d.ts +0 -797
  249. package/lib/esm/bundler/actions.js +0 -1368
  250. package/lib/esm/bundler/index.d.ts +0 -2
  251. package/lib/esm/bundler/index.js +0 -2
  252. package/lib/esm/bundler/types.d.ts +0 -235
  253. package/lib/esm/bundler/types.js +0 -1
  254. package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -332
  255. package/lib/esm/entities/vaultV1ReallocationData.js +0 -559
  256. package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -80
  257. package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -241
@@ -34,7 +34,7 @@ export interface BlueBorrowParams {
34
34
  * Encodes a pure borrow through BlueBundlesV1.
35
35
  *
36
36
  * Delegates to {@link blueSupplyCollateralBorrow} with a zero collateral leg. Vault V2 allocator
37
- * penalties and referral fees reduce the assets received, and no Bundler3 action is encoded.
37
+ * penalties and referral fees reduce the assets received.
38
38
  *
39
39
  * @param params - Borrow encoding parameters.
40
40
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -53,8 +53,9 @@ export interface BlueBorrowParams {
53
53
  * @throws {NegativeInputError} when an amount, LTV, fee, or reallocation penalty is negative.
54
54
  * @throws {NonPositiveInputError} when the borrow, deadline, or reallocation amount is not positive.
55
55
  * @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its bound.
56
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
56
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
57
57
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
58
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
58
59
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
59
60
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
60
61
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
@@ -7,7 +7,7 @@ const supplyCollateralBorrow_js_1 = require("./supplyCollateralBorrow.js");
7
7
  * Encodes a pure borrow through BlueBundlesV1.
8
8
  *
9
9
  * Delegates to {@link blueSupplyCollateralBorrow} with a zero collateral leg. Vault V2 allocator
10
- * penalties and referral fees reduce the assets received, and no Bundler3 action is encoded.
10
+ * penalties and referral fees reduce the assets received.
11
11
  *
12
12
  * @param params - Borrow encoding parameters.
13
13
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -26,8 +26,9 @@ const supplyCollateralBorrow_js_1 = require("./supplyCollateralBorrow.js");
26
26
  * @throws {NegativeInputError} when an amount, LTV, fee, or reallocation penalty is negative.
27
27
  * @throws {NonPositiveInputError} when the borrow, deadline, or reallocation amount is not positive.
28
28
  * @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its bound.
29
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
29
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
30
30
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
31
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
31
32
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
32
33
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
33
34
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
@@ -152,19 +152,11 @@ const selectBlueBundlesV1RequirementSignatures = (signatures, accepts) => {
152
152
  permit2SignatureTransfer: accepts.token,
153
153
  authorization: accepts.authorization,
154
154
  });
155
- if (permit?.action.type === "permit2") {
156
- throw new index_js_2.BundlesRequirementSignatureMismatchError({
157
- field: "type",
158
- expected: "permit or permit2SignatureTransfer",
159
- actual: permit.action.type,
160
- });
161
- }
162
155
  if (permit != null && permit2SignatureTransfer != null) {
163
156
  throw new index_js_2.AmbiguousRequirementSignaturesError("permit", 2);
164
157
  }
165
158
  return {
166
- token: permit ??
167
- permit2SignatureTransfer,
159
+ token: permit ?? permit2SignatureTransfer,
168
160
  authorization,
169
161
  };
170
162
  };
@@ -61,9 +61,9 @@ export interface BlueRefinanceParams {
61
61
  * @throws {NegativeInputError} when `maxLtv`, a referral fee, or a reallocation penalty is negative.
62
62
  * @throws {NonPositiveInputError} when the deadline or a reallocation amount is not positive.
63
63
  * @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its ABI bound.
64
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
64
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
65
65
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
66
- * @throws {InvalidReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
66
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
67
67
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
68
68
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
69
69
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the destination market.
@@ -34,9 +34,9 @@ const common_js_1 = require("./common.js");
34
34
  * @throws {NegativeInputError} when `maxLtv`, a referral fee, or a reallocation penalty is negative.
35
35
  * @throws {NonPositiveInputError} when the deadline or a reallocation amount is not positive.
36
36
  * @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its ABI bound.
37
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
37
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
38
38
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
39
- * @throws {InvalidReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
39
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
40
40
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
41
41
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
42
42
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the destination market.
@@ -67,7 +67,7 @@ export interface BlueRepayParams {
67
67
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
68
68
  * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
69
69
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
70
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
70
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
71
71
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
72
72
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
73
73
  * @example
@@ -39,7 +39,7 @@ const repayWithdrawCollateral_js_1 = require("./repayWithdrawCollateral.js");
39
39
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
40
40
  * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
41
41
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
42
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
42
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
43
43
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
44
44
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
45
45
  * @example
@@ -43,7 +43,7 @@ export interface BlueRepayWithdrawCollateralParams {
43
43
  *
44
44
  * `maxRepayAssets` funds the live repayment plus fee and BlueBundlesV1 refunds the unused amount.
45
45
  * A saturated `repayShares = maxUint256` closes the live remaining debt. This route has no
46
- * Bundler3 share-price bound or `slippageTolerance` input.
46
+ * share-price bound or `slippageTolerance` input.
47
47
  *
48
48
  * @param params - Combined-operation encoding parameters.
49
49
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -68,7 +68,7 @@ export interface BlueRepayWithdrawCollateralParams {
68
68
  * @throws {NonPositiveInputError} when both operation legs are zero, repay funding is absent, or the deadline is invalid.
69
69
  * @throws {MaxRepayAssetsBelowRepayAssetsError} when exact-asset funding cannot cover the repayment and referral fee.
70
70
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
71
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
71
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
72
72
  * @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
73
73
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
74
74
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
@@ -11,7 +11,7 @@ const common_js_1 = require("./common.js");
11
11
  *
12
12
  * `maxRepayAssets` funds the live repayment plus fee and BlueBundlesV1 refunds the unused amount.
13
13
  * A saturated `repayShares = maxUint256` closes the live remaining debt. This route has no
14
- * Bundler3 share-price bound or `slippageTolerance` input.
14
+ * share-price bound or `slippageTolerance` input.
15
15
  *
16
16
  * @param params - Combined-operation encoding parameters.
17
17
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -36,7 +36,7 @@ const common_js_1 = require("./common.js");
36
36
  * @throws {NonPositiveInputError} when both operation legs are zero, repay funding is absent, or the deadline is invalid.
37
37
  * @throws {MaxRepayAssetsBelowRepayAssetsError} when exact-asset funding cannot cover the repayment and referral fee.
38
38
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
39
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
39
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
40
40
  * @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
41
41
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
42
42
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
@@ -32,7 +32,7 @@ export interface BlueSupplyParams {
32
32
  * Encodes a direct BlueBundlesV1 loan-asset supply transaction.
33
33
  *
34
34
  * `assets` is the gross funded amount; BlueBundlesV1 deducts the referral fee before supplying.
35
- * This route has no Bundler3 share-price bound or `slippageTolerance` input.
35
+ * This route has no share-price bound or `slippageTolerance` input.
36
36
  *
37
37
  * @param params - Supply encoding parameters.
38
38
  * @param params.market.chainId - Chain containing the BlueBundlesV1 deployment.
@@ -50,7 +50,7 @@ export interface BlueSupplyParams {
50
50
  * @throws {NonPositiveInputError} when `assets` or `deadline` is not positive.
51
51
  * @throws {NegativeInputError} when `nativeAmount` or `referralFeePct` is negative.
52
52
  * @throws {InputExceedsMaxError} when `assets` exceeds `uint256` or `referralFeePct` is at least WAD.
53
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
53
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
54
54
  * @throws {NativeFundingAmountMismatchError} when native funding does not equal `assets`.
55
55
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
56
56
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
@@ -10,7 +10,7 @@ const common_js_1 = require("./common.js");
10
10
  * Encodes a direct BlueBundlesV1 loan-asset supply transaction.
11
11
  *
12
12
  * `assets` is the gross funded amount; BlueBundlesV1 deducts the referral fee before supplying.
13
- * This route has no Bundler3 share-price bound or `slippageTolerance` input.
13
+ * This route has no share-price bound or `slippageTolerance` input.
14
14
  *
15
15
  * @param params - Supply encoding parameters.
16
16
  * @param params.market.chainId - Chain containing the BlueBundlesV1 deployment.
@@ -28,7 +28,7 @@ const common_js_1 = require("./common.js");
28
28
  * @throws {NonPositiveInputError} when `assets` or `deadline` is not positive.
29
29
  * @throws {NegativeInputError} when `nativeAmount` or `referralFeePct` is negative.
30
30
  * @throws {InputExceedsMaxError} when `assets` exceeds `uint256` or `referralFeePct` is at least WAD.
31
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
31
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
32
32
  * @throws {NativeFundingAmountMismatchError} when native funding does not equal `assets`.
33
33
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
34
34
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
@@ -32,7 +32,7 @@ export interface BlueSupplyCollateralParams {
32
32
  * Encodes a pure collateral supply through BlueBundlesV1.
33
33
  *
34
34
  * Delegates to {@link blueSupplyCollateralBorrow} with a zero borrow leg and an unrestricted LTV
35
- * cap. Native funding is exclusive with ERC-20 funding and no Bundler3 action is encoded.
35
+ * cap. Native funding is exclusive with ERC-20 funding.
36
36
  *
37
37
  * @param params - Collateral-supply encoding parameters.
38
38
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -59,7 +59,7 @@ export interface BlueSupplyCollateralParams {
59
59
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
60
60
  * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
61
61
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
62
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
62
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
63
63
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
64
64
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
65
65
  * @example
@@ -8,7 +8,7 @@ const supplyCollateralBorrow_js_1 = require("./supplyCollateralBorrow.js");
8
8
  * Encodes a pure collateral supply through BlueBundlesV1.
9
9
  *
10
10
  * Delegates to {@link blueSupplyCollateralBorrow} with a zero borrow leg and an unrestricted LTV
11
- * cap. Native funding is exclusive with ERC-20 funding and no Bundler3 action is encoded.
11
+ * cap. Native funding is exclusive with ERC-20 funding.
12
12
  *
13
13
  * @param params - Collateral-supply encoding parameters.
14
14
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -35,7 +35,7 @@ const supplyCollateralBorrow_js_1 = require("./supplyCollateralBorrow.js");
35
35
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
36
36
  * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
37
37
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
38
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
38
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
39
39
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
40
40
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
41
41
  * @example
@@ -40,7 +40,7 @@ export interface BlueSupplyCollateralBorrowParams {
40
40
  * Encodes a direct BlueBundlesV1 collateral supply and/or borrow transaction.
41
41
  *
42
42
  * Reallocations are Vault V2-only and require a borrow leg. Penalties and referral fees reduce
43
- * borrow proceeds. This route has no Bundler3 share-price bound or `slippageTolerance` input.
43
+ * borrow proceeds. This route has no share-price bound or `slippageTolerance` input.
44
44
  *
45
45
  * @param params - Combined-operation encoding parameters.
46
46
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -64,8 +64,9 @@ export interface BlueSupplyCollateralBorrowParams {
64
64
  * or a reallocation amount is not positive.
65
65
  * @throws {ReallocationsRequireBorrowError} when reallocations accompany no borrow.
66
66
  * @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its ABI bound.
67
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
67
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
68
68
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
69
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
69
70
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
70
71
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
71
72
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
@@ -10,7 +10,7 @@ const common_js_1 = require("./common.js");
10
10
  * Encodes a direct BlueBundlesV1 collateral supply and/or borrow transaction.
11
11
  *
12
12
  * Reallocations are Vault V2-only and require a borrow leg. Penalties and referral fees reduce
13
- * borrow proceeds. This route has no Bundler3 share-price bound or `slippageTolerance` input.
13
+ * borrow proceeds. This route has no share-price bound or `slippageTolerance` input.
14
14
  *
15
15
  * @param params - Combined-operation encoding parameters.
16
16
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -34,8 +34,9 @@ const common_js_1 = require("./common.js");
34
34
  * or a reallocation amount is not positive.
35
35
  * @throws {ReallocationsRequireBorrowError} when reallocations accompany no borrow.
36
36
  * @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its ABI bound.
37
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
37
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
38
38
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
39
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
39
40
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
40
41
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
41
42
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
@@ -35,7 +35,7 @@ export interface BlueWithdrawParams {
35
35
  *
36
36
  * Vault V2 allocator penalties and referral fees reduce the assets received. Shares mode has no
37
37
  * saturated full-close sentinel or onchain minimum-assets guarantee, and this route has no
38
- * Bundler3 share-price bound or `slippageTolerance` input.
38
+ * share-price bound or `slippageTolerance` input.
39
39
  *
40
40
  * @param params - Withdrawal encoding parameters.
41
41
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -56,9 +56,9 @@ export interface BlueWithdrawParams {
56
56
  * @throws {NonPositiveInputError} when neither mode, no valid deadline, or a non-positive
57
57
  * reallocation amount is provided.
58
58
  * @throws {InputExceedsMaxError} when a withdraw amount, fee, reallocation amount, or penalty exceeds its ABI bound.
59
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
59
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
60
60
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
61
- * @throws {InvalidReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
61
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
62
62
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
63
63
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
64
64
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
@@ -11,7 +11,7 @@ const common_js_1 = require("./common.js");
11
11
  *
12
12
  * Vault V2 allocator penalties and referral fees reduce the assets received. Shares mode has no
13
13
  * saturated full-close sentinel or onchain minimum-assets guarantee, and this route has no
14
- * Bundler3 share-price bound or `slippageTolerance` input.
14
+ * share-price bound or `slippageTolerance` input.
15
15
  *
16
16
  * @param params - Withdrawal encoding parameters.
17
17
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -32,9 +32,9 @@ const common_js_1 = require("./common.js");
32
32
  * @throws {NonPositiveInputError} when neither mode, no valid deadline, or a non-positive
33
33
  * reallocation amount is provided.
34
34
  * @throws {InputExceedsMaxError} when a withdraw amount, fee, reallocation amount, or penalty exceeds its ABI bound.
35
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
35
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
36
36
  * @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
37
- * @throws {InvalidReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
37
+ * @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
38
38
  * @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
39
39
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
40
40
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
@@ -32,7 +32,7 @@ export interface BlueWithdrawCollateralParams {
32
32
  * Encodes a pure collateral withdrawal through BlueBundlesV1.
33
33
  *
34
34
  * Delegates to {@link blueRepayWithdrawCollateral} with a zero repay leg. BlueBundlesV1 enforces
35
- * the supplied post-operation LTV, and no standalone Morpho or Bundler3 call is encoded.
35
+ * the supplied post-operation LTV, and no standalone Morpho call is encoded.
36
36
  *
37
37
  * @param params - Collateral-withdrawal encoding parameters.
38
38
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -50,7 +50,7 @@ export interface BlueWithdrawCollateralParams {
50
50
  * @throws {NegativeInputError} when collateral, LTV, or fee is negative.
51
51
  * @throws {NonPositiveInputError} when collateral or deadline is not positive.
52
52
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
53
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
53
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
54
54
  * @throws {DepositOwnerMismatchError} when the signed authorization owner differs from `userAddress`.
55
55
  * @throws {BundlesRequirementSignatureMismatchError} when authorization cannot be bound safely.
56
56
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
@@ -7,7 +7,7 @@ const repayWithdrawCollateral_js_1 = require("./repayWithdrawCollateral.js");
7
7
  * Encodes a pure collateral withdrawal through BlueBundlesV1.
8
8
  *
9
9
  * Delegates to {@link blueRepayWithdrawCollateral} with a zero repay leg. BlueBundlesV1 enforces
10
- * the supplied post-operation LTV, and no standalone Morpho or Bundler3 call is encoded.
10
+ * the supplied post-operation LTV, and no standalone Morpho call is encoded.
11
11
  *
12
12
  * @param params - Collateral-withdrawal encoding parameters.
13
13
  * @param params.market.chainId - Chain containing BlueBundlesV1.
@@ -25,7 +25,7 @@ const repayWithdrawCollateral_js_1 = require("./repayWithdrawCollateral.js");
25
25
  * @throws {NegativeInputError} when collateral, LTV, or fee is negative.
26
26
  * @throws {NonPositiveInputError} when collateral or deadline is not positive.
27
27
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
28
- * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
28
+ * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
29
29
  * @throws {DepositOwnerMismatchError} when the signed authorization owner differs from `userAddress`.
30
30
  * @throws {BundlesRequirementSignatureMismatchError} when authorization cannot be bound safely.
31
31
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
@@ -96,11 +96,12 @@ export declare const resolveBundlesFunding: (params: BundlesFundingArgs) => {
96
96
  * @param params.amount - Exact pull amount in the token's smallest unit; must match both signed amount fields.
97
97
  * @param params.requirementSignature - Optional signed ERC-2612 or Permit2 SignatureTransfer requirement; omit for allowance funding.
98
98
  * @returns An empty, ERC-2612, or Permit2 SignatureTransfer token permit.
99
- * @throws {UnexpectedRequirementSignatureError} when Permit2 AllowanceTransfer is supplied.
100
99
  * @throws {DepositOwnerMismatchError} when the signature owner differs from `userAddress`.
101
100
  * @throws {DepositAssetMismatchError} when the signed token differs from `token`.
102
101
  * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
103
102
  * @throws {DepositSpenderMismatchError} when the signed spender differs from `spender`.
103
+ * @throws {UnsupportedRequirementSignatureError} when the signature's action type is neither
104
+ * "permit" nor "permit2SignatureTransfer".
104
105
  * @throws {BundlesRequirementSignatureMismatchError} when signature metadata is malformed.
105
106
  * @example
106
107
  * ```ts
@@ -153,7 +154,10 @@ export declare const normalizeBundlesSignature: (serializedSignature: Hex, onInv
153
154
  * @param params.amount - Optional exact share allowance in the vault share token's smallest unit.
154
155
  * @param params.requirementSignature - Optional signed ERC-2612 share requirement; omit for the empty-permit sentinel.
155
156
  * @returns The signed share permit or the contract's empty-permit sentinel.
156
- * @throws {BundlesPermitMismatchError} when the requirement kind, token, or signature is invalid.
157
+ * @throws {NonPositiveInputError} when a bundle or permit deadline is not positive.
158
+ * @throws {InputExceedsMaxError} when a bundle or permit deadline exceeds uint256.
159
+ * @throws {BundlesPermitMismatchError} when the requirement kind, token, owner, spender, amount or
160
+ * deadline, or signature is invalid.
157
161
  * @example
158
162
  * ```ts
159
163
  * import { getBundlesSharesPermit } from "@morpho-org/morpho-sdk";
@@ -84,11 +84,12 @@ exports.resolveBundlesFunding = resolveBundlesFunding;
84
84
  * @param params.amount - Exact pull amount in the token's smallest unit; must match both signed amount fields.
85
85
  * @param params.requirementSignature - Optional signed ERC-2612 or Permit2 SignatureTransfer requirement; omit for allowance funding.
86
86
  * @returns An empty, ERC-2612, or Permit2 SignatureTransfer token permit.
87
- * @throws {UnexpectedRequirementSignatureError} when Permit2 AllowanceTransfer is supplied.
88
87
  * @throws {DepositOwnerMismatchError} when the signature owner differs from `userAddress`.
89
88
  * @throws {DepositAssetMismatchError} when the signed token differs from `token`.
90
89
  * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
91
90
  * @throws {DepositSpenderMismatchError} when the signed spender differs from `spender`.
91
+ * @throws {UnsupportedRequirementSignatureError} when the signature's action type is neither
92
+ * "permit" nor "permit2SignatureTransfer".
92
93
  * @throws {BundlesRequirementSignatureMismatchError} when signature metadata is malformed.
93
94
  * @example
94
95
  * ```ts
@@ -108,9 +109,9 @@ const getBundlesTokenPermit = (params) => {
108
109
  const { requirementSignature } = params;
109
110
  if (requirementSignature == null)
110
111
  return { ...EMPTY_TOKEN_PERMIT };
111
- if (requirementSignature.action.type === "permit2") {
112
- throw new index_js_2.UnexpectedRequirementSignatureError("permit");
113
- }
112
+ const { type } = requirementSignature.action;
113
+ if (type !== "permit" && type !== "permit2SignatureTransfer")
114
+ throw new index_js_2.UnsupportedRequirementSignatureError(type);
114
115
  if (!(0, viem_1.isAddressEqual)(requirementSignature.args.owner, params.userAddress)) {
115
116
  throw new index_js_2.DepositOwnerMismatchError(params.userAddress, requirementSignature.args.owner);
116
117
  }
@@ -232,7 +233,10 @@ exports.normalizeBundlesSignature = normalizeBundlesSignature;
232
233
  * @param params.amount - Optional exact share allowance in the vault share token's smallest unit.
233
234
  * @param params.requirementSignature - Optional signed ERC-2612 share requirement; omit for the empty-permit sentinel.
234
235
  * @returns The signed share permit or the contract's empty-permit sentinel.
235
- * @throws {BundlesPermitMismatchError} when the requirement kind, token, or signature is invalid.
236
+ * @throws {NonPositiveInputError} when a bundle or permit deadline is not positive.
237
+ * @throws {InputExceedsMaxError} when a bundle or permit deadline exceeds uint256.
238
+ * @throws {BundlesPermitMismatchError} when the requirement kind, token, owner, spender, amount or
239
+ * deadline, or signature is invalid.
236
240
  * @example
237
241
  * ```ts
238
242
  * import { getBundlesSharesPermit } from "@morpho-org/morpho-sdk";
@@ -247,6 +251,12 @@ exports.normalizeBundlesSignature = normalizeBundlesSignature;
247
251
  */
248
252
  const getBundlesSharesPermit = (params) => {
249
253
  const { requirementSignature } = params;
254
+ // Require a positive uint256 for the fallback permit deadline.
255
+ (0, validate_js_1.validateDeadline)(params.deadline);
256
+ if (requirementSignature != null) {
257
+ // Require a positive uint256 for the signed permit deadline too.
258
+ (0, validate_js_1.validateDeadline)(requirementSignature.args.deadline);
259
+ }
250
260
  if (requirementSignature == null) {
251
261
  return {
252
262
  value: 0n,
@@ -296,6 +306,14 @@ const getBundlesSharesPermit = (params) => {
296
306
  actual: String(requirementSignature.args.amount),
297
307
  });
298
308
  }
309
+ if ((params.owner != null || params.spender != null || params.amount != null) &&
310
+ requirementSignature.action.args.amount !== requirementSignature.args.amount) {
311
+ throw new index_js_2.BundlesPermitMismatchError({
312
+ field: "amount",
313
+ expected: String(requirementSignature.args.amount),
314
+ actual: String(requirementSignature.action.args.amount),
315
+ });
316
+ }
299
317
  if ((params.owner != null || params.spender != null || params.amount != null) &&
300
318
  requirementSignature.action.args.deadline !==
301
319
  requirementSignature.args.deadline) {
@@ -6,6 +6,5 @@ export * from "./blue/index.js";
6
6
  export * from "./bundles/index.js";
7
7
  export * from "./midnight/index.js";
8
8
  export * from "./requirements/index.js";
9
- export * from "./signatures/index.js";
10
9
  export * from "./vaultV1/index.js";
11
10
  export * from "./vaultV2/index.js";
@@ -18,6 +18,5 @@ __exportStar(require("./blue/index.js"), exports);
18
18
  __exportStar(require("./bundles/index.js"), exports);
19
19
  __exportStar(require("./midnight/index.js"), exports);
20
20
  __exportStar(require("./requirements/index.js"), exports);
21
- __exportStar(require("./signatures/index.js"), exports);
22
21
  __exportStar(require("./vaultV1/index.js"), exports);
23
22
  __exportStar(require("./vaultV2/index.js"), exports);
@@ -10,15 +10,13 @@ import { type AuthorizationRequirementSignature, type BlueAuthorizationAction, t
10
10
  * - When `supportSignature` is falsy (default), returns the
11
11
  * `setAuthorization(authorized, true)` transaction the user submits before the operation.
12
12
  * - When `supportSignature` is `true`, reads the user's Morpho `nonce` and returns a signable
13
- * `Requirement`. The selected route consumes the result: Bundler3 emits
14
- * `setAuthorizationWithSig`, while BlueBundlesV1 embeds its signed-authorization struct.
13
+ * `Requirement` consumed by BlueBundlesV1.
15
14
  *
16
15
  * @param params.viemClient - Connected viem `Client` whose `chain.id` matches `params.chainId`.
17
- * @param params.chainId - Target chain id used to resolve Morpho and the default GeneralAdapter1.
16
+ * @param params.chainId - Target chain id used to resolve Morpho and BlueBundlesV1.
18
17
  * @param params.userAddress - The user granting authorization.
19
- * @param params.authorized - Operator to authorize. Defaults to GeneralAdapter1; direct Blue
20
- * writes pass the registered BlueBundlesV1 deployment. Must be the chain's registered
21
- * GeneralAdapter1 or BlueBundlesV1 operator.
18
+ * @param params.authorized - Operator to authorize. Defaults to the chain's registered
19
+ * BlueBundlesV1 deployment and must match it.
22
20
  * @param params.deadline - Optional signature deadline forwarded to the authorization encoder.
23
21
  * @param params.supportSignature - When `true`, return a signable `Requirement` instead of a
24
22
  * transaction so the destination route can consume the signed authorization.
@@ -26,8 +24,8 @@ import { type AuthorizationRequirementSignature, type BlueAuthorizationAction, t
26
24
  * `Requirement` (when `supportSignature` is `true`), or `null` when authorization is already in
27
25
  * place.
28
26
  * @throws {ChainIdMismatchError} when `viemClient.chain?.id !== params.chainId`.
29
- * @throws {UnsupportedAuthorizationOperatorError} when `authorized` is neither the chain's
30
- * GeneralAdapter1 nor its BlueBundlesV1 operator.
27
+ * @throws {UnsupportedAuthorizationOperatorError} when `authorized` is not the chain's
28
+ * BlueBundlesV1 operator.
31
29
  * @throws {NonPositiveInputError} when a provided `deadline` is not positive.
32
30
  * @throws {InputExceedsMaxError} when a provided `deadline` exceeds `uint256`.
33
31
  * @throws {ExpiredDeadlineError} when a provided `deadline` is positive but not in the future.
@@ -17,15 +17,13 @@ const encodeBlueSignatureAuthorization_js_1 = require("../encode/encodeBlueSigna
17
17
  * - When `supportSignature` is falsy (default), returns the
18
18
  * `setAuthorization(authorized, true)` transaction the user submits before the operation.
19
19
  * - When `supportSignature` is `true`, reads the user's Morpho `nonce` and returns a signable
20
- * `Requirement`. The selected route consumes the result: Bundler3 emits
21
- * `setAuthorizationWithSig`, while BlueBundlesV1 embeds its signed-authorization struct.
20
+ * `Requirement` consumed by BlueBundlesV1.
22
21
  *
23
22
  * @param params.viemClient - Connected viem `Client` whose `chain.id` matches `params.chainId`.
24
- * @param params.chainId - Target chain id used to resolve Morpho and the default GeneralAdapter1.
23
+ * @param params.chainId - Target chain id used to resolve Morpho and BlueBundlesV1.
25
24
  * @param params.userAddress - The user granting authorization.
26
- * @param params.authorized - Operator to authorize. Defaults to GeneralAdapter1; direct Blue
27
- * writes pass the registered BlueBundlesV1 deployment. Must be the chain's registered
28
- * GeneralAdapter1 or BlueBundlesV1 operator.
25
+ * @param params.authorized - Operator to authorize. Defaults to the chain's registered
26
+ * BlueBundlesV1 deployment and must match it.
29
27
  * @param params.deadline - Optional signature deadline forwarded to the authorization encoder.
30
28
  * @param params.supportSignature - When `true`, return a signable `Requirement` instead of a
31
29
  * transaction so the destination route can consume the signed authorization.
@@ -33,8 +31,8 @@ const encodeBlueSignatureAuthorization_js_1 = require("../encode/encodeBlueSigna
33
31
  * `Requirement` (when `supportSignature` is `true`), or `null` when authorization is already in
34
32
  * place.
35
33
  * @throws {ChainIdMismatchError} when `viemClient.chain?.id !== params.chainId`.
36
- * @throws {UnsupportedAuthorizationOperatorError} when `authorized` is neither the chain's
37
- * GeneralAdapter1 nor its BlueBundlesV1 operator.
34
+ * @throws {UnsupportedAuthorizationOperatorError} when `authorized` is not the chain's
35
+ * BlueBundlesV1 operator.
38
36
  * @throws {NonPositiveInputError} when a provided `deadline` is not positive.
39
37
  * @throws {InputExceedsMaxError} when a provided `deadline` exceeds `uint256`.
40
38
  * @throws {ExpiredDeadlineError} when a provided `deadline` is positive but not in the future.
@@ -66,16 +64,13 @@ const getBlueAuthorizationRequirement = async (params) => {
66
64
  if (viemClient.chain?.id !== chainId) {
67
65
  throw new index_js_1.ChainIdMismatchError(viemClient.chain?.id, chainId);
68
66
  }
69
- const { morpho, bundler3: { generalAdapter1 }, bundles, } = (0, blue_sdk_1.getChainAddresses)(chainId);
70
- const authorized = params.authorized ?? generalAdapter1;
71
- // The SDK only ever authorizes the chain's registered GeneralAdapter1 or BlueBundlesV1 operator;
67
+ const { blue: morpho } = (0, blue_sdk_1.getChainAddresses)(chainId);
68
+ const blueBundlesV1 = (0, morpho_ts_1.getChainAddress)(chainId, "bundles.blueBundlesV1");
69
+ const authorized = params.authorized ?? blueBundlesV1;
70
+ // The SDK only ever authorizes the chain's registered BlueBundlesV1 operator;
72
71
  // reject any other override so a misconfigured `authorized` cannot grant an arbitrary address
73
72
  // control over the user's Morpho positions.
74
- const supportedOperators = [generalAdapter1];
75
- if (bundles?.blueBundlesV1 != null) {
76
- supportedOperators.push(bundles.blueBundlesV1);
77
- }
78
- if (!supportedOperators.some((operator) => (0, viem_1.isAddressEqual)(operator, authorized))) {
73
+ if (!(0, viem_1.isAddressEqual)(blueBundlesV1, authorized)) {
79
74
  throw new index_js_1.UnsupportedAuthorizationOperatorError(authorized, chainId);
80
75
  }
81
76
  const pc = viemClient.extend(viem_1.publicActions);
@@ -5,7 +5,7 @@ import { type AuthorizationRequirementSignature, type Requirement } from "../../
5
5
  interface EncodeBlueSignatureAuthorizationParams {
6
6
  /** Account granting the authorization and signing it (the Morpho `authorizer`). */
7
7
  owner: Address;
8
- /** Operator to authorize on Morpho, such as GeneralAdapter1 or BlueBundlesV1. */
8
+ /** BlueBundlesV1 operator to authorize on Morpho. */
9
9
  authorized: Address;
10
10
  /** Target chain id; must match `viemClient.chain.id`. */
11
11
  chainId: number;
@@ -17,9 +17,8 @@ interface EncodeBlueSignatureAuthorizationParams {
17
17
  deadline?: bigint;
18
18
  }
19
19
  /**
20
- * Builds a Morpho authorization `Requirement` that, once signed, lets `authorized` operate on
21
- * Morpho on the signer's behalf. Bundler3 consumes the result through `setAuthorizationWithSig`;
22
- * BlueBundlesV1 embeds the same signed authorization in its direct-call struct.
20
+ * Builds a Morpho authorization `Requirement` that, once signed, lets BlueBundlesV1 operate on
21
+ * Morpho on the signer's behalf.
23
22
  *
24
23
  * The returned `Requirement.sign()` produces the EIP-712 signature over Morpho's `Authorization`
25
24
  * typed data, verifies it against the connected account, and returns a deep-frozen
@@ -30,7 +29,7 @@ interface EncodeBlueSignatureAuthorizationParams {
30
29
  * @param viemClient - Connected viem `Client` whose `chain.id` matches `params.chainId`.
31
30
  * @param params - Authorization encoding parameters.
32
31
  * @param params.owner - Account granting the authorization and signing it (the Morpho `authorizer`).
33
- * @param params.authorized - Operator to authorize, such as GeneralAdapter1 or BlueBundlesV1.
32
+ * @param params.authorized - BlueBundlesV1 operator to authorize.
34
33
  * @param params.chainId - Target chain id.
35
34
  * @param params.nonce - The owner's current Morpho authorization nonce.
36
35
  * @param params.isAuthorized - Grant (`true`, default) or revoke (`false`).
@@ -54,7 +53,7 @@ interface EncodeBlueSignatureAuthorizationParams {
54
53
  * const client = createWalletClient({ chain: mainnet, transport: http() });
55
54
  * const requirement = await encodeBlueSignatureAuthorization(client, {
56
55
  * owner,
57
- * authorized: generalAdapter1,
56
+ * authorized: blueBundlesV1,
58
57
  * chainId: 1,
59
58
  * nonce: 0n,
60
59
  * });
@@ -7,9 +7,8 @@ const signAndVerifyTypedData_js_1 = require("../../../helpers/signAndVerifyTyped
7
7
  const validate_js_1 = require("../../../helpers/validate.js");
8
8
  const index_js_1 = require("../../../types/index.js");
9
9
  /**
10
- * Builds a Morpho authorization `Requirement` that, once signed, lets `authorized` operate on
11
- * Morpho on the signer's behalf. Bundler3 consumes the result through `setAuthorizationWithSig`;
12
- * BlueBundlesV1 embeds the same signed authorization in its direct-call struct.
10
+ * Builds a Morpho authorization `Requirement` that, once signed, lets BlueBundlesV1 operate on
11
+ * Morpho on the signer's behalf.
13
12
  *
14
13
  * The returned `Requirement.sign()` produces the EIP-712 signature over Morpho's `Authorization`
15
14
  * typed data, verifies it against the connected account, and returns a deep-frozen
@@ -20,7 +19,7 @@ const index_js_1 = require("../../../types/index.js");
20
19
  * @param viemClient - Connected viem `Client` whose `chain.id` matches `params.chainId`.
21
20
  * @param params - Authorization encoding parameters.
22
21
  * @param params.owner - Account granting the authorization and signing it (the Morpho `authorizer`).
23
- * @param params.authorized - Operator to authorize, such as GeneralAdapter1 or BlueBundlesV1.
22
+ * @param params.authorized - BlueBundlesV1 operator to authorize.
24
23
  * @param params.chainId - Target chain id.
25
24
  * @param params.nonce - The owner's current Morpho authorization nonce.
26
25
  * @param params.isAuthorized - Grant (`true`, default) or revoke (`false`).
@@ -44,7 +43,7 @@ const index_js_1 = require("../../../types/index.js");
44
43
  * const client = createWalletClient({ chain: mainnet, transport: http() });
45
44
  * const requirement = await encodeBlueSignatureAuthorization(client, {
46
45
  * owner,
47
- * authorized: generalAdapter1,
46
+ * authorized: blueBundlesV1,
48
47
  * chainId: 1,
49
48
  * nonce: 0n,
50
49
  * });