@morpho-org/morpho-sdk 6.6.0 → 7.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 (153) hide show
  1. package/MIGRATION-v6-to-v7.md +291 -0
  2. package/README.md +26 -12
  3. package/lib/cjs/abis.d.ts +1 -1
  4. package/lib/cjs/abis.js +3 -2
  5. package/lib/cjs/actions/bundles/common.d.ts +9 -5
  6. package/lib/cjs/actions/bundles/common.js +22 -13
  7. package/lib/cjs/actions/midnight/authorization.d.ts +3 -2
  8. package/lib/cjs/actions/midnight/authorization.js +3 -2
  9. package/lib/cjs/actions/midnight/cancelAndMake.d.ts +153 -0
  10. package/lib/cjs/actions/midnight/cancelAndMake.js +292 -0
  11. package/lib/cjs/actions/midnight/index.d.ts +3 -3
  12. package/lib/cjs/actions/midnight/index.js +3 -3
  13. package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +40 -23
  14. package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +105 -69
  15. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +52 -27
  16. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +128 -71
  17. package/lib/cjs/actions/midnight/takeBorrow.d.ts +40 -28
  18. package/lib/cjs/actions/midnight/takeBorrow.js +95 -54
  19. package/lib/cjs/actions/midnight/takeLend.d.ts +51 -27
  20. package/lib/cjs/actions/midnight/takeLend.js +111 -54
  21. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +97 -0
  22. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +201 -0
  23. package/lib/cjs/actions/midnight/takeWithdraw.d.ts +69 -0
  24. package/lib/cjs/actions/midnight/takeWithdraw.js +153 -0
  25. package/lib/cjs/actions/midnight/types.d.ts +7 -26
  26. package/lib/cjs/actions/midnight/types.js +0 -13
  27. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
  28. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +3 -2
  29. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +4 -4
  30. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +5 -5
  31. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +2 -2
  32. package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -2
  33. package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +24 -8
  34. package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +24 -13
  35. package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -7
  36. package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +11 -7
  37. package/lib/cjs/actions/requirements/midnight/index.d.ts +0 -1
  38. package/lib/cjs/actions/requirements/midnight/index.js +0 -1
  39. package/lib/cjs/constants.d.ts +1 -1
  40. package/lib/cjs/constants.js +2 -1
  41. package/lib/cjs/entities/index.d.ts +2 -2
  42. package/lib/cjs/entities/midnight/midnight.d.ts +582 -108
  43. package/lib/cjs/entities/midnight/midnight.js +981 -509
  44. package/lib/cjs/entities/midnight/types.d.ts +142 -60
  45. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +2 -1
  46. package/lib/cjs/entities/vaultV1/vaultV1.js +1 -0
  47. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +2 -1
  48. package/lib/cjs/entities/vaultV2/vaultV2.js +1 -0
  49. package/lib/cjs/helpers/callback.d.ts +54 -0
  50. package/lib/cjs/helpers/callback.js +73 -0
  51. package/lib/cjs/helpers/constant.d.ts +2 -0
  52. package/lib/cjs/helpers/constant.js +3 -1
  53. package/lib/cjs/helpers/index.d.ts +3 -2
  54. package/lib/cjs/helpers/index.js +6 -1
  55. package/lib/cjs/helpers/signAndVerifyTypedData.d.ts +3 -3
  56. package/lib/cjs/helpers/signAndVerifyTypedData.js +3 -3
  57. package/lib/cjs/helpers/validate.d.ts +43 -2
  58. package/lib/cjs/helpers/validate.js +60 -3
  59. package/lib/cjs/helpers/validateMidnightAuthorizationTarget.d.ts +1 -1
  60. package/lib/cjs/helpers/validateMidnightAuthorizationTarget.js +3 -7
  61. package/lib/cjs/helpers/validateRequirementSpender.d.ts +3 -3
  62. package/lib/cjs/helpers/validateRequirementSpender.js +4 -5
  63. package/lib/cjs/midnight/abis.d.ts +1 -1
  64. package/lib/cjs/midnight/abis.js +3 -2
  65. package/lib/cjs/midnight/types.d.ts +1 -1
  66. package/lib/cjs/types/action.d.ts +117 -89
  67. package/lib/cjs/types/action.js +1 -19
  68. package/lib/cjs/types/error.d.ts +126 -40
  69. package/lib/cjs/types/error.js +154 -49
  70. package/lib/esm/abis.d.ts +1 -1
  71. package/lib/esm/abis.js +1 -1
  72. package/lib/esm/actions/bundles/common.d.ts +9 -5
  73. package/lib/esm/actions/bundles/common.js +22 -13
  74. package/lib/esm/actions/midnight/authorization.d.ts +3 -2
  75. package/lib/esm/actions/midnight/authorization.js +3 -2
  76. package/lib/esm/actions/midnight/cancelAndMake.d.ts +153 -0
  77. package/lib/esm/actions/midnight/cancelAndMake.js +288 -0
  78. package/lib/esm/actions/midnight/index.d.ts +3 -3
  79. package/lib/esm/actions/midnight/index.js +3 -3
  80. package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +40 -23
  81. package/lib/esm/actions/midnight/repayWithdrawCollateral.js +108 -72
  82. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +52 -27
  83. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +131 -74
  84. package/lib/esm/actions/midnight/takeBorrow.d.ts +40 -28
  85. package/lib/esm/actions/midnight/takeBorrow.js +98 -57
  86. package/lib/esm/actions/midnight/takeLend.d.ts +51 -27
  87. package/lib/esm/actions/midnight/takeLend.js +114 -57
  88. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +97 -0
  89. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +197 -0
  90. package/lib/esm/actions/midnight/takeWithdraw.d.ts +69 -0
  91. package/lib/esm/actions/midnight/takeWithdraw.js +149 -0
  92. package/lib/esm/actions/midnight/types.d.ts +7 -26
  93. package/lib/esm/actions/midnight/types.js +1 -12
  94. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
  95. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +3 -2
  96. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -4
  97. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +5 -5
  98. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +2 -2
  99. package/lib/esm/actions/requirements/getRequirementsApproval.js +2 -2
  100. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +24 -8
  101. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +25 -14
  102. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -7
  103. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +11 -7
  104. package/lib/esm/actions/requirements/midnight/index.d.ts +0 -1
  105. package/lib/esm/actions/requirements/midnight/index.js +0 -1
  106. package/lib/esm/constants.d.ts +1 -1
  107. package/lib/esm/constants.js +1 -1
  108. package/lib/esm/entities/index.d.ts +2 -2
  109. package/lib/esm/entities/midnight/midnight.d.ts +582 -108
  110. package/lib/esm/entities/midnight/midnight.js +987 -515
  111. package/lib/esm/entities/midnight/types.d.ts +142 -60
  112. package/lib/esm/entities/vaultV1/vaultV1.d.ts +2 -1
  113. package/lib/esm/entities/vaultV1/vaultV1.js +1 -0
  114. package/lib/esm/entities/vaultV2/vaultV2.d.ts +2 -1
  115. package/lib/esm/entities/vaultV2/vaultV2.js +1 -0
  116. package/lib/esm/helpers/callback.d.ts +54 -0
  117. package/lib/esm/helpers/callback.js +68 -0
  118. package/lib/esm/helpers/constant.d.ts +2 -0
  119. package/lib/esm/helpers/constant.js +2 -0
  120. package/lib/esm/helpers/index.d.ts +3 -2
  121. package/lib/esm/helpers/index.js +3 -2
  122. package/lib/esm/helpers/signAndVerifyTypedData.d.ts +3 -3
  123. package/lib/esm/helpers/signAndVerifyTypedData.js +3 -3
  124. package/lib/esm/helpers/validate.d.ts +43 -2
  125. package/lib/esm/helpers/validate.js +58 -2
  126. package/lib/esm/helpers/validateMidnightAuthorizationTarget.d.ts +1 -1
  127. package/lib/esm/helpers/validateMidnightAuthorizationTarget.js +3 -7
  128. package/lib/esm/helpers/validateRequirementSpender.d.ts +3 -3
  129. package/lib/esm/helpers/validateRequirementSpender.js +4 -5
  130. package/lib/esm/midnight/abis.d.ts +1 -1
  131. package/lib/esm/midnight/abis.js +1 -1
  132. package/lib/esm/midnight/types.d.ts +1 -1
  133. package/lib/esm/types/action.d.ts +117 -89
  134. package/lib/esm/types/action.js +1 -18
  135. package/lib/esm/types/error.d.ts +126 -40
  136. package/lib/esm/types/error.js +135 -38
  137. package/package.json +8 -7
  138. package/lib/cjs/actions/midnight/cancelOffer.d.ts +0 -38
  139. package/lib/cjs/actions/midnight/cancelOffer.js +0 -73
  140. package/lib/cjs/actions/midnight/mempoolSubmitOffers.d.ts +0 -52
  141. package/lib/cjs/actions/midnight/mempoolSubmitOffers.js +0 -72
  142. package/lib/cjs/actions/midnight/setterRatifierRatifyRoot.d.ts +0 -40
  143. package/lib/cjs/actions/midnight/setterRatifierRatifyRoot.js +0 -59
  144. package/lib/cjs/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.d.ts +0 -42
  145. package/lib/cjs/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.js +0 -70
  146. package/lib/esm/actions/midnight/cancelOffer.d.ts +0 -38
  147. package/lib/esm/actions/midnight/cancelOffer.js +0 -69
  148. package/lib/esm/actions/midnight/mempoolSubmitOffers.d.ts +0 -52
  149. package/lib/esm/actions/midnight/mempoolSubmitOffers.js +0 -68
  150. package/lib/esm/actions/midnight/setterRatifierRatifyRoot.d.ts +0 -40
  151. package/lib/esm/actions/midnight/setterRatifierRatifyRoot.js +0 -55
  152. package/lib/esm/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.d.ts +0 -42
  153. package/lib/esm/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.js +0 -66
@@ -70,8 +70,7 @@ export declare const validateMidnightMarketChainId: (market: MidnightMarketInput
70
70
  * the provided user address.
71
71
  *
72
72
  * Used at `sign()` time by the shared `signAndVerifyTypedData` helper (which
73
- * backs the permit, Permit2, Blue authorization, and Midnight offer-root
74
- * signature flows) and by `encodeVaultSharesPermit`, to enforce builder =
73
+ * backs the permit, Permit2, and Blue authorization signature flows) and by `encodeVaultSharesPermit`, to enforce builder =
75
74
  * signer: the signing flow is
76
75
  * the only path where an account/address mismatch is a real security concern
77
76
  * (rather than just an integrator footgun).
@@ -163,6 +162,48 @@ export declare const validateChainId: (clientChainId: number | undefined, expect
163
162
  * @throws {NativeAmountOnNonWNativeAssetError} if the asset is not wNative.
164
163
  */
165
164
  export declare const validateNativeAsset: (chainId: number, asset: Address) => void;
165
+ /**
166
+ * Validates native ETH funding against the wNative tokens pulled by a MidnightBundlesV2 action.
167
+ *
168
+ * @param params.chainId - Chain used to resolve wNative.
169
+ * @param params.nativeAmount - Optional native ETH sent as `value`; the bundle wraps it into the
170
+ * chain's wNative and transfers it to `msg.sender` before pulling. It may cover part or all of the
171
+ * maximum wNative amount this call can pull, but not more. Any wrapped native not pulled stays in
172
+ * the sender's wallet as wNative. The wNative approval to `MidnightBundlesV2` is still required
173
+ * for the full pulled amount.
174
+ * @param params.pulls - Token pulls performed by the bundle action.
175
+ * @returns The transaction `value` and the `wrappedNative` contract argument.
176
+ * @throws {NegativeInputError} when `nativeAmount` is negative.
177
+ * @throws {ChainWNativeMissingError} when wNative is not configured for the chain.
178
+ * @throws {NativeAmountOnNonWNativeAssetError} when pulls are non-empty and none use wNative.
179
+ * @throws {InputExceedsMaxError} when `nativeAmount` exceeds the maximum wNative pull, including
180
+ * when the call pulls none.
181
+ * @example
182
+ * ```ts
183
+ * import { getChainAddress } from "@morpho-org/morpho-ts";
184
+ * import { validateMidnightNativeAmount } from "@morpho-org/morpho-sdk";
185
+ *
186
+ * const wNative = getChainAddress(8453, "wNative");
187
+ * const funding = validateMidnightNativeAmount({
188
+ * chainId: 8453,
189
+ * nativeAmount: 1_000n,
190
+ * pulls: [{ token: wNative, assets: 2_000n }],
191
+ * });
192
+ * funding.value; // 1_000n
193
+ * funding.wrappedNative; // wNative
194
+ * ```
195
+ */
196
+ export declare const validateMidnightNativeAmount: (params: {
197
+ readonly chainId: number;
198
+ readonly nativeAmount?: bigint;
199
+ readonly pulls: readonly {
200
+ readonly token: Address;
201
+ readonly assets: bigint;
202
+ }[];
203
+ }) => {
204
+ value: bigint;
205
+ wrappedNative: Address;
206
+ };
166
207
  /** @internal Validates native funding against a vault's wrapped-native asset. */
167
208
  export declare const validateNativeVaultAsset: (chainId: number, vaultAsset: Address) => void;
168
209
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateWithdrawShares = exports.validateWithdrawAmount = exports.validateSlippageTolerance = exports.validateVaultV2BlueReallocations = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validateNativeVaultAsset = exports.validateNativeAsset = exports.validateChainId = exports.validatePositionHealth = exports.validateAccrualPosition = exports.validateMidnightMarketChainId = exports.validateReferralFee = exports.validateDeadline = exports.validateUint256Field = void 0;
3
+ exports.validateWithdrawShares = exports.validateWithdrawAmount = exports.validateSlippageTolerance = exports.validateVaultV2BlueReallocations = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validateNativeVaultAsset = exports.validateMidnightNativeAmount = exports.validateNativeAsset = exports.validateChainId = exports.validatePositionHealth = exports.validateAccrualPosition = exports.validateMidnightMarketChainId = exports.validateReferralFee = exports.validateDeadline = exports.validateUint256Field = void 0;
4
4
  exports.validateUserAddress = validateUserAddress;
5
5
  const blue_sdk_1 = require("@morpho-org/blue-sdk");
6
6
  const morpho_ts_1 = require("@morpho-org/morpho-ts");
@@ -113,8 +113,7 @@ exports.validateMidnightMarketChainId = validateMidnightMarketChainId;
113
113
  * the provided user address.
114
114
  *
115
115
  * Used at `sign()` time by the shared `signAndVerifyTypedData` helper (which
116
- * backs the permit, Permit2, Blue authorization, and Midnight offer-root
117
- * signature flows) and by `encodeVaultSharesPermit`, to enforce builder =
116
+ * backs the permit, Permit2, and Blue authorization signature flows) and by `encodeVaultSharesPermit`, to enforce builder =
118
117
  * signer: the signing flow is
119
118
  * the only path where an account/address mismatch is a real security concern
120
119
  * (rather than just an integrator footgun).
@@ -242,6 +241,64 @@ const validateNativeAsset = (chainId, asset) => {
242
241
  }
243
242
  };
244
243
  exports.validateNativeAsset = validateNativeAsset;
244
+ /**
245
+ * Validates native ETH funding against the wNative tokens pulled by a MidnightBundlesV2 action.
246
+ *
247
+ * @param params.chainId - Chain used to resolve wNative.
248
+ * @param params.nativeAmount - Optional native ETH sent as `value`; the bundle wraps it into the
249
+ * chain's wNative and transfers it to `msg.sender` before pulling. It may cover part or all of the
250
+ * maximum wNative amount this call can pull, but not more. Any wrapped native not pulled stays in
251
+ * the sender's wallet as wNative. The wNative approval to `MidnightBundlesV2` is still required
252
+ * for the full pulled amount.
253
+ * @param params.pulls - Token pulls performed by the bundle action.
254
+ * @returns The transaction `value` and the `wrappedNative` contract argument.
255
+ * @throws {NegativeInputError} when `nativeAmount` is negative.
256
+ * @throws {ChainWNativeMissingError} when wNative is not configured for the chain.
257
+ * @throws {NativeAmountOnNonWNativeAssetError} when pulls are non-empty and none use wNative.
258
+ * @throws {InputExceedsMaxError} when `nativeAmount` exceeds the maximum wNative pull, including
259
+ * when the call pulls none.
260
+ * @example
261
+ * ```ts
262
+ * import { getChainAddress } from "@morpho-org/morpho-ts";
263
+ * import { validateMidnightNativeAmount } from "@morpho-org/morpho-sdk";
264
+ *
265
+ * const wNative = getChainAddress(8453, "wNative");
266
+ * const funding = validateMidnightNativeAmount({
267
+ * chainId: 8453,
268
+ * nativeAmount: 1_000n,
269
+ * pulls: [{ token: wNative, assets: 2_000n }],
270
+ * });
271
+ * funding.value; // 1_000n
272
+ * funding.wrappedNative; // wNative
273
+ * ```
274
+ */
275
+ const validateMidnightNativeAmount = (params) => {
276
+ const { nativeAmount, chainId, pulls } = params;
277
+ if (nativeAmount === undefined || nativeAmount === 0n) {
278
+ return { value: 0n, wrappedNative: viem_1.zeroAddress };
279
+ }
280
+ if (nativeAmount < 0n) {
281
+ throw new index_js_1.NegativeInputError("nativeAmount", nativeAmount);
282
+ }
283
+ const { wNative } = (0, blue_sdk_1.getChainAddresses)(chainId);
284
+ if (!(0, morpho_ts_1.isDefined)(wNative)) {
285
+ throw new index_js_1.ChainWNativeMissingError(chainId);
286
+ }
287
+ const wNativePulled = pulls.reduce((total, pull) => (0, viem_1.isAddressEqual)(pull.token, wNative) ? total + pull.assets : total, 0n);
288
+ const firstPull = pulls[0];
289
+ if (firstPull && !pulls.some((pull) => (0, viem_1.isAddressEqual)(pull.token, wNative))) {
290
+ throw new index_js_1.NativeAmountOnNonWNativeAssetError(firstPull.token, wNative);
291
+ }
292
+ if (nativeAmount > wNativePulled) {
293
+ throw new index_js_1.InputExceedsMaxError({
294
+ field: "nativeAmount",
295
+ value: nativeAmount,
296
+ max: wNativePulled,
297
+ });
298
+ }
299
+ return { value: nativeAmount, wrappedNative: wNative };
300
+ };
301
+ exports.validateMidnightNativeAmount = validateMidnightNativeAmount;
245
302
  /** @internal Validates native funding against a vault's wrapped-native asset. */
246
303
  const validateNativeVaultAsset = (chainId, vaultAsset) => {
247
304
  const { wNative } = (0, blue_sdk_1.getChainAddresses)(chainId);
@@ -5,7 +5,7 @@ import { type Address } from "viem";
5
5
  * @param params - Authorization target validation parameters.
6
6
  * @param params.chainId - Chain id used to resolve supported Midnight operators.
7
7
  * @param params.authorized - Operator address receiving authorization.
8
- * @returns Nothing after the operator matches MidnightBundles or a supported ratifier.
8
+ * @returns Nothing after the operator matches MidnightBundlesV2.
9
9
  * @throws {UnsupportedMidnightAuthorizationTargetError} when `authorized` is not a supported operator.
10
10
  * @internal
11
11
  */
@@ -10,17 +10,13 @@ const index_js_1 = require("../types/index.js");
10
10
  * @param params - Authorization target validation parameters.
11
11
  * @param params.chainId - Chain id used to resolve supported Midnight operators.
12
12
  * @param params.authorized - Operator address receiving authorization.
13
- * @returns Nothing after the operator matches MidnightBundles or a supported ratifier.
13
+ * @returns Nothing after the operator matches MidnightBundlesV2.
14
14
  * @throws {UnsupportedMidnightAuthorizationTargetError} when `authorized` is not a supported operator.
15
15
  * @internal
16
16
  */
17
17
  const validateMidnightAuthorizationTarget = (params) => {
18
- const { midnightBundles, ecrecoverRatifier, setterRatifier } = (0, morpho_ts_1.getChainAddresses)(params.chainId);
19
- const supportedTargets = [
20
- midnightBundles,
21
- ecrecoverRatifier,
22
- setterRatifier,
23
- ].filter((target) => target != null);
18
+ const { midnightBundlesV2 } = (0, morpho_ts_1.getChainAddresses)(params.chainId);
19
+ const supportedTargets = midnightBundlesV2 == null ? [] : [midnightBundlesV2];
24
20
  if (!supportedTargets.some((supported) => (0, viem_1.isAddressEqual)(params.authorized, supported))) {
25
21
  throw new index_js_1.UnsupportedMidnightAuthorizationTargetError({
26
22
  authorized: params.authorized,
@@ -1,6 +1,6 @@
1
1
  import { type Address } from "@morpho-org/blue-sdk";
2
2
  /** Supported spender slots that can be validated against the chain address registry. */
3
- export type RequirementSpenderKey = "permit2" | "midnight" | "midnightBundles" | "vaultExitBundlesV1" | "vaultBundlesV1" | "blueBundlesV1";
3
+ export type RequirementSpenderKey = "permit2" | "midnight" | "midnightBundlesV2" | "vaultExitBundlesV1" | "vaultBundlesV1" | "blueBundlesV1";
4
4
  /**
5
5
  * Validates that a requirement encoder spender matches one of the allowed chain addresses.
6
6
  *
@@ -18,8 +18,8 @@ export type RequirementSpenderKey = "permit2" | "midnight" | "midnightBundles" |
18
18
  *
19
19
  * validateRequirementSpender({
20
20
  * chainId: 8453,
21
- * spender: getChainAddress(8453, "midnightBundles"),
22
- * allowed: ["midnightBundles"],
21
+ * spender: getChainAddress(8453, "midnight"),
22
+ * allowed: ["midnight"],
23
23
  * });
24
24
  * ```
25
25
  */
@@ -21,17 +21,17 @@ const index_js_1 = require("../types/index.js");
21
21
  *
22
22
  * validateRequirementSpender({
23
23
  * chainId: 8453,
24
- * spender: getChainAddress(8453, "midnightBundles"),
25
- * allowed: ["midnightBundles"],
24
+ * spender: getChainAddress(8453, "midnight"),
25
+ * allowed: ["midnight"],
26
26
  * });
27
27
  * ```
28
28
  */
29
29
  const validateRequirementSpender = (params) => {
30
- const { permit2, midnight, midnightBundles, bundles } = (0, blue_sdk_1.getChainAddresses)(params.chainId);
30
+ const { permit2, midnight, midnightBundlesV2, bundles } = (0, blue_sdk_1.getChainAddresses)(params.chainId);
31
31
  const addresses = {
32
32
  permit2,
33
33
  midnight,
34
- midnightBundles,
34
+ midnightBundlesV2,
35
35
  vaultExitBundlesV1: bundles?.vaultExitBundlesV1,
36
36
  vaultBundlesV1: bundles?.vaultBundlesV1,
37
37
  blueBundlesV1: bundles?.blueBundlesV1,
@@ -43,7 +43,6 @@ const validateRequirementSpender = (params) => {
43
43
  chainId: params.chainId,
44
44
  permit2,
45
45
  midnight,
46
- midnightBundles,
47
46
  supportedSpenders,
48
47
  });
49
48
  }
@@ -1 +1 @@
1
- export { ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, priceRatifierV1Abi, rateRatifierV1Abi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
1
+ export { blueBuyCallbackFactoryAbi, ecrecoverRatifierAbi, midnightAbi, midnightBundlesV2Abi, priceRatifierV1Abi, rateRatifierV1Abi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setterRatifierAbi = exports.rateRatifierV1Abi = exports.priceRatifierV1Abi = exports.midnightBundlesAbi = exports.midnightAbi = exports.ecrecoverRatifierAbi = void 0;
3
+ exports.setterRatifierAbi = exports.rateRatifierV1Abi = exports.priceRatifierV1Abi = exports.midnightBundlesV2Abi = exports.midnightAbi = exports.ecrecoverRatifierAbi = exports.blueBuyCallbackFactoryAbi = void 0;
4
4
  var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
+ Object.defineProperty(exports, "blueBuyCallbackFactoryAbi", { enumerable: true, get: function () { return midnight_sdk_1.blueBuyCallbackFactoryAbi; } });
5
6
  Object.defineProperty(exports, "ecrecoverRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.ecrecoverRatifierAbi; } });
6
7
  Object.defineProperty(exports, "midnightAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightAbi; } });
7
- Object.defineProperty(exports, "midnightBundlesAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightBundlesAbi; } });
8
+ Object.defineProperty(exports, "midnightBundlesV2Abi", { enumerable: true, get: function () { return midnight_sdk_1.midnightBundlesV2Abi; } });
8
9
  Object.defineProperty(exports, "priceRatifierV1Abi", { enumerable: true, get: function () { return midnight_sdk_1.priceRatifierV1Abi; } });
9
10
  Object.defineProperty(exports, "rateRatifierV1Abi", { enumerable: true, get: function () { return midnight_sdk_1.rateRatifierV1Abi; } });
10
11
  Object.defineProperty(exports, "setterRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.setterRatifierAbi; } });
@@ -1 +1 @@
1
- export type { BuildFixedRateOfferChainParams, DecodedEcrecoverRatifierData, DecodedPriceRatifierV1Data, DecodedRateRatifierV1Data, DecodedSetterRatifierData, DeploylessFetchParameters, EcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams, EcrecoverRatifierDataRequest, EcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams, EcrecoverRatifierRatifyRequest, EcrecoverRatifierRootDigestParams, EcrecoverRatifierSignRequest, EcrecoverRatifierTypedDataParams, EcrecoverRatifierTypedDataRequest, EcrecoverSignatureInput, FixedRateOfferChainLeg, GetRatifierInfoParams, MidnightCallParameters, MidnightFetchParams, PriceRatifierV1Leaf, PriceRatifierV1LeafStruct, PriceRatifierV1TreeDescriptor, PriceRatifierV1TreeInput, RateRatifierV1Leaf, RateRatifierV1LeafStruct, RateRatifierV1TreeDescriptor, RateRatifierV1TreeInput, RatifierInfo, SetterRatifierDataParams, SetterRatifierDataRequest, SetterRatifierDataVerificationParams, SetterRatifierRatifyRequest, VerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
1
+ export type { BuildFixedRateOfferChainParams, CollateralTransfer, DecodedEcrecoverRatifierData, DecodedPriceRatifierV1Data, DecodedRateRatifierV1Data, DecodedSetterRatifierData, DeploylessFetchParameters, EcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams, EcrecoverRatifierDataRequest, EcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams, EcrecoverRatifierRatifyRequest, EcrecoverRatifierRootDigestParams, EcrecoverRatifierSignRequest, EcrecoverRatifierTypedDataParams, EcrecoverRatifierTypedDataRequest, EcrecoverSignatureInput, FixedRateOfferChainLeg, GetRatifierInfoParams, GroupCancellation, MidnightCallParameters, MidnightFetchParams, PriceRatifierV1Leaf, PriceRatifierV1LeafStruct, PriceRatifierV1TreeDescriptor, PriceRatifierV1TreeInput, RateRatifierV1Leaf, RateRatifierV1LeafStruct, RateRatifierV1TreeDescriptor, RateRatifierV1TreeInput, RatifierInfo, SetterRatifierDataParams, SetterRatifierDataRequest, SetterRatifierDataVerificationParams, SetterRatifierRatifyRequest, VerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
@@ -1,6 +1,50 @@
1
1
  import type { InputMarketParams } from "@morpho-org/blue-sdk";
2
+ import type { CollateralTransfer as MidnightCollateralTransfer, GroupCancellation as MidnightGroupCancellation } from "@morpho-org/midnight-sdk";
2
3
  import type { Address, Hex, TypedDataDefinition, WalletClient } from "viem";
3
4
  import type { Deallocation } from "./deallocation.js";
5
+ export type { CollateralTransfer as MidnightCollateralTransfer, GroupCancellation as MidnightGroupCancellation, } from "@morpho-org/midnight-sdk";
6
+ /**
7
+ * Direct repayment for `repayWithdrawCollateral`: `assets` repays exactly that many loan assets
8
+ * (`0n` only withdraws); `full` repays the whole debt at execution: it pulls the finite
9
+ * `maxBuyerAssets` upfront and refunds the rest, so the sender must hold the full cap. A `full`
10
+ * repay reverts onchain with `Panic(0x11)` when the debt at execution exceeds `maxBuyerAssets`.
11
+ */
12
+ export type MidnightRepay = {
13
+ readonly type: "assets";
14
+ readonly assets: bigint;
15
+ } | {
16
+ readonly type: "full";
17
+ readonly maxBuyerAssets: bigint;
18
+ };
19
+ /**
20
+ * Amount target of a `MidnightBundlesV2` buy (lend or repay): an exact amount of loan assets paid
21
+ * with a minimum of units bought, or an exact amount of units bought with a maximum of loan assets paid.
22
+ */
23
+ export type MidnightBuyTarget = {
24
+ readonly type: "assets";
25
+ /** Loan assets paid, referral fee included. */
26
+ readonly assets: bigint;
27
+ readonly minUnits: bigint;
28
+ } | {
29
+ readonly type: "units";
30
+ readonly units: bigint;
31
+ /** Loan assets pulled from the sender, referral fee included; the unused remainder is returned. */
32
+ readonly maxBuyerAssets: bigint;
33
+ };
34
+ /**
35
+ * Amount target of a `MidnightBundlesV2` sell (borrow or withdraw): an exact amount of loan assets
36
+ * received with a maximum of units sold, or an exact amount of units sold with a minimum of loan assets received.
37
+ */
38
+ export type MidnightSellTarget = {
39
+ readonly type: "assets";
40
+ /** Loan assets received before the referral fee. */
41
+ readonly assets: bigint;
42
+ readonly maxUnits: bigint;
43
+ } | {
44
+ readonly type: "units";
45
+ readonly units: bigint;
46
+ readonly minSellerAssets: bigint;
47
+ };
4
48
  /**
5
49
  * Serves as the common discriminated action-metadata base shared by both
6
50
  * {@link TransactionAction} (actions that carry encoded calldata) and
@@ -316,46 +360,49 @@ export interface MidnightAuthorizationAction extends BaseAction<"midnightAuthori
316
360
  readonly onBehalf: Address;
317
361
  }> {
318
362
  }
319
- /** Metadata for a SetterRatifier ratify-root prerequisite transaction. */
320
- export interface SetterRatifierRatifyRootAction extends BaseAction<"setterRatifierRatifyRoot", {
321
- readonly maker: Address;
322
- readonly root: Hex;
323
- readonly isRootRatified: boolean;
324
- }> {
325
- }
326
363
  /** Metadata for a Midnight bundle that lends into fixed-rate offers. */
327
364
  export interface MidnightTakeLendAction extends BaseAction<"midnightTakeLend", {
328
365
  readonly market: Hex;
329
- readonly assets: bigint;
330
- readonly minUnits: bigint;
331
- readonly taker: Address;
366
+ readonly target: MidnightBuyTarget;
332
367
  readonly takeableOffers: number;
368
+ readonly maxContinuousFee: bigint;
333
369
  readonly deadline: bigint;
370
+ readonly referralFeePct: bigint;
371
+ readonly referralFeeRecipient: Address;
334
372
  }> {
335
373
  }
336
374
  /** Metadata for a Midnight bundle that borrows from fixed-rate offers. */
337
375
  export interface MidnightTakeBorrowAction extends BaseAction<"midnightTakeBorrow", {
338
376
  readonly market: Hex;
339
- readonly loanAssets: bigint;
340
- readonly maxUnits: bigint;
341
- readonly taker: Address;
377
+ readonly target: MidnightSellTarget;
342
378
  readonly receiver: Address;
343
- readonly collateralSupplies: number;
344
379
  readonly takeableOffers: number;
345
380
  readonly deadline: bigint;
381
+ readonly referralFeePct: bigint;
382
+ readonly referralFeeRecipient: Address;
383
+ }> {
384
+ }
385
+ /** Metadata for a reduce-only Midnight bundle that redeems credit, then sells the rest to offers. */
386
+ export interface MidnightTakeWithdrawAction extends BaseAction<"midnightTakeWithdraw", {
387
+ readonly market: Hex;
388
+ readonly target: MidnightSellTarget;
389
+ readonly receiver: Address;
390
+ readonly takeableOffers: number;
391
+ readonly deadline: bigint;
392
+ readonly referralFeePct: bigint;
393
+ readonly referralFeeRecipient: Address;
346
394
  }> {
347
395
  }
348
396
  /** Metadata for a Midnight bundle that supplies collateral and borrows from fixed-rate offers. */
349
397
  export interface MidnightSupplyCollateralTakeBorrowAction extends BaseAction<"midnightSupplyCollateralTakeBorrow", {
350
398
  readonly market: Hex;
351
- readonly collateralAssets: bigint;
352
- readonly loanAssets: bigint;
353
- readonly maxUnits: bigint;
354
- readonly taker: Address;
399
+ readonly target: MidnightSellTarget;
355
400
  readonly receiver: Address;
356
- readonly collateralSupplies: number;
401
+ readonly collateralSupplies: readonly MidnightCollateralTransfer[];
357
402
  readonly takeableOffers: number;
358
403
  readonly deadline: bigint;
404
+ readonly referralFeePct: bigint;
405
+ readonly referralFeeRecipient: Address;
359
406
  }> {
360
407
  }
361
408
  /** Metadata for a direct Midnight collateral-supply transaction. */
@@ -366,16 +413,6 @@ export interface MidnightSupplyCollateralAction extends BaseAction<"midnightSupp
366
413
  readonly onBehalf: Address;
367
414
  }> {
368
415
  }
369
- /** Metadata for a Midnight mempool payload submission. */
370
- export interface MempoolSubmitOffersAction extends BaseAction<"mempoolSubmitOffers", {
371
- readonly groups: readonly Hex[];
372
- readonly root: Hex;
373
- readonly maker: Address;
374
- readonly ratifier: Address;
375
- readonly ratifierType: "ecrecover" | "setter";
376
- readonly offers: number;
377
- }> {
378
- }
379
416
  /** Metadata for a direct Midnight credit redemption transaction. */
380
417
  export interface MidnightRedeemAction extends BaseAction<"midnightRedeem", {
381
418
  readonly market: Hex;
@@ -384,21 +421,55 @@ export interface MidnightRedeemAction extends BaseAction<"midnightRedeem", {
384
421
  readonly receiver: Address;
385
422
  }> {
386
423
  }
387
- /** Metadata for a Midnight bundle that repays credit and/or withdraws collateral. */
424
+ /** Metadata for a Midnight reduce-only bundle that repays debt through offers, then withdraws collateral. */
425
+ export interface MidnightTakeRepayWithdrawCollateralAction extends BaseAction<"midnightTakeRepayWithdrawCollateral", {
426
+ readonly market: Hex;
427
+ readonly target: MidnightBuyTarget;
428
+ readonly repayEnabled: boolean;
429
+ readonly collateralWithdrawals: readonly MidnightCollateralTransfer[];
430
+ readonly collateralReceiver: Address;
431
+ readonly takeableOffers: number;
432
+ readonly maxContinuousFee: bigint;
433
+ readonly deadline: bigint;
434
+ readonly referralFeePct: bigint;
435
+ readonly referralFeeRecipient: Address;
436
+ }> {
437
+ }
438
+ /** Metadata for a direct MidnightBundlesV2 repayment and/or collateral withdrawal. */
388
439
  export interface MidnightRepayWithdrawCollateralAction extends BaseAction<"midnightRepayWithdrawCollateral", {
389
440
  readonly market: Hex;
390
- readonly repayAssets: bigint;
391
- readonly collateralWithdrawals: number;
392
- readonly onBehalf: Address;
441
+ readonly repay: MidnightRepay;
442
+ readonly collateralWithdrawals: readonly MidnightCollateralTransfer[];
393
443
  readonly collateralReceiver: Address;
394
444
  readonly deadline: bigint;
395
445
  }> {
396
446
  }
397
- /** Metadata for a direct Midnight offer-cancellation transaction. */
398
- export interface MidnightCancelOfferAction extends BaseAction<"midnightCancelOffer", {
399
- readonly group: Hex;
400
- readonly amount: bigint;
401
- readonly onBehalf: Address;
447
+ /**
448
+ * Loan assets supplied to a Morpho Blue market for the maker's `BlueBuyCallback` derived from
449
+ * `callbackSalt`. Offers funded by it set that callback and `abi.encode(market)` as callback data.
450
+ */
451
+ export interface MidnightBlueSupply {
452
+ /** Morpho Blue market receiving the parked loan assets. */
453
+ readonly market: InputMarketParams;
454
+ /** Positive loan assets pulled from `msg.sender` and supplied for the callback. */
455
+ readonly assets: bigint;
456
+ /** CREATE2 salt selecting the maker's `BlueBuyCallback`. */
457
+ readonly callbackSalt: Hex;
458
+ }
459
+ /**
460
+ * Metadata for a Midnight Bundles V2 maker bundle; cancel-only bundles and bundles without
461
+ * collateral carry a zero `market` (`zeroHash`). Cancel-only bundles also carry a zero `ratifier`
462
+ * and `root`.
463
+ */
464
+ export interface MidnightCancelAndMakeAction extends BaseAction<"midnightCancelAndMake", {
465
+ readonly market: Hex;
466
+ readonly ratifier: Address;
467
+ readonly root: Hex;
468
+ readonly groups: readonly Hex[];
469
+ readonly cancellations: readonly MidnightGroupCancellation[];
470
+ readonly collateralSupplies: readonly MidnightCollateralTransfer[];
471
+ readonly blueSupply?: MidnightBlueSupply;
472
+ readonly deadline: bigint;
402
473
  }> {
403
474
  }
404
475
  /**
@@ -406,7 +477,7 @@ export interface MidnightCancelOfferAction extends BaseAction<"midnightCancelOff
406
477
  * VaultV2, Blue, and Midnight flows. The `type` tag discriminates the union so
407
478
  * consumers can `switch` exhaustively on it.
408
479
  */
409
- export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2InKindRedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1InKindRedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueWithdrawAction | BlueRefinanceAction | BlueAuthorizationAction | MidnightAuthorizationAction | SetterRatifierRatifyRootAction | MidnightTakeLendAction | MidnightTakeBorrowAction | MidnightSupplyCollateralTakeBorrowAction | MidnightSupplyCollateralAction | MempoolSubmitOffersAction | MidnightRedeemAction | MidnightRepayWithdrawCollateralAction | MidnightCancelOfferAction;
480
+ export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2InKindRedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1InKindRedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueWithdrawAction | BlueRefinanceAction | BlueAuthorizationAction | MidnightAuthorizationAction | MidnightTakeLendAction | MidnightTakeBorrowAction | MidnightTakeWithdrawAction | MidnightSupplyCollateralTakeBorrowAction | MidnightSupplyCollateralAction | MidnightRedeemAction | MidnightTakeRepayWithdrawCollateralAction | MidnightRepayWithdrawCollateralAction | MidnightCancelAndMakeAction;
410
481
  /**
411
482
  * Describes a single, immutable, deep-frozen transaction to submit on-chain:
412
483
  * the target `to`, native `value`, encoded call `data`, and the originating
@@ -476,13 +547,6 @@ export interface AuthorizationSignatureArgs {
476
547
  /** EIP-712 signature over the Morpho `Authorization` typed data. */
477
548
  readonly signature: Hex;
478
549
  }
479
- /** Signed and encoded Ecrecover offer-root payload used by Midnight maker flows. */
480
- export interface MidnightOfferRootSignatureArgs {
481
- readonly owner: Address;
482
- readonly root: Hex;
483
- readonly signature: Hex;
484
- readonly payload: Hex;
485
- }
486
550
  /** EIP-712 payload carried by a signable requirement action. */
487
551
  export type RequirementTypedData = TypedDataDefinition<Record<string, unknown>, string>;
488
552
  /** Signable ERC-2612 permit requirement for a fixed-bundles token pull. */
@@ -522,26 +586,10 @@ export interface AuthorizationAction extends BaseAction<"authorization", {
522
586
  /** EIP-712 payload to sign for this Morpho authorization. See {@link PermitAction.typedData}. */
523
587
  readonly typedData?: RequirementTypedData;
524
588
  }
525
- /** Metadata for a Midnight offer-root signature request. */
526
- export interface MidnightOfferRootSignatureAction extends BaseAction<"midnightOfferRootSignature", {
527
- readonly root: Hex;
528
- readonly ratifier: Address;
529
- readonly offers: number;
530
- }> {
531
- /**
532
- * EIP-712 offer-tree payload `sign()` signs for this Midnight ratification, exposed so it can be
533
- * inspected or displayed before signing. See {@link PermitAction.typedData}.
534
- *
535
- * A bare signature over this payload is not enough to build the submit-offers transaction:
536
- * `sign()` also derives the ratification payload (`MidnightOfferRootSignature.args.payload`) that
537
- * `buildTx()` submits to the mempool.
538
- */
539
- readonly typedData?: RequirementTypedData;
540
- }
541
589
  /** Action metadata supported by signature requirements. */
542
- export type SignatureRequirementAction = PermitAction | Permit2SignatureTransferAction | AuthorizationAction | MidnightOfferRootSignatureAction;
590
+ export type SignatureRequirementAction = PermitAction | Permit2SignatureTransferAction | AuthorizationAction;
543
591
  /** Argument payloads returned by signature requirements. */
544
- export type RequirementSignatureArgs = PermitArgs | AuthorizationSignatureArgs | MidnightOfferRootSignatureArgs;
592
+ export type RequirementSignatureArgs = PermitArgs | AuthorizationSignatureArgs;
545
593
  /** A signed ERC-2612 permit requirement. */
546
594
  export interface Erc2612RequirementSignature {
547
595
  readonly args: Readonly<PermitArgs>;
@@ -559,21 +607,15 @@ export interface AuthorizationRequirementSignature {
559
607
  readonly args: AuthorizationSignatureArgs;
560
608
  readonly action: AuthorizationAction;
561
609
  }
562
- /** A signed Midnight Ecrecover offer-root requirement. */
563
- export interface MidnightOfferRootSignature {
564
- readonly args: MidnightOfferRootSignatureArgs;
565
- readonly action: MidnightOfferRootSignatureAction;
566
- }
567
610
  /**
568
611
  * The deep-frozen output of `Requirement.sign()`. Discriminated on `action.type`:
569
612
  * `"permit"` carries token-approval args, `"permit2SignatureTransfer"` carries a
570
- * bundles SignatureTransfer, `"authorization"` carries the signed Morpho authorization,
571
- * and Midnight adds `"midnightOfferRootSignature"`.
613
+ * bundles SignatureTransfer, and `"authorization"` carries the signed Morpho authorization.
572
614
  */
573
615
  export type RequirementSignature<TAction extends SignatureRequirementAction | undefined = undefined, TArgs extends RequirementSignatureArgs | undefined = undefined> = TAction extends SignatureRequirementAction ? TArgs extends RequirementSignatureArgs ? {
574
616
  args: TArgs;
575
617
  action: TAction;
576
- } : never : PermitRequirementSignature | Permit2SignatureTransferRequirementSignature | AuthorizationRequirementSignature | MidnightOfferRootSignature;
618
+ } : never : PermitRequirementSignature | Permit2SignatureTransferRequirementSignature | AuthorizationRequirementSignature;
577
619
  type RequirementResult<TSignatureOrAction extends RequirementSignature | SignatureRequirementAction, TArgs extends RequirementSignatureArgs | undefined> = TSignatureOrAction extends SignatureRequirementAction ? RequirementSignature<TSignatureOrAction, Extract<TArgs, RequirementSignatureArgs>> : Extract<TSignatureOrAction, RequirementSignature>;
578
620
  /**
579
621
  * A signable approval / authorization requirement. `sign()` returns the matching
@@ -605,8 +647,6 @@ export interface Requirement<TSignatureOrAction extends RequirementSignature | S
605
647
  }
606
648
  /** ERC-2612 or Permit2 SignatureTransfer requirement consumed by a fixed bundles contract. */
607
649
  export type BundlesTokenSignatureRequirement = Requirement<BundlesTokenRequirementSignature>;
608
- /** Midnight Ecrecover offer-root signature requirement. */
609
- export type MidnightOfferRootRequirement = Requirement<MidnightOfferRootSignatureAction, MidnightOfferRootSignatureArgs>;
610
650
  /** Any token signature requirement supported by an SDK transaction route. */
611
651
  export type TokenSignatureRequirement = BundlesTokenSignatureRequirement;
612
652
  /** Token signature result consumed by a fixed bundles contract. */
@@ -614,11 +654,11 @@ export type BundlesTokenRequirementSignature = Erc2612RequirementSignature | Per
614
654
  /** Any token signature result supported by an SDK transaction route. */
615
655
  export type TokenRequirementSignature = BundlesTokenRequirementSignature;
616
656
  /** Any signature result returned by an action-output signature requirement. */
617
- export type AnyRequirementSignature = TokenRequirementSignature | AuthorizationRequirementSignature | MidnightOfferRootSignature;
657
+ export type AnyRequirementSignature = TokenRequirementSignature | AuthorizationRequirementSignature;
618
658
  /** Any signature requirement returned by an entity action output. */
619
- export type SignatureRequirement = TokenSignatureRequirement | MidnightOfferRootRequirement | Requirement<AuthorizationRequirementSignature>;
659
+ export type SignatureRequirement = TokenSignatureRequirement | Requirement<AuthorizationRequirementSignature>;
620
660
  /** Call action metadata that can appear as an action prerequisite. */
621
- export type CallRequirementAction = ERC20ApprovalAction | BlueAuthorizationAction | MidnightAuthorizationAction | SetterRatifierRatifyRootAction | MidnightSupplyCollateralAction;
661
+ export type CallRequirementAction = ERC20ApprovalAction | BlueAuthorizationAction | MidnightAuthorizationAction | MidnightSupplyCollateralAction;
622
662
  /** Onchain call prerequisite returned by action-output `getRequirements()`. */
623
663
  export type CallRequirement = Readonly<Transaction<CallRequirementAction>>;
624
664
  /** Onchain call or signature prerequisite returned by an entity action output. */
@@ -705,13 +745,6 @@ export declare function isPermit2SignatureTransferSignature(signature: Requireme
705
745
  * @returns `true` when `signature.action.type` is `"authorization"`.
706
746
  */
707
747
  export declare function isAuthorizationSignature(signature: RequirementSignature): signature is AuthorizationRequirementSignature;
708
- /**
709
- * Narrows a {@link RequirementSignature} to a Midnight offer-root signature.
710
- *
711
- * @param signature - The signed requirement to test.
712
- * @returns `true` when `signature.action.type` is `"midnightOfferRootSignature"`.
713
- */
714
- export declare function isMidnightOfferRootSignature(signature: RequirementSignature): signature is MidnightOfferRootSignature;
715
748
  /** The typed requirement-signature slots a transaction builder consumes, split from a `buildTx` array. */
716
749
  export interface SelectedRequirementSignatures {
717
750
  /** The single ERC-2612 signature, when present. */
@@ -720,8 +753,6 @@ export interface SelectedRequirementSignatures {
720
753
  readonly permit2SignatureTransfer?: Permit2SignatureTransferRequirementSignature;
721
754
  /** The single Morpho authorization signature, when present. */
722
755
  readonly authorization?: AuthorizationRequirementSignature;
723
- /** The single Midnight offer-root signature, when present. */
724
- readonly midnightOfferRoot?: MidnightOfferRootSignature;
725
756
  }
726
757
  /**
727
758
  * Splits a `buildTx` signature array into its typed requirement-signature slots, rejecting
@@ -737,7 +768,6 @@ export interface SelectedRequirementSignatures {
737
768
  * @param accepts.permit - Whether an ERC-2612 signature is consumed.
738
769
  * @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
739
770
  * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
740
- * @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
741
771
  * @returns The accepted signature in each typed slot, when present.
742
772
  * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
743
773
  * @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
@@ -756,6 +786,4 @@ export declare function selectRequirementSignatures(signatures: readonly Require
756
786
  readonly permit?: boolean;
757
787
  readonly permit2SignatureTransfer?: boolean;
758
788
  readonly authorization?: boolean;
759
- readonly midnightOfferRoot?: boolean;
760
789
  }): SelectedRequirementSignatures;
761
- export {};