@morpho-org/morpho-sdk 4.1.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +12 -12
  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/refinance.d.ts +13 -3
  5. package/lib/cjs/actions/blue/refinance.js +8 -2
  6. package/lib/cjs/actions/blue/repay.d.ts +6 -5
  7. package/lib/cjs/actions/blue/repay.js +10 -18
  8. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +15 -6
  9. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +16 -18
  10. package/lib/cjs/actions/blue/supply.d.ts +7 -7
  11. package/lib/cjs/actions/blue/supply.js +10 -20
  12. package/lib/cjs/actions/blue/supplyCollateral.d.ts +8 -8
  13. package/lib/cjs/actions/blue/supplyCollateral.js +11 -21
  14. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +18 -6
  15. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +17 -19
  16. package/lib/cjs/actions/blue/withdraw.d.ts +10 -2
  17. package/lib/cjs/actions/blue/withdraw.js +7 -1
  18. package/lib/cjs/actions/index.d.ts +1 -0
  19. package/lib/cjs/actions/index.js +1 -0
  20. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +49 -0
  21. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +111 -0
  22. package/lib/cjs/actions/requirements/blue/index.d.ts +1 -0
  23. package/lib/cjs/actions/requirements/blue/index.js +17 -0
  24. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +55 -0
  25. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +89 -0
  26. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +6 -5
  27. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +17 -5
  28. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +9 -7
  29. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +18 -4
  30. package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2.d.ts → encodeErc20Permit2Approve.d.ts} +11 -13
  31. package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2.js → encodeErc20Permit2Approve.js} +10 -14
  32. package/lib/cjs/actions/requirements/encode/index.d.ts +2 -1
  33. package/lib/cjs/actions/requirements/encode/index.js +2 -1
  34. package/lib/cjs/actions/requirements/{getRequirements.d.ts → generalAdapter/getGeneralAdapterRequirements.d.ts} +34 -20
  35. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +151 -0
  36. package/lib/{esm/actions/requirements/getRequirementsPermit.d.ts → cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts} +6 -14
  37. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +50 -0
  38. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +57 -0
  39. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +74 -0
  40. package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +3 -0
  41. package/lib/cjs/actions/requirements/generalAdapter/index.js +19 -0
  42. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +3 -2
  43. package/lib/cjs/actions/requirements/getRequirementsApproval.js +3 -2
  44. package/lib/cjs/actions/requirements/index.d.ts +2 -5
  45. package/lib/cjs/actions/requirements/index.js +2 -5
  46. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +29 -0
  47. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +48 -0
  48. package/lib/{esm/actions/requirements/getRequirementsAction.d.ts → cjs/actions/signatures/getTokenRequirementActions.d.ts} +17 -17
  49. package/lib/cjs/actions/{requirements/getRequirementsAction.js → signatures/getTokenRequirementActions.js} +26 -13
  50. package/lib/cjs/actions/signatures/index.d.ts +2 -0
  51. package/lib/cjs/actions/signatures/index.js +18 -0
  52. package/lib/cjs/actions/vaultV1/deposit.d.ts +6 -8
  53. package/lib/cjs/actions/vaultV1/deposit.js +11 -21
  54. package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +6 -6
  55. package/lib/cjs/actions/vaultV1/migrateToV2.js +12 -20
  56. package/lib/cjs/actions/vaultV2/deposit.d.ts +6 -8
  57. package/lib/cjs/actions/vaultV2/deposit.js +11 -21
  58. package/lib/cjs/addresses.d.ts +2 -2
  59. package/lib/cjs/addresses.js +2 -1
  60. package/lib/cjs/bundler/actions.d.ts +44 -4
  61. package/lib/cjs/bundler/actions.js +75 -2
  62. package/lib/cjs/bundler/types.d.ts +6 -0
  63. package/lib/cjs/constants.d.ts +2 -2
  64. package/lib/cjs/constants.js +3 -3
  65. package/lib/cjs/entities/blue/blue.d.ts +58 -33
  66. package/lib/cjs/entities/blue/blue.js +171 -125
  67. package/lib/cjs/entities/reallocationData.d.ts +12 -12
  68. package/lib/cjs/entities/reallocationData.js +19 -19
  69. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -9
  70. package/lib/cjs/entities/vaultV1/vaultV1.js +44 -34
  71. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +6 -6
  72. package/lib/cjs/entities/vaultV2/vaultV2.js +21 -16
  73. package/lib/cjs/errors.d.ts +3 -2
  74. package/lib/cjs/errors.js +5 -2
  75. package/lib/cjs/helpers/validate.d.ts +2 -2
  76. package/lib/cjs/helpers/validate.js +1 -1
  77. package/lib/cjs/types/action.d.ts +113 -9
  78. package/lib/cjs/types/action.js +79 -5
  79. package/lib/cjs/types/error.d.ts +73 -0
  80. package/lib/cjs/types/error.js +89 -4
  81. package/lib/cjs/types.d.ts +2 -1
  82. package/lib/cjs/utils.d.ts +1 -1
  83. package/lib/cjs/utils.js +2 -3
  84. package/lib/esm/actions/blue/borrow.d.ts +12 -2
  85. package/lib/esm/actions/blue/borrow.js +7 -1
  86. package/lib/esm/actions/blue/refinance.d.ts +13 -3
  87. package/lib/esm/actions/blue/refinance.js +8 -2
  88. package/lib/esm/actions/blue/repay.d.ts +6 -5
  89. package/lib/esm/actions/blue/repay.js +10 -18
  90. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +15 -6
  91. package/lib/esm/actions/blue/repayWithdrawCollateral.js +16 -18
  92. package/lib/esm/actions/blue/supply.d.ts +7 -7
  93. package/lib/esm/actions/blue/supply.js +10 -20
  94. package/lib/esm/actions/blue/supplyCollateral.d.ts +8 -8
  95. package/lib/esm/actions/blue/supplyCollateral.js +11 -21
  96. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +18 -6
  97. package/lib/esm/actions/blue/supplyCollateralBorrow.js +17 -19
  98. package/lib/esm/actions/blue/withdraw.d.ts +10 -2
  99. package/lib/esm/actions/blue/withdraw.js +7 -1
  100. package/lib/esm/actions/index.d.ts +1 -0
  101. package/lib/esm/actions/index.js +1 -0
  102. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +49 -0
  103. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +107 -0
  104. package/lib/esm/actions/requirements/blue/index.d.ts +1 -0
  105. package/lib/esm/actions/requirements/blue/index.js +1 -0
  106. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +55 -0
  107. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +85 -0
  108. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +6 -5
  109. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +19 -7
  110. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +9 -7
  111. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +20 -6
  112. package/lib/esm/actions/requirements/encode/{encodeErc20Permit2.d.ts → encodeErc20Permit2Approve.d.ts} +11 -13
  113. package/lib/esm/actions/requirements/encode/{encodeErc20Permit2.js → encodeErc20Permit2Approve.js} +8 -12
  114. package/lib/esm/actions/requirements/encode/index.d.ts +2 -1
  115. package/lib/esm/actions/requirements/encode/index.js +2 -1
  116. package/lib/esm/actions/requirements/{getRequirements.d.ts → generalAdapter/getGeneralAdapterRequirements.d.ts} +34 -20
  117. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +147 -0
  118. package/lib/{cjs/actions/requirements/getRequirementsPermit.d.ts → esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts} +6 -14
  119. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +46 -0
  120. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +57 -0
  121. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +70 -0
  122. package/lib/esm/actions/requirements/generalAdapter/index.d.ts +3 -0
  123. package/lib/esm/actions/requirements/generalAdapter/index.js +3 -0
  124. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +3 -2
  125. package/lib/esm/actions/requirements/getRequirementsApproval.js +3 -2
  126. package/lib/esm/actions/requirements/index.d.ts +2 -5
  127. package/lib/esm/actions/requirements/index.js +2 -5
  128. package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +29 -0
  129. package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +44 -0
  130. package/lib/{cjs/actions/requirements/getRequirementsAction.d.ts → esm/actions/signatures/getTokenRequirementActions.d.ts} +17 -17
  131. package/lib/esm/actions/{requirements/getRequirementsAction.js → signatures/getTokenRequirementActions.js} +24 -11
  132. package/lib/esm/actions/signatures/index.d.ts +2 -0
  133. package/lib/esm/actions/signatures/index.js +2 -0
  134. package/lib/esm/actions/vaultV1/deposit.d.ts +6 -8
  135. package/lib/esm/actions/vaultV1/deposit.js +11 -21
  136. package/lib/esm/actions/vaultV1/migrateToV2.d.ts +6 -6
  137. package/lib/esm/actions/vaultV1/migrateToV2.js +12 -20
  138. package/lib/esm/actions/vaultV2/deposit.d.ts +6 -8
  139. package/lib/esm/actions/vaultV2/deposit.js +11 -21
  140. package/lib/esm/addresses.d.ts +2 -2
  141. package/lib/esm/addresses.js +1 -1
  142. package/lib/esm/bundler/actions.d.ts +44 -4
  143. package/lib/esm/bundler/actions.js +77 -4
  144. package/lib/esm/bundler/types.d.ts +6 -0
  145. package/lib/esm/constants.d.ts +2 -2
  146. package/lib/esm/constants.js +2 -2
  147. package/lib/esm/entities/blue/blue.d.ts +58 -33
  148. package/lib/esm/entities/blue/blue.js +173 -127
  149. package/lib/esm/entities/reallocationData.d.ts +12 -12
  150. package/lib/esm/entities/reallocationData.js +18 -18
  151. package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -9
  152. package/lib/esm/entities/vaultV1/vaultV1.js +46 -36
  153. package/lib/esm/entities/vaultV2/vaultV2.d.ts +6 -6
  154. package/lib/esm/entities/vaultV2/vaultV2.js +23 -18
  155. package/lib/esm/errors.d.ts +3 -2
  156. package/lib/esm/errors.js +2 -1
  157. package/lib/esm/helpers/validate.d.ts +2 -2
  158. package/lib/esm/helpers/validate.js +1 -1
  159. package/lib/esm/types/action.d.ts +113 -9
  160. package/lib/esm/types/action.js +75 -4
  161. package/lib/esm/types/error.d.ts +73 -0
  162. package/lib/esm/types/error.js +84 -2
  163. package/lib/esm/types.d.ts +2 -1
  164. package/lib/esm/utils.d.ts +1 -1
  165. package/lib/esm/utils.js +1 -1
  166. package/package.json +6 -6
  167. package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.d.ts +0 -37
  168. package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.js +0 -71
  169. package/lib/cjs/actions/requirements/getRequirements.js +0 -112
  170. package/lib/cjs/actions/requirements/getRequirementsPermit.js +0 -57
  171. package/lib/cjs/actions/requirements/getRequirementsPermit2.d.ts +0 -63
  172. package/lib/cjs/actions/requirements/getRequirementsPermit2.js +0 -85
  173. package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.d.ts +0 -37
  174. package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.js +0 -67
  175. package/lib/esm/actions/requirements/getRequirements.js +0 -108
  176. package/lib/esm/actions/requirements/getRequirementsPermit.js +0 -53
  177. package/lib/esm/actions/requirements/getRequirementsPermit2.d.ts +0 -63
  178. package/lib/esm/actions/requirements/getRequirementsPermit2.js +0 -81
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGeneralAdapterRequirementsPermit = void 0;
4
+ const blue_sdk_1 = require("@morpho-org/blue-sdk");
5
+ const index_js_1 = require("../encode/index.js");
6
+ /**
7
+ * Computes the EIP-2612 permit `Requirement` an integrator must sign so that `GeneralAdapter1`
8
+ * can pull `amount` of `token`.
9
+ *
10
+ * @param viemClient - Connected viem `Client` (used by the returned `Requirement.sign()`).
11
+ * @param params.token - ERC-20 token address (must support EIP-2612).
12
+ * @param params.chainId - The chain the bundle targets.
13
+ * @param params.args.amount - Required token amount.
14
+ * @param params.nonce - The user's current EIP-2612 nonce on `token`.
15
+ * @param params.supportDeployless - Whether to fetch token metadata via deployless multicall.
16
+ * @returns A single-element array containing the exact-amount `Requirement` to sign.
17
+ * @example
18
+ * ```ts
19
+ * import { createWalletClient, http } from "viem";
20
+ * import { mainnet } from "viem/chains";
21
+ * import { getGeneralAdapterRequirementsPermit } from "@morpho-org/morpho-sdk";
22
+ *
23
+ * const client = createWalletClient({ chain: mainnet, transport: http() });
24
+ * const reqs = await getGeneralAdapterRequirementsPermit(client, {
25
+ * token: USDC, // an ERC-2612-compatible token; DAI is excluded by getGeneralAdapterRequirements
26
+ * chainId: 1,
27
+ * args: { amount: 1_000_000n },
28
+ * nonce: 0n,
29
+ * });
30
+ * // reqs satisfies Requirement[]
31
+ * ```
32
+ */
33
+ const getGeneralAdapterRequirementsPermit = async (viemClient, params) => {
34
+ const { token, chainId, args: { amount }, nonce, supportDeployless, } = params;
35
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
36
+ // Existing direct ERC-20 allowance is intentionally not an input here. ERC-2612 overwrites the
37
+ // allowance with the signed amount, and the bundle spends exactly `amount`, leaving no residual
38
+ // allowance after inclusion.
39
+ return [
40
+ await (0, index_js_1.encodeErc20Permit)(viemClient, {
41
+ token,
42
+ spender: generalAdapter1,
43
+ amount,
44
+ chainId,
45
+ nonce,
46
+ supportDeployless,
47
+ }),
48
+ ];
49
+ };
50
+ exports.getGeneralAdapterRequirementsPermit = getGeneralAdapterRequirementsPermit;
@@ -0,0 +1,57 @@
1
+ import { type Address } from "@morpho-org/blue-sdk";
2
+ import type { Bundler3TokenSignatureRequirement, ERC20ApprovalAction, Transaction } from "../../../types/index.js";
3
+ interface GeneralAdapterPermit2Erc20Allowances {
4
+ readonly permit2: bigint;
5
+ }
6
+ /**
7
+ * Computes the Permit2 prerequisites for `GeneralAdapter1` to pull `amount` of `address`.
8
+ *
9
+ * Emits two ordered prerequisites:
10
+ *
11
+ * 1. A classic ERC-20 approval to the Permit2 contract (infinite, if not already in place).
12
+ * 2. A Permit2 `Requirement` signed against `GeneralAdapter1`.
13
+ *
14
+ * The Permit2 signature is always requested for the exact transfer amount when this path is
15
+ * selected. Permit2 allowance signatures overwrite the existing allowance, so relying on
16
+ * residual Permit2-managed allowance would make the final transfer path depend on stale state and
17
+ * could leave allowance behind after a partial spend.
18
+ *
19
+ * @param params.address - ERC-20 token address.
20
+ * @param params.chainId - The chain the bundle targets.
21
+ * @param params.permit2 - The Permit2 contract address for the chain.
22
+ * @param params.args.amount - Required token amount.
23
+ * @param params.erc20Allowances - Current ERC-20 allowances keyed by spender contract name.
24
+ * @param params.permit2Nonce - Current Permit2 nonce for the token owner / token / GeneralAdapter1 tuple.
25
+ * @returns Ordered list of approval transactions and/or `Requirement` objects to satisfy before
26
+ * bundling.
27
+ * @throws {ApprovalAmountLessThanSpendAmountError} from the inner approval helper when its
28
+ * bookkeeping invariants break (should not happen with the values this function passes).
29
+ * @example
30
+ * ```ts
31
+ * import { getChainAddresses } from "@morpho-org/blue-sdk";
32
+ * import { getGeneralAdapterRequirementsPermit2 } from "@morpho-org/morpho-sdk";
33
+ *
34
+ * const { permit2 } = getChainAddresses(1);
35
+ * if (!permit2) throw new Error("Permit2 not configured for this chain");
36
+ * const requirements = getGeneralAdapterRequirementsPermit2({
37
+ * address: USDC,
38
+ * chainId: 1,
39
+ * permit2,
40
+ * args: { amount: 1_000_000n },
41
+ * erc20Allowances: { permit2: 0n },
42
+ * permit2Nonce: 0n,
43
+ * });
44
+ * // requirements satisfies (Readonly<Transaction<ERC20ApprovalAction> | Bundler3TokenSignatureRequirement>)[]
45
+ * ```
46
+ */
47
+ export declare const getGeneralAdapterRequirementsPermit2: (params: {
48
+ address: Address;
49
+ chainId: number;
50
+ permit2: Address;
51
+ args: {
52
+ amount: bigint;
53
+ };
54
+ erc20Allowances: GeneralAdapterPermit2Erc20Allowances;
55
+ permit2Nonce: bigint;
56
+ }) => Readonly<Transaction<ERC20ApprovalAction> | Bundler3TokenSignatureRequirement>[];
57
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGeneralAdapterRequirementsPermit2 = void 0;
4
+ const blue_sdk_1 = require("@morpho-org/blue-sdk");
5
+ const encodeErc20Permit2Approve_js_1 = require("../encode/encodeErc20Permit2Approve.js");
6
+ const getRequirementsApproval_js_1 = require("../getRequirementsApproval.js");
7
+ /**
8
+ * Computes the Permit2 prerequisites for `GeneralAdapter1` to pull `amount` of `address`.
9
+ *
10
+ * Emits two ordered prerequisites:
11
+ *
12
+ * 1. A classic ERC-20 approval to the Permit2 contract (infinite, if not already in place).
13
+ * 2. A Permit2 `Requirement` signed against `GeneralAdapter1`.
14
+ *
15
+ * The Permit2 signature is always requested for the exact transfer amount when this path is
16
+ * selected. Permit2 allowance signatures overwrite the existing allowance, so relying on
17
+ * residual Permit2-managed allowance would make the final transfer path depend on stale state and
18
+ * could leave allowance behind after a partial spend.
19
+ *
20
+ * @param params.address - ERC-20 token address.
21
+ * @param params.chainId - The chain the bundle targets.
22
+ * @param params.permit2 - The Permit2 contract address for the chain.
23
+ * @param params.args.amount - Required token amount.
24
+ * @param params.erc20Allowances - Current ERC-20 allowances keyed by spender contract name.
25
+ * @param params.permit2Nonce - Current Permit2 nonce for the token owner / token / GeneralAdapter1 tuple.
26
+ * @returns Ordered list of approval transactions and/or `Requirement` objects to satisfy before
27
+ * bundling.
28
+ * @throws {ApprovalAmountLessThanSpendAmountError} from the inner approval helper when its
29
+ * bookkeeping invariants break (should not happen with the values this function passes).
30
+ * @example
31
+ * ```ts
32
+ * import { getChainAddresses } from "@morpho-org/blue-sdk";
33
+ * import { getGeneralAdapterRequirementsPermit2 } from "@morpho-org/morpho-sdk";
34
+ *
35
+ * const { permit2 } = getChainAddresses(1);
36
+ * if (!permit2) throw new Error("Permit2 not configured for this chain");
37
+ * const requirements = getGeneralAdapterRequirementsPermit2({
38
+ * address: USDC,
39
+ * chainId: 1,
40
+ * permit2,
41
+ * args: { amount: 1_000_000n },
42
+ * erc20Allowances: { permit2: 0n },
43
+ * permit2Nonce: 0n,
44
+ * });
45
+ * // requirements satisfies (Readonly<Transaction<ERC20ApprovalAction> | Bundler3TokenSignatureRequirement>)[]
46
+ * ```
47
+ */
48
+ const getGeneralAdapterRequirementsPermit2 = (params) => {
49
+ const { address, chainId, permit2, args: { amount }, erc20Allowances, permit2Nonce, } = params;
50
+ const requirements = [];
51
+ const approvalRequirements = (0, getRequirementsApproval_js_1.getRequirementsApproval)({
52
+ address,
53
+ chainId,
54
+ args: {
55
+ approvalAmount: blue_sdk_1.MathLib.MAX_UINT_160, // Always approve infinite.
56
+ spendAmount: amount,
57
+ spender: permit2,
58
+ },
59
+ allowances: erc20Allowances.permit2,
60
+ });
61
+ requirements.push(...approvalRequirements);
62
+ // Existing Permit2-managed allowance is intentionally not checked for sufficiency. Permit2
63
+ // overwrites the allowance with this signed amount, and the bundle spends exactly `amount`,
64
+ // leaving no residual Permit2 allowance after inclusion.
65
+ requirements.push((0, encodeErc20Permit2Approve_js_1.encodeErc20Permit2Approve)({
66
+ token: address,
67
+ amount,
68
+ chainId,
69
+ nonce: permit2Nonce,
70
+ expiration: blue_sdk_1.MathLib.MAX_UINT_48, // Always approve indefinitely.
71
+ }));
72
+ return requirements;
73
+ };
74
+ exports.getGeneralAdapterRequirementsPermit2 = getGeneralAdapterRequirementsPermit2;
@@ -0,0 +1,3 @@
1
+ export * from "./getGeneralAdapterRequirements.js";
2
+ export * from "./getGeneralAdapterRequirementsPermit.js";
3
+ export * from "./getGeneralAdapterRequirementsPermit2.js";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getGeneralAdapterRequirements.js"), exports);
18
+ __exportStar(require("./getGeneralAdapterRequirementsPermit.js"), exports);
19
+ __exportStar(require("./getGeneralAdapterRequirementsPermit2.js"), exports);
@@ -1,7 +1,7 @@
1
1
  import type { Address } from "@morpho-org/blue-sdk";
2
2
  import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js";
3
3
  /**
4
- * Computes classic ERC-20 approval transactions for a spender, given the existing allowance.
4
+ * Computes classic ERC-20 approval transactions for GeneralAdapter1 or Permit2, given the existing allowance.
5
5
  *
6
6
  * Returns an empty array when the allowance already covers `spendAmount`. When the token is in
7
7
  * `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
@@ -13,11 +13,12 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
13
13
  * @param params.args.spendAmount - The amount the bundle will actually pull.
14
14
  * @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
15
15
  * may be `MAX_UINT_160` for Permit2 prerequisites).
16
- * @param params.args.spender - Address that will be granted the approval.
16
+ * @param params.args.spender - Address that will be granted the approval. Must be GeneralAdapter1 or Permit2.
17
17
  * @param params.allowances - The user's current allowance of `address` for `spender`.
18
18
  * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
19
19
  * followed by the new approval. Empty when no approval is needed.
20
20
  * @throws {ApprovalAmountLessThanSpendAmountError} when `approvalAmount < spendAmount`.
21
+ * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not GeneralAdapter1 or Permit2 for `chainId`.
21
22
  * @example
22
23
  * ```ts
23
24
  * import { getRequirementsApproval } from "@morpho-org/morpho-sdk";
@@ -5,7 +5,7 @@ const constant_js_1 = require("../../helpers/constant.js");
5
5
  const index_js_1 = require("../../types/index.js");
6
6
  const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
7
7
  /**
8
- * Computes classic ERC-20 approval transactions for a spender, given the existing allowance.
8
+ * Computes classic ERC-20 approval transactions for GeneralAdapter1 or Permit2, given the existing allowance.
9
9
  *
10
10
  * Returns an empty array when the allowance already covers `spendAmount`. When the token is in
11
11
  * `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
@@ -17,11 +17,12 @@ const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
17
17
  * @param params.args.spendAmount - The amount the bundle will actually pull.
18
18
  * @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
19
19
  * may be `MAX_UINT_160` for Permit2 prerequisites).
20
- * @param params.args.spender - Address that will be granted the approval.
20
+ * @param params.args.spender - Address that will be granted the approval. Must be GeneralAdapter1 or Permit2.
21
21
  * @param params.allowances - The user's current allowance of `address` for `spender`.
22
22
  * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
23
23
  * followed by the new approval. Empty when no approval is needed.
24
24
  * @throws {ApprovalAmountLessThanSpendAmountError} when `approvalAmount < spendAmount`.
25
+ * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not GeneralAdapter1 or Permit2 for `chainId`.
25
26
  * @example
26
27
  * ```ts
27
28
  * import { getRequirementsApproval } from "@morpho-org/morpho-sdk";
@@ -1,7 +1,4 @@
1
+ export * from "./blue/index.js";
1
2
  export * from "./encode/index.js";
2
- export * from "./getMorphoAuthorizationRequirement.js";
3
- export * from "./getRequirements.js";
4
- export * from "./getRequirementsAction.js";
3
+ export * from "./generalAdapter/index.js";
5
4
  export * from "./getRequirementsApproval.js";
6
- export * from "./getRequirementsPermit.js";
7
- export * from "./getRequirementsPermit2.js";
@@ -14,10 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./blue/index.js"), exports);
17
18
  __exportStar(require("./encode/index.js"), exports);
18
- __exportStar(require("./getMorphoAuthorizationRequirement.js"), exports);
19
- __exportStar(require("./getRequirements.js"), exports);
20
- __exportStar(require("./getRequirementsAction.js"), exports);
19
+ __exportStar(require("./generalAdapter/index.js"), exports);
21
20
  __exportStar(require("./getRequirementsApproval.js"), exports);
22
- __exportStar(require("./getRequirementsPermit.js"), exports);
23
- __exportStar(require("./getRequirementsPermit2.js"), exports);
@@ -0,0 +1,29 @@
1
+ import type { Action } from "../../bundler/index.js";
2
+ import { type AuthorizationRequirementSignature } from "../../types/index.js";
3
+ /**
4
+ * Encodes the bundler action that consumes a signed Morpho authorization, granting
5
+ * `authorized` (GeneralAdapter1) operator rights on behalf of the signer via
6
+ * `setAuthorizationWithSig` — replacing a standalone `setAuthorization` transaction.
7
+ *
8
+ * The signature's `authorized` is pinned to the chain's `GeneralAdapter1`: an authorization
9
+ * targeting any other account is rejected so the bundle can never hand operator rights over the
10
+ * user's Morpho position to an unintended address. The action is emitted with `skipRevert: false`
11
+ * so a rejected or stale authorization fails the whole bundle rather than letting a later
12
+ * on-behalf Morpho call revert opaquely.
13
+ *
14
+ * @param chainId - Chain whose `GeneralAdapter1` the signature must authorize.
15
+ * @param signature - The signed authorization produced by `Requirement.sign()`.
16
+ * @returns A single `morphoSetAuthorizationWithSig` bundler `Action`.
17
+ * @throws {BundlerErrors.UnexpectedSignature} when `signature.args.authorized` is not the chain's
18
+ * `GeneralAdapter1`.
19
+ * @example
20
+ * ```ts
21
+ * import { getBlueAuthorizationAction } from "@morpho-org/morpho-sdk";
22
+ *
23
+ * // `requirement` comes from `getBlueAuthorizationRequirement` with `supportSignature: true`.
24
+ * const signed = await requirement.sign(walletClient, borrower);
25
+ * const action = getBlueAuthorizationAction(1, signed);
26
+ * // action satisfies { type: "morphoSetAuthorizationWithSig"; args: [...] }
27
+ * ```
28
+ */
29
+ export declare const getBlueAuthorizationAction: (chainId: number, signature: AuthorizationRequirementSignature) => Action;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBlueAuthorizationAction = void 0;
4
+ const blue_sdk_1 = require("@morpho-org/blue-sdk");
5
+ const viem_1 = require("viem");
6
+ const index_js_1 = require("../../types/index.js");
7
+ /**
8
+ * Encodes the bundler action that consumes a signed Morpho authorization, granting
9
+ * `authorized` (GeneralAdapter1) operator rights on behalf of the signer via
10
+ * `setAuthorizationWithSig` — replacing a standalone `setAuthorization` transaction.
11
+ *
12
+ * The signature's `authorized` is pinned to the chain's `GeneralAdapter1`: an authorization
13
+ * targeting any other account is rejected so the bundle can never hand operator rights over the
14
+ * user's Morpho position to an unintended address. The action is emitted with `skipRevert: false`
15
+ * so a rejected or stale authorization fails the whole bundle rather than letting a later
16
+ * on-behalf Morpho call revert opaquely.
17
+ *
18
+ * @param chainId - Chain whose `GeneralAdapter1` the signature must authorize.
19
+ * @param signature - The signed authorization produced by `Requirement.sign()`.
20
+ * @returns A single `morphoSetAuthorizationWithSig` bundler `Action`.
21
+ * @throws {BundlerErrors.UnexpectedSignature} when `signature.args.authorized` is not the chain's
22
+ * `GeneralAdapter1`.
23
+ * @example
24
+ * ```ts
25
+ * import { getBlueAuthorizationAction } from "@morpho-org/morpho-sdk";
26
+ *
27
+ * // `requirement` comes from `getBlueAuthorizationRequirement` with `supportSignature: true`.
28
+ * const signed = await requirement.sign(walletClient, borrower);
29
+ * const action = getBlueAuthorizationAction(1, signed);
30
+ * // action satisfies { type: "morphoSetAuthorizationWithSig"; args: [...] }
31
+ * ```
32
+ */
33
+ const getBlueAuthorizationAction = (chainId, signature) => {
34
+ const { owner, authorized, isAuthorized, nonce, deadline } = signature.args;
35
+ const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
36
+ if (!(0, viem_1.isAddressEqual)(authorized, generalAdapter1)) {
37
+ throw new index_js_1.BundlerErrors.UnexpectedSignature(authorized);
38
+ }
39
+ return {
40
+ type: "morphoSetAuthorizationWithSig",
41
+ args: [
42
+ { authorizer: owner, authorized, isAuthorized, nonce, deadline },
43
+ signature.args.signature,
44
+ false /* skipRevert */,
45
+ ],
46
+ };
47
+ };
48
+ exports.getBlueAuthorizationAction = getBlueAuthorizationAction;
@@ -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,22 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRequirementsAction = void 0;
3
+ exports.getTokenRequirementActions = void 0;
4
4
  const viem_1 = require("viem");
5
5
  const index_js_1 = require("../../types/index.js");
6
6
  /**
7
- * Encodes the bundler actions that consume a pre-signed permit / permit2 requirement and pull
8
- * the asset to `recipient`.
7
+ * Encodes the bundler actions that pull the asset to `recipient`, optionally consuming a
8
+ * pre-signed permit / permit2 requirement first.
9
9
  *
10
10
  * Permit2 path emits `approve2` + `transferFrom2`; classic permit path emits `permit` +
11
- * `erc20TransferFrom`. The signed `asset` and `amount` must match the pulled `asset` and
12
- * `amount` exactly, otherwise the function throws so the caller does not silently spend a
13
- * wider-than-expected approval.
11
+ * `erc20TransferFrom`. When no signature is provided, the function emits a plain
12
+ * `erc20TransferFrom` against an existing ERC-20 allowance.
13
+ *
14
+ * The signed `asset` and `amount` must match the pulled `asset` and `amount` exactly, otherwise
15
+ * the function throws so the caller does not silently spend a wider-than-expected approval.
14
16
  *
15
17
  * @param params.asset - The ERC-20 to pull.
16
18
  * @param params.amount - The amount to pull, in the asset's smallest unit.
17
19
  * @param params.recipient - The address that receives the transfer.
18
- * @param params.requirementSignature - The signed permit / permit2 to apply before the transfer.
19
- * @returns A pair of bundler `Action`s: a permit / approve2 followed by the transfer.
20
+ * @param params.requirementSignature - Optional signed permit / permit2 to apply before the transfer.
21
+ * @returns Bundler `Action`s needed to pull the token.
20
22
  * @throws {DepositAssetMismatchError} when the signed asset differs from `asset`.
21
23
  * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
22
24
  * @throws {Permit2ExpirationMissingError} when `action.type === "permit2"` but `args.expiration` is missing.
@@ -24,7 +26,7 @@ const index_js_1 = require("../../types/index.js");
24
26
  * ```ts
25
27
  * import { createWalletClient, http } from "viem";
26
28
  * import { mainnet } from "viem/chains";
27
- * import { getRequirementsAction } from "@morpho-org/morpho-sdk";
29
+ * import { getTokenRequirementActions } from "@morpho-org/morpho-sdk";
28
30
  *
29
31
  * const walletClient = createWalletClient({
30
32
  * chain: mainnet,
@@ -32,10 +34,10 @@ const index_js_1 = require("../../types/index.js");
32
34
  * account: borrower,
33
35
  * });
34
36
  *
35
- * // `requirement` comes from `getRequirements*` helpers; signing produces a `RequirementSignature`.
37
+ * // `requirement` comes from a requirement helper; signing produces a `RequirementSignature`.
36
38
  * const requirementSignature = await requirement.sign(walletClient, borrower);
37
39
  *
38
- * const actions = getRequirementsAction({
40
+ * const actions = getTokenRequirementActions({
39
41
  * asset: loanToken,
40
42
  * amount: 1_000_000n,
41
43
  * recipient: generalAdapter1,
@@ -44,12 +46,23 @@ const index_js_1 = require("../../types/index.js");
44
46
  * // actions satisfies Action[]
45
47
  * // - permit2 path: [{ type: "approve2", ... }, { type: "transferFrom2", ... }]
46
48
  * // - classic permit path: [{ type: "permit", ... }, { type: "erc20TransferFrom", ... }]
49
+ * // - no signature: [{ type: "erc20TransferFrom", ... }]
47
50
  * ```
48
51
  */
49
- const getRequirementsAction = ({ asset, amount, recipient, requirementSignature, }) => {
52
+ const getTokenRequirementActions = ({ asset, amount, recipient, requirementSignature, }) => {
53
+ if (requirementSignature == null) {
54
+ return [
55
+ {
56
+ type: "erc20TransferFrom",
57
+ args: [asset, amount, recipient, false /* skipRevert */],
58
+ },
59
+ ];
60
+ }
50
61
  if (!(0, viem_1.isAddressEqual)(requirementSignature.args.asset, asset)) {
51
62
  throw new index_js_1.DepositAssetMismatchError(asset, requirementSignature.args.asset);
52
63
  }
64
+ // Permit2 and ERC-2612 overwrite the previous allowance with the signed amount.
65
+ // It must exactly cover the transfer: less would fail, more would leave residual allowance.
53
66
  if (requirementSignature.args.amount !== amount) {
54
67
  throw new index_js_1.DepositAmountMismatchError(amount, requirementSignature.args.amount);
55
68
  }
@@ -99,4 +112,4 @@ const getRequirementsAction = ({ asset, amount, recipient, requirementSignature,
99
112
  },
100
113
  ];
101
114
  };
102
- exports.getRequirementsAction = getRequirementsAction;
115
+ exports.getTokenRequirementActions = getTokenRequirementActions;
@@ -0,0 +1,2 @@
1
+ export * from "./getBlueAuthorizationAction.js";
2
+ export * from "./getTokenRequirementActions.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getBlueAuthorizationAction.js"), exports);
18
+ __exportStar(require("./getTokenRequirementActions.js"), exports);
@@ -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