@morpho-org/morpho-sdk 4.2.0 → 5.1.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 (191) hide show
  1. package/README.md +16 -16
  2. package/lib/cjs/actions/blue/borrow.d.ts +12 -2
  3. package/lib/cjs/actions/blue/borrow.js +7 -1
  4. package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +47 -0
  5. package/lib/cjs/actions/blue/buildAssetFundingActions.js +63 -0
  6. package/lib/cjs/actions/blue/refinance.d.ts +13 -3
  7. package/lib/cjs/actions/blue/refinance.js +8 -2
  8. package/lib/cjs/actions/blue/repay.d.ts +44 -43
  9. package/lib/cjs/actions/blue/repay.js +70 -59
  10. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +50 -41
  11. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +75 -54
  12. package/lib/cjs/actions/blue/resolveRepayFunding.d.ts +69 -0
  13. package/lib/cjs/actions/blue/resolveRepayFunding.js +82 -0
  14. package/lib/cjs/actions/blue/supply.d.ts +8 -8
  15. package/lib/cjs/actions/blue/supply.js +11 -35
  16. package/lib/cjs/actions/blue/supplyCollateral.d.ts +9 -9
  17. package/lib/cjs/actions/blue/supplyCollateral.js +12 -36
  18. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +19 -7
  19. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +17 -32
  20. package/lib/cjs/actions/blue/withdraw.d.ts +10 -2
  21. package/lib/cjs/actions/blue/withdraw.js +7 -1
  22. package/lib/cjs/actions/index.d.ts +1 -0
  23. package/lib/cjs/actions/index.js +1 -0
  24. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +49 -0
  25. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +111 -0
  26. package/lib/cjs/actions/requirements/blue/index.d.ts +1 -0
  27. package/lib/cjs/actions/requirements/blue/index.js +17 -0
  28. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +55 -0
  29. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +89 -0
  30. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +6 -5
  31. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +17 -5
  32. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +9 -7
  33. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +18 -4
  34. package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2.d.ts → encodeErc20Permit2Approve.d.ts} +11 -13
  35. package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2.js → encodeErc20Permit2Approve.js} +10 -14
  36. package/lib/cjs/actions/requirements/encode/index.d.ts +2 -1
  37. package/lib/cjs/actions/requirements/encode/index.js +2 -1
  38. package/lib/cjs/actions/requirements/{getRequirements.d.ts → generalAdapter/getGeneralAdapterRequirements.d.ts} +34 -20
  39. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +151 -0
  40. package/lib/{esm/actions/requirements/getRequirementsPermit.d.ts → cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts} +6 -14
  41. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +50 -0
  42. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +57 -0
  43. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +74 -0
  44. package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +3 -0
  45. package/lib/cjs/actions/requirements/generalAdapter/index.js +19 -0
  46. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +3 -2
  47. package/lib/cjs/actions/requirements/getRequirementsApproval.js +3 -2
  48. package/lib/cjs/actions/requirements/index.d.ts +2 -5
  49. package/lib/cjs/actions/requirements/index.js +2 -5
  50. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +29 -0
  51. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +48 -0
  52. package/lib/{esm/actions/requirements/getRequirementsAction.d.ts → cjs/actions/signatures/getTokenRequirementActions.d.ts} +17 -17
  53. package/lib/cjs/actions/{requirements/getRequirementsAction.js → signatures/getTokenRequirementActions.js} +26 -13
  54. package/lib/cjs/actions/signatures/index.d.ts +2 -0
  55. package/lib/cjs/actions/signatures/index.js +18 -0
  56. package/lib/cjs/actions/vaultV1/deposit.d.ts +6 -8
  57. package/lib/cjs/actions/vaultV1/deposit.js +11 -21
  58. package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +6 -6
  59. package/lib/cjs/actions/vaultV1/migrateToV2.js +12 -20
  60. package/lib/cjs/actions/vaultV2/deposit.d.ts +6 -8
  61. package/lib/cjs/actions/vaultV2/deposit.js +11 -21
  62. package/lib/cjs/addresses.d.ts +2 -2
  63. package/lib/cjs/addresses.js +2 -1
  64. package/lib/cjs/bundler/actions.d.ts +44 -4
  65. package/lib/cjs/bundler/actions.js +75 -2
  66. package/lib/cjs/bundler/types.d.ts +6 -0
  67. package/lib/cjs/constants.d.ts +2 -2
  68. package/lib/cjs/constants.js +3 -3
  69. package/lib/cjs/entities/blue/blue.d.ts +58 -33
  70. package/lib/cjs/entities/blue/blue.js +309 -189
  71. package/lib/cjs/entities/reallocationData.d.ts +0 -44
  72. package/lib/cjs/entities/reallocationData.js +3 -50
  73. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -9
  74. package/lib/cjs/entities/vaultV1/vaultV1.js +44 -34
  75. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +6 -6
  76. package/lib/cjs/entities/vaultV2/vaultV2.js +21 -16
  77. package/lib/cjs/errors.d.ts +3 -2
  78. package/lib/cjs/errors.js +5 -2
  79. package/lib/cjs/helpers/index.d.ts +1 -1
  80. package/lib/cjs/helpers/index.js +1 -2
  81. package/lib/cjs/helpers/validate.d.ts +2 -20
  82. package/lib/cjs/helpers/validate.js +2 -39
  83. package/lib/cjs/types/action.d.ts +164 -12
  84. package/lib/cjs/types/action.js +79 -5
  85. package/lib/cjs/types/error.d.ts +97 -2
  86. package/lib/cjs/types/error.js +113 -7
  87. package/lib/cjs/types.d.ts +2 -1
  88. package/lib/cjs/utils.d.ts +2 -2
  89. package/lib/cjs/utils.js +2 -4
  90. package/lib/esm/actions/blue/borrow.d.ts +12 -2
  91. package/lib/esm/actions/blue/borrow.js +7 -1
  92. package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +47 -0
  93. package/lib/esm/actions/blue/buildAssetFundingActions.js +59 -0
  94. package/lib/esm/actions/blue/refinance.d.ts +13 -3
  95. package/lib/esm/actions/blue/refinance.js +8 -2
  96. package/lib/esm/actions/blue/repay.d.ts +44 -43
  97. package/lib/esm/actions/blue/repay.js +71 -60
  98. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +50 -41
  99. package/lib/esm/actions/blue/repayWithdrawCollateral.js +76 -55
  100. package/lib/esm/actions/blue/resolveRepayFunding.d.ts +69 -0
  101. package/lib/esm/actions/blue/resolveRepayFunding.js +78 -0
  102. package/lib/esm/actions/blue/supply.d.ts +8 -8
  103. package/lib/esm/actions/blue/supply.js +12 -36
  104. package/lib/esm/actions/blue/supplyCollateral.d.ts +9 -9
  105. package/lib/esm/actions/blue/supplyCollateral.js +13 -37
  106. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +19 -7
  107. package/lib/esm/actions/blue/supplyCollateralBorrow.js +18 -33
  108. package/lib/esm/actions/blue/withdraw.d.ts +10 -2
  109. package/lib/esm/actions/blue/withdraw.js +7 -1
  110. package/lib/esm/actions/index.d.ts +1 -0
  111. package/lib/esm/actions/index.js +1 -0
  112. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +49 -0
  113. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +107 -0
  114. package/lib/esm/actions/requirements/blue/index.d.ts +1 -0
  115. package/lib/esm/actions/requirements/blue/index.js +1 -0
  116. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +55 -0
  117. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +85 -0
  118. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +6 -5
  119. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +19 -7
  120. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +9 -7
  121. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +20 -6
  122. package/lib/esm/actions/requirements/encode/{encodeErc20Permit2.d.ts → encodeErc20Permit2Approve.d.ts} +11 -13
  123. package/lib/esm/actions/requirements/encode/{encodeErc20Permit2.js → encodeErc20Permit2Approve.js} +8 -12
  124. package/lib/esm/actions/requirements/encode/index.d.ts +2 -1
  125. package/lib/esm/actions/requirements/encode/index.js +2 -1
  126. package/lib/esm/actions/requirements/{getRequirements.d.ts → generalAdapter/getGeneralAdapterRequirements.d.ts} +34 -20
  127. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +147 -0
  128. package/lib/{cjs/actions/requirements/getRequirementsPermit.d.ts → esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts} +6 -14
  129. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +46 -0
  130. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +57 -0
  131. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +70 -0
  132. package/lib/esm/actions/requirements/generalAdapter/index.d.ts +3 -0
  133. package/lib/esm/actions/requirements/generalAdapter/index.js +3 -0
  134. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +3 -2
  135. package/lib/esm/actions/requirements/getRequirementsApproval.js +3 -2
  136. package/lib/esm/actions/requirements/index.d.ts +2 -5
  137. package/lib/esm/actions/requirements/index.js +2 -5
  138. package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +29 -0
  139. package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +44 -0
  140. package/lib/{cjs/actions/requirements/getRequirementsAction.d.ts → esm/actions/signatures/getTokenRequirementActions.d.ts} +17 -17
  141. package/lib/esm/actions/{requirements/getRequirementsAction.js → signatures/getTokenRequirementActions.js} +24 -11
  142. package/lib/esm/actions/signatures/index.d.ts +2 -0
  143. package/lib/esm/actions/signatures/index.js +2 -0
  144. package/lib/esm/actions/vaultV1/deposit.d.ts +6 -8
  145. package/lib/esm/actions/vaultV1/deposit.js +11 -21
  146. package/lib/esm/actions/vaultV1/migrateToV2.d.ts +6 -6
  147. package/lib/esm/actions/vaultV1/migrateToV2.js +12 -20
  148. package/lib/esm/actions/vaultV2/deposit.d.ts +6 -8
  149. package/lib/esm/actions/vaultV2/deposit.js +11 -21
  150. package/lib/esm/addresses.d.ts +2 -2
  151. package/lib/esm/addresses.js +1 -1
  152. package/lib/esm/bundler/actions.d.ts +44 -4
  153. package/lib/esm/bundler/actions.js +77 -4
  154. package/lib/esm/bundler/types.d.ts +6 -0
  155. package/lib/esm/constants.d.ts +2 -2
  156. package/lib/esm/constants.js +2 -2
  157. package/lib/esm/entities/blue/blue.d.ts +58 -33
  158. package/lib/esm/entities/blue/blue.js +311 -191
  159. package/lib/esm/entities/reallocationData.d.ts +0 -44
  160. package/lib/esm/entities/reallocationData.js +2 -49
  161. package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -9
  162. package/lib/esm/entities/vaultV1/vaultV1.js +46 -36
  163. package/lib/esm/entities/vaultV2/vaultV2.d.ts +6 -6
  164. package/lib/esm/entities/vaultV2/vaultV2.js +23 -18
  165. package/lib/esm/errors.d.ts +3 -2
  166. package/lib/esm/errors.js +2 -1
  167. package/lib/esm/helpers/index.d.ts +1 -1
  168. package/lib/esm/helpers/index.js +1 -1
  169. package/lib/esm/helpers/validate.d.ts +2 -20
  170. package/lib/esm/helpers/validate.js +2 -38
  171. package/lib/esm/types/action.d.ts +164 -12
  172. package/lib/esm/types/action.js +75 -4
  173. package/lib/esm/types/error.d.ts +97 -2
  174. package/lib/esm/types/error.js +107 -5
  175. package/lib/esm/types.d.ts +2 -1
  176. package/lib/esm/utils.d.ts +2 -2
  177. package/lib/esm/utils.js +2 -2
  178. package/package.json +22 -21
  179. package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.d.ts +0 -37
  180. package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.js +0 -71
  181. package/lib/cjs/actions/requirements/getRequirements.js +0 -112
  182. package/lib/cjs/actions/requirements/getRequirementsPermit.js +0 -57
  183. package/lib/cjs/actions/requirements/getRequirementsPermit2.d.ts +0 -63
  184. package/lib/cjs/actions/requirements/getRequirementsPermit2.js +0 -85
  185. package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.d.ts +0 -37
  186. package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.js +0 -67
  187. package/lib/esm/actions/requirements/getRequirements.js +0 -108
  188. package/lib/esm/actions/requirements/getRequirementsPermit.js +0 -53
  189. package/lib/esm/actions/requirements/getRequirementsPermit2.d.ts +0 -63
  190. package/lib/esm/actions/requirements/getRequirementsPermit2.js +0 -81
  191. package/src/index.ts +0 -4
@@ -1,29 +1,28 @@
1
1
  import { type Address } from "viem";
2
2
  import type { Action } from "../../bundler/index.js";
3
- import { type Permit2Action, type PermitAction, type PermitArgs } from "../../types/index.js";
4
- interface GetRequirementsActionParams {
3
+ import { type PermitRequirementSignature } from "../../types/index.js";
4
+ interface GetTokenRequirementActionsParams {
5
5
  asset: Address;
6
6
  amount: bigint;
7
7
  recipient: Address;
8
- requirementSignature: {
9
- args: PermitArgs;
10
- action: PermitAction | Permit2Action;
11
- };
8
+ requirementSignature?: PermitRequirementSignature;
12
9
  }
13
10
  /**
14
- * Encodes the bundler actions that consume a pre-signed permit / permit2 requirement and pull
15
- * the asset to `recipient`.
11
+ * Encodes the bundler actions that pull the asset to `recipient`, optionally consuming a
12
+ * pre-signed permit / permit2 requirement first.
16
13
  *
17
14
  * Permit2 path emits `approve2` + `transferFrom2`; classic permit path emits `permit` +
18
- * `erc20TransferFrom`. The signed `asset` and `amount` must match the pulled `asset` and
19
- * `amount` exactly, otherwise the function throws so the caller does not silently spend a
20
- * wider-than-expected approval.
15
+ * `erc20TransferFrom`. When no signature is provided, the function emits a plain
16
+ * `erc20TransferFrom` against an existing ERC-20 allowance.
17
+ *
18
+ * The signed `asset` and `amount` must match the pulled `asset` and `amount` exactly, otherwise
19
+ * the function throws so the caller does not silently spend a wider-than-expected approval.
21
20
  *
22
21
  * @param params.asset - The ERC-20 to pull.
23
22
  * @param params.amount - The amount to pull, in the asset's smallest unit.
24
23
  * @param params.recipient - The address that receives the transfer.
25
- * @param params.requirementSignature - The signed permit / permit2 to apply before the transfer.
26
- * @returns A pair of bundler `Action`s: a permit / approve2 followed by the transfer.
24
+ * @param params.requirementSignature - Optional signed permit / permit2 to apply before the transfer.
25
+ * @returns Bundler `Action`s needed to pull the token.
27
26
  * @throws {DepositAssetMismatchError} when the signed asset differs from `asset`.
28
27
  * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
29
28
  * @throws {Permit2ExpirationMissingError} when `action.type === "permit2"` but `args.expiration` is missing.
@@ -31,7 +30,7 @@ interface GetRequirementsActionParams {
31
30
  * ```ts
32
31
  * import { createWalletClient, http } from "viem";
33
32
  * import { mainnet } from "viem/chains";
34
- * import { getRequirementsAction } from "@morpho-org/morpho-sdk";
33
+ * import { getTokenRequirementActions } from "@morpho-org/morpho-sdk";
35
34
  *
36
35
  * const walletClient = createWalletClient({
37
36
  * chain: mainnet,
@@ -39,10 +38,10 @@ interface GetRequirementsActionParams {
39
38
  * account: borrower,
40
39
  * });
41
40
  *
42
- * // `requirement` comes from `getRequirements*` helpers; signing produces a `RequirementSignature`.
41
+ * // `requirement` comes from a requirement helper; signing produces a `RequirementSignature`.
43
42
  * const requirementSignature = await requirement.sign(walletClient, borrower);
44
43
  *
45
- * const actions = getRequirementsAction({
44
+ * const actions = getTokenRequirementActions({
46
45
  * asset: loanToken,
47
46
  * amount: 1_000_000n,
48
47
  * recipient: generalAdapter1,
@@ -51,7 +50,8 @@ interface GetRequirementsActionParams {
51
50
  * // actions satisfies Action[]
52
51
  * // - permit2 path: [{ type: "approve2", ... }, { type: "transferFrom2", ... }]
53
52
  * // - classic permit path: [{ type: "permit", ... }, { type: "erc20TransferFrom", ... }]
53
+ * // - no signature: [{ type: "erc20TransferFrom", ... }]
54
54
  * ```
55
55
  */
56
- export declare const getRequirementsAction: ({ asset, amount, recipient, requirementSignature, }: GetRequirementsActionParams) => Action[];
56
+ export declare const getTokenRequirementActions: ({ asset, amount, recipient, requirementSignature, }: GetTokenRequirementActionsParams) => Action[];
57
57
  export {};
@@ -1,19 +1,21 @@
1
1
  import { isAddressEqual } from "viem";
2
2
  import { DepositAmountMismatchError, DepositAssetMismatchError, Permit2ExpirationMissingError, } from "../../types/index.js";
3
3
  /**
4
- * Encodes the bundler actions that consume a pre-signed permit / permit2 requirement and pull
5
- * the asset to `recipient`.
4
+ * Encodes the bundler actions that pull the asset to `recipient`, optionally consuming a
5
+ * pre-signed permit / permit2 requirement first.
6
6
  *
7
7
  * Permit2 path emits `approve2` + `transferFrom2`; classic permit path emits `permit` +
8
- * `erc20TransferFrom`. The signed `asset` and `amount` must match the pulled `asset` and
9
- * `amount` exactly, otherwise the function throws so the caller does not silently spend a
10
- * wider-than-expected approval.
8
+ * `erc20TransferFrom`. When no signature is provided, the function emits a plain
9
+ * `erc20TransferFrom` against an existing ERC-20 allowance.
10
+ *
11
+ * The signed `asset` and `amount` must match the pulled `asset` and `amount` exactly, otherwise
12
+ * the function throws so the caller does not silently spend a wider-than-expected approval.
11
13
  *
12
14
  * @param params.asset - The ERC-20 to pull.
13
15
  * @param params.amount - The amount to pull, in the asset's smallest unit.
14
16
  * @param params.recipient - The address that receives the transfer.
15
- * @param params.requirementSignature - The signed permit / permit2 to apply before the transfer.
16
- * @returns A pair of bundler `Action`s: a permit / approve2 followed by the transfer.
17
+ * @param params.requirementSignature - Optional signed permit / permit2 to apply before the transfer.
18
+ * @returns Bundler `Action`s needed to pull the token.
17
19
  * @throws {DepositAssetMismatchError} when the signed asset differs from `asset`.
18
20
  * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
19
21
  * @throws {Permit2ExpirationMissingError} when `action.type === "permit2"` but `args.expiration` is missing.
@@ -21,7 +23,7 @@ import { DepositAmountMismatchError, DepositAssetMismatchError, Permit2Expiratio
21
23
  * ```ts
22
24
  * import { createWalletClient, http } from "viem";
23
25
  * import { mainnet } from "viem/chains";
24
- * import { getRequirementsAction } from "@morpho-org/morpho-sdk";
26
+ * import { getTokenRequirementActions } from "@morpho-org/morpho-sdk";
25
27
  *
26
28
  * const walletClient = createWalletClient({
27
29
  * chain: mainnet,
@@ -29,10 +31,10 @@ import { DepositAmountMismatchError, DepositAssetMismatchError, Permit2Expiratio
29
31
  * account: borrower,
30
32
  * });
31
33
  *
32
- * // `requirement` comes from `getRequirements*` helpers; signing produces a `RequirementSignature`.
34
+ * // `requirement` comes from a requirement helper; signing produces a `RequirementSignature`.
33
35
  * const requirementSignature = await requirement.sign(walletClient, borrower);
34
36
  *
35
- * const actions = getRequirementsAction({
37
+ * const actions = getTokenRequirementActions({
36
38
  * asset: loanToken,
37
39
  * amount: 1_000_000n,
38
40
  * recipient: generalAdapter1,
@@ -41,12 +43,23 @@ import { DepositAmountMismatchError, DepositAssetMismatchError, Permit2Expiratio
41
43
  * // actions satisfies Action[]
42
44
  * // - permit2 path: [{ type: "approve2", ... }, { type: "transferFrom2", ... }]
43
45
  * // - classic permit path: [{ type: "permit", ... }, { type: "erc20TransferFrom", ... }]
46
+ * // - no signature: [{ type: "erc20TransferFrom", ... }]
44
47
  * ```
45
48
  */
46
- export const getRequirementsAction = ({ asset, amount, recipient, requirementSignature, }) => {
49
+ export const getTokenRequirementActions = ({ asset, amount, recipient, requirementSignature, }) => {
50
+ if (requirementSignature == null) {
51
+ return [
52
+ {
53
+ type: "erc20TransferFrom",
54
+ args: [asset, amount, recipient, false /* skipRevert */],
55
+ },
56
+ ];
57
+ }
47
58
  if (!isAddressEqual(requirementSignature.args.asset, asset)) {
48
59
  throw new DepositAssetMismatchError(asset, requirementSignature.args.asset);
49
60
  }
61
+ // Permit2 and ERC-2612 overwrite the previous allowance with the signed amount.
62
+ // It must exactly cover the transfer: less would fail, more would leave residual allowance.
50
63
  if (requirementSignature.args.amount !== amount) {
51
64
  throw new DepositAmountMismatchError(amount, requirementSignature.args.amount);
52
65
  }
@@ -0,0 +1,2 @@
1
+ export * from "./getBlueAuthorizationAction.js";
2
+ export * from "./getTokenRequirementActions.js";
@@ -0,0 +1,2 @@
1
+ export * from "./getBlueAuthorizationAction.js";
2
+ export * from "./getTokenRequirementActions.js";
@@ -1,5 +1,5 @@
1
1
  import { type Address } from "viem";
2
- import { type DepositAmountArgs, type Metadata, type RequirementSignature, type Transaction, type VaultV1DepositAction } from "../../types/index.js";
2
+ import { type DepositAmountArgs, type Metadata, type PermitRequirementSignature, type Transaction, type VaultV1DepositAction } from "../../types/index.js";
3
3
  /** Parameters for {@link vaultV1Deposit}. */
4
4
  export interface VaultV1DepositParams {
5
5
  vault: {
@@ -10,7 +10,7 @@ export interface VaultV1DepositParams {
10
10
  args: DepositAmountArgs & {
11
11
  maxSharePrice: bigint;
12
12
  recipient: Address;
13
- requirementSignature?: RequirementSignature;
13
+ requirementSignature?: PermitRequirementSignature;
14
14
  };
15
15
  metadata?: Metadata;
16
16
  }
@@ -33,9 +33,7 @@ export interface VaultV1DepositParams {
33
33
  * @param params.args.maxSharePrice - Maximum acceptable share price (in RAY, slippage
34
34
  * protection enforced on-chain by `GeneralAdapter1`).
35
35
  * @param params.args.recipient - Address that receives the minted vault shares.
36
- * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval. When
37
- * absent, the bundle uses a plain `erc20TransferFrom` and assumes the user has already
38
- * approved `GeneralAdapter1`.
36
+ * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval.
39
37
  * @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
40
38
  * deposit. Requires the vault asset to be the chain's wNative.
41
39
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -48,12 +46,12 @@ export interface VaultV1DepositParams {
48
46
  * configured wNative.
49
47
  * @throws {NativeAmountOnNonWNativeVaultError} when `nativeAmount` is provided but the vault
50
48
  * asset is not the chain's wNative.
51
- * @throws {DepositAssetMismatchError} from `getRequirementsAction` when `amount > 0n` and
49
+ * @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
52
50
  * `requirementSignature` is provided and the signed asset differs from `vault.asset`. The
53
51
  * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
54
- * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
52
+ * @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
55
53
  * `requirementSignature` is provided and the signed amount differs from `args.amount`.
56
- * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
54
+ * @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when `amount > 0n` and a
57
55
  * Permit2 requirement signature is missing its expiration.
58
56
  * @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
59
57
  * @example
@@ -4,7 +4,7 @@ import { isAddressEqual } from "viem";
4
4
  import { BundlerAction } from "../../bundler/index.js";
5
5
  import { addTransactionMetadata } from "../../helpers/index.js";
6
6
  import { ChainWNativeMissingError, NativeAmountOnNonWNativeVaultError, NegativeNativeAmountError, NonPositiveAssetAmountError, NonPositiveMaxSharePriceError, ZeroDepositAmountError, } from "../../types/index.js";
7
- import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
7
+ import { getTokenRequirementActions } from "../signatures/getTokenRequirementActions.js";
8
8
  /**
9
9
  * Prepares a deposit transaction for a VaultV1 (MetaMorpho) contract.
10
10
  *
@@ -24,9 +24,7 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
24
24
  * @param params.args.maxSharePrice - Maximum acceptable share price (in RAY, slippage
25
25
  * protection enforced on-chain by `GeneralAdapter1`).
26
26
  * @param params.args.recipient - Address that receives the minted vault shares.
27
- * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval. When
28
- * absent, the bundle uses a plain `erc20TransferFrom` and assumes the user has already
29
- * approved `GeneralAdapter1`.
27
+ * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval.
30
28
  * @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
31
29
  * deposit. Requires the vault asset to be the chain's wNative.
32
30
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -39,12 +37,12 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
39
37
  * configured wNative.
40
38
  * @throws {NativeAmountOnNonWNativeVaultError} when `nativeAmount` is provided but the vault
41
39
  * asset is not the chain's wNative.
42
- * @throws {DepositAssetMismatchError} from `getRequirementsAction` when `amount > 0n` and
40
+ * @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
43
41
  * `requirementSignature` is provided and the signed asset differs from `vault.asset`. The
44
42
  * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
45
- * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
43
+ * @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
46
44
  * `requirementSignature` is provided and the signed amount differs from `args.amount`.
47
- * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
45
+ * @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when `amount > 0n` and a
48
46
  * Permit2 requirement signature is missing its expiration.
49
47
  * @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
50
48
  * @example
@@ -92,20 +90,12 @@ export const vaultV1Deposit = ({ vault: { chainId, address: vaultAddress, asset
92
90
  });
93
91
  }
94
92
  if (amount > 0n) {
95
- if (requirementSignature) {
96
- actions.push(...getRequirementsAction({
97
- asset,
98
- amount,
99
- recipient: generalAdapter1,
100
- requirementSignature,
101
- }));
102
- }
103
- else {
104
- actions.push({
105
- type: "erc20TransferFrom",
106
- args: [asset, amount, generalAdapter1, false /* skipRevert */],
107
- });
108
- }
93
+ actions.push(...getTokenRequirementActions({
94
+ asset,
95
+ amount,
96
+ recipient: generalAdapter1,
97
+ requirementSignature,
98
+ }));
109
99
  }
110
100
  const totalAssets = amount + (nativeAmount ?? 0n);
111
101
  if (totalAssets === 0n) {
@@ -1,5 +1,5 @@
1
1
  import { type Address } from "viem";
2
- import { type Metadata, type RequirementSignature, type Transaction, type VaultV1MigrateToV2Action } from "../../types/index.js";
2
+ import { type Metadata, type PermitRequirementSignature, type Transaction, type VaultV1MigrateToV2Action } from "../../types/index.js";
3
3
  /** Parameters for {@link vaultV1MigrateToV2}. */
4
4
  export interface VaultV1MigrateToV2Params {
5
5
  vault: {
@@ -21,7 +21,7 @@ export interface VaultV1MigrateToV2Params {
21
21
  /** Receives the V2 vault shares. */
22
22
  recipient: Address;
23
23
  /** Pre-signed permit/permit2 approval for V1 share transfer. */
24
- requirementSignature?: RequirementSignature;
24
+ requirementSignature?: PermitRequirementSignature;
25
25
  };
26
26
  metadata?: Metadata;
27
27
  }
@@ -51,7 +51,7 @@ export interface VaultV1MigrateToV2Params {
51
51
  * for the deposit leg).
52
52
  * @param params.args.recipient - Address that receives the V2 vault shares.
53
53
  * @param params.args.requirementSignature - Optional pre-signed permit/permit2 for the V1 share
54
- * transfer. When absent, the bundle falls back to a plain `erc20TransferFrom`.
54
+ * transfer.
55
55
  * @param params.metadata - Optional analytics metadata attached to the bundle.
56
56
  * @returns A deep-frozen `Transaction<VaultV1MigrateToV2Action>` with `to`, `value`, `data`, and
57
57
  * the typed `action` discriminator the simulation layer consumes.
@@ -59,11 +59,11 @@ export interface VaultV1MigrateToV2Params {
59
59
  * @throws {NonPositiveSharesAmountError} when `shares <= 0n`.
60
60
  * @throws {NegativeMinSharePriceError} when `minSharePriceVaultV1 < 0n`.
61
61
  * @throws {NonPositiveMaxSharePriceError} when `maxSharePriceVaultV2 <= 0n`.
62
- * @throws {DepositAssetMismatchError} from `getRequirementsAction` when `requirementSignature`
62
+ * @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `requirementSignature`
63
63
  * is provided and the signed asset differs from `vault.address` (the V1 share token).
64
- * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
64
+ * @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `requirementSignature`
65
65
  * is provided and the signed amount differs from `args.shares`.
66
- * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
66
+ * @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when a Permit2 requirement
67
67
  * signature is missing its expiration.
68
68
  * @example
69
69
  * ```ts
@@ -4,7 +4,7 @@ import { isAddressEqual, maxUint256 } from "viem";
4
4
  import { BundlerAction } from "../../bundler/index.js";
5
5
  import { addTransactionMetadata } from "../../helpers/index.js";
6
6
  import { NegativeMinSharePriceError, NonPositiveMaxSharePriceError, NonPositiveSharesAmountError, VaultAssetMismatchError, } from "../../types/index.js";
7
- import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
7
+ import { getTokenRequirementActions } from "../signatures/getTokenRequirementActions.js";
8
8
  /**
9
9
  * Prepares an atomic full-migration transaction from VaultV1 to VaultV2.
10
10
  *
@@ -31,7 +31,7 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
31
31
  * for the deposit leg).
32
32
  * @param params.args.recipient - Address that receives the V2 vault shares.
33
33
  * @param params.args.requirementSignature - Optional pre-signed permit/permit2 for the V1 share
34
- * transfer. When absent, the bundle falls back to a plain `erc20TransferFrom`.
34
+ * transfer.
35
35
  * @param params.metadata - Optional analytics metadata attached to the bundle.
36
36
  * @returns A deep-frozen `Transaction<VaultV1MigrateToV2Action>` with `to`, `value`, `data`, and
37
37
  * the typed `action` discriminator the simulation layer consumes.
@@ -39,11 +39,11 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
39
39
  * @throws {NonPositiveSharesAmountError} when `shares <= 0n`.
40
40
  * @throws {NegativeMinSharePriceError} when `minSharePriceVaultV1 < 0n`.
41
41
  * @throws {NonPositiveMaxSharePriceError} when `maxSharePriceVaultV2 <= 0n`.
42
- * @throws {DepositAssetMismatchError} from `getRequirementsAction` when `requirementSignature`
42
+ * @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `requirementSignature`
43
43
  * is provided and the signed asset differs from `vault.address` (the V1 share token).
44
- * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
44
+ * @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `requirementSignature`
45
45
  * is provided and the signed amount differs from `args.shares`.
46
- * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
46
+ * @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when a Permit2 requirement
47
47
  * signature is missing its expiration.
48
48
  * @example
49
49
  * ```ts
@@ -82,21 +82,13 @@ export const vaultV1MigrateToV2 = ({ vault: { chainId, address: sourceVault, ass
82
82
  const actions = [];
83
83
  // Transfer V1 shares from user to GA1.
84
84
  // With a signature: permit/permit2 + transferFrom for the signed amount.
85
- // Without: plain erc20TransferFrom for the specified shares amount.
86
- if (requirementSignature) {
87
- actions.push(...getRequirementsAction({
88
- asset: sourceVault,
89
- amount: shares,
90
- recipient: generalAdapter1,
91
- requirementSignature,
92
- }));
93
- }
94
- else {
95
- actions.push({
96
- type: "erc20TransferFrom",
97
- args: [sourceVault, shares, generalAdapter1, false /* skipRevert */],
98
- });
99
- }
85
+ // Without a signature: use ERC-20 transferFrom for the specified shares amount.
86
+ actions.push(...getTokenRequirementActions({
87
+ asset: sourceVault,
88
+ amount: shares,
89
+ recipient: generalAdapter1,
90
+ requirementSignature,
91
+ }));
100
92
  // GA1 redeems its own shares (owner = GA1, no allowance check).
101
93
  actions.push({
102
94
  type: "erc4626Redeem",
@@ -1,5 +1,5 @@
1
1
  import { type Address } from "viem";
2
- import { type DepositAmountArgs, type Metadata, type RequirementSignature, type Transaction, type VaultV2DepositAction } from "../../types/index.js";
2
+ import { type DepositAmountArgs, type Metadata, type PermitRequirementSignature, type Transaction, type VaultV2DepositAction } from "../../types/index.js";
3
3
  /** Parameters for {@link vaultV2Deposit}. */
4
4
  export interface VaultV2DepositParams {
5
5
  vault: {
@@ -10,7 +10,7 @@ export interface VaultV2DepositParams {
10
10
  args: DepositAmountArgs & {
11
11
  maxSharePrice: bigint;
12
12
  recipient: Address;
13
- requirementSignature?: RequirementSignature;
13
+ requirementSignature?: PermitRequirementSignature;
14
14
  };
15
15
  metadata?: Metadata;
16
16
  }
@@ -33,9 +33,7 @@ export interface VaultV2DepositParams {
33
33
  * @param params.args.maxSharePrice - Maximum acceptable share price (in RAY, slippage
34
34
  * protection enforced on-chain by `GeneralAdapter1`).
35
35
  * @param params.args.recipient - Address that receives the minted vault shares.
36
- * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval. When
37
- * absent, the bundle uses a plain `erc20TransferFrom` and assumes the user has already
38
- * approved `GeneralAdapter1`.
36
+ * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval.
39
37
  * @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
40
38
  * deposit. Requires the vault asset to be the chain's wNative.
41
39
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -48,12 +46,12 @@ export interface VaultV2DepositParams {
48
46
  * configured wNative.
49
47
  * @throws {NativeAmountOnNonWNativeVaultError} when `nativeAmount` is provided but the vault
50
48
  * asset is not the chain's wNative.
51
- * @throws {DepositAssetMismatchError} from `getRequirementsAction` when `amount > 0n` and
49
+ * @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
52
50
  * `requirementSignature` is provided and the signed asset differs from `vault.asset`. The
53
51
  * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
54
- * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
52
+ * @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
55
53
  * `requirementSignature` is provided and the signed amount differs from `args.amount`.
56
- * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
54
+ * @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when `amount > 0n` and a
57
55
  * Permit2 requirement signature is missing its expiration.
58
56
  * @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
59
57
  * @example
@@ -4,7 +4,7 @@ import { isAddressEqual } from "viem";
4
4
  import { BundlerAction } from "../../bundler/index.js";
5
5
  import { addTransactionMetadata } from "../../helpers/index.js";
6
6
  import { ChainWNativeMissingError, NativeAmountOnNonWNativeVaultError, NegativeNativeAmountError, NonPositiveAssetAmountError, NonPositiveMaxSharePriceError, ZeroDepositAmountError, } from "../../types/index.js";
7
- import { getRequirementsAction } from "../requirements/getRequirementsAction.js";
7
+ import { getTokenRequirementActions } from "../signatures/getTokenRequirementActions.js";
8
8
  /**
9
9
  * Prepares a deposit transaction for a VaultV2 contract.
10
10
  *
@@ -24,9 +24,7 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
24
24
  * @param params.args.maxSharePrice - Maximum acceptable share price (in RAY, slippage
25
25
  * protection enforced on-chain by `GeneralAdapter1`).
26
26
  * @param params.args.recipient - Address that receives the minted vault shares.
27
- * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval. When
28
- * absent, the bundle uses a plain `erc20TransferFrom` and assumes the user has already
29
- * approved `GeneralAdapter1`.
27
+ * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval.
30
28
  * @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
31
29
  * deposit. Requires the vault asset to be the chain's wNative.
32
30
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -39,12 +37,12 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
39
37
  * configured wNative.
40
38
  * @throws {NativeAmountOnNonWNativeVaultError} when `nativeAmount` is provided but the vault
41
39
  * asset is not the chain's wNative.
42
- * @throws {DepositAssetMismatchError} from `getRequirementsAction` when `amount > 0n` and
40
+ * @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
43
41
  * `requirementSignature` is provided and the signed asset differs from `vault.asset`. The
44
42
  * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
45
- * @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
43
+ * @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
46
44
  * `requirementSignature` is provided and the signed amount differs from `args.amount`.
47
- * @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
45
+ * @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when `amount > 0n` and a
48
46
  * Permit2 requirement signature is missing its expiration.
49
47
  * @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
50
48
  * @example
@@ -92,20 +90,12 @@ export const vaultV2Deposit = ({ vault: { chainId, address: vaultAddress, asset
92
90
  });
93
91
  }
94
92
  if (amount > 0n) {
95
- if (requirementSignature) {
96
- actions.push(...getRequirementsAction({
97
- asset,
98
- amount,
99
- recipient: generalAdapter1,
100
- requirementSignature,
101
- }));
102
- }
103
- else {
104
- actions.push({
105
- type: "erc20TransferFrom",
106
- args: [asset, amount, generalAdapter1, false /* skipRevert */],
107
- });
108
- }
93
+ actions.push(...getTokenRequirementActions({
94
+ asset,
95
+ amount,
96
+ recipient: generalAdapter1,
97
+ requirementSignature,
98
+ }));
109
99
  }
110
100
  const totalAssets = amount + (nativeAmount ?? 0n);
111
101
  if (totalAssets === 0n) {
@@ -1,2 +1,2 @@
1
- export type { AddressLabel, ChainAddresses, ChainDeployments, } from "@morpho-org/blue-sdk";
2
- export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
1
+ export type { AddressLabel, AddressRegistry, ChainAddresses, ChainDeployments, DeploymentRegistry, } from "@morpho-org/blue-sdk";
2
+ export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
@@ -1 +1 @@
1
- export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
1
+ export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
@@ -1,6 +1,6 @@
1
1
  import { type InputMarketParams } from "@morpho-org/blue-sdk";
2
- import { type Address, type Hex } from "viem";
3
- import type { Action, InputReallocation, Permit2PermitSingle } from "./types.js";
2
+ import { type Address, type Hex, type Signature } from "viem";
3
+ import type { Action, Authorization, InputReallocation, Permit2PermitSingle } from "./types.js";
4
4
  /**
5
5
  * Encoded low-level call consumed by Bundler3's `multicall`.
6
6
  */
@@ -211,7 +211,7 @@ export declare namespace BundlerAction {
211
211
  * );
212
212
  * ```
213
213
  */
214
- function permit(chainId: number, owner: Address, asset: Address, amount: bigint, deadline: bigint, signature: Hex, skipRevert?: boolean): BundlerCall[];
214
+ function permit(chainId: number, owner: Address, asset: Address, amount: bigint, deadline: bigint, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
215
215
  /**
216
216
  * Encodes a Permit2 approval for GeneralAdapter1 spending.
217
217
  *
@@ -248,7 +248,7 @@ export declare namespace BundlerAction {
248
248
  * );
249
249
  * ```
250
250
  */
251
- function approve2(chainId: number, owner: Address, permitSingle: Permit2PermitSingle, signature: Hex, skipRevert?: boolean): BundlerCall[];
251
+ function approve2(chainId: number, owner: Address, permitSingle: Permit2PermitSingle, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
252
252
  /**
253
253
  * Encodes a GeneralAdapter1 Permit2 transfer.
254
254
  *
@@ -334,6 +334,46 @@ export declare namespace BundlerAction {
334
334
  * ```
335
335
  */
336
336
  function erc4626Redeem(chainId: number, erc4626: Address, shares: bigint, minSharePrice: bigint, receiver: Address, owner: Address, skipRevert?: boolean): BundlerCall[];
337
+ /**
338
+ * Encodes a Morpho Blue `setAuthorizationWithSig` call that submits a signed authorization.
339
+ *
340
+ * Lets a bundle grant `authorization.authorized` (GeneralAdapter1) operator rights on Morpho
341
+ * on behalf of `authorization.authorizer` without a separate `setAuthorization` transaction.
342
+ *
343
+ * @param chainId - Chain where the action will execute.
344
+ * @param authorization - The Morpho authorization payload covered by the signature.
345
+ * @param signature - The owner's EIP-712 signature over the authorization typed data, as a hex
346
+ * string or a viem `Signature` object.
347
+ * @param skipRevert - Whether Bundler3 should tolerate a revert. Defaults to `true`, matching
348
+ * the convention for already-authorized accounts (the call reverts harmlessly).
349
+ * @returns Encoded Bundler3 calls.
350
+ * @throws {BundlerErrors.UnexpectedSignature} when `authorization.authorized` is not the chain's
351
+ * `GeneralAdapter1` — the only operator this bundled path may grant rights to.
352
+ *
353
+ * @example
354
+ * ```ts
355
+ * import { getChainAddresses } from "@morpho-org/blue-sdk";
356
+ * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
357
+ *
358
+ * const { generalAdapter1 } = getChainAddresses(1).bundler3;
359
+ * const owner = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
360
+ * const signature =
361
+ * "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221b";
362
+ *
363
+ * const calls = BundlerAction.morphoSetAuthorizationWithSig(
364
+ * 1,
365
+ * {
366
+ * authorizer: owner,
367
+ * authorized: generalAdapter1,
368
+ * isAuthorized: true,
369
+ * nonce: 0n,
370
+ * deadline: 1_900_000_000n,
371
+ * },
372
+ * signature,
373
+ * );
374
+ * ```
375
+ */
376
+ function morphoSetAuthorizationWithSig(chainId: number, authorization: Authorization, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
337
377
  /**
338
378
  * Encodes a GeneralAdapter1 Morpho Blue supply-collateral call.
339
379
  *