@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
@@ -4,7 +4,7 @@ exports.isRequirementApproval = isRequirementApproval;
4
4
  exports.isRequirementBlueAuthorization = isRequirementBlueAuthorization;
5
5
  exports.isRequirementSignature = isRequirementSignature;
6
6
  exports.isPermitSignature = isPermitSignature;
7
- exports.isPermit2TransferFromSignature = isPermit2TransferFromSignature;
7
+ exports.isPermit2SignatureTransferSignature = isPermit2SignatureTransferSignature;
8
8
  exports.isAuthorizationSignature = isAuthorizationSignature;
9
9
  exports.isMidnightOfferRootSignature = isMidnightOfferRootSignature;
10
10
  exports.selectRequirementSignatures = selectRequirementSignatures;
@@ -54,20 +54,20 @@ function isPermitSignature(signature) {
54
54
  * Narrows a {@link RequirementSignature} to a Permit2 SignatureTransfer result.
55
55
  *
56
56
  * @param signature - The signed requirement to test.
57
- * @returns `true` when `signature.action.type` is `"permit2TransferFrom"`.
57
+ * @returns `true` when `signature.action.type` is `"permit2SignatureTransfer"`.
58
58
  * @example
59
59
  * ```ts
60
60
  * import {
61
- * isPermit2TransferFromSignature,
61
+ * isPermit2SignatureTransferSignature,
62
62
  * type RequirementSignature,
63
63
  * } from "@morpho-org/morpho-sdk";
64
64
  *
65
65
  * const getPermit2Nonce = (signature: RequirementSignature): bigint | undefined =>
66
- * isPermit2TransferFromSignature(signature) ? signature.args.nonce : undefined;
66
+ * isPermit2SignatureTransferSignature(signature) ? signature.args.nonce : undefined;
67
67
  * ```
68
68
  */
69
- function isPermit2TransferFromSignature(signature) {
70
- return signature.action.type === "permit2TransferFrom";
69
+ function isPermit2SignatureTransferSignature(signature) {
70
+ return signature.action.type === "permit2SignatureTransfer";
71
71
  }
72
72
  /**
73
73
  * Narrows a {@link RequirementSignature} to a signed Morpho authorization.
@@ -99,7 +99,7 @@ function isMidnightOfferRootSignature(signature) {
99
99
  * @param signatures - The signatures passed to `buildTx`.
100
100
  * @param accepts - Which signature kinds this operation consumes.
101
101
  * @param accepts.permit - Whether an ERC-2612 or Permit2 AllowanceTransfer signature is consumed.
102
- * @param accepts.permit2TransferFrom - Whether a Permit2 SignatureTransfer is consumed.
102
+ * @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
103
103
  * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
104
104
  * @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
105
105
  * @returns The accepted signature in each typed slot, when present.
@@ -119,13 +119,13 @@ function selectRequirementSignatures(signatures, accepts) {
119
119
  if (signatures == null)
120
120
  return {};
121
121
  const permits = signatures.filter(isPermitSignature);
122
- const permit2Transfers = signatures.filter(isPermit2TransferFromSignature);
122
+ const permit2Transfers = signatures.filter(isPermit2SignatureTransferSignature);
123
123
  const authorizations = signatures.filter(isAuthorizationSignature);
124
124
  const midnightOfferRoots = signatures.filter(isMidnightOfferRootSignature);
125
125
  if (!accepts.permit && permits.length > 0)
126
126
  throw new error_js_1.UnexpectedRequirementSignatureError("permit");
127
- if (!accepts.permit2TransferFrom && permit2Transfers.length > 0)
128
- throw new error_js_1.UnexpectedRequirementSignatureError("permit2TransferFrom");
127
+ if (!accepts.permit2SignatureTransfer && permit2Transfers.length > 0)
128
+ throw new error_js_1.UnexpectedRequirementSignatureError("permit2SignatureTransfer");
129
129
  if (!accepts.authorization && authorizations.length > 0)
130
130
  throw new error_js_1.UnexpectedRequirementSignatureError("authorization");
131
131
  if (!accepts.midnightOfferRoot && midnightOfferRoots.length > 0)
@@ -133,14 +133,14 @@ function selectRequirementSignatures(signatures, accepts) {
133
133
  if (permits.length > 1)
134
134
  throw new error_js_1.AmbiguousRequirementSignaturesError("permit", permits.length);
135
135
  if (permit2Transfers.length > 1)
136
- throw new error_js_1.AmbiguousRequirementSignaturesError("permit2TransferFrom", permit2Transfers.length);
136
+ throw new error_js_1.AmbiguousRequirementSignaturesError("permit2SignatureTransfer", permit2Transfers.length);
137
137
  if (authorizations.length > 1)
138
138
  throw new error_js_1.AmbiguousRequirementSignaturesError("authorization", authorizations.length);
139
139
  if (midnightOfferRoots.length > 1)
140
140
  throw new error_js_1.AmbiguousRequirementSignaturesError("midnightOfferRootSignature", midnightOfferRoots.length);
141
141
  return {
142
142
  permit: permits[0],
143
- permit2TransferFrom: permit2Transfers[0],
143
+ permit2SignatureTransfer: permit2Transfers[0],
144
144
  authorization: authorizations[0],
145
145
  midnightOfferRoot: midnightOfferRoots[0],
146
146
  };
@@ -184,8 +184,8 @@ export declare class VaultIsBlueFeeRecipientError extends Error {
184
184
  */
185
185
  constructor(vault: Address, blue: Address);
186
186
  }
187
- /** Thrown when a vault-shares requirement cannot be safely encoded as an ERC-2612 permit. */
188
- export declare class VaultExitBundlesV1PermitMismatchError extends Error {
187
+ /** Thrown when a vault-shares requirement cannot be safely encoded as a bundles permit. */
188
+ export declare class BundlesPermitMismatchError extends Error {
189
189
  /**
190
190
  * @param params - Permit mismatch values used to explain the rejection.
191
191
  * @param params.field - Permit field that does not match the exit.
@@ -193,21 +193,34 @@ export declare class VaultExitBundlesV1PermitMismatchError extends Error {
193
193
  * @param params.actual - Value supplied by the signature.
194
194
  * @param params.cause - Original parser failure when signature decoding is wrapped.
195
195
  */
196
- readonly field: "type" | "asset" | "signature";
196
+ readonly field: "type" | "asset" | "owner" | "spender" | "amount" | "nonce" | "deadline" | "signature";
197
197
  readonly expected: string;
198
198
  readonly actual: string;
199
199
  constructor(params: {
200
- readonly field: "type" | "asset" | "signature";
200
+ readonly field: "type" | "asset" | "owner" | "spender" | "amount" | "nonce" | "deadline" | "signature";
201
201
  readonly expected: string;
202
202
  readonly actual: string;
203
203
  readonly cause?: unknown;
204
204
  });
205
205
  }
206
- /** Thrown when a signed requirement cannot be safely encoded for BlueBundlesV1. */
207
- export declare class BlueBundlesV1RequirementSignatureMismatchError extends Error {
208
- /** Field whose signed value or encoding is invalid for the direct BlueBundlesV1 call. */
209
- readonly field: "type" | "authorized" | "isAuthorized" | "deadline" | "signature";
210
- /** Value required by BlueBundlesV1. */
206
+ /**
207
+ * Thrown by the deprecated VaultExitBundlesV1 permit compatibility helper.
208
+ *
209
+ * @deprecated Use {@link BundlesPermitMismatchError} with `getBundlesSharesPermit`.
210
+ */
211
+ export declare class VaultExitBundlesV1PermitMismatchError extends BundlesPermitMismatchError {
212
+ constructor(params: {
213
+ readonly field: "type" | "asset" | "owner" | "spender" | "amount" | "nonce" | "deadline" | "signature";
214
+ readonly expected: string;
215
+ readonly actual: string;
216
+ readonly cause?: unknown;
217
+ });
218
+ }
219
+ /** Thrown when a signed requirement cannot be safely encoded for a fixed bundles call. */
220
+ export declare class BundlesRequirementSignatureMismatchError extends Error {
221
+ /** Field whose signed value or encoding is invalid for the fixed bundles call. */
222
+ readonly field: "type" | "authorized" | "isAuthorized" | "nonce" | "deadline" | "signature";
223
+ /** Value required by the fixed bundles call. */
211
224
  readonly expected: string;
212
225
  /** Value supplied by the signed requirement. */
213
226
  readonly actual: string;
@@ -219,18 +232,22 @@ export declare class BlueBundlesV1RequirementSignatureMismatchError extends Erro
219
232
  * @param params.cause - Original signature parser failure, when applicable.
220
233
  */
221
234
  constructor(params: {
222
- field: "type" | "authorized" | "isAuthorized" | "deadline" | "signature";
235
+ field: "type" | "authorized" | "isAuthorized" | "nonce" | "deadline" | "signature";
223
236
  expected: string;
224
237
  actual: string;
225
238
  cause?: unknown;
226
239
  });
227
240
  }
241
+ /** @deprecated Use {@link BundlesRequirementSignatureMismatchError}. */
242
+ export { BundlesRequirementSignatureMismatchError as BlueBundlesV1RequirementSignatureMismatchError, };
228
243
  /** Thrown when Permit2 SignatureTransfer is selected without an explicit unordered nonce. */
229
- export declare class MissingPermit2TransferFromNonceError extends Error {
244
+ export declare class MissingPermit2SignatureTransferNonceError extends Error {
230
245
  constructor();
231
246
  }
247
+ /** @deprecated Use {@link MissingPermit2SignatureTransferNonceError}. */
248
+ export { MissingPermit2SignatureTransferNonceError as MissingPermit2TransferFromNonceError, };
232
249
  /** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
233
- export declare class Permit2TransferFromNonceAlreadyUsedError extends Error {
250
+ export declare class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
234
251
  readonly owner: Address;
235
252
  readonly nonce: bigint;
236
253
  /**
@@ -249,6 +266,8 @@ export declare class NoUnusedPermit2NonceError extends Error {
249
266
  */
250
267
  constructor(owner: Address, startNonce: bigint);
251
268
  }
269
+ /** @deprecated Use {@link Permit2SignatureTransferNonceAlreadyUsedError}. */
270
+ export { Permit2SignatureTransferNonceAlreadyUsedError as Permit2TransferFromNonceAlreadyUsedError, };
252
271
  /** Thrown when native funding does not exactly match the contract's gross token pull. */
253
272
  export declare class NativeFundingAmountMismatchError extends Error {
254
273
  readonly nativeAmount: bigint;
@@ -260,9 +279,38 @@ export declare class NativeFundingAmountMismatchError extends Error {
260
279
  constructor(nativeAmount: bigint, requiredAmount: bigint);
261
280
  }
262
281
  /** Thrown when a positive referral fee has no recipient. */
263
- export declare class MissingReferralFeeRecipientError extends Error {
282
+ export declare class ReferralFeeRecipientMissingError extends Error {
283
+ constructor();
284
+ }
285
+ /** @deprecated Use {@link ReferralFeeRecipientMissingError}. */
286
+ export declare const MissingReferralFeeRecipientError: typeof ReferralFeeRecipientMissingError;
287
+ /** @deprecated Use {@link ReferralFeeRecipientMissingError}. */
288
+ export type MissingReferralFeeRecipientError = ReferralFeeRecipientMissingError;
289
+ /**
290
+ * Thrown when a referral fee percentage is outside the contract's `[0, WAD)` range.
291
+ *
292
+ * Extends {@link InputExceedsMaxError} — and reports the same `field`, `value`, and `max` the
293
+ * generic bound error used to carry for this input — so integrators already pattern-matching
294
+ * `InputExceedsMaxError` keep catching this failure.
295
+ */
296
+ export declare class ReferralFeePctExceededError extends InputExceedsMaxError {
297
+ readonly referralFeePct: bigint;
298
+ /** @param referralFeePct - WAD-scaled referral fee percentage supplied by the caller. */
299
+ constructor(referralFeePct: bigint);
300
+ }
301
+ /** Thrown when a fixed bundles call mixes ERC-20 and native funding. */
302
+ export declare class MixedBundlesFundingError extends Error {
264
303
  constructor();
265
304
  }
305
+ /** Thrown when a vault migration specifies both assets and shares, or neither. */
306
+ export declare class AmountAndSharesExclusiveError extends Error {
307
+ constructor();
308
+ }
309
+ /** Thrown when a vault migration selects the same source and destination vault. */
310
+ export declare class SameVaultMigrationError extends Error {
311
+ readonly vault: Address;
312
+ constructor(vault: Address);
313
+ }
266
314
  /** Thrown when a BlueBundlesV1 reallocation source uses another loan token. */
267
315
  export declare class ReallocationLoanTokenMismatchError extends Error {
268
316
  readonly expected: Address;
@@ -473,7 +521,7 @@ export declare namespace BundlerErrors {
473
521
  }
474
522
  }
475
523
  /** Requirement signature kind accepted by action-output transaction builders. */
476
- export type RequirementSignatureKind = "permit" | "permit2TransferFrom" | "authorization" | "midnightOfferRootSignature";
524
+ export type RequirementSignatureKind = "permit" | "permit2SignatureTransfer" | "authorization" | "midnightOfferRootSignature";
477
525
  /**
478
526
  * Thrown when `buildTx` receives more than one requirement signature of the same kind.
479
527
  *
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AddressMismatchError = exports.UnexpectedRequirementSignatureError = exports.AmbiguousRequirementSignaturesError = exports.BundlerErrors = exports.NegativeMaxRepaySharePriceError = exports.NegativeBorrowSharesError = exports.NegativeMinSharePriceError = exports.NegativeWithdrawMinSharePriceError = exports.NegativeSupplyMaxSharePriceError = exports.NegativeSupplyAmountError = exports.NonPositiveMinBorrowSharePriceError = exports.NegativeReallocationFeeError = exports.NegativeNativeAmountError = exports.NegativeSlippageToleranceError = exports.NonPositiveWithdrawAmountError = exports.ZeroSupplyAmountError = exports.NonPositiveWithdrawCollateralAmountError = exports.NonPositiveRepayMaxSharePriceError = exports.NonPositiveRepayAmountError = exports.NonPositiveReallocationAmountError = exports.ZeroCollateralAmountError = exports.NonPositiveBorrowAmountError = exports.ZeroDepositAmountError = exports.NonPositiveMaxSharePriceError = exports.NonPositiveSharesAmountError = exports.NonPositiveAssetAmountError = exports.MaxRepayAssetsBelowRepayAssetsError = exports.ReallocationsRequireBorrowError = exports.UnsupportedAuthorizationOperatorError = exports.ReallocationLoanTokenMismatchError = exports.MissingReferralFeeRecipientError = exports.NativeFundingAmountMismatchError = exports.NoUnusedPermit2NonceError = exports.Permit2TransferFromNonceAlreadyUsedError = exports.MissingPermit2TransferFromNonceError = exports.BlueBundlesV1RequirementSignatureMismatchError = exports.VaultExitBundlesV1PermitMismatchError = exports.VaultIsBlueFeeRecipientError = exports.VaultMorphoMismatchError = exports.InsufficientBlueBalanceForInKindRedeemError = exports.InKindRedeemCoverageError = exports.InKindRedeemZeroDeallocationError = exports.UnsupportedInKindAdapterError = exports.AdapterNotPartOfVaultError = exports.InKindRedeemRequiresSingleAdapterError = exports.ExpiredDeadlineError = exports.EmptyMarketParamsListError = exports.InputExceedsMaxError = exports.NonPositiveInputError = exports.NegativeInputError = void 0;
4
- exports.UnknownReallocationMarketPublicAllocatorConfigError = exports.UnknownReallocationActiveAdaptersError = exports.UnknownReallocationPublicAllocatorConfigError = exports.UnknownReallocationAllocationError = exports.UnknownReallocationPositionError = exports.UnknownReallocationVaultMarketConfigError = exports.UnknownReallocationVaultError = exports.UnknownReallocationMarketError = exports.InsufficientSharedLiquidityError = exports.DisabledReallocationMarketError = exports.MissingPublicAllocatorConfigError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.ShareDivideByZeroError = exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.MutuallyExclusiveRepayAmountsError = exports.TransferAmountNotEqualToAssetsError = exports.UnsortedReallocationWithdrawalsError = exports.InconsistentReallocationPenaltyError = exports.InvalidReallocationSourceTypeError = exports.InvalidReallocationAddressError = exports.MixedReallocationVersionsError = exports.InvalidReallocationShapeError = exports.ReallocationWithdrawalOnTargetMarketError = exports.EmptyReallocationWithdrawalsError = exports.AccrualPositionUserMismatchError = exports.MarketIdMismatchError = exports.MissingMarketPriceError = exports.BorrowExceedsSafeLtvError = exports.NativeAmountOnNonWNativeCollateralError = exports.NativeAmountOnNonWNativeAssetError = exports.VaultAddressMismatchError = exports.ChainWNativeMissingError = exports.NativeAmountOnNonWNativeVaultError = exports.Permit2ExpirationMissingError = exports.DepositSpenderMismatchError = exports.DepositOwnerMismatchError = exports.DepositAssetMismatchError = exports.DepositAmountMismatchError = exports.EmptyDeallocationsError = exports.ExcessiveSlippageToleranceError = exports.MissingAccrualPositionError = exports.UnsupportedMidnightAuthorizationTargetError = exports.UnsupportedErc20ApprovalSpenderError = exports.ApprovalAmountLessThanSpendAmountError = exports.MissingClientPropertyError = exports.CryptoUnavailableError = exports.ChainIdMismatchError = void 0;
5
- exports.RefinanceSharesMissingBorrowAssetsError = exports.RefinanceExceedsBorrowAssetsError = exports.RefinanceExceedsBorrowSharesError = exports.RefinanceExceedsCollateralError = exports.BorrowAmountAndSharesExclusiveError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.VaultAssetMismatchError = exports.ReallocationWithdrawExceedsMarketSupplyError = exports.WithdrawSharesExceedSupplyError = exports.WithdrawExceedsSupplyError = exports.MutuallyExclusiveWithdrawAmountsError = exports.InsufficientMidnightWithdrawableLiquidityError = exports.MidnightRedeemExceedsCreditError = exports.NoMidnightCreditToRedeemError = exports.UnpreparedMidnightOfferRootSignatureError = exports.MidnightOfferRootOfferCountMismatchError = exports.MidnightOfferRootRatifierMismatchError = exports.MidnightOfferRootOwnerMismatchError = exports.MidnightOfferRootMismatchError = exports.MissingMidnightOfferRootSignatureError = exports.UnknownMidnightRatifierError = exports.MidnightTakeableOfferMarketMismatchError = exports.MidnightOfferMarketLoanTokenMismatchError = exports.MidnightMarketAddressMismatchError = exports.MidnightOfferMarketAddressMismatchError = exports.MidnightOfferMarketChainMismatchError = exports.MidnightOfferMakerMismatchError = exports.MidnightOfferSideMismatchError = exports.EmptyMidnightTakeableOffersError = exports.MidnightAmountExceedsMaxOfferCapError = exports.ReallocationAdapterSupplySharesUnderflowError = exports.ReallocationAllocationUnderflowError = exports.UnknownReallocationAdapterError = void 0;
3
+ exports.NegativeSupplyAmountError = exports.NonPositiveMinBorrowSharePriceError = exports.NegativeReallocationFeeError = exports.NegativeNativeAmountError = exports.NegativeSlippageToleranceError = exports.NonPositiveWithdrawAmountError = exports.ZeroSupplyAmountError = exports.NonPositiveWithdrawCollateralAmountError = exports.NonPositiveRepayMaxSharePriceError = exports.NonPositiveRepayAmountError = exports.NonPositiveReallocationAmountError = exports.ZeroCollateralAmountError = exports.NonPositiveBorrowAmountError = exports.ZeroDepositAmountError = exports.NonPositiveMaxSharePriceError = exports.NonPositiveSharesAmountError = exports.NonPositiveAssetAmountError = exports.MaxRepayAssetsBelowRepayAssetsError = exports.ReallocationsRequireBorrowError = exports.UnsupportedAuthorizationOperatorError = exports.ReallocationLoanTokenMismatchError = exports.SameVaultMigrationError = exports.AmountAndSharesExclusiveError = exports.MixedBundlesFundingError = exports.ReferralFeePctExceededError = exports.MissingReferralFeeRecipientError = exports.ReferralFeeRecipientMissingError = exports.NativeFundingAmountMismatchError = exports.Permit2TransferFromNonceAlreadyUsedError = exports.NoUnusedPermit2NonceError = exports.Permit2SignatureTransferNonceAlreadyUsedError = exports.MissingPermit2TransferFromNonceError = exports.MissingPermit2SignatureTransferNonceError = exports.BlueBundlesV1RequirementSignatureMismatchError = exports.BundlesRequirementSignatureMismatchError = exports.VaultExitBundlesV1PermitMismatchError = exports.BundlesPermitMismatchError = exports.VaultIsBlueFeeRecipientError = exports.VaultMorphoMismatchError = exports.InsufficientBlueBalanceForInKindRedeemError = exports.InKindRedeemCoverageError = exports.InKindRedeemZeroDeallocationError = exports.UnsupportedInKindAdapterError = exports.AdapterNotPartOfVaultError = exports.InKindRedeemRequiresSingleAdapterError = exports.ExpiredDeadlineError = exports.EmptyMarketParamsListError = exports.InputExceedsMaxError = exports.NonPositiveInputError = exports.NegativeInputError = void 0;
4
+ exports.DisabledReallocationMarketError = exports.MissingPublicAllocatorConfigError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.ShareDivideByZeroError = exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.MutuallyExclusiveRepayAmountsError = exports.TransferAmountNotEqualToAssetsError = exports.UnsortedReallocationWithdrawalsError = exports.InconsistentReallocationPenaltyError = exports.InvalidReallocationSourceTypeError = exports.InvalidReallocationAddressError = exports.MixedReallocationVersionsError = exports.InvalidReallocationShapeError = exports.ReallocationWithdrawalOnTargetMarketError = exports.EmptyReallocationWithdrawalsError = exports.AccrualPositionUserMismatchError = exports.MarketIdMismatchError = exports.MissingMarketPriceError = exports.BorrowExceedsSafeLtvError = exports.NativeAmountOnNonWNativeCollateralError = exports.NativeAmountOnNonWNativeAssetError = exports.VaultAddressMismatchError = exports.ChainWNativeMissingError = exports.NativeAmountOnNonWNativeVaultError = exports.Permit2ExpirationMissingError = exports.DepositSpenderMismatchError = exports.DepositOwnerMismatchError = exports.DepositAssetMismatchError = exports.DepositAmountMismatchError = exports.EmptyDeallocationsError = exports.ExcessiveSlippageToleranceError = exports.MissingAccrualPositionError = exports.UnsupportedMidnightAuthorizationTargetError = exports.UnsupportedErc20ApprovalSpenderError = exports.ApprovalAmountLessThanSpendAmountError = exports.MissingClientPropertyError = exports.CryptoUnavailableError = exports.ChainIdMismatchError = exports.AddressMismatchError = exports.UnexpectedRequirementSignatureError = exports.AmbiguousRequirementSignaturesError = exports.BundlerErrors = exports.NegativeMaxRepaySharePriceError = exports.NegativeBorrowSharesError = exports.NegativeMinSharePriceError = exports.NegativeWithdrawMinSharePriceError = exports.NegativeSupplyMaxSharePriceError = void 0;
5
+ exports.RefinanceSharesMissingBorrowAssetsError = exports.RefinanceExceedsBorrowAssetsError = exports.RefinanceExceedsBorrowSharesError = exports.RefinanceExceedsCollateralError = exports.BorrowAmountAndSharesExclusiveError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.VaultAssetMismatchError = exports.ReallocationWithdrawExceedsMarketSupplyError = exports.WithdrawSharesExceedSupplyError = exports.WithdrawExceedsSupplyError = exports.MutuallyExclusiveWithdrawAmountsError = exports.InsufficientMidnightWithdrawableLiquidityError = exports.MidnightRedeemExceedsCreditError = exports.NoMidnightCreditToRedeemError = exports.UnpreparedMidnightOfferRootSignatureError = exports.MidnightOfferRootOfferCountMismatchError = exports.MidnightOfferRootRatifierMismatchError = exports.MidnightOfferRootOwnerMismatchError = exports.MidnightOfferRootMismatchError = exports.MissingMidnightOfferRootSignatureError = exports.UnknownMidnightRatifierError = exports.MidnightTakeableOfferMarketMismatchError = exports.MidnightOfferMarketLoanTokenMismatchError = exports.MidnightMarketAddressMismatchError = exports.MidnightOfferMarketAddressMismatchError = exports.MidnightOfferMarketChainMismatchError = exports.MidnightOfferMakerMismatchError = exports.MidnightOfferSideMismatchError = exports.EmptyMidnightTakeableOffersError = exports.MidnightAmountExceedsMaxOfferCapError = exports.ReallocationAdapterSupplySharesUnderflowError = exports.ReallocationAllocationUnderflowError = exports.UnknownReallocationAdapterError = exports.UnknownReallocationMarketPublicAllocatorConfigError = exports.UnknownReallocationActiveAdaptersError = exports.UnknownReallocationPublicAllocatorConfigError = exports.UnknownReallocationAllocationError = exports.UnknownReallocationPositionError = exports.UnknownReallocationVaultMarketConfigError = exports.UnknownReallocationVaultError = exports.UnknownReallocationMarketError = exports.InsufficientSharedLiquidityError = void 0;
6
6
  const blue_sdk_1 = require("@morpho-org/blue-sdk");
7
7
  /**
8
8
  * Thrown when a morpho-sdk input that must be non-negative is negative.
@@ -248,8 +248,8 @@ class VaultIsBlueFeeRecipientError extends Error {
248
248
  }
249
249
  }
250
250
  exports.VaultIsBlueFeeRecipientError = VaultIsBlueFeeRecipientError;
251
- /** Thrown when a vault-shares requirement cannot be safely encoded as an ERC-2612 permit. */
252
- class VaultExitBundlesV1PermitMismatchError extends Error {
251
+ /** Thrown when a vault-shares requirement cannot be safely encoded as a bundles permit. */
252
+ class BundlesPermitMismatchError extends Error {
253
253
  /**
254
254
  * @param params - Permit mismatch values used to explain the rejection.
255
255
  * @param params.field - Permit field that does not match the exit.
@@ -261,19 +261,32 @@ class VaultExitBundlesV1PermitMismatchError extends Error {
261
261
  expected;
262
262
  actual;
263
263
  constructor(params) {
264
- super(`VaultExitBundlesV1 permit ${params.field} mismatch: expected "${params.expected}", got "${params.actual}". Rebuild and sign the vault-exit permit.`, { cause: params.cause });
264
+ super(`Bundles permit ${params.field} mismatch: expected "${params.expected}", got "${params.actual}". Resolve and sign the requirements returned by this prepared operation.`, { cause: params.cause });
265
265
  this.field = params.field;
266
266
  this.expected = params.expected;
267
267
  this.actual = params.actual;
268
+ this.name = "BundlesPermitMismatchError";
269
+ }
270
+ }
271
+ exports.BundlesPermitMismatchError = BundlesPermitMismatchError;
272
+ /**
273
+ * Thrown by the deprecated VaultExitBundlesV1 permit compatibility helper.
274
+ *
275
+ * @deprecated Use {@link BundlesPermitMismatchError} with `getBundlesSharesPermit`.
276
+ */
277
+ class VaultExitBundlesV1PermitMismatchError extends BundlesPermitMismatchError {
278
+ constructor(params) {
279
+ super(params);
280
+ this.message = `VaultExitBundlesV1 permit ${params.field} mismatch: expected "${params.expected}", got "${params.actual}". Rebuild and sign the vault-exit permit.`;
268
281
  this.name = "VaultExitBundlesV1PermitMismatchError";
269
282
  }
270
283
  }
271
284
  exports.VaultExitBundlesV1PermitMismatchError = VaultExitBundlesV1PermitMismatchError;
272
- /** Thrown when a signed requirement cannot be safely encoded for BlueBundlesV1. */
273
- class BlueBundlesV1RequirementSignatureMismatchError extends Error {
274
- /** Field whose signed value or encoding is invalid for the direct BlueBundlesV1 call. */
285
+ /** Thrown when a signed requirement cannot be safely encoded for a fixed bundles call. */
286
+ class BundlesRequirementSignatureMismatchError extends Error {
287
+ /** Field whose signed value or encoding is invalid for the fixed bundles call. */
275
288
  field;
276
- /** Value required by BlueBundlesV1. */
289
+ /** Value required by the fixed bundles call. */
277
290
  expected;
278
291
  /** Value supplied by the signed requirement. */
279
292
  actual;
@@ -285,24 +298,26 @@ class BlueBundlesV1RequirementSignatureMismatchError extends Error {
285
298
  * @param params.cause - Original signature parser failure, when applicable.
286
299
  */
287
300
  constructor(params) {
288
- super(`BlueBundlesV1 requirement ${params.field} mismatch: expected "${params.expected}", got "${params.actual}". Resolve and sign the requirements returned by this Blue action.`, { cause: params.cause });
301
+ super(`Bundles requirement ${params.field} mismatch: expected "${params.expected}", got "${params.actual}". Resolve and sign the requirements returned by this prepared operation.`, { cause: params.cause });
289
302
  this.field = params.field;
290
303
  this.expected = params.expected;
291
304
  this.actual = params.actual;
292
- this.name = "BlueBundlesV1RequirementSignatureMismatchError";
305
+ this.name = "BundlesRequirementSignatureMismatchError";
293
306
  }
294
307
  }
295
- exports.BlueBundlesV1RequirementSignatureMismatchError = BlueBundlesV1RequirementSignatureMismatchError;
308
+ exports.BundlesRequirementSignatureMismatchError = BundlesRequirementSignatureMismatchError;
309
+ exports.BlueBundlesV1RequirementSignatureMismatchError = BundlesRequirementSignatureMismatchError;
296
310
  /** Thrown when Permit2 SignatureTransfer is selected without an explicit unordered nonce. */
297
- class MissingPermit2TransferFromNonceError extends Error {
311
+ class MissingPermit2SignatureTransferNonceError extends Error {
298
312
  constructor() {
299
313
  super("Permit2 SignatureTransfer requires an explicit unused permit2Nonce. Generate a unique uint256 nonce, pass it to getRequirements(), and resolve the requirements again.");
300
- this.name = "MissingPermit2TransferFromNonceError";
314
+ this.name = "MissingPermit2SignatureTransferNonceError";
301
315
  }
302
316
  }
303
- exports.MissingPermit2TransferFromNonceError = MissingPermit2TransferFromNonceError;
317
+ exports.MissingPermit2SignatureTransferNonceError = MissingPermit2SignatureTransferNonceError;
318
+ exports.MissingPermit2TransferFromNonceError = MissingPermit2SignatureTransferNonceError;
304
319
  /** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
305
- class Permit2TransferFromNonceAlreadyUsedError extends Error {
320
+ class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
306
321
  owner;
307
322
  nonce;
308
323
  /**
@@ -313,10 +328,11 @@ class Permit2TransferFromNonceAlreadyUsedError extends Error {
313
328
  super(`Permit2 nonce "${nonce}" is already used for owner "${owner}". Generate a different uint256 permit2Nonce and resolve the requirements again.`);
314
329
  this.owner = owner;
315
330
  this.nonce = nonce;
316
- this.name = "Permit2TransferFromNonceAlreadyUsedError";
331
+ this.name = "Permit2SignatureTransferNonceAlreadyUsedError";
317
332
  }
318
333
  }
319
- exports.Permit2TransferFromNonceAlreadyUsedError = Permit2TransferFromNonceAlreadyUsedError;
334
+ exports.Permit2SignatureTransferNonceAlreadyUsedError = Permit2SignatureTransferNonceAlreadyUsedError;
335
+ exports.Permit2TransferFromNonceAlreadyUsedError = Permit2SignatureTransferNonceAlreadyUsedError;
320
336
  /** Thrown when no unused Permit2 unordered nonce exists at or after the requested start nonce. */
321
337
  class NoUnusedPermit2NonceError extends Error {
322
338
  owner;
@@ -350,13 +366,63 @@ class NativeFundingAmountMismatchError extends Error {
350
366
  }
351
367
  exports.NativeFundingAmountMismatchError = NativeFundingAmountMismatchError;
352
368
  /** Thrown when a positive referral fee has no recipient. */
353
- class MissingReferralFeeRecipientError extends Error {
369
+ class ReferralFeeRecipientMissingError extends Error {
354
370
  constructor() {
355
371
  super("A positive referralFeePct requires referralFeeRecipient. Provide the recipient or set referralFeePct to zero.");
356
- this.name = "MissingReferralFeeRecipientError";
372
+ this.name = "ReferralFeeRecipientMissingError";
373
+ }
374
+ }
375
+ exports.ReferralFeeRecipientMissingError = ReferralFeeRecipientMissingError;
376
+ /** @deprecated Use {@link ReferralFeeRecipientMissingError}. */
377
+ exports.MissingReferralFeeRecipientError = ReferralFeeRecipientMissingError;
378
+ /**
379
+ * Thrown when a referral fee percentage is outside the contract's `[0, WAD)` range.
380
+ *
381
+ * Extends {@link InputExceedsMaxError} — and reports the same `field`, `value`, and `max` the
382
+ * generic bound error used to carry for this input — so integrators already pattern-matching
383
+ * `InputExceedsMaxError` keep catching this failure.
384
+ */
385
+ class ReferralFeePctExceededError extends InputExceedsMaxError {
386
+ referralFeePct;
387
+ /** @param referralFeePct - WAD-scaled referral fee percentage supplied by the caller. */
388
+ constructor(referralFeePct) {
389
+ super({
390
+ field: "referralFeePct",
391
+ value: referralFeePct,
392
+ max: blue_sdk_1.MathLib.WAD - 1n,
393
+ });
394
+ this.referralFeePct = referralFeePct;
395
+ this.message = `Referral fee percentage "${referralFeePct}" must be below WAD. Reduce referralFeePct or disable the referral fee.`;
396
+ this.name = "ReferralFeePctExceededError";
397
+ }
398
+ }
399
+ exports.ReferralFeePctExceededError = ReferralFeePctExceededError;
400
+ /** Thrown when a fixed bundles call mixes ERC-20 and native funding. */
401
+ class MixedBundlesFundingError extends Error {
402
+ constructor() {
403
+ super("Bundles funding accepts either amount or nativeAmount, not both. Choose one funding source and rebuild the transaction.");
404
+ this.name = "MixedBundlesFundingError";
405
+ }
406
+ }
407
+ exports.MixedBundlesFundingError = MixedBundlesFundingError;
408
+ /** Thrown when a vault migration specifies both assets and shares, or neither. */
409
+ class AmountAndSharesExclusiveError extends Error {
410
+ constructor() {
411
+ super("Vault migration requires exactly one of assets or shares. Choose the desired withdrawal mode and rebuild the transaction.");
412
+ this.name = "AmountAndSharesExclusiveError";
413
+ }
414
+ }
415
+ exports.AmountAndSharesExclusiveError = AmountAndSharesExclusiveError;
416
+ /** Thrown when a vault migration selects the same source and destination vault. */
417
+ class SameVaultMigrationError extends Error {
418
+ vault;
419
+ constructor(vault) {
420
+ super(`Source and destination vault are both "${vault}". Select a different destination vault.`);
421
+ this.vault = vault;
422
+ this.name = "SameVaultMigrationError";
357
423
  }
358
424
  }
359
- exports.MissingReferralFeeRecipientError = MissingReferralFeeRecipientError;
425
+ exports.SameVaultMigrationError = SameVaultMigrationError;
360
426
  /** Thrown when a BlueBundlesV1 reallocation source uses another loan token. */
361
427
  class ReallocationLoanTokenMismatchError extends Error {
362
428
  expected;
package/lib/esm/abis.d.ts CHANGED
@@ -326,6 +326,216 @@ export declare const vaultExitBundlesV1Abi: readonly [{
326
326
  readonly outputs: readonly [];
327
327
  readonly stateMutability: "nonpayable";
328
328
  }];
329
+ /**
330
+ * Pinned ABI for the VaultBundlesV1 entrypoints used by Vault V1 and Vault V2 actions.
331
+ *
332
+ * Sourced from `morpho-org/bundles` commit
333
+ * `f27e7bcf744310303e24faa522b71d702e696686`.
334
+ */
335
+ export declare const vaultBundlesV1Abi: readonly [{
336
+ readonly type: "error";
337
+ readonly name: "AlreadyInitiated";
338
+ readonly inputs: readonly [];
339
+ }, {
340
+ readonly type: "error";
341
+ readonly name: "DeadlinePassed";
342
+ readonly inputs: readonly [];
343
+ }, {
344
+ readonly type: "error";
345
+ readonly name: "InconsistentAssets";
346
+ readonly inputs: readonly [];
347
+ }, {
348
+ readonly type: "error";
349
+ readonly name: "NotExactlyOneZero";
350
+ readonly inputs: readonly [];
351
+ }, {
352
+ readonly type: "error";
353
+ readonly name: "PctExceeded";
354
+ readonly inputs: readonly [];
355
+ }, {
356
+ readonly type: "error";
357
+ readonly name: "SlippageExceeded";
358
+ readonly inputs: readonly [];
359
+ }, {
360
+ readonly type: "function";
361
+ readonly name: "initiator";
362
+ readonly inputs: readonly [];
363
+ readonly outputs: readonly [{
364
+ readonly name: "";
365
+ readonly type: "address";
366
+ readonly internalType: "address";
367
+ }];
368
+ readonly stateMutability: "view";
369
+ }, {
370
+ readonly type: "function";
371
+ readonly name: "vaultBundlesV1Deposit";
372
+ readonly inputs: readonly [{
373
+ readonly name: "vault";
374
+ readonly type: "address";
375
+ readonly internalType: "address";
376
+ }, {
377
+ readonly name: "assets";
378
+ readonly type: "uint256";
379
+ readonly internalType: "uint256";
380
+ }, {
381
+ readonly name: "maxSharePriceE27";
382
+ readonly type: "uint256";
383
+ readonly internalType: "uint256";
384
+ }, {
385
+ readonly name: "assetPermit";
386
+ readonly type: "tuple";
387
+ readonly internalType: "struct TokenPermit";
388
+ readonly components: readonly [{
389
+ readonly name: "kind";
390
+ readonly type: "uint8";
391
+ readonly internalType: "enum PermitKind";
392
+ }, {
393
+ readonly name: "data";
394
+ readonly type: "bytes";
395
+ readonly internalType: "bytes";
396
+ }];
397
+ }, {
398
+ readonly name: "referralFeePct";
399
+ readonly type: "uint256";
400
+ readonly internalType: "uint256";
401
+ }, {
402
+ readonly name: "referralFeeRecipient";
403
+ readonly type: "address";
404
+ readonly internalType: "address";
405
+ }, {
406
+ readonly name: "deadline";
407
+ readonly type: "uint256";
408
+ readonly internalType: "uint256";
409
+ }];
410
+ readonly outputs: readonly [];
411
+ readonly stateMutability: "payable";
412
+ }, {
413
+ readonly type: "function";
414
+ readonly name: "vaultBundlesV1Withdraw";
415
+ readonly inputs: readonly [{
416
+ readonly name: "vault";
417
+ readonly type: "address";
418
+ readonly internalType: "address";
419
+ }, {
420
+ readonly name: "assets";
421
+ readonly type: "uint256";
422
+ readonly internalType: "uint256";
423
+ }, {
424
+ readonly name: "shares";
425
+ readonly type: "uint256";
426
+ readonly internalType: "uint256";
427
+ }, {
428
+ readonly name: "sharesPermit";
429
+ readonly type: "tuple";
430
+ readonly internalType: "struct Permit";
431
+ readonly components: readonly [{
432
+ readonly name: "value";
433
+ readonly type: "uint256";
434
+ readonly internalType: "uint256";
435
+ }, {
436
+ readonly name: "nonce";
437
+ readonly type: "uint256";
438
+ readonly internalType: "uint256";
439
+ }, {
440
+ readonly name: "deadline";
441
+ readonly type: "uint256";
442
+ readonly internalType: "uint256";
443
+ }, {
444
+ readonly name: "v";
445
+ readonly type: "uint8";
446
+ readonly internalType: "uint8";
447
+ }, {
448
+ readonly name: "r";
449
+ readonly type: "bytes32";
450
+ readonly internalType: "bytes32";
451
+ }, {
452
+ readonly name: "s";
453
+ readonly type: "bytes32";
454
+ readonly internalType: "bytes32";
455
+ }];
456
+ }, {
457
+ readonly name: "referralFeePct";
458
+ readonly type: "uint256";
459
+ readonly internalType: "uint256";
460
+ }, {
461
+ readonly name: "referralFeeRecipient";
462
+ readonly type: "address";
463
+ readonly internalType: "address";
464
+ }, {
465
+ readonly name: "deadline";
466
+ readonly type: "uint256";
467
+ readonly internalType: "uint256";
468
+ }];
469
+ readonly outputs: readonly [];
470
+ readonly stateMutability: "nonpayable";
471
+ }, {
472
+ readonly type: "function";
473
+ readonly name: "vaultBundlesV1Migrate";
474
+ readonly inputs: readonly [{
475
+ readonly name: "sourceVault";
476
+ readonly type: "address";
477
+ readonly internalType: "address";
478
+ }, {
479
+ readonly name: "destVault";
480
+ readonly type: "address";
481
+ readonly internalType: "address";
482
+ }, {
483
+ readonly name: "assetsWithdrawn";
484
+ readonly type: "uint256";
485
+ readonly internalType: "uint256";
486
+ }, {
487
+ readonly name: "sharesRedeemed";
488
+ readonly type: "uint256";
489
+ readonly internalType: "uint256";
490
+ }, {
491
+ readonly name: "destMaxSharePriceE27";
492
+ readonly type: "uint256";
493
+ readonly internalType: "uint256";
494
+ }, {
495
+ readonly name: "sharesPermit";
496
+ readonly type: "tuple";
497
+ readonly internalType: "struct Permit";
498
+ readonly components: readonly [{
499
+ readonly name: "value";
500
+ readonly type: "uint256";
501
+ readonly internalType: "uint256";
502
+ }, {
503
+ readonly name: "nonce";
504
+ readonly type: "uint256";
505
+ readonly internalType: "uint256";
506
+ }, {
507
+ readonly name: "deadline";
508
+ readonly type: "uint256";
509
+ readonly internalType: "uint256";
510
+ }, {
511
+ readonly name: "v";
512
+ readonly type: "uint8";
513
+ readonly internalType: "uint8";
514
+ }, {
515
+ readonly name: "r";
516
+ readonly type: "bytes32";
517
+ readonly internalType: "bytes32";
518
+ }, {
519
+ readonly name: "s";
520
+ readonly type: "bytes32";
521
+ readonly internalType: "bytes32";
522
+ }];
523
+ }, {
524
+ readonly name: "referralFeePct";
525
+ readonly type: "uint256";
526
+ readonly internalType: "uint256";
527
+ }, {
528
+ readonly name: "referralFeeRecipient";
529
+ readonly type: "address";
530
+ readonly internalType: "address";
531
+ }, {
532
+ readonly name: "deadline";
533
+ readonly type: "uint256";
534
+ readonly internalType: "uint256";
535
+ }];
536
+ readonly outputs: readonly [];
537
+ readonly stateMutability: "nonpayable";
538
+ }];
329
539
  /** ABI for the Bundler3 multicall contract. */
330
540
  export declare const bundler3Abi: readonly [{
331
541
  readonly type: "function";