@morpho-org/morpho-sdk 6.6.0 → 7.1.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/MIGRATION-v6-to-v7.md +297 -0
  2. package/README.md +26 -12
  3. package/lib/cjs/abis.d.ts +2 -2
  4. package/lib/cjs/abis.js +7 -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/blue/abis.d.ts +1 -1
  40. package/lib/cjs/blue/abis.js +5 -1
  41. package/lib/cjs/blue/entities.d.ts +4 -4
  42. package/lib/cjs/blue/entities.js +3 -1
  43. package/lib/cjs/blue/errors.d.ts +2 -2
  44. package/lib/cjs/blue/errors.js +5 -1
  45. package/lib/cjs/blue/fetch.d.ts +2 -2
  46. package/lib/cjs/blue/fetch.js +3 -1
  47. package/lib/cjs/blue/utils.d.ts +1 -1
  48. package/lib/cjs/blue/utils.js +2 -1
  49. package/lib/cjs/constants.d.ts +1 -1
  50. package/lib/cjs/constants.js +2 -1
  51. package/lib/cjs/entities/index.d.ts +6 -6
  52. package/lib/cjs/entities/index.js +3 -1
  53. package/lib/cjs/entities/midnight/midnight.d.ts +585 -108
  54. package/lib/cjs/entities/midnight/midnight.js +984 -509
  55. package/lib/cjs/entities/midnight/types.d.ts +142 -60
  56. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +3 -2
  57. package/lib/cjs/entities/vaultV1/vaultV1.js +32 -34
  58. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +37 -12
  59. package/lib/cjs/entities/vaultV2/vaultV2.js +68 -41
  60. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +5 -3
  61. package/lib/cjs/entities/vaultV2BlueReallocationData.js +9 -3
  62. package/lib/cjs/errors.d.ts +4 -4
  63. package/lib/cjs/errors.js +10 -5
  64. package/lib/cjs/fetch.d.ts +2 -2
  65. package/lib/cjs/fetch.js +3 -1
  66. package/lib/cjs/helpers/callback.d.ts +54 -0
  67. package/lib/cjs/helpers/callback.js +73 -0
  68. package/lib/cjs/helpers/constant.d.ts +2 -0
  69. package/lib/cjs/helpers/constant.js +3 -1
  70. package/lib/cjs/helpers/index.d.ts +3 -2
  71. package/lib/cjs/helpers/index.js +6 -1
  72. package/lib/cjs/helpers/signAndVerifyTypedData.d.ts +3 -3
  73. package/lib/cjs/helpers/signAndVerifyTypedData.js +3 -3
  74. package/lib/cjs/helpers/validate.d.ts +43 -2
  75. package/lib/cjs/helpers/validate.js +60 -3
  76. package/lib/cjs/helpers/validateMidnightAuthorizationTarget.d.ts +1 -1
  77. package/lib/cjs/helpers/validateMidnightAuthorizationTarget.js +3 -7
  78. package/lib/cjs/helpers/validateRequirementSpender.d.ts +3 -3
  79. package/lib/cjs/helpers/validateRequirementSpender.js +4 -5
  80. package/lib/cjs/midnight/abis.d.ts +1 -1
  81. package/lib/cjs/midnight/abis.js +3 -2
  82. package/lib/cjs/midnight/errors.d.ts +2 -1
  83. package/lib/cjs/midnight/errors.js +5 -4
  84. package/lib/cjs/midnight/types.d.ts +1 -1
  85. package/lib/cjs/types/action.d.ts +219 -90
  86. package/lib/cjs/types/action.js +103 -20
  87. package/lib/cjs/types/error.d.ts +126 -40
  88. package/lib/cjs/types/error.js +154 -49
  89. package/lib/cjs/utils.d.ts +2 -2
  90. package/lib/cjs/utils.js +4 -2
  91. package/lib/esm/abis.d.ts +2 -2
  92. package/lib/esm/abis.js +2 -2
  93. package/lib/esm/actions/bundles/common.d.ts +9 -5
  94. package/lib/esm/actions/bundles/common.js +22 -13
  95. package/lib/esm/actions/midnight/authorization.d.ts +3 -2
  96. package/lib/esm/actions/midnight/authorization.js +3 -2
  97. package/lib/esm/actions/midnight/cancelAndMake.d.ts +153 -0
  98. package/lib/esm/actions/midnight/cancelAndMake.js +288 -0
  99. package/lib/esm/actions/midnight/index.d.ts +3 -3
  100. package/lib/esm/actions/midnight/index.js +3 -3
  101. package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +40 -23
  102. package/lib/esm/actions/midnight/repayWithdrawCollateral.js +108 -72
  103. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +52 -27
  104. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +131 -74
  105. package/lib/esm/actions/midnight/takeBorrow.d.ts +40 -28
  106. package/lib/esm/actions/midnight/takeBorrow.js +98 -57
  107. package/lib/esm/actions/midnight/takeLend.d.ts +51 -27
  108. package/lib/esm/actions/midnight/takeLend.js +114 -57
  109. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +97 -0
  110. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +197 -0
  111. package/lib/esm/actions/midnight/takeWithdraw.d.ts +69 -0
  112. package/lib/esm/actions/midnight/takeWithdraw.js +149 -0
  113. package/lib/esm/actions/midnight/types.d.ts +7 -26
  114. package/lib/esm/actions/midnight/types.js +1 -12
  115. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
  116. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +3 -2
  117. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -4
  118. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +5 -5
  119. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +2 -2
  120. package/lib/esm/actions/requirements/getRequirementsApproval.js +2 -2
  121. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +24 -8
  122. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +25 -14
  123. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -7
  124. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +11 -7
  125. package/lib/esm/actions/requirements/midnight/index.d.ts +0 -1
  126. package/lib/esm/actions/requirements/midnight/index.js +0 -1
  127. package/lib/esm/blue/abis.d.ts +1 -1
  128. package/lib/esm/blue/abis.js +1 -1
  129. package/lib/esm/blue/entities.d.ts +4 -4
  130. package/lib/esm/blue/entities.js +2 -2
  131. package/lib/esm/blue/errors.d.ts +2 -2
  132. package/lib/esm/blue/errors.js +2 -2
  133. package/lib/esm/blue/fetch.d.ts +2 -2
  134. package/lib/esm/blue/fetch.js +2 -2
  135. package/lib/esm/blue/utils.d.ts +1 -1
  136. package/lib/esm/blue/utils.js +1 -1
  137. package/lib/esm/constants.d.ts +1 -1
  138. package/lib/esm/constants.js +1 -1
  139. package/lib/esm/entities/index.d.ts +6 -6
  140. package/lib/esm/entities/index.js +2 -2
  141. package/lib/esm/entities/midnight/midnight.d.ts +585 -108
  142. package/lib/esm/entities/midnight/midnight.js +990 -515
  143. package/lib/esm/entities/midnight/types.d.ts +142 -60
  144. package/lib/esm/entities/vaultV1/vaultV1.d.ts +3 -2
  145. package/lib/esm/entities/vaultV1/vaultV1.js +33 -35
  146. package/lib/esm/entities/vaultV2/vaultV2.d.ts +37 -12
  147. package/lib/esm/entities/vaultV2/vaultV2.js +69 -42
  148. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +5 -3
  149. package/lib/esm/entities/vaultV2BlueReallocationData.js +9 -3
  150. package/lib/esm/errors.d.ts +4 -4
  151. package/lib/esm/errors.js +4 -4
  152. package/lib/esm/fetch.d.ts +2 -2
  153. package/lib/esm/fetch.js +2 -2
  154. package/lib/esm/helpers/callback.d.ts +54 -0
  155. package/lib/esm/helpers/callback.js +68 -0
  156. package/lib/esm/helpers/constant.d.ts +2 -0
  157. package/lib/esm/helpers/constant.js +2 -0
  158. package/lib/esm/helpers/index.d.ts +3 -2
  159. package/lib/esm/helpers/index.js +3 -2
  160. package/lib/esm/helpers/signAndVerifyTypedData.d.ts +3 -3
  161. package/lib/esm/helpers/signAndVerifyTypedData.js +3 -3
  162. package/lib/esm/helpers/validate.d.ts +43 -2
  163. package/lib/esm/helpers/validate.js +58 -2
  164. package/lib/esm/helpers/validateMidnightAuthorizationTarget.d.ts +1 -1
  165. package/lib/esm/helpers/validateMidnightAuthorizationTarget.js +3 -7
  166. package/lib/esm/helpers/validateRequirementSpender.d.ts +3 -3
  167. package/lib/esm/helpers/validateRequirementSpender.js +4 -5
  168. package/lib/esm/midnight/abis.d.ts +1 -1
  169. package/lib/esm/midnight/abis.js +1 -1
  170. package/lib/esm/midnight/errors.d.ts +2 -1
  171. package/lib/esm/midnight/errors.js +2 -1
  172. package/lib/esm/midnight/types.d.ts +1 -1
  173. package/lib/esm/types/action.d.ts +219 -90
  174. package/lib/esm/types/action.js +103 -19
  175. package/lib/esm/types/error.d.ts +126 -40
  176. package/lib/esm/types/error.js +135 -38
  177. package/lib/esm/utils.d.ts +2 -2
  178. package/lib/esm/utils.js +2 -2
  179. package/package.json +10 -10
  180. package/lib/cjs/actions/midnight/cancelOffer.d.ts +0 -38
  181. package/lib/cjs/actions/midnight/cancelOffer.js +0 -73
  182. package/lib/cjs/actions/midnight/mempoolSubmitOffers.d.ts +0 -52
  183. package/lib/cjs/actions/midnight/mempoolSubmitOffers.js +0 -72
  184. package/lib/cjs/actions/midnight/setterRatifierRatifyRoot.d.ts +0 -40
  185. package/lib/cjs/actions/midnight/setterRatifierRatifyRoot.js +0 -59
  186. package/lib/cjs/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.d.ts +0 -42
  187. package/lib/cjs/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.js +0 -70
  188. package/lib/esm/actions/midnight/cancelOffer.d.ts +0 -38
  189. package/lib/esm/actions/midnight/cancelOffer.js +0 -69
  190. package/lib/esm/actions/midnight/mempoolSubmitOffers.d.ts +0 -52
  191. package/lib/esm/actions/midnight/mempoolSubmitOffers.js +0 -68
  192. package/lib/esm/actions/midnight/setterRatifierRatifyRoot.d.ts +0 -40
  193. package/lib/esm/actions/midnight/setterRatifierRatifyRoot.js +0 -55
  194. package/lib/esm/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.d.ts +0 -42
  195. package/lib/esm/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.js +0 -66
@@ -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;
378
+ readonly receiver: Address;
379
+ readonly takeableOffers: number;
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;
342
389
  readonly receiver: Address;
343
- readonly collateralSupplies: number;
344
390
  readonly takeableOffers: number;
345
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. */
@@ -637,8 +677,99 @@ export interface ActionOutput<TAction extends BaseAction = TransactionAction, TS
637
677
  readonly buildTx: (signatures?: TSignatures) => Readonly<Transaction<TAction>>;
638
678
  readonly getRequirements: (params?: TRequirementsParams) => Promise<readonly ActionRequirement[]>;
639
679
  }
680
+ /**
681
+ * Narrows an action requirement to an ERC-20 approval transaction.
682
+ *
683
+ * @param requirement - The requirement returned by `getRequirements()` to test.
684
+ * @returns `true` when `requirement.action.type` is `"erc20Approval"`.
685
+ * @example
686
+ * ```ts
687
+ * import { vaults } from "@morpho-org/morpho-test";
688
+ * import {
689
+ * isRequirementApproval,
690
+ * morphoViemExtension,
691
+ * } from "@morpho-org/morpho-sdk";
692
+ * import { createWalletClient, http, publicActions, zeroAddress } from "viem";
693
+ * import { mainnet } from "viem/chains";
694
+ *
695
+ * const client = createWalletClient({
696
+ * chain: mainnet,
697
+ * transport: http(),
698
+ * account: zeroAddress,
699
+ * })
700
+ * .extend(publicActions)
701
+ * .extend(morphoViemExtension());
702
+ *
703
+ * const vault = client.morpho.vaultV1(
704
+ * vaults[mainnet.id].steakUsdc.address,
705
+ * mainnet.id,
706
+ * );
707
+ * const vaultData = await vault.getData();
708
+ * const handle = vault.deposit({
709
+ * amount: 1_000_000n,
710
+ * userAddress: zeroAddress,
711
+ * vaultData,
712
+ * });
713
+ *
714
+ * for (const requirement of await handle.getRequirements()) {
715
+ * if (!isRequirementApproval(requirement)) continue;
716
+ *
717
+ * const { amount, spender } = requirement.action.args;
718
+ * const hash = await client.sendTransaction(requirement);
719
+ * console.log({ amount, spender, hash });
720
+ * await client.waitForTransactionReceipt({ hash });
721
+ * }
722
+ * ```
723
+ */
640
724
  export declare function isRequirementApproval(requirement: unknown): requirement is Transaction<ERC20ApprovalAction>;
641
- /** Checks whether an action requirement is a Blue authorization call. */
725
+ /**
726
+ * Narrows an action requirement to a Blue authorization call.
727
+ *
728
+ * @param requirement - The requirement returned by `getRequirements()` to test.
729
+ * @returns `true` when the requirement is a call whose `action.type` is `"blueAuthorization"`.
730
+ * @example
731
+ * ```ts
732
+ * import { AccrualPosition } from "@morpho-org/blue-sdk";
733
+ * import { markets } from "@morpho-org/morpho-test";
734
+ * import { Time } from "@morpho-org/morpho-ts";
735
+ * import { createWalletClient, http, publicActions, zeroAddress } from "viem";
736
+ * import { mainnet } from "viem/chains";
737
+ * import {
738
+ * isRequirementBlueAuthorization,
739
+ * morphoViemExtension,
740
+ * } from "@morpho-org/morpho-sdk";
741
+ *
742
+ * const client = createWalletClient({
743
+ * chain: mainnet,
744
+ * transport: http(),
745
+ * account: zeroAddress,
746
+ * })
747
+ * .extend(publicActions)
748
+ * .extend(morphoViemExtension());
749
+ *
750
+ * const blue = client.morpho.blue(
751
+ * markets[mainnet.id].usdc_wbtc,
752
+ * mainnet.id,
753
+ * );
754
+ * const positionData = new AccrualPosition(
755
+ * { user: zeroAddress, supplyShares: 0n, borrowShares: 0n, collateral: 10n ** 8n },
756
+ * await blue.getMarketData(),
757
+ * );
758
+ * const handle = blue.borrow({
759
+ * userAddress: zeroAddress,
760
+ * borrowAssets: 1_000_000n,
761
+ * positionData,
762
+ * deadline: Time.timestamp() + 600n,
763
+ * });
764
+ *
765
+ * for (const requirement of await handle.getRequirements()) {
766
+ * if (!isRequirementBlueAuthorization(requirement)) continue;
767
+ *
768
+ * const hash = await client.sendTransaction(requirement);
769
+ * await client.waitForTransactionReceipt({ hash });
770
+ * }
771
+ * ```
772
+ */
642
773
  export declare function isRequirementBlueAuthorization(requirement: unknown): requirement is Transaction<BlueAuthorizationAction>;
643
774
  /**
644
775
  * Narrows an action requirement to a signature requirement.
@@ -703,15 +834,18 @@ export declare function isPermit2SignatureTransferSignature(signature: Requireme
703
834
  *
704
835
  * @param signature - The signed requirement to test.
705
836
  * @returns `true` when `signature.action.type` is `"authorization"`.
706
- */
707
- export declare function isAuthorizationSignature(signature: RequirementSignature): signature is AuthorizationRequirementSignature;
708
- /**
709
- * Narrows a {@link RequirementSignature} to a Midnight offer-root signature.
837
+ * @example
838
+ * ```ts
839
+ * import {
840
+ * isAuthorizationSignature,
841
+ * type RequirementSignature,
842
+ * } from "@morpho-org/morpho-sdk";
710
843
  *
711
- * @param signature - The signed requirement to test.
712
- * @returns `true` when `signature.action.type` is `"midnightOfferRootSignature"`.
844
+ * const getAuthorizationNonce = (signature: RequirementSignature): bigint | undefined =>
845
+ * isAuthorizationSignature(signature) ? signature.args.nonce : undefined;
846
+ * ```
713
847
  */
714
- export declare function isMidnightOfferRootSignature(signature: RequirementSignature): signature is MidnightOfferRootSignature;
848
+ export declare function isAuthorizationSignature(signature: RequirementSignature): signature is AuthorizationRequirementSignature;
715
849
  /** The typed requirement-signature slots a transaction builder consumes, split from a `buildTx` array. */
716
850
  export interface SelectedRequirementSignatures {
717
851
  /** The single ERC-2612 signature, when present. */
@@ -720,8 +854,6 @@ export interface SelectedRequirementSignatures {
720
854
  readonly permit2SignatureTransfer?: Permit2SignatureTransferRequirementSignature;
721
855
  /** The single Morpho authorization signature, when present. */
722
856
  readonly authorization?: AuthorizationRequirementSignature;
723
- /** The single Midnight offer-root signature, when present. */
724
- readonly midnightOfferRoot?: MidnightOfferRootSignature;
725
857
  }
726
858
  /**
727
859
  * Splits a `buildTx` signature array into its typed requirement-signature slots, rejecting
@@ -737,7 +869,6 @@ export interface SelectedRequirementSignatures {
737
869
  * @param accepts.permit - Whether an ERC-2612 signature is consumed.
738
870
  * @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
739
871
  * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
740
- * @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
741
872
  * @returns The accepted signature in each typed slot, when present.
742
873
  * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
743
874
  * @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
@@ -756,6 +887,4 @@ export declare function selectRequirementSignatures(signatures: readonly Require
756
887
  readonly permit?: boolean;
757
888
  readonly permit2SignatureTransfer?: boolean;
758
889
  readonly authorization?: boolean;
759
- readonly midnightOfferRoot?: boolean;
760
890
  }): SelectedRequirementSignatures;
761
- export {};
@@ -6,9 +6,52 @@ exports.isRequirementSignature = isRequirementSignature;
6
6
  exports.isPermitSignature = isPermitSignature;
7
7
  exports.isPermit2SignatureTransferSignature = isPermit2SignatureTransferSignature;
8
8
  exports.isAuthorizationSignature = isAuthorizationSignature;
9
- exports.isMidnightOfferRootSignature = isMidnightOfferRootSignature;
10
9
  exports.selectRequirementSignatures = selectRequirementSignatures;
11
10
  const error_js_1 = require("./error.js");
11
+ /**
12
+ * Narrows an action requirement to an ERC-20 approval transaction.
13
+ *
14
+ * @param requirement - The requirement returned by `getRequirements()` to test.
15
+ * @returns `true` when `requirement.action.type` is `"erc20Approval"`.
16
+ * @example
17
+ * ```ts
18
+ * import { vaults } from "@morpho-org/morpho-test";
19
+ * import {
20
+ * isRequirementApproval,
21
+ * morphoViemExtension,
22
+ * } from "@morpho-org/morpho-sdk";
23
+ * import { createWalletClient, http, publicActions, zeroAddress } from "viem";
24
+ * import { mainnet } from "viem/chains";
25
+ *
26
+ * const client = createWalletClient({
27
+ * chain: mainnet,
28
+ * transport: http(),
29
+ * account: zeroAddress,
30
+ * })
31
+ * .extend(publicActions)
32
+ * .extend(morphoViemExtension());
33
+ *
34
+ * const vault = client.morpho.vaultV1(
35
+ * vaults[mainnet.id].steakUsdc.address,
36
+ * mainnet.id,
37
+ * );
38
+ * const vaultData = await vault.getData();
39
+ * const handle = vault.deposit({
40
+ * amount: 1_000_000n,
41
+ * userAddress: zeroAddress,
42
+ * vaultData,
43
+ * });
44
+ *
45
+ * for (const requirement of await handle.getRequirements()) {
46
+ * if (!isRequirementApproval(requirement)) continue;
47
+ *
48
+ * const { amount, spender } = requirement.action.args;
49
+ * const hash = await client.sendTransaction(requirement);
50
+ * console.log({ amount, spender, hash });
51
+ * await client.waitForTransactionReceipt({ hash });
52
+ * }
53
+ * ```
54
+ */
12
55
  function isRequirementApproval(requirement) {
13
56
  return (typeof requirement === "object" &&
14
57
  requirement !== null &&
@@ -21,7 +64,54 @@ function isRequirementApproval(requirement) {
21
64
  "type" in requirement.action &&
22
65
  requirement.action.type === "erc20Approval");
23
66
  }
24
- /** Checks whether an action requirement is a Blue authorization call. */
67
+ /**
68
+ * Narrows an action requirement to a Blue authorization call.
69
+ *
70
+ * @param requirement - The requirement returned by `getRequirements()` to test.
71
+ * @returns `true` when the requirement is a call whose `action.type` is `"blueAuthorization"`.
72
+ * @example
73
+ * ```ts
74
+ * import { AccrualPosition } from "@morpho-org/blue-sdk";
75
+ * import { markets } from "@morpho-org/morpho-test";
76
+ * import { Time } from "@morpho-org/morpho-ts";
77
+ * import { createWalletClient, http, publicActions, zeroAddress } from "viem";
78
+ * import { mainnet } from "viem/chains";
79
+ * import {
80
+ * isRequirementBlueAuthorization,
81
+ * morphoViemExtension,
82
+ * } from "@morpho-org/morpho-sdk";
83
+ *
84
+ * const client = createWalletClient({
85
+ * chain: mainnet,
86
+ * transport: http(),
87
+ * account: zeroAddress,
88
+ * })
89
+ * .extend(publicActions)
90
+ * .extend(morphoViemExtension());
91
+ *
92
+ * const blue = client.morpho.blue(
93
+ * markets[mainnet.id].usdc_wbtc,
94
+ * mainnet.id,
95
+ * );
96
+ * const positionData = new AccrualPosition(
97
+ * { user: zeroAddress, supplyShares: 0n, borrowShares: 0n, collateral: 10n ** 8n },
98
+ * await blue.getMarketData(),
99
+ * );
100
+ * const handle = blue.borrow({
101
+ * userAddress: zeroAddress,
102
+ * borrowAssets: 1_000_000n,
103
+ * positionData,
104
+ * deadline: Time.timestamp() + 600n,
105
+ * });
106
+ *
107
+ * for (const requirement of await handle.getRequirements()) {
108
+ * if (!isRequirementBlueAuthorization(requirement)) continue;
109
+ *
110
+ * const hash = await client.sendTransaction(requirement);
111
+ * await client.waitForTransactionReceipt({ hash });
112
+ * }
113
+ * ```
114
+ */
25
115
  function isRequirementBlueAuthorization(requirement) {
26
116
  return (typeof requirement === "object" &&
27
117
  requirement !== null &&
@@ -84,19 +174,20 @@ function isPermit2SignatureTransferSignature(signature) {
84
174
  *
85
175
  * @param signature - The signed requirement to test.
86
176
  * @returns `true` when `signature.action.type` is `"authorization"`.
177
+ * @example
178
+ * ```ts
179
+ * import {
180
+ * isAuthorizationSignature,
181
+ * type RequirementSignature,
182
+ * } from "@morpho-org/morpho-sdk";
183
+ *
184
+ * const getAuthorizationNonce = (signature: RequirementSignature): bigint | undefined =>
185
+ * isAuthorizationSignature(signature) ? signature.args.nonce : undefined;
186
+ * ```
87
187
  */
88
188
  function isAuthorizationSignature(signature) {
89
189
  return signature.action.type === "authorization";
90
190
  }
91
- /**
92
- * Narrows a {@link RequirementSignature} to a Midnight offer-root signature.
93
- *
94
- * @param signature - The signed requirement to test.
95
- * @returns `true` when `signature.action.type` is `"midnightOfferRootSignature"`.
96
- */
97
- function isMidnightOfferRootSignature(signature) {
98
- return signature.action.type === "midnightOfferRootSignature";
99
- }
100
191
  /**
101
192
  * Splits a `buildTx` signature array into its typed requirement-signature slots, rejecting
102
193
  * ambiguous or unexpected input so a path never silently consumes the wrong signature.
@@ -111,7 +202,6 @@ function isMidnightOfferRootSignature(signature) {
111
202
  * @param accepts.permit - Whether an ERC-2612 signature is consumed.
112
203
  * @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
113
204
  * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
114
- * @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
115
205
  * @returns The accepted signature in each typed slot, when present.
116
206
  * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
117
207
  * @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
@@ -132,11 +222,9 @@ function selectRequirementSignatures(signatures, accepts) {
132
222
  const permits = signatures.filter(isPermitSignature);
133
223
  const permit2Transfers = signatures.filter(isPermit2SignatureTransferSignature);
134
224
  const authorizations = signatures.filter(isAuthorizationSignature);
135
- const midnightOfferRoots = signatures.filter(isMidnightOfferRootSignature);
136
225
  const unsupported = signatures.find((signature) => !isPermitSignature(signature) &&
137
226
  !isPermit2SignatureTransferSignature(signature) &&
138
- !isAuthorizationSignature(signature) &&
139
- !isMidnightOfferRootSignature(signature));
227
+ !isAuthorizationSignature(signature));
140
228
  if (unsupported != null)
141
229
  throw new error_js_1.UnsupportedRequirementSignatureError(unsupported.action.type);
142
230
  if (!accepts.permit && permits.length > 0)
@@ -145,20 +233,15 @@ function selectRequirementSignatures(signatures, accepts) {
145
233
  throw new error_js_1.UnexpectedRequirementSignatureError("permit2SignatureTransfer");
146
234
  if (!accepts.authorization && authorizations.length > 0)
147
235
  throw new error_js_1.UnexpectedRequirementSignatureError("authorization");
148
- if (!accepts.midnightOfferRoot && midnightOfferRoots.length > 0)
149
- throw new error_js_1.UnexpectedRequirementSignatureError("midnightOfferRootSignature");
150
236
  if (permits.length > 1)
151
237
  throw new error_js_1.AmbiguousRequirementSignaturesError("permit", permits.length);
152
238
  if (permit2Transfers.length > 1)
153
239
  throw new error_js_1.AmbiguousRequirementSignaturesError("permit2SignatureTransfer", permit2Transfers.length);
154
240
  if (authorizations.length > 1)
155
241
  throw new error_js_1.AmbiguousRequirementSignaturesError("authorization", authorizations.length);
156
- if (midnightOfferRoots.length > 1)
157
- throw new error_js_1.AmbiguousRequirementSignaturesError("midnightOfferRootSignature", midnightOfferRoots.length);
158
242
  return {
159
243
  permit: permits[0],
160
244
  permit2SignatureTransfer: permit2Transfers[0],
161
245
  authorization: authorizations[0],
162
- midnightOfferRoot: midnightOfferRoots[0],
163
246
  };
164
247
  }