@morpho-org/morpho-sdk 6.0.0-next.0 → 6.0.0-next.1

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 (205) hide show
  1. package/MIGRATION-v5-to-v6.md +206 -3
  2. package/README.md +81 -41
  3. package/lib/cjs/abis.d.ts +210 -0
  4. package/lib/cjs/abis.js +142 -2
  5. package/lib/cjs/actions/blue/borrow.d.ts +1 -1
  6. package/lib/cjs/actions/blue/borrow.js +1 -1
  7. package/lib/cjs/actions/blue/common.d.ts +6 -19
  8. package/lib/cjs/actions/blue/common.js +25 -138
  9. package/lib/cjs/actions/blue/refinance.d.ts +1 -1
  10. package/lib/cjs/actions/blue/refinance.js +1 -1
  11. package/lib/cjs/actions/blue/repay.d.ts +3 -3
  12. package/lib/cjs/actions/blue/repay.js +1 -1
  13. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +3 -3
  14. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +1 -1
  15. package/lib/cjs/actions/blue/supply.d.ts +3 -3
  16. package/lib/cjs/actions/blue/supply.js +1 -1
  17. package/lib/cjs/actions/blue/supplyCollateral.d.ts +3 -3
  18. package/lib/cjs/actions/blue/supplyCollateral.js +1 -1
  19. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -3
  20. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +1 -1
  21. package/lib/cjs/actions/blue/withdraw.d.ts +1 -1
  22. package/lib/cjs/actions/blue/withdraw.js +1 -1
  23. package/lib/cjs/actions/blue/withdrawCollateral.d.ts +1 -1
  24. package/lib/cjs/actions/blue/withdrawCollateral.js +1 -1
  25. package/lib/cjs/actions/bundles/common.d.ts +200 -0
  26. package/lib/cjs/actions/bundles/common.js +469 -0
  27. package/lib/cjs/actions/bundles/index.d.ts +3 -0
  28. package/lib/cjs/actions/bundles/index.js +23 -0
  29. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
  30. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +125 -0
  31. package/lib/cjs/actions/index.d.ts +1 -0
  32. package/lib/cjs/actions/index.js +1 -0
  33. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
  34. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
  35. package/lib/cjs/actions/midnight/takeBorrow.d.ts +2 -2
  36. package/lib/cjs/actions/midnight/takeBorrow.js +2 -2
  37. package/lib/cjs/actions/midnight/takeLend.d.ts +2 -2
  38. package/lib/cjs/actions/midnight/takeLend.js +2 -2
  39. package/lib/cjs/actions/requirements/blue/getUnusedPermit2Nonce.d.ts +1 -1
  40. package/lib/cjs/actions/requirements/blue/getUnusedPermit2Nonce.js +1 -1
  41. package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
  42. package/lib/cjs/actions/requirements/blue/index.js +0 -1
  43. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +1 -1
  44. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
  45. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +2 -1
  46. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +3 -3
  47. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +10 -4
  48. package/lib/{esm/actions/requirements/encode/encodeErc20Permit2TransferFrom.d.ts → cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts} +12 -12
  49. package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2TransferFrom.js → encodeErc20Permit2SignatureTransfer.js} +13 -13
  50. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -4
  51. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +6 -5
  52. package/lib/cjs/actions/requirements/encode/index.d.ts +1 -1
  53. package/lib/cjs/actions/requirements/encode/index.js +1 -1
  54. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +4 -3
  55. package/lib/cjs/actions/requirements/getRequirementsApproval.js +4 -3
  56. package/lib/cjs/actions/signatures/getTokenRequirementActions.js +2 -2
  57. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +22 -30
  58. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +18 -66
  59. package/lib/cjs/actions/vaultV1/deposit.d.ts +73 -57
  60. package/lib/cjs/actions/vaultV1/deposit.js +110 -109
  61. package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +43 -66
  62. package/lib/cjs/actions/vaultV1/migrateToV2.js +91 -104
  63. package/lib/cjs/actions/vaultV1/redeem.d.ts +30 -23
  64. package/lib/cjs/actions/vaultV1/redeem.js +56 -33
  65. package/lib/cjs/actions/vaultV1/withdraw.d.ts +58 -24
  66. package/lib/cjs/actions/vaultV1/withdraw.js +86 -34
  67. package/lib/cjs/actions/vaultV2/deposit.d.ts +74 -57
  68. package/lib/cjs/actions/vaultV2/deposit.js +111 -109
  69. package/lib/cjs/actions/vaultV2/redeem.d.ts +30 -24
  70. package/lib/cjs/actions/vaultV2/redeem.js +56 -34
  71. package/lib/cjs/actions/vaultV2/withdraw.d.ts +58 -25
  72. package/lib/cjs/actions/vaultV2/withdraw.js +86 -35
  73. package/lib/cjs/entities/blue/blue.d.ts +19 -19
  74. package/lib/cjs/entities/blue/blue.js +3 -1
  75. package/lib/cjs/entities/index.d.ts +1 -0
  76. package/lib/cjs/entities/index.js +15 -0
  77. package/lib/cjs/entities/midnight/midnight.d.ts +2 -2
  78. package/lib/cjs/{actions/requirements/blue/getBlueBundlesV1TokenRequirements.d.ts → entities/requirements/getBundlesTokenRequirements.d.ts} +21 -14
  79. package/lib/cjs/{actions/requirements/blue/getBlueBundlesV1TokenRequirements.js → entities/requirements/getBundlesTokenRequirements.js} +61 -65
  80. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
  81. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +74 -0
  82. package/lib/cjs/entities/requirements/index.d.ts +1 -0
  83. package/lib/cjs/entities/requirements/index.js +17 -0
  84. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +348 -98
  85. package/lib/cjs/entities/vaultV1/vaultV1.js +322 -120
  86. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +221 -68
  87. package/lib/cjs/entities/vaultV2/vaultV2.js +219 -77
  88. package/lib/cjs/helpers/index.d.ts +2 -1
  89. package/lib/cjs/helpers/index.js +5 -1
  90. package/lib/cjs/helpers/referralFee.d.ts +21 -0
  91. package/lib/cjs/helpers/referralFee.js +35 -0
  92. package/lib/cjs/helpers/slippage.d.ts +90 -1
  93. package/lib/cjs/helpers/slippage.js +123 -0
  94. package/lib/cjs/helpers/validate.d.ts +2 -0
  95. package/lib/cjs/helpers/validate.js +12 -1
  96. package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
  97. package/lib/cjs/helpers/validateRequirementSpender.js +1 -0
  98. package/lib/cjs/index.d.ts +1 -0
  99. package/lib/cjs/index.js +1 -0
  100. package/lib/cjs/types/action.d.ts +179 -70
  101. package/lib/cjs/types/action.js +12 -12
  102. package/lib/cjs/types/error.d.ts +62 -14
  103. package/lib/cjs/types/error.js +88 -22
  104. package/lib/esm/abis.d.ts +210 -0
  105. package/lib/esm/abis.js +140 -0
  106. package/lib/esm/actions/blue/borrow.d.ts +1 -1
  107. package/lib/esm/actions/blue/borrow.js +1 -1
  108. package/lib/esm/actions/blue/common.d.ts +6 -19
  109. package/lib/esm/actions/blue/common.js +27 -140
  110. package/lib/esm/actions/blue/refinance.d.ts +1 -1
  111. package/lib/esm/actions/blue/refinance.js +1 -1
  112. package/lib/esm/actions/blue/repay.d.ts +3 -3
  113. package/lib/esm/actions/blue/repay.js +1 -1
  114. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +3 -3
  115. package/lib/esm/actions/blue/repayWithdrawCollateral.js +1 -1
  116. package/lib/esm/actions/blue/supply.d.ts +3 -3
  117. package/lib/esm/actions/blue/supply.js +1 -1
  118. package/lib/esm/actions/blue/supplyCollateral.d.ts +3 -3
  119. package/lib/esm/actions/blue/supplyCollateral.js +1 -1
  120. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -3
  121. package/lib/esm/actions/blue/supplyCollateralBorrow.js +1 -1
  122. package/lib/esm/actions/blue/withdraw.d.ts +1 -1
  123. package/lib/esm/actions/blue/withdraw.js +1 -1
  124. package/lib/esm/actions/blue/withdrawCollateral.d.ts +1 -1
  125. package/lib/esm/actions/blue/withdrawCollateral.js +1 -1
  126. package/lib/esm/actions/bundles/common.d.ts +200 -0
  127. package/lib/esm/actions/bundles/common.js +457 -0
  128. package/lib/esm/actions/bundles/index.d.ts +3 -0
  129. package/lib/esm/actions/bundles/index.js +2 -0
  130. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
  131. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +121 -0
  132. package/lib/esm/actions/index.d.ts +1 -0
  133. package/lib/esm/actions/index.js +1 -0
  134. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
  135. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
  136. package/lib/esm/actions/midnight/takeBorrow.d.ts +2 -2
  137. package/lib/esm/actions/midnight/takeBorrow.js +2 -2
  138. package/lib/esm/actions/midnight/takeLend.d.ts +2 -2
  139. package/lib/esm/actions/midnight/takeLend.js +2 -2
  140. package/lib/esm/actions/requirements/blue/getUnusedPermit2Nonce.d.ts +1 -1
  141. package/lib/esm/actions/requirements/blue/getUnusedPermit2Nonce.js +1 -1
  142. package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
  143. package/lib/esm/actions/requirements/blue/index.js +0 -1
  144. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +1 -1
  145. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
  146. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +2 -1
  147. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +3 -3
  148. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +10 -4
  149. package/lib/{cjs/actions/requirements/encode/encodeErc20Permit2TransferFrom.d.ts → esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts} +12 -12
  150. package/lib/esm/actions/requirements/encode/{encodeErc20Permit2TransferFrom.js → encodeErc20Permit2SignatureTransfer.js} +11 -11
  151. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -4
  152. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +6 -5
  153. package/lib/esm/actions/requirements/encode/index.d.ts +1 -1
  154. package/lib/esm/actions/requirements/encode/index.js +1 -1
  155. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +4 -3
  156. package/lib/esm/actions/requirements/getRequirementsApproval.js +4 -3
  157. package/lib/esm/actions/signatures/getTokenRequirementActions.js +3 -3
  158. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +22 -30
  159. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +19 -67
  160. package/lib/esm/actions/vaultV1/deposit.d.ts +73 -57
  161. package/lib/esm/actions/vaultV1/deposit.js +112 -111
  162. package/lib/esm/actions/vaultV1/migrateToV2.d.ts +43 -66
  163. package/lib/esm/actions/vaultV1/migrateToV2.js +93 -106
  164. package/lib/esm/actions/vaultV1/redeem.d.ts +30 -23
  165. package/lib/esm/actions/vaultV1/redeem.js +56 -33
  166. package/lib/esm/actions/vaultV1/withdraw.d.ts +58 -24
  167. package/lib/esm/actions/vaultV1/withdraw.js +86 -34
  168. package/lib/esm/actions/vaultV2/deposit.d.ts +74 -57
  169. package/lib/esm/actions/vaultV2/deposit.js +113 -111
  170. package/lib/esm/actions/vaultV2/redeem.d.ts +30 -24
  171. package/lib/esm/actions/vaultV2/redeem.js +56 -34
  172. package/lib/esm/actions/vaultV2/withdraw.d.ts +58 -25
  173. package/lib/esm/actions/vaultV2/withdraw.js +86 -35
  174. package/lib/esm/entities/blue/blue.d.ts +19 -19
  175. package/lib/esm/entities/blue/blue.js +4 -2
  176. package/lib/esm/entities/index.d.ts +1 -0
  177. package/lib/esm/entities/index.js +1 -0
  178. package/lib/esm/entities/midnight/midnight.d.ts +2 -2
  179. package/lib/esm/{actions/requirements/blue/getBlueBundlesV1TokenRequirements.d.ts → entities/requirements/getBundlesTokenRequirements.d.ts} +21 -14
  180. package/lib/esm/{actions/requirements/blue/getBlueBundlesV1TokenRequirements.js → entities/requirements/getBundlesTokenRequirements.js} +51 -55
  181. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
  182. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +70 -0
  183. package/lib/esm/entities/requirements/index.d.ts +1 -0
  184. package/lib/esm/entities/requirements/index.js +1 -0
  185. package/lib/esm/entities/vaultV1/vaultV1.d.ts +348 -98
  186. package/lib/esm/entities/vaultV1/vaultV1.js +326 -124
  187. package/lib/esm/entities/vaultV2/vaultV2.d.ts +221 -68
  188. package/lib/esm/entities/vaultV2/vaultV2.js +222 -80
  189. package/lib/esm/helpers/index.d.ts +2 -1
  190. package/lib/esm/helpers/index.js +2 -1
  191. package/lib/esm/helpers/referralFee.d.ts +21 -0
  192. package/lib/esm/helpers/referralFee.js +31 -0
  193. package/lib/esm/helpers/slippage.d.ts +90 -1
  194. package/lib/esm/helpers/slippage.js +122 -2
  195. package/lib/esm/helpers/validate.d.ts +2 -0
  196. package/lib/esm/helpers/validate.js +11 -1
  197. package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
  198. package/lib/esm/helpers/validateRequirementSpender.js +1 -0
  199. package/lib/esm/index.d.ts +1 -0
  200. package/lib/esm/index.js +1 -0
  201. package/lib/esm/types/action.d.ts +179 -70
  202. package/lib/esm/types/action.js +11 -11
  203. package/lib/esm/types/error.d.ts +62 -14
  204. package/lib/esm/types/error.js +80 -16
  205. package/package.json +3 -3
package/lib/esm/abis.js CHANGED
@@ -179,6 +179,146 @@ export const vaultExitBundlesV1Abi = [
179
179
  stateMutability: "nonpayable",
180
180
  },
181
181
  ];
182
+ /**
183
+ * Pinned ABI for the VaultBundlesV1 entrypoints used by Vault V1 and Vault V2 actions.
184
+ *
185
+ * Sourced from `morpho-org/bundles` commit
186
+ * `f27e7bcf744310303e24faa522b71d702e696686`.
187
+ */
188
+ export const vaultBundlesV1Abi = [
189
+ { type: "error", name: "AlreadyInitiated", inputs: [] },
190
+ { type: "error", name: "DeadlinePassed", inputs: [] },
191
+ { type: "error", name: "InconsistentAssets", inputs: [] },
192
+ { type: "error", name: "NotExactlyOneZero", inputs: [] },
193
+ { type: "error", name: "PctExceeded", inputs: [] },
194
+ { type: "error", name: "SlippageExceeded", inputs: [] },
195
+ {
196
+ type: "function",
197
+ name: "initiator",
198
+ inputs: [],
199
+ outputs: [{ name: "", type: "address", internalType: "address" }],
200
+ stateMutability: "view",
201
+ },
202
+ {
203
+ type: "function",
204
+ name: "vaultBundlesV1Deposit",
205
+ inputs: [
206
+ { name: "vault", type: "address", internalType: "address" },
207
+ { name: "assets", type: "uint256", internalType: "uint256" },
208
+ {
209
+ name: "maxSharePriceE27",
210
+ type: "uint256",
211
+ internalType: "uint256",
212
+ },
213
+ {
214
+ name: "assetPermit",
215
+ type: "tuple",
216
+ internalType: "struct TokenPermit",
217
+ components: [
218
+ { name: "kind", type: "uint8", internalType: "enum PermitKind" },
219
+ { name: "data", type: "bytes", internalType: "bytes" },
220
+ ],
221
+ },
222
+ {
223
+ name: "referralFeePct",
224
+ type: "uint256",
225
+ internalType: "uint256",
226
+ },
227
+ {
228
+ name: "referralFeeRecipient",
229
+ type: "address",
230
+ internalType: "address",
231
+ },
232
+ { name: "deadline", type: "uint256", internalType: "uint256" },
233
+ ],
234
+ outputs: [],
235
+ stateMutability: "payable",
236
+ },
237
+ {
238
+ type: "function",
239
+ name: "vaultBundlesV1Withdraw",
240
+ inputs: [
241
+ { name: "vault", type: "address", internalType: "address" },
242
+ { name: "assets", type: "uint256", internalType: "uint256" },
243
+ { name: "shares", type: "uint256", internalType: "uint256" },
244
+ {
245
+ name: "sharesPermit",
246
+ type: "tuple",
247
+ internalType: "struct Permit",
248
+ components: [
249
+ { name: "value", type: "uint256", internalType: "uint256" },
250
+ { name: "nonce", type: "uint256", internalType: "uint256" },
251
+ { name: "deadline", type: "uint256", internalType: "uint256" },
252
+ { name: "v", type: "uint8", internalType: "uint8" },
253
+ { name: "r", type: "bytes32", internalType: "bytes32" },
254
+ { name: "s", type: "bytes32", internalType: "bytes32" },
255
+ ],
256
+ },
257
+ {
258
+ name: "referralFeePct",
259
+ type: "uint256",
260
+ internalType: "uint256",
261
+ },
262
+ {
263
+ name: "referralFeeRecipient",
264
+ type: "address",
265
+ internalType: "address",
266
+ },
267
+ { name: "deadline", type: "uint256", internalType: "uint256" },
268
+ ],
269
+ outputs: [],
270
+ stateMutability: "nonpayable",
271
+ },
272
+ {
273
+ type: "function",
274
+ name: "vaultBundlesV1Migrate",
275
+ inputs: [
276
+ { name: "sourceVault", type: "address", internalType: "address" },
277
+ { name: "destVault", type: "address", internalType: "address" },
278
+ {
279
+ name: "assetsWithdrawn",
280
+ type: "uint256",
281
+ internalType: "uint256",
282
+ },
283
+ {
284
+ name: "sharesRedeemed",
285
+ type: "uint256",
286
+ internalType: "uint256",
287
+ },
288
+ {
289
+ name: "destMaxSharePriceE27",
290
+ type: "uint256",
291
+ internalType: "uint256",
292
+ },
293
+ {
294
+ name: "sharesPermit",
295
+ type: "tuple",
296
+ internalType: "struct Permit",
297
+ components: [
298
+ { name: "value", type: "uint256", internalType: "uint256" },
299
+ { name: "nonce", type: "uint256", internalType: "uint256" },
300
+ { name: "deadline", type: "uint256", internalType: "uint256" },
301
+ { name: "v", type: "uint8", internalType: "uint8" },
302
+ { name: "r", type: "bytes32", internalType: "bytes32" },
303
+ { name: "s", type: "bytes32", internalType: "bytes32" },
304
+ ],
305
+ },
306
+ {
307
+ name: "referralFeePct",
308
+ type: "uint256",
309
+ internalType: "uint256",
310
+ },
311
+ {
312
+ name: "referralFeeRecipient",
313
+ type: "address",
314
+ internalType: "address",
315
+ },
316
+ { name: "deadline", type: "uint256", internalType: "uint256" },
317
+ ],
318
+ outputs: [],
319
+ stateMutability: "nonpayable",
320
+ },
321
+ ];
182
322
  /** ABI for the Bundler3 multicall contract. */
183
323
  export const bundler3Abi = [
184
324
  {
@@ -60,7 +60,7 @@ export interface BlueBorrowParams {
60
60
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
61
61
  * @throws {ReallocationLoanTokenMismatchError} when a source market uses another loan token.
62
62
  * @throws {DepositOwnerMismatchError} when the signed authorization owner differs from `userAddress`.
63
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when authorization cannot be bound safely.
63
+ * @throws {BundlesRequirementSignatureMismatchError} when authorization cannot be bound safely.
64
64
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
65
65
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
66
66
  * @example
@@ -30,7 +30,7 @@ import { blueSupplyCollateralBorrow } from "./supplyCollateralBorrow.js";
30
30
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
31
31
  * @throws {ReallocationLoanTokenMismatchError} when a source market uses another loan token.
32
32
  * @throws {DepositOwnerMismatchError} when the signed authorization owner differs from `userAddress`.
33
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when authorization cannot be bound safely.
33
+ * @throws {BundlesRequirementSignatureMismatchError} when authorization cannot be bound safely.
34
34
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
35
35
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
36
36
  * @example
@@ -1,6 +1,7 @@
1
1
  import { MarketParams } from "@morpho-org/blue-sdk";
2
2
  import { type Address, type Hex } from "viem";
3
- import { type AuthorizationRequirementSignature, type BaseAction, type BlueBundlesV1TokenRequirementSignature, type Metadata, type RequirementSignature, type TokenRequirementSignature, type Transaction, type VaultV2BlueReallocation } from "../../types/index.js";
3
+ import { type AuthorizationRequirementSignature, type BaseAction, type BundlesTokenRequirementSignature, type Metadata, type RequirementSignature, type Transaction, type VaultV2BlueReallocation } from "../../types/index.js";
4
+ import { type BundlesTokenPermit } from "../bundles/index.js";
4
5
  /** @internal */
5
6
  export interface BlueBundlesV1CommonParams {
6
7
  chainId: number;
@@ -15,21 +16,7 @@ export interface NormalizedBlueBundlesV1CommonParams {
15
16
  referralFeePct: bigint;
16
17
  referralFeeRecipient: Address;
17
18
  }
18
- /**
19
- * BlueBundlesV1 token-permit discriminator carried in the encoded permit struct: `none` (0) skips
20
- * the pull, `erc2612` (1) is an ERC-2612 permit, `permit2TransferFrom` (2) is a Permit2
21
- * SignatureTransfer. Named so a transposed literal can't silently route a permit to the wrong branch.
22
- * @internal
23
- */
24
- declare const BLUE_BUNDLES_V1_TOKEN_PERMIT_KIND: {
25
- readonly none: 0;
26
- readonly erc2612: 1;
27
- readonly permit2TransferFrom: 2;
28
- };
29
- interface BlueBundlesV1TokenPermit {
30
- kind: (typeof BLUE_BUNDLES_V1_TOKEN_PERMIT_KIND)[keyof typeof BLUE_BUNDLES_V1_TOKEN_PERMIT_KIND];
31
- data: Hex;
32
- }
19
+ type BlueBundlesV1TokenPermit = BundlesTokenPermit;
33
20
  interface BlueBundlesV1SignedAuthorization {
34
21
  signature: {
35
22
  v: number;
@@ -47,7 +34,7 @@ export declare const validateBlueBundlesV1NativeFunding: (params: {
47
34
  token: Address;
48
35
  fundedAmount: bigint;
49
36
  nativeAmount?: bigint;
50
- requirementSignature?: BlueBundlesV1TokenRequirementSignature;
37
+ requirementSignature?: BundlesTokenRequirementSignature;
51
38
  }) => bigint;
52
39
  /** @internal */
53
40
  export declare const getBlueBundlesV1TokenPermit: (params: {
@@ -55,7 +42,7 @@ export declare const getBlueBundlesV1TokenPermit: (params: {
55
42
  userAddress: Address;
56
43
  token: Address;
57
44
  amount: bigint;
58
- requirementSignature?: TokenRequirementSignature;
45
+ requirementSignature?: BundlesTokenRequirementSignature;
59
46
  }) => BlueBundlesV1TokenPermit;
60
47
  /** @internal */
61
48
  export declare const getBlueBundlesV1SignedAuthorization: (params: {
@@ -86,7 +73,7 @@ export declare const selectBlueBundlesV1RequirementSignatures: (signatures: read
86
73
  token?: boolean;
87
74
  authorization?: boolean;
88
75
  }) => {
89
- token?: BlueBundlesV1TokenRequirementSignature;
76
+ token?: BundlesTokenRequirementSignature;
90
77
  authorization?: AuthorizationRequirementSignature;
91
78
  };
92
79
  /** @internal */
@@ -1,24 +1,11 @@
1
1
  import { MarketParams, MathLib, VaultV2BluePublicAllocatorConfigUtils, } from "@morpho-org/blue-sdk";
2
2
  import { deepFreeze, getChainAddress } from "@morpho-org/morpho-ts";
3
- import { compactSignatureToSignature, encodeAbiParameters, isAddressEqual, maxUint256, parseCompactSignature, parseSignature, size, zeroAddress, zeroHash, } from "viem";
3
+ import { compactSignatureToSignature, isAddressEqual, parseCompactSignature, parseSignature, size, zeroAddress, zeroHash, } from "viem";
4
4
  import { addTransactionMetadata, validateNativeAsset, } from "../../helpers/index.js";
5
5
  import { validateVaultV2BlueReallocations } from "../../helpers/validate.js";
6
- import { AmbiguousRequirementSignaturesError, BlueBundlesV1RequirementSignatureMismatchError, DepositAmountMismatchError, DepositAssetMismatchError, DepositOwnerMismatchError, DepositSpenderMismatchError, InputExceedsMaxError, MissingReferralFeeRecipientError, NativeFundingAmountMismatchError, NegativeInputError, NonPositiveInputError, ReallocationLoanTokenMismatchError, selectRequirementSignatures, UnexpectedRequirementSignatureError, } from "../../types/index.js";
7
- /**
8
- * BlueBundlesV1 token-permit discriminator carried in the encoded permit struct: `none` (0) skips
9
- * the pull, `erc2612` (1) is an ERC-2612 permit, `permit2TransferFrom` (2) is a Permit2
10
- * SignatureTransfer. Named so a transposed literal can't silently route a permit to the wrong branch.
11
- * @internal
12
- */
13
- const BLUE_BUNDLES_V1_TOKEN_PERMIT_KIND = {
14
- none: 0,
15
- erc2612: 1,
16
- permit2TransferFrom: 2,
17
- };
18
- const EMPTY_TOKEN_PERMIT = {
19
- kind: BLUE_BUNDLES_V1_TOKEN_PERMIT_KIND.none,
20
- data: "0x",
21
- };
6
+ import { AmbiguousRequirementSignaturesError, BundlesRequirementSignatureMismatchError, DepositOwnerMismatchError, NativeFundingAmountMismatchError, NegativeInputError, ReallocationLoanTokenMismatchError, selectRequirementSignatures, UnexpectedRequirementSignatureError, } from "../../types/index.js";
7
+ import { normalizeBundlesCommonParams } from "../bundles/common.js";
8
+ import { getBundlesTokenPermit, } from "../bundles/index.js";
22
9
  const EMPTY_SIGNED_AUTHORIZATION = {
23
10
  signature: { v: 0, r: zeroHash, s: zeroHash },
24
11
  nonce: 0n,
@@ -26,35 +13,10 @@ const EMPTY_SIGNED_AUTHORIZATION = {
26
13
  };
27
14
  /** @internal */
28
15
  export const normalizeBlueBundlesV1CommonParams = (params) => {
29
- if (params.deadline <= 0n) {
30
- throw new NonPositiveInputError("deadline", params.deadline);
31
- }
32
- if (params.deadline > maxUint256) {
33
- throw new InputExceedsMaxError({
34
- field: "deadline",
35
- value: params.deadline,
36
- max: maxUint256,
37
- });
38
- }
39
- const referralFeePct = params.referralFeePct ?? 0n;
40
- if (referralFeePct < 0n) {
41
- throw new NegativeInputError("referralFeePct", referralFeePct);
42
- }
43
- if (referralFeePct >= MathLib.WAD) {
44
- throw new InputExceedsMaxError({
45
- field: "referralFeePct",
46
- value: referralFeePct,
47
- max: MathLib.WAD - 1n,
48
- });
49
- }
50
- if (referralFeePct > 0n &&
51
- (params.referralFeeRecipient == null ||
52
- isAddressEqual(params.referralFeeRecipient, zeroAddress))) {
53
- throw new MissingReferralFeeRecipientError();
54
- }
16
+ const normalized = normalizeBundlesCommonParams(params);
55
17
  return {
56
- referralFeePct,
57
- referralFeeRecipient: params.referralFeeRecipient ?? zeroAddress,
18
+ referralFeePct: normalized.referralFeePct,
19
+ referralFeeRecipient: normalized.referralFeeRecipient,
58
20
  };
59
21
  };
60
22
  /** @internal */
@@ -76,88 +38,13 @@ export const validateBlueBundlesV1NativeFunding = (params) => {
76
38
  };
77
39
  /** @internal */
78
40
  export const getBlueBundlesV1TokenPermit = (params) => {
79
- const { requirementSignature } = params;
80
- if (requirementSignature == null)
81
- return EMPTY_TOKEN_PERMIT;
82
- const spender = getChainAddress(params.chainId, "bundles.blueBundlesV1");
83
- if (!isAddressEqual(requirementSignature.args.owner, params.userAddress)) {
84
- throw new DepositOwnerMismatchError(params.userAddress, requirementSignature.args.owner);
85
- }
86
- if (!isAddressEqual(requirementSignature.args.asset, params.token)) {
87
- throw new DepositAssetMismatchError(params.token, requirementSignature.args.asset);
88
- }
89
- if (requirementSignature.args.amount !== params.amount) {
90
- throw new DepositAmountMismatchError(params.amount, requirementSignature.args.amount);
91
- }
92
- if (!isAddressEqual(requirementSignature.action.args.spender, spender)) {
93
- throw new DepositSpenderMismatchError(spender, requirementSignature.action.args.spender);
94
- }
95
- if (requirementSignature.action.args.amount !== params.amount) {
96
- throw new DepositAmountMismatchError(params.amount, requirementSignature.action.args.amount);
97
- }
98
- if (requirementSignature.action.args.deadline !==
99
- requirementSignature.args.deadline) {
100
- throw new BlueBundlesV1RequirementSignatureMismatchError({
101
- field: "deadline",
102
- expected: String(requirementSignature.args.deadline),
103
- actual: String(requirementSignature.action.args.deadline),
104
- });
105
- }
106
- if (requirementSignature.action.type === "permit2TransferFrom") {
107
- return {
108
- kind: BLUE_BUNDLES_V1_TOKEN_PERMIT_KIND.permit2TransferFrom,
109
- data: encodeAbiParameters([
110
- { type: "uint256", name: "nonce" },
111
- { type: "uint256", name: "deadline" },
112
- { type: "bytes", name: "signature" },
113
- ], [
114
- requirementSignature.args.nonce,
115
- requirementSignature.args.deadline,
116
- requirementSignature.args.signature,
117
- ]),
118
- };
119
- }
120
- if (requirementSignature.action.type !== "permit") {
121
- throw new BlueBundlesV1RequirementSignatureMismatchError({
122
- field: "type",
123
- expected: "permit or permit2TransferFrom",
124
- actual: requirementSignature.action.type,
125
- });
126
- }
127
- const serializedSignature = requirementSignature.args.signature;
128
- let parsed;
129
- try {
130
- parsed =
131
- size(serializedSignature) === 64
132
- ? compactSignatureToSignature(parseCompactSignature(serializedSignature))
133
- : parseSignature(serializedSignature);
134
- }
135
- catch (cause) {
136
- throw new BlueBundlesV1RequirementSignatureMismatchError({
137
- field: "signature",
138
- expected: "a 64-byte compact or 65-byte serialized ECDSA signature",
139
- actual: serializedSignature,
140
- cause,
141
- });
142
- }
143
- const v = parsed.v ??
144
- (parsed.yParity == null ? undefined : BigInt(parsed.yParity + 27));
145
- if (v == null) {
146
- throw new BlueBundlesV1RequirementSignatureMismatchError({
147
- field: "signature",
148
- expected: "a signature containing v or yParity",
149
- actual: serializedSignature,
150
- });
151
- }
152
- return {
153
- kind: BLUE_BUNDLES_V1_TOKEN_PERMIT_KIND.erc2612,
154
- data: encodeAbiParameters([
155
- { type: "uint256", name: "deadline" },
156
- { type: "uint8", name: "v" },
157
- { type: "bytes32", name: "r" },
158
- { type: "bytes32", name: "s" },
159
- ], [requirementSignature.args.deadline, Number(v), parsed.r, parsed.s]),
160
- };
41
+ return getBundlesTokenPermit({
42
+ userAddress: params.userAddress,
43
+ token: params.token,
44
+ spender: getChainAddress(params.chainId, "bundles.blueBundlesV1"),
45
+ amount: params.amount,
46
+ requirementSignature: params.requirementSignature,
47
+ });
161
48
  };
162
49
  /** @internal */
163
50
  export const getBlueBundlesV1SignedAuthorization = (params) => {
@@ -169,28 +56,28 @@ export const getBlueBundlesV1SignedAuthorization = (params) => {
169
56
  throw new DepositOwnerMismatchError(params.userAddress, authorizationSignature.args.owner);
170
57
  }
171
58
  if (!isAddressEqual(authorizationSignature.args.authorized, authorized)) {
172
- throw new BlueBundlesV1RequirementSignatureMismatchError({
59
+ throw new BundlesRequirementSignatureMismatchError({
173
60
  field: "authorized",
174
61
  expected: authorized,
175
62
  actual: authorizationSignature.args.authorized,
176
63
  });
177
64
  }
178
65
  if (!isAddressEqual(authorizationSignature.action.args.authorized, authorized)) {
179
- throw new BlueBundlesV1RequirementSignatureMismatchError({
66
+ throw new BundlesRequirementSignatureMismatchError({
180
67
  field: "authorized",
181
68
  expected: authorized,
182
69
  actual: authorizationSignature.action.args.authorized,
183
70
  });
184
71
  }
185
72
  if (!authorizationSignature.args.isAuthorized) {
186
- throw new BlueBundlesV1RequirementSignatureMismatchError({
73
+ throw new BundlesRequirementSignatureMismatchError({
187
74
  field: "isAuthorized",
188
75
  expected: "true",
189
76
  actual: String(authorizationSignature.args.isAuthorized),
190
77
  });
191
78
  }
192
79
  if (!authorizationSignature.action.args.isAuthorized) {
193
- throw new BlueBundlesV1RequirementSignatureMismatchError({
80
+ throw new BundlesRequirementSignatureMismatchError({
194
81
  field: "isAuthorized",
195
82
  expected: "true",
196
83
  actual: String(authorizationSignature.action.args.isAuthorized),
@@ -198,7 +85,7 @@ export const getBlueBundlesV1SignedAuthorization = (params) => {
198
85
  }
199
86
  if (authorizationSignature.action.args.deadline !==
200
87
  authorizationSignature.args.deadline) {
201
- throw new BlueBundlesV1RequirementSignatureMismatchError({
88
+ throw new BundlesRequirementSignatureMismatchError({
202
89
  field: "deadline",
203
90
  expected: String(authorizationSignature.args.deadline),
204
91
  actual: String(authorizationSignature.action.args.deadline),
@@ -213,7 +100,7 @@ export const getBlueBundlesV1SignedAuthorization = (params) => {
213
100
  : parseSignature(serializedSignature);
214
101
  }
215
102
  catch (cause) {
216
- throw new BlueBundlesV1RequirementSignatureMismatchError({
103
+ throw new BundlesRequirementSignatureMismatchError({
217
104
  field: "signature",
218
105
  expected: "a 64-byte compact or 65-byte serialized ECDSA signature",
219
106
  actual: serializedSignature,
@@ -223,7 +110,7 @@ export const getBlueBundlesV1SignedAuthorization = (params) => {
223
110
  const v = parsed.v ??
224
111
  (parsed.yParity == null ? undefined : BigInt(parsed.yParity + 27));
225
112
  if (v == null) {
226
- throw new BlueBundlesV1RequirementSignatureMismatchError({
113
+ throw new BundlesRequirementSignatureMismatchError({
227
114
  field: "signature",
228
115
  expected: "a signature containing v or yParity",
229
116
  actual: serializedSignature,
@@ -271,24 +158,24 @@ export const getBlueBundlesV1ReferralFeeAssets = (assets, referralFeePct) => ref
271
158
  : MathLib.mulDivDown(assets, referralFeePct, MathLib.WAD - referralFeePct);
272
159
  /** @internal */
273
160
  export const selectBlueBundlesV1RequirementSignatures = (signatures, accepts) => {
274
- const { permit, permit2TransferFrom, authorization } = selectRequirementSignatures(signatures, {
161
+ const { permit, permit2SignatureTransfer, authorization } = selectRequirementSignatures(signatures, {
275
162
  permit: accepts.token,
276
- permit2TransferFrom: accepts.token,
163
+ permit2SignatureTransfer: accepts.token,
277
164
  authorization: accepts.authorization,
278
165
  });
279
166
  if (permit?.action.type === "permit2") {
280
- throw new BlueBundlesV1RequirementSignatureMismatchError({
167
+ throw new BundlesRequirementSignatureMismatchError({
281
168
  field: "type",
282
- expected: "permit or permit2TransferFrom",
169
+ expected: "permit or permit2SignatureTransfer",
283
170
  actual: permit.action.type,
284
171
  });
285
172
  }
286
- if (permit != null && permit2TransferFrom != null) {
173
+ if (permit != null && permit2SignatureTransfer != null) {
287
174
  throw new AmbiguousRequirementSignaturesError("permit", 2);
288
175
  }
289
176
  return {
290
177
  token: permit ??
291
- permit2TransferFrom,
178
+ permit2SignatureTransfer,
292
179
  authorization,
293
180
  };
294
181
  };
@@ -69,7 +69,7 @@ export interface BlueRefinanceParams {
69
69
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the destination market.
70
70
  * @throws {ReallocationLoanTokenMismatchError} when a source market uses another loan token.
71
71
  * @throws {DepositOwnerMismatchError} when the signed authorization owner differs from `userAddress`.
72
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when authorization cannot be bound safely.
72
+ * @throws {BundlesRequirementSignatureMismatchError} when authorization cannot be bound safely.
73
73
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
74
74
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
75
75
  * @example
@@ -39,7 +39,7 @@ import { finalizeBlueBundlesV1Transaction, getBlueBundlesV1PenaltyAssets, getBlu
39
39
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the destination market.
40
40
  * @throws {ReallocationLoanTokenMismatchError} when a source market uses another loan token.
41
41
  * @throws {DepositOwnerMismatchError} when the signed authorization owner differs from `userAddress`.
42
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when authorization cannot be bound safely.
42
+ * @throws {BundlesRequirementSignatureMismatchError} when authorization cannot be bound safely.
43
43
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
44
44
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
45
45
  * @example
@@ -1,6 +1,6 @@
1
1
  import type { MarketParams } from "@morpho-org/blue-sdk";
2
2
  import { type Address } from "viem";
3
- import type { BlueBundlesV1TokenRequirementSignature, BlueRepayAction, Metadata, Transaction } from "../../types/index.js";
3
+ import type { BlueRepayAction, BundlesTokenRequirementSignature, Metadata, Transaction } from "../../types/index.js";
4
4
  /** Parameters for {@link blueRepay}. */
5
5
  export interface BlueRepayParams {
6
6
  /** Chain and scoped Morpho Blue market. */
@@ -27,7 +27,7 @@ export interface BlueRepayParams {
27
27
  /** Recipient required when `referralFeePct` is positive. */
28
28
  readonly referralFeeRecipient?: Address;
29
29
  /** Optional loan-token ERC-2612 or Permit2 SignatureTransfer result. */
30
- readonly requirementSignature?: BlueBundlesV1TokenRequirementSignature;
30
+ readonly requirementSignature?: BundlesTokenRequirementSignature;
31
31
  };
32
32
  /** Optional transaction metadata suffix. */
33
33
  readonly metadata?: Metadata;
@@ -65,7 +65,7 @@ export interface BlueRepayParams {
65
65
  * @throws {DepositAssetMismatchError} when the signed asset differs from the loan token.
66
66
  * @throws {DepositAmountMismatchError} when the signed amount differs from `maxRepayAssets`.
67
67
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
68
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when a signature cannot be encoded safely.
68
+ * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
69
69
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
70
70
  * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
71
71
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
@@ -34,7 +34,7 @@ import { blueRepayWithdrawCollateral } from "./repayWithdrawCollateral.js";
34
34
  * @throws {DepositAssetMismatchError} when the signed asset differs from the loan token.
35
35
  * @throws {DepositAmountMismatchError} when the signed amount differs from `maxRepayAssets`.
36
36
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
37
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when a signature cannot be encoded safely.
37
+ * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
38
38
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
39
39
  * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
40
40
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
@@ -1,6 +1,6 @@
1
1
  import type { MarketParams } from "@morpho-org/blue-sdk";
2
2
  import { type Address } from "viem";
3
- import { type AuthorizationRequirementSignature, type BlueBundlesV1TokenRequirementSignature, type BlueRepayWithdrawCollateralAction, type Metadata, type Transaction } from "../../types/index.js";
3
+ import { type AuthorizationRequirementSignature, type BlueRepayWithdrawCollateralAction, type BundlesTokenRequirementSignature, type Metadata, type Transaction } from "../../types/index.js";
4
4
  /** Parameters for {@link blueRepayWithdrawCollateral}. */
5
5
  export interface BlueRepayWithdrawCollateralParams {
6
6
  /** Chain and scoped Morpho Blue market. */
@@ -31,7 +31,7 @@ export interface BlueRepayWithdrawCollateralParams {
31
31
  /** Recipient required when `referralFeePct` is positive. */
32
32
  readonly referralFeeRecipient?: Address;
33
33
  /** Optional loan-token ERC-2612 or Permit2 SignatureTransfer result. */
34
- readonly requirementSignature?: BlueBundlesV1TokenRequirementSignature;
34
+ readonly requirementSignature?: BundlesTokenRequirementSignature;
35
35
  /** Optional Morpho authorization signature for BlueBundlesV1. */
36
36
  readonly authorizationSignature?: AuthorizationRequirementSignature;
37
37
  };
@@ -77,7 +77,7 @@ export interface BlueRepayWithdrawCollateralParams {
77
77
  * @throws {DepositAssetMismatchError} when the signed asset differs from the loan token.
78
78
  * @throws {DepositAmountMismatchError} when the signed amount differs from `maxRepayAssets`.
79
79
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
80
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when a signature cannot be bound safely.
80
+ * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be bound safely.
81
81
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
82
82
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
83
83
  * @example
@@ -42,7 +42,7 @@ import { finalizeBlueBundlesV1Transaction, getBlueBundlesV1ReferralFeeAssets, ge
42
42
  * @throws {DepositAssetMismatchError} when the signed asset differs from the loan token.
43
43
  * @throws {DepositAmountMismatchError} when the signed amount differs from `maxRepayAssets`.
44
44
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
45
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when a signature cannot be bound safely.
45
+ * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be bound safely.
46
46
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
47
47
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
48
48
  * @example
@@ -1,6 +1,6 @@
1
1
  import type { MarketParams } from "@morpho-org/blue-sdk";
2
2
  import { type Address } from "viem";
3
- import type { BlueBundlesV1TokenRequirementSignature, BlueSupplyAction, Metadata, Transaction } from "../../types/index.js";
3
+ import type { BlueSupplyAction, BundlesTokenRequirementSignature, Metadata, Transaction } from "../../types/index.js";
4
4
  /** Parameters for {@link blueSupply}. */
5
5
  export interface BlueSupplyParams {
6
6
  /** Chain and scoped Morpho Blue market. */
@@ -23,7 +23,7 @@ export interface BlueSupplyParams {
23
23
  /** Recipient required when `referralFeePct` is positive. */
24
24
  readonly referralFeeRecipient?: Address;
25
25
  /** Optional ERC-2612 or Permit2 SignatureTransfer requirement result. */
26
- readonly requirementSignature?: BlueBundlesV1TokenRequirementSignature;
26
+ readonly requirementSignature?: BundlesTokenRequirementSignature;
27
27
  };
28
28
  /** Optional transaction metadata suffix. */
29
29
  readonly metadata?: Metadata;
@@ -59,7 +59,7 @@ export interface BlueSupplyParams {
59
59
  * @throws {DepositAssetMismatchError} when the signed asset differs from the loan token.
60
60
  * @throws {DepositAmountMismatchError} when the signed amount differs from `assets`.
61
61
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
62
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when the signature kind or encoding is invalid.
62
+ * @throws {BundlesRequirementSignatureMismatchError} when the signature kind or encoding is invalid.
63
63
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
64
64
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
65
65
  * @example
@@ -33,7 +33,7 @@ import { finalizeBlueBundlesV1Transaction, getBlueBundlesV1TokenPermit, normaliz
33
33
  * @throws {DepositAssetMismatchError} when the signed asset differs from the loan token.
34
34
  * @throws {DepositAmountMismatchError} when the signed amount differs from `assets`.
35
35
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
36
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when the signature kind or encoding is invalid.
36
+ * @throws {BundlesRequirementSignatureMismatchError} when the signature kind or encoding is invalid.
37
37
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
38
38
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
39
39
  * @example
@@ -1,6 +1,6 @@
1
1
  import type { MarketParams } from "@morpho-org/blue-sdk";
2
2
  import { type Address } from "viem";
3
- import type { BlueBundlesV1TokenRequirementSignature, BlueSupplyCollateralAction, Metadata, Transaction } from "../../types/index.js";
3
+ import type { BlueSupplyCollateralAction, BundlesTokenRequirementSignature, Metadata, Transaction } from "../../types/index.js";
4
4
  /** Parameters for {@link blueSupplyCollateral}. */
5
5
  export interface BlueSupplyCollateralParams {
6
6
  /** Chain and scoped Morpho Blue market. */
@@ -23,7 +23,7 @@ export interface BlueSupplyCollateralParams {
23
23
  /** Recipient required when `referralFeePct` is positive. */
24
24
  readonly referralFeeRecipient?: Address;
25
25
  /** Optional collateral ERC-2612 or Permit2 SignatureTransfer result. */
26
- readonly requirementSignature?: BlueBundlesV1TokenRequirementSignature;
26
+ readonly requirementSignature?: BundlesTokenRequirementSignature;
27
27
  };
28
28
  /** Optional transaction metadata suffix. */
29
29
  readonly metadata?: Metadata;
@@ -57,7 +57,7 @@ export interface BlueSupplyCollateralParams {
57
57
  * @throws {DepositAssetMismatchError} when the signed asset differs from the collateral token.
58
58
  * @throws {DepositAmountMismatchError} when the signed amount differs from `collateralAssets`.
59
59
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
60
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when a signature cannot be encoded safely.
60
+ * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
61
61
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
62
62
  * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
63
63
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.
@@ -30,7 +30,7 @@ import { blueSupplyCollateralBorrow } from "./supplyCollateralBorrow.js";
30
30
  * @throws {DepositAssetMismatchError} when the signed asset differs from the collateral token.
31
31
  * @throws {DepositAmountMismatchError} when the signed amount differs from `collateralAssets`.
32
32
  * @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
33
- * @throws {BlueBundlesV1RequirementSignatureMismatchError} when a signature cannot be encoded safely.
33
+ * @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
34
34
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
35
35
  * @throws {MissingReferralFeeRecipientError} when a positive fee has no recipient.
36
36
  * @throws {UnsupportedChainIdError} when the chain is absent from the registry.