@morpho-org/morpho-sdk 6.5.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 (167) 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 +3 -1
  41. package/lib/cjs/entities/blue/blue.d.ts +10 -6
  42. package/lib/cjs/entities/blue/blue.js +5 -3
  43. package/lib/cjs/entities/index.d.ts +2 -2
  44. package/lib/cjs/entities/midnight/midnight.d.ts +582 -108
  45. package/lib/cjs/entities/midnight/midnight.js +981 -509
  46. package/lib/cjs/entities/midnight/types.d.ts +142 -60
  47. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +2 -1
  48. package/lib/cjs/entities/vaultV1/vaultV1.js +1 -0
  49. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +2 -1
  50. package/lib/cjs/entities/vaultV2/vaultV2.js +1 -0
  51. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +11 -3
  52. package/lib/cjs/entities/vaultV2BlueReallocationData.js +119 -43
  53. package/lib/cjs/helpers/callback.d.ts +54 -0
  54. package/lib/cjs/helpers/callback.js +73 -0
  55. package/lib/cjs/helpers/constant.d.ts +10 -0
  56. package/lib/cjs/helpers/constant.js +11 -1
  57. package/lib/cjs/helpers/index.d.ts +3 -2
  58. package/lib/cjs/helpers/index.js +7 -1
  59. package/lib/cjs/helpers/signAndVerifyTypedData.d.ts +3 -3
  60. package/lib/cjs/helpers/signAndVerifyTypedData.js +3 -3
  61. package/lib/cjs/helpers/utilization.d.ts +13 -0
  62. package/lib/cjs/helpers/utilization.js +26 -1
  63. package/lib/cjs/helpers/validate.d.ts +43 -2
  64. package/lib/cjs/helpers/validate.js +60 -3
  65. package/lib/cjs/helpers/validateMidnightAuthorizationTarget.d.ts +1 -1
  66. package/lib/cjs/helpers/validateMidnightAuthorizationTarget.js +3 -7
  67. package/lib/cjs/helpers/validateRequirementSpender.d.ts +3 -3
  68. package/lib/cjs/helpers/validateRequirementSpender.js +4 -5
  69. package/lib/cjs/midnight/abis.d.ts +1 -1
  70. package/lib/cjs/midnight/abis.js +3 -2
  71. package/lib/cjs/midnight/types.d.ts +1 -1
  72. package/lib/cjs/types/action.d.ts +117 -89
  73. package/lib/cjs/types/action.js +1 -19
  74. package/lib/cjs/types/error.d.ts +126 -40
  75. package/lib/cjs/types/error.js +154 -49
  76. package/lib/cjs/types/sharedLiquidity.d.ts +17 -0
  77. package/lib/esm/abis.d.ts +1 -1
  78. package/lib/esm/abis.js +1 -1
  79. package/lib/esm/actions/bundles/common.d.ts +9 -5
  80. package/lib/esm/actions/bundles/common.js +22 -13
  81. package/lib/esm/actions/midnight/authorization.d.ts +3 -2
  82. package/lib/esm/actions/midnight/authorization.js +3 -2
  83. package/lib/esm/actions/midnight/cancelAndMake.d.ts +153 -0
  84. package/lib/esm/actions/midnight/cancelAndMake.js +288 -0
  85. package/lib/esm/actions/midnight/index.d.ts +3 -3
  86. package/lib/esm/actions/midnight/index.js +3 -3
  87. package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +40 -23
  88. package/lib/esm/actions/midnight/repayWithdrawCollateral.js +108 -72
  89. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +52 -27
  90. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +131 -74
  91. package/lib/esm/actions/midnight/takeBorrow.d.ts +40 -28
  92. package/lib/esm/actions/midnight/takeBorrow.js +98 -57
  93. package/lib/esm/actions/midnight/takeLend.d.ts +51 -27
  94. package/lib/esm/actions/midnight/takeLend.js +114 -57
  95. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +97 -0
  96. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +197 -0
  97. package/lib/esm/actions/midnight/takeWithdraw.d.ts +69 -0
  98. package/lib/esm/actions/midnight/takeWithdraw.js +149 -0
  99. package/lib/esm/actions/midnight/types.d.ts +7 -26
  100. package/lib/esm/actions/midnight/types.js +1 -12
  101. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
  102. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +3 -2
  103. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -4
  104. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +5 -5
  105. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +2 -2
  106. package/lib/esm/actions/requirements/getRequirementsApproval.js +2 -2
  107. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +24 -8
  108. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +25 -14
  109. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -7
  110. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +11 -7
  111. package/lib/esm/actions/requirements/midnight/index.d.ts +0 -1
  112. package/lib/esm/actions/requirements/midnight/index.js +0 -1
  113. package/lib/esm/constants.d.ts +1 -1
  114. package/lib/esm/constants.js +1 -1
  115. package/lib/esm/entities/blue/blue.d.ts +10 -6
  116. package/lib/esm/entities/blue/blue.js +5 -3
  117. package/lib/esm/entities/index.d.ts +2 -2
  118. package/lib/esm/entities/midnight/midnight.d.ts +582 -108
  119. package/lib/esm/entities/midnight/midnight.js +987 -515
  120. package/lib/esm/entities/midnight/types.d.ts +142 -60
  121. package/lib/esm/entities/vaultV1/vaultV1.d.ts +2 -1
  122. package/lib/esm/entities/vaultV1/vaultV1.js +1 -0
  123. package/lib/esm/entities/vaultV2/vaultV2.d.ts +2 -1
  124. package/lib/esm/entities/vaultV2/vaultV2.js +1 -0
  125. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +11 -3
  126. package/lib/esm/entities/vaultV2BlueReallocationData.js +120 -44
  127. package/lib/esm/helpers/callback.d.ts +54 -0
  128. package/lib/esm/helpers/callback.js +68 -0
  129. package/lib/esm/helpers/constant.d.ts +10 -0
  130. package/lib/esm/helpers/constant.js +10 -0
  131. package/lib/esm/helpers/index.d.ts +3 -2
  132. package/lib/esm/helpers/index.js +3 -2
  133. package/lib/esm/helpers/signAndVerifyTypedData.d.ts +3 -3
  134. package/lib/esm/helpers/signAndVerifyTypedData.js +3 -3
  135. package/lib/esm/helpers/utilization.d.ts +13 -0
  136. package/lib/esm/helpers/utilization.js +25 -1
  137. package/lib/esm/helpers/validate.d.ts +43 -2
  138. package/lib/esm/helpers/validate.js +58 -2
  139. package/lib/esm/helpers/validateMidnightAuthorizationTarget.d.ts +1 -1
  140. package/lib/esm/helpers/validateMidnightAuthorizationTarget.js +3 -7
  141. package/lib/esm/helpers/validateRequirementSpender.d.ts +3 -3
  142. package/lib/esm/helpers/validateRequirementSpender.js +4 -5
  143. package/lib/esm/midnight/abis.d.ts +1 -1
  144. package/lib/esm/midnight/abis.js +1 -1
  145. package/lib/esm/midnight/types.d.ts +1 -1
  146. package/lib/esm/types/action.d.ts +117 -89
  147. package/lib/esm/types/action.js +1 -18
  148. package/lib/esm/types/error.d.ts +126 -40
  149. package/lib/esm/types/error.js +135 -38
  150. package/lib/esm/types/sharedLiquidity.d.ts +17 -0
  151. package/package.json +9 -8
  152. package/lib/cjs/actions/midnight/cancelOffer.d.ts +0 -38
  153. package/lib/cjs/actions/midnight/cancelOffer.js +0 -73
  154. package/lib/cjs/actions/midnight/mempoolSubmitOffers.d.ts +0 -52
  155. package/lib/cjs/actions/midnight/mempoolSubmitOffers.js +0 -72
  156. package/lib/cjs/actions/midnight/setterRatifierRatifyRoot.d.ts +0 -40
  157. package/lib/cjs/actions/midnight/setterRatifierRatifyRoot.js +0 -59
  158. package/lib/cjs/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.d.ts +0 -42
  159. package/lib/cjs/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.js +0 -70
  160. package/lib/esm/actions/midnight/cancelOffer.d.ts +0 -38
  161. package/lib/esm/actions/midnight/cancelOffer.js +0 -69
  162. package/lib/esm/actions/midnight/mempoolSubmitOffers.d.ts +0 -52
  163. package/lib/esm/actions/midnight/mempoolSubmitOffers.js +0 -68
  164. package/lib/esm/actions/midnight/setterRatifierRatifyRoot.d.ts +0 -40
  165. package/lib/esm/actions/midnight/setterRatifierRatifyRoot.js +0 -55
  166. package/lib/esm/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.d.ts +0 -42
  167. 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;
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 {};
@@ -6,7 +6,6 @@ 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");
12
11
  function isRequirementApproval(requirement) {
@@ -88,15 +87,6 @@ function isPermit2SignatureTransferSignature(signature) {
88
87
  function isAuthorizationSignature(signature) {
89
88
  return signature.action.type === "authorization";
90
89
  }
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
90
  /**
101
91
  * Splits a `buildTx` signature array into its typed requirement-signature slots, rejecting
102
92
  * ambiguous or unexpected input so a path never silently consumes the wrong signature.
@@ -111,7 +101,6 @@ function isMidnightOfferRootSignature(signature) {
111
101
  * @param accepts.permit - Whether an ERC-2612 signature is consumed.
112
102
  * @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
113
103
  * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
114
- * @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
115
104
  * @returns The accepted signature in each typed slot, when present.
116
105
  * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
117
106
  * @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
@@ -132,11 +121,9 @@ function selectRequirementSignatures(signatures, accepts) {
132
121
  const permits = signatures.filter(isPermitSignature);
133
122
  const permit2Transfers = signatures.filter(isPermit2SignatureTransferSignature);
134
123
  const authorizations = signatures.filter(isAuthorizationSignature);
135
- const midnightOfferRoots = signatures.filter(isMidnightOfferRootSignature);
136
124
  const unsupported = signatures.find((signature) => !isPermitSignature(signature) &&
137
125
  !isPermit2SignatureTransferSignature(signature) &&
138
- !isAuthorizationSignature(signature) &&
139
- !isMidnightOfferRootSignature(signature));
126
+ !isAuthorizationSignature(signature));
140
127
  if (unsupported != null)
141
128
  throw new error_js_1.UnsupportedRequirementSignatureError(unsupported.action.type);
142
129
  if (!accepts.permit && permits.length > 0)
@@ -145,20 +132,15 @@ function selectRequirementSignatures(signatures, accepts) {
145
132
  throw new error_js_1.UnexpectedRequirementSignatureError("permit2SignatureTransfer");
146
133
  if (!accepts.authorization && authorizations.length > 0)
147
134
  throw new error_js_1.UnexpectedRequirementSignatureError("authorization");
148
- if (!accepts.midnightOfferRoot && midnightOfferRoots.length > 0)
149
- throw new error_js_1.UnexpectedRequirementSignatureError("midnightOfferRootSignature");
150
135
  if (permits.length > 1)
151
136
  throw new error_js_1.AmbiguousRequirementSignaturesError("permit", permits.length);
152
137
  if (permit2Transfers.length > 1)
153
138
  throw new error_js_1.AmbiguousRequirementSignaturesError("permit2SignatureTransfer", permit2Transfers.length);
154
139
  if (authorizations.length > 1)
155
140
  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
141
  return {
159
142
  permit: permits[0],
160
143
  permit2SignatureTransfer: permit2Transfers[0],
161
144
  authorization: authorizations[0],
162
- midnightOfferRoot: midnightOfferRoots[0],
163
145
  };
164
146
  }
@@ -500,7 +500,8 @@ export declare class BundlesPermitMismatchError extends Error {
500
500
  /**
501
501
  * @param params - Permit mismatch values used to explain the rejection.
502
502
  * @param params.field - Permit field that does not match the exit.
503
- * @param params.expected - Value required by the exit.
503
+ * @param params.expected - Value required by the exit. For `field: "amount"` on an
504
+ * operation that accepts a range of permit amounts, an inclusive `"[min, max]"` range.
504
505
  * @param params.actual - Value supplied by the signature.
505
506
  * @param params.cause - Original parser failure when signature decoding is wrapped.
506
507
  */
@@ -632,7 +633,7 @@ export declare class MaxRepayAssetsBelowRepayAssetsError extends Error {
632
633
  constructor(maxRepayAssets: bigint, repayAssets: bigint);
633
634
  }
634
635
  /** Requirement signature kind accepted by action-output transaction builders. */
635
- export type RequirementSignatureKind = "permit" | "permit2SignatureTransfer" | "authorization" | "midnightOfferRootSignature";
636
+ export type RequirementSignatureKind = "permit" | "permit2SignatureTransfer" | "authorization";
636
637
  /**
637
638
  * Thrown when `buildTx` receives more than one requirement signature of the same kind.
638
639
  *
@@ -709,11 +710,10 @@ export declare class UnsupportedErc20ApprovalSpenderError extends Error {
709
710
  readonly chainId: number;
710
711
  readonly permit2?: Address;
711
712
  readonly midnight?: Address;
712
- readonly midnightBundles?: Address;
713
713
  readonly supportedSpenders?: readonly (Address | undefined)[];
714
714
  });
715
715
  }
716
- /** Thrown when a Midnight authorization requirement targets an unsupported operator. */
716
+ /** Thrown when a Midnight authorization target (a requirement operator, or the ratifier that `midnightCancelAndMake` activates and MidnightBundlesV2 authorizes) is not registered for the chain. */
717
717
  export declare class UnsupportedMidnightAuthorizationTargetError extends Error {
718
718
  constructor(params: {
719
719
  readonly authorized: Address;
@@ -1027,12 +1027,19 @@ export declare class ReallocationAdapterSupplySharesUnderflowError extends Error
1027
1027
  readonly withdrawnShares: bigint;
1028
1028
  });
1029
1029
  }
1030
- /** Thrown when a Midnight amount exceeds the maximum offer-cap value accepted onchain. */
1031
- export declare class MidnightAmountExceedsMaxOfferCapError extends Error {
1030
+ /** Thrown when a Midnight batch cancellation has no offer groups. */
1031
+ export declare class EmptyMidnightGroupCancellationsError extends Error {
1032
+ constructor();
1033
+ }
1034
+ /** Thrown when a Midnight flow passes a collateral market with no collateral supplies. */
1035
+ export declare class EmptyMidnightCollateralSuppliesError extends Error {
1036
+ constructor();
1037
+ }
1038
+ /** Thrown when a Midnight batch cancellation lists the same offer group twice. */
1039
+ export declare class DuplicateMidnightGroupCancellationError extends Error {
1032
1040
  constructor(params: {
1033
- readonly label: string;
1034
- readonly amount: bigint;
1035
- readonly maxOfferCap: bigint;
1041
+ readonly index: number;
1042
+ readonly group: Hex;
1036
1043
  });
1037
1044
  }
1038
1045
  /** Thrown when a Midnight flow needs at least one takeable offer. */
@@ -1047,6 +1054,12 @@ export declare class MidnightOfferSideMismatchError extends Error {
1047
1054
  actualBuy: boolean;
1048
1055
  });
1049
1056
  }
1057
+ /** Thrown when a Midnight maker method that is not a limit exit receives a reduce-only offer. */
1058
+ export declare class MidnightOfferReduceOnlyError extends Error {
1059
+ constructor(params: {
1060
+ readonly index: number;
1061
+ });
1062
+ }
1050
1063
  /** Thrown when a Midnight maker offer belongs to a different account than the action flow. */
1051
1064
  export declare class MidnightOfferMakerMismatchError extends Error {
1052
1065
  constructor(params: {
@@ -1055,6 +1068,74 @@ export declare class MidnightOfferMakerMismatchError extends Error {
1055
1068
  readonly actualMaker: Address;
1056
1069
  });
1057
1070
  }
1071
+ /** Thrown when a Midnight maker offer sets a nonzero continuous fee cap. */
1072
+ export declare class MidnightOfferContinuousFeeCapError extends Error {
1073
+ /** Offer index in the maker tree. */
1074
+ readonly index: number;
1075
+ /** Continuous fee cap supplied on the offer. */
1076
+ readonly continuousFeeCap: bigint;
1077
+ /**
1078
+ * @param params - Offer index and rejected fee cap.
1079
+ * @param params.index - Offer index in the maker tree.
1080
+ * @param params.continuousFeeCap - Continuous fee cap supplied on the offer.
1081
+ */
1082
+ constructor(params: {
1083
+ readonly index: number;
1084
+ readonly continuousFeeCap: bigint;
1085
+ });
1086
+ }
1087
+ /** Thrown when a Midnight sell offer routes its seller proceeds to another address. */
1088
+ export declare class MidnightOfferSellerReceiverMismatchError extends Error {
1089
+ /** Offer index in the maker tree. */
1090
+ readonly index: number;
1091
+ /** Offer maker, which must receive seller proceeds. */
1092
+ readonly expectedReceiver: Address;
1093
+ /** Seller receiver supplied on the offer. */
1094
+ readonly actualReceiver: Address;
1095
+ /**
1096
+ * @param params - Offer index and expected and actual seller receivers.
1097
+ * @param params.index - Offer index in the maker tree.
1098
+ * @param params.expectedReceiver - Offer maker, which must receive seller proceeds.
1099
+ * @param params.actualReceiver - Seller receiver supplied on the offer.
1100
+ */
1101
+ constructor(params: {
1102
+ readonly index: number;
1103
+ readonly expectedReceiver: Address;
1104
+ readonly actualReceiver: Address;
1105
+ });
1106
+ }
1107
+ /** Thrown when a Midnight taker flow uses an unbounded target or deadline. */
1108
+ export declare class UnboundedMidnightTakeInputError extends Error {
1109
+ readonly field: "target.units" | "target.maxBuyerAssets" | "target.maxUnits" | "deadline";
1110
+ /**
1111
+ * @param field - Target or deadline input set to `maxUint256`.
1112
+ */
1113
+ constructor(field: "target.units" | "target.maxBuyerAssets" | "target.maxUnits" | "deadline");
1114
+ }
1115
+ /** Thrown when a Midnight taker flow uses a zero address as its receiver. */
1116
+ export declare class MidnightZeroReceiverError extends Error {
1117
+ readonly field: "receiver";
1118
+ /**
1119
+ * @param field - Receiver field containing the zero address.
1120
+ */
1121
+ constructor(field: "receiver");
1122
+ }
1123
+ /** Thrown when a Midnight take deadline is more than one hour from the current time. */
1124
+ export declare class MidnightTakeDeadlineTooFarError extends Error {
1125
+ /** Deadline supplied by the caller. */
1126
+ readonly deadline: bigint;
1127
+ /** Accepted maximum deadline. */
1128
+ readonly maxDeadline: bigint;
1129
+ /**
1130
+ * @param params - Supplied deadline and accepted maximum.
1131
+ * @param params.deadline - Deadline supplied by the caller.
1132
+ * @param params.maxDeadline - Latest accepted deadline.
1133
+ */
1134
+ constructor(params: {
1135
+ readonly deadline: bigint;
1136
+ readonly maxDeadline: bigint;
1137
+ });
1138
+ }
1058
1139
  /** Thrown when a Midnight maker offer targets a different chain than the action flow. */
1059
1140
  export declare class MidnightOfferMarketChainMismatchError extends Error {
1060
1141
  constructor(params: {
@@ -1086,58 +1167,57 @@ export declare class MidnightOfferMarketLoanTokenMismatchError extends Error {
1086
1167
  readonly actualLoanToken: Address;
1087
1168
  });
1088
1169
  }
1089
- /** Thrown when a quoted Midnight takeable offer belongs to a different market than the requested flow. */
1090
- export declare class MidnightTakeableOfferMarketMismatchError extends Error {
1170
+ /** Thrown when a Blue-funded Midnight lend offer does not use the maker's derived `BlueBuyCallback`. */
1171
+ export declare class MidnightOfferCallbackMismatchError extends Error {
1091
1172
  constructor(params: {
1092
- index: number;
1093
- expectedMarket: string;
1094
- actualMarket: string;
1173
+ readonly index: number;
1174
+ readonly expectedCallback: Address;
1175
+ readonly actualCallback: Address;
1095
1176
  });
1096
1177
  }
1097
- /** Thrown when a Midnight offer tree uses an unsupported ratifier address. */
1098
- export declare class UnknownMidnightRatifierError extends Error {
1178
+ /** Thrown when a Blue-funded Midnight lend offer's callback data is not the ABI-encoded Blue market. */
1179
+ export declare class MidnightOfferCallbackDataMismatchError extends Error {
1099
1180
  constructor(params: {
1100
- ratifier: Address;
1101
- ecrecoverRatifier: Address;
1102
- setterRatifier: Address;
1181
+ readonly index: number;
1182
+ readonly expectedCallbackData: Hex;
1183
+ readonly actualCallbackData: Hex;
1103
1184
  });
1104
1185
  }
1105
- /** Thrown when a Midnight Ecrecover maker flow builds the submit transaction before signing. */
1106
- export declare class MissingMidnightOfferRootSignatureError extends Error {
1107
- constructor();
1186
+ /** Thrown when loan assets would be parked in a Morpho Blue market with no existing supply. */
1187
+ export declare class EmptyBlueParkingMarketError extends Error {
1188
+ constructor(params: {
1189
+ readonly marketId: MarketId;
1190
+ });
1108
1191
  }
1109
- /** Thrown when a Midnight offer-root signature does not match the prepared tree root. */
1110
- export declare class MidnightOfferRootMismatchError extends Error {
1192
+ /** Thrown when parked assets would mint no Morpho Blue supply shares. */
1193
+ export declare class ZeroBlueParkingSharesError extends Error {
1111
1194
  constructor(params: {
1112
- expectedRoot: string;
1113
- actualRoot: string;
1195
+ readonly marketId: MarketId;
1196
+ readonly assets: bigint;
1114
1197
  });
1115
1198
  }
1116
- /** Thrown when a Midnight offer-root signature was produced by another maker account. */
1117
- export declare class MidnightOfferRootOwnerMismatchError extends Error {
1199
+ /** Thrown when a quoted Midnight takeable offer belongs to a different market than the requested flow. */
1200
+ export declare class MidnightTakeableOfferMarketMismatchError extends Error {
1118
1201
  constructor(params: {
1119
- expectedOwner: Address;
1120
- actualOwner: Address;
1202
+ index: number;
1203
+ expectedMarket: string;
1204
+ actualMarket: string;
1121
1205
  });
1122
1206
  }
1123
- /** Thrown when a Midnight offer-root signature targets another ratifier. */
1124
- export declare class MidnightOfferRootRatifierMismatchError extends Error {
1207
+ /** Thrown when a Midnight offer's ratifier does not match its tree's ratifier route. */
1208
+ export declare class MidnightOfferRatifierMismatchError extends Error {
1125
1209
  constructor(params: {
1210
+ index: number;
1126
1211
  expectedRatifier: Address;
1127
1212
  actualRatifier: Address;
1128
1213
  });
1129
1214
  }
1130
- /** Thrown when a Midnight offer-root signature was produced for another offer count. */
1131
- export declare class MidnightOfferRootOfferCountMismatchError extends Error {
1215
+ /** Thrown when a Midnight repost cancels a group it also publishes. */
1216
+ export declare class MidnightReplacementGroupCancelledError extends Error {
1132
1217
  constructor(params: {
1133
- expectedOffers: number;
1134
- actualOffers: number;
1218
+ readonly group: Hex;
1135
1219
  });
1136
1220
  }
1137
- /** Thrown when a Midnight offer-root signature carries no encoded payload. */
1138
- export declare class UnpreparedMidnightOfferRootSignatureError extends Error {
1139
- constructor();
1140
- }
1141
1221
  /** Thrown when a Midnight redeem flow finds no credit units for the user. */
1142
1222
  export declare class NoMidnightCreditToRedeemError extends Error {
1143
1223
  constructor(market: string);
@@ -1209,3 +1289,9 @@ export declare class RefinanceSameMarketError extends Error {
1209
1289
  export declare class RefinanceTokenMismatchError extends Error {
1210
1290
  constructor(sourceMarket: string, targetMarket: string);
1211
1291
  }
1292
+ /** Thrown when a maker limit-exit offer can increase or open a position. */
1293
+ export declare class MidnightOfferNotReduceOnlyError extends Error {
1294
+ constructor(params: {
1295
+ readonly index: number;
1296
+ });
1297
+ }