@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
@@ -105,8 +105,7 @@ export const validateMidnightMarketChainId = (market, chainId) => {
105
105
  * the provided user address.
106
106
  *
107
107
  * Used at `sign()` time by the shared `signAndVerifyTypedData` helper (which
108
- * backs the permit, Permit2, Blue authorization, and Midnight offer-root
109
- * signature flows) and by `encodeVaultSharesPermit`, to enforce builder =
108
+ * backs the permit, Permit2, and Blue authorization signature flows) and by `encodeVaultSharesPermit`, to enforce builder =
110
109
  * signer: the signing flow is
111
110
  * the only path where an account/address mismatch is a real security concern
112
111
  * (rather than just an integrator footgun).
@@ -230,6 +229,63 @@ export const validateNativeAsset = (chainId, asset) => {
230
229
  throw new NativeAmountOnNonWNativeAssetError(asset, wNative);
231
230
  }
232
231
  };
232
+ /**
233
+ * Validates native ETH funding against the wNative tokens pulled by a MidnightBundlesV2 action.
234
+ *
235
+ * @param params.chainId - Chain used to resolve wNative.
236
+ * @param params.nativeAmount - Optional native ETH sent as `value`; the bundle wraps it into the
237
+ * chain's wNative and transfers it to `msg.sender` before pulling. It may cover part or all of the
238
+ * maximum wNative amount this call can pull, but not more. Any wrapped native not pulled stays in
239
+ * the sender's wallet as wNative. The wNative approval to `MidnightBundlesV2` is still required
240
+ * for the full pulled amount.
241
+ * @param params.pulls - Token pulls performed by the bundle action.
242
+ * @returns The transaction `value` and the `wrappedNative` contract argument.
243
+ * @throws {NegativeInputError} when `nativeAmount` is negative.
244
+ * @throws {ChainWNativeMissingError} when wNative is not configured for the chain.
245
+ * @throws {NativeAmountOnNonWNativeAssetError} when pulls are non-empty and none use wNative.
246
+ * @throws {InputExceedsMaxError} when `nativeAmount` exceeds the maximum wNative pull, including
247
+ * when the call pulls none.
248
+ * @example
249
+ * ```ts
250
+ * import { getChainAddress } from "@morpho-org/morpho-ts";
251
+ * import { validateMidnightNativeAmount } from "@morpho-org/morpho-sdk";
252
+ *
253
+ * const wNative = getChainAddress(8453, "wNative");
254
+ * const funding = validateMidnightNativeAmount({
255
+ * chainId: 8453,
256
+ * nativeAmount: 1_000n,
257
+ * pulls: [{ token: wNative, assets: 2_000n }],
258
+ * });
259
+ * funding.value; // 1_000n
260
+ * funding.wrappedNative; // wNative
261
+ * ```
262
+ */
263
+ export const validateMidnightNativeAmount = (params) => {
264
+ const { nativeAmount, chainId, pulls } = params;
265
+ if (nativeAmount === undefined || nativeAmount === 0n) {
266
+ return { value: 0n, wrappedNative: zeroAddress };
267
+ }
268
+ if (nativeAmount < 0n) {
269
+ throw new NegativeInputError("nativeAmount", nativeAmount);
270
+ }
271
+ const { wNative } = getChainAddresses(chainId);
272
+ if (!isDefined(wNative)) {
273
+ throw new ChainWNativeMissingError(chainId);
274
+ }
275
+ const wNativePulled = pulls.reduce((total, pull) => isAddressEqual(pull.token, wNative) ? total + pull.assets : total, 0n);
276
+ const firstPull = pulls[0];
277
+ if (firstPull && !pulls.some((pull) => isAddressEqual(pull.token, wNative))) {
278
+ throw new NativeAmountOnNonWNativeAssetError(firstPull.token, wNative);
279
+ }
280
+ if (nativeAmount > wNativePulled) {
281
+ throw new InputExceedsMaxError({
282
+ field: "nativeAmount",
283
+ value: nativeAmount,
284
+ max: wNativePulled,
285
+ });
286
+ }
287
+ return { value: nativeAmount, wrappedNative: wNative };
288
+ };
233
289
  /** @internal Validates native funding against a vault's wrapped-native asset. */
234
290
  export const validateNativeVaultAsset = (chainId, vaultAsset) => {
235
291
  const { wNative } = 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
  */
@@ -7,17 +7,13 @@ import { UnsupportedMidnightAuthorizationTargetError } from "../types/index.js";
7
7
  * @param params - Authorization target validation parameters.
8
8
  * @param params.chainId - Chain id used to resolve supported Midnight operators.
9
9
  * @param params.authorized - Operator address receiving authorization.
10
- * @returns Nothing after the operator matches MidnightBundles or a supported ratifier.
10
+ * @returns Nothing after the operator matches MidnightBundlesV2.
11
11
  * @throws {UnsupportedMidnightAuthorizationTargetError} when `authorized` is not a supported operator.
12
12
  * @internal
13
13
  */
14
14
  export const validateMidnightAuthorizationTarget = (params) => {
15
- const { midnightBundles, ecrecoverRatifier, setterRatifier } = getChainAddresses(params.chainId);
16
- const supportedTargets = [
17
- midnightBundles,
18
- ecrecoverRatifier,
19
- setterRatifier,
20
- ].filter((target) => target != null);
15
+ const { midnightBundlesV2 } = getChainAddresses(params.chainId);
16
+ const supportedTargets = midnightBundlesV2 == null ? [] : [midnightBundlesV2];
21
17
  if (!supportedTargets.some((supported) => isAddressEqual(params.authorized, supported))) {
22
18
  throw new UnsupportedMidnightAuthorizationTargetError({
23
19
  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
  */
@@ -18,17 +18,17 @@ import { UnsupportedErc20ApprovalSpenderError } from "../types/index.js";
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
  */
26
26
  export const validateRequirementSpender = (params) => {
27
- const { permit2, midnight, midnightBundles, bundles } = getChainAddresses(params.chainId);
27
+ const { permit2, midnight, midnightBundlesV2, bundles } = getChainAddresses(params.chainId);
28
28
  const addresses = {
29
29
  permit2,
30
30
  midnight,
31
- midnightBundles,
31
+ midnightBundlesV2,
32
32
  vaultExitBundlesV1: bundles?.vaultExitBundlesV1,
33
33
  vaultBundlesV1: bundles?.vaultBundlesV1,
34
34
  blueBundlesV1: bundles?.blueBundlesV1,
@@ -40,7 +40,6 @@ export const validateRequirementSpender = (params) => {
40
40
  chainId: params.chainId,
41
41
  permit2,
42
42
  midnight,
43
- midnightBundles,
44
43
  supportedSpenders,
45
44
  });
46
45
  }
@@ -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 +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 +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 {};
@@ -78,15 +78,6 @@ export function isPermit2SignatureTransferSignature(signature) {
78
78
  export function isAuthorizationSignature(signature) {
79
79
  return signature.action.type === "authorization";
80
80
  }
81
- /**
82
- * Narrows a {@link RequirementSignature} to a Midnight offer-root signature.
83
- *
84
- * @param signature - The signed requirement to test.
85
- * @returns `true` when `signature.action.type` is `"midnightOfferRootSignature"`.
86
- */
87
- export function isMidnightOfferRootSignature(signature) {
88
- return signature.action.type === "midnightOfferRootSignature";
89
- }
90
81
  /**
91
82
  * Splits a `buildTx` signature array into its typed requirement-signature slots, rejecting
92
83
  * ambiguous or unexpected input so a path never silently consumes the wrong signature.
@@ -101,7 +92,6 @@ export function isMidnightOfferRootSignature(signature) {
101
92
  * @param accepts.permit - Whether an ERC-2612 signature is consumed.
102
93
  * @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
103
94
  * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
104
- * @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
105
95
  * @returns The accepted signature in each typed slot, when present.
106
96
  * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
107
97
  * @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
@@ -122,11 +112,9 @@ export function selectRequirementSignatures(signatures, accepts) {
122
112
  const permits = signatures.filter(isPermitSignature);
123
113
  const permit2Transfers = signatures.filter(isPermit2SignatureTransferSignature);
124
114
  const authorizations = signatures.filter(isAuthorizationSignature);
125
- const midnightOfferRoots = signatures.filter(isMidnightOfferRootSignature);
126
115
  const unsupported = signatures.find((signature) => !isPermitSignature(signature) &&
127
116
  !isPermit2SignatureTransferSignature(signature) &&
128
- !isAuthorizationSignature(signature) &&
129
- !isMidnightOfferRootSignature(signature));
117
+ !isAuthorizationSignature(signature));
130
118
  if (unsupported != null)
131
119
  throw new UnsupportedRequirementSignatureError(unsupported.action.type);
132
120
  if (!accepts.permit && permits.length > 0)
@@ -135,20 +123,15 @@ export function selectRequirementSignatures(signatures, accepts) {
135
123
  throw new UnexpectedRequirementSignatureError("permit2SignatureTransfer");
136
124
  if (!accepts.authorization && authorizations.length > 0)
137
125
  throw new UnexpectedRequirementSignatureError("authorization");
138
- if (!accepts.midnightOfferRoot && midnightOfferRoots.length > 0)
139
- throw new UnexpectedRequirementSignatureError("midnightOfferRootSignature");
140
126
  if (permits.length > 1)
141
127
  throw new AmbiguousRequirementSignaturesError("permit", permits.length);
142
128
  if (permit2Transfers.length > 1)
143
129
  throw new AmbiguousRequirementSignaturesError("permit2SignatureTransfer", permit2Transfers.length);
144
130
  if (authorizations.length > 1)
145
131
  throw new AmbiguousRequirementSignaturesError("authorization", authorizations.length);
146
- if (midnightOfferRoots.length > 1)
147
- throw new AmbiguousRequirementSignaturesError("midnightOfferRootSignature", midnightOfferRoots.length);
148
132
  return {
149
133
  permit: permits[0],
150
134
  permit2SignatureTransfer: permit2Transfers[0],
151
135
  authorization: authorizations[0],
152
- midnightOfferRoot: midnightOfferRoots[0],
153
136
  };
154
137
  }