@morpho-org/morpho-sdk 9.7.0 → 10.0.0-next.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 (185) hide show
  1. package/MIGRATION-v9-to-v10.md +114 -0
  2. package/README.md +5 -1
  3. package/lib/cjs/abis.d.ts +1 -1
  4. package/lib/cjs/abis.js +5 -1
  5. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +3 -4
  6. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +1 -1
  7. package/lib/cjs/actions/midnight/cancelAndMake.d.ts +2 -1
  8. package/lib/cjs/actions/midnight/cancelAndMake.js +2 -1
  9. package/lib/cjs/actions/midnight/cancelOffers.d.ts +54 -0
  10. package/lib/cjs/actions/midnight/cancelOffers.js +107 -0
  11. package/lib/cjs/actions/midnight/index.d.ts +1 -0
  12. package/lib/cjs/actions/midnight/index.js +1 -0
  13. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +1 -1
  14. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +1 -1
  15. package/lib/cjs/actions/midnight/takeBorrow.d.ts +1 -1
  16. package/lib/cjs/actions/midnight/takeBorrow.js +1 -1
  17. package/lib/cjs/actions/midnight/takeLend.d.ts +1 -1
  18. package/lib/cjs/actions/midnight/takeLend.js +1 -1
  19. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -1
  20. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +1 -1
  21. package/lib/cjs/actions/midnight/takeWithdraw.d.ts +1 -1
  22. package/lib/cjs/actions/midnight/takeWithdraw.js +1 -1
  23. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -4
  24. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -1
  25. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +4 -6
  26. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +3 -3
  27. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +4 -6
  28. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +3 -3
  29. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -6
  30. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +3 -2
  31. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +3 -5
  32. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +26 -23
  33. package/lib/cjs/blue/abis.d.ts +1 -1
  34. package/lib/cjs/blue/abis.js +5 -1
  35. package/lib/cjs/blue/entities.d.ts +4 -4
  36. package/lib/cjs/blue/entities.js +3 -1
  37. package/lib/cjs/blue/errors.d.ts +2 -2
  38. package/lib/cjs/blue/errors.js +5 -1
  39. package/lib/cjs/blue/fetch.d.ts +2 -2
  40. package/lib/cjs/blue/fetch.js +3 -1
  41. package/lib/cjs/blue/utils.d.ts +1 -1
  42. package/lib/cjs/blue/utils.js +2 -1
  43. package/lib/cjs/entities/blue/blue.d.ts +34 -28
  44. package/lib/cjs/entities/blue/blue.js +99 -73
  45. package/lib/cjs/entities/index.d.ts +4 -4
  46. package/lib/cjs/entities/index.js +3 -1
  47. package/lib/cjs/entities/midnight/deadline.d.ts +2 -2
  48. package/lib/cjs/entities/midnight/deadline.js +2 -2
  49. package/lib/cjs/entities/midnight/midnight.d.ts +49 -51
  50. package/lib/cjs/entities/midnight/midnight.js +144 -131
  51. package/lib/cjs/entities/midnight/publication.d.ts +2 -0
  52. package/lib/cjs/entities/midnight/publication.js +126 -100
  53. package/lib/cjs/entities/midnight/types.d.ts +4 -4
  54. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +3 -5
  55. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +17 -17
  56. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +3 -4
  57. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +1 -1
  58. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +12 -12
  59. package/lib/cjs/entities/vaultV1/vaultV1.js +83 -57
  60. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +50 -24
  61. package/lib/cjs/entities/vaultV2/vaultV2.js +166 -90
  62. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +17 -2
  63. package/lib/cjs/entities/vaultV2BlueReallocationData.js +1410 -806
  64. package/lib/cjs/errors.d.ts +4 -4
  65. package/lib/cjs/errors.js +7 -5
  66. package/lib/cjs/fetch.d.ts +2 -2
  67. package/lib/cjs/fetch.js +3 -1
  68. package/lib/cjs/helpers/deadShares.js +55 -34
  69. package/lib/cjs/helpers/metadata.d.ts +14 -2
  70. package/lib/cjs/helpers/metadata.js +39 -4
  71. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +34 -22
  72. package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +7 -1
  73. package/lib/cjs/helpers/validate.js +76 -61
  74. package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +154 -103
  75. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +31 -20
  76. package/lib/cjs/index.d.ts +1 -0
  77. package/lib/cjs/index.js +3 -1
  78. package/lib/cjs/midnight/errors.d.ts +2 -1
  79. package/lib/cjs/midnight/errors.js +5 -4
  80. package/lib/cjs/transactionPlan/plan.js +6 -3
  81. package/lib/cjs/transactionPlan/serde.js +7 -7
  82. package/lib/cjs/transactionPlan/vaultv2/deposit.d.ts +6 -4
  83. package/lib/cjs/transactionPlan/vaultv2/deposit.js +5 -3
  84. package/lib/cjs/transactionPlan/vaultv2/withdraw.d.ts +6 -4
  85. package/lib/cjs/transactionPlan/vaultv2/withdraw.js +5 -3
  86. package/lib/cjs/types/action.d.ts +26 -2
  87. package/lib/cjs/types/action.js +1 -1
  88. package/lib/cjs/types/error.js +11 -5
  89. package/lib/cjs/types/metadata.d.ts +12 -2
  90. package/lib/cjs/utils.d.ts +2 -2
  91. package/lib/cjs/utils.js +4 -2
  92. package/lib/cjs/version.d.ts +2 -0
  93. package/lib/cjs/version.js +6 -0
  94. package/lib/esm/abis.d.ts +1 -1
  95. package/lib/esm/abis.js +1 -1
  96. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +3 -4
  97. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +1 -1
  98. package/lib/esm/actions/midnight/cancelAndMake.d.ts +2 -1
  99. package/lib/esm/actions/midnight/cancelAndMake.js +2 -1
  100. package/lib/esm/actions/midnight/cancelOffers.d.ts +54 -0
  101. package/lib/esm/actions/midnight/cancelOffers.js +103 -0
  102. package/lib/esm/actions/midnight/index.d.ts +1 -0
  103. package/lib/esm/actions/midnight/index.js +1 -0
  104. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +1 -1
  105. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +1 -1
  106. package/lib/esm/actions/midnight/takeBorrow.d.ts +1 -1
  107. package/lib/esm/actions/midnight/takeBorrow.js +1 -1
  108. package/lib/esm/actions/midnight/takeLend.d.ts +1 -1
  109. package/lib/esm/actions/midnight/takeLend.js +1 -1
  110. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -1
  111. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +1 -1
  112. package/lib/esm/actions/midnight/takeWithdraw.d.ts +1 -1
  113. package/lib/esm/actions/midnight/takeWithdraw.js +1 -1
  114. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -4
  115. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -1
  116. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +4 -6
  117. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +3 -3
  118. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -6
  119. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +3 -3
  120. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -6
  121. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +3 -2
  122. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +3 -5
  123. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +26 -23
  124. package/lib/esm/blue/abis.d.ts +1 -1
  125. package/lib/esm/blue/abis.js +1 -1
  126. package/lib/esm/blue/entities.d.ts +4 -4
  127. package/lib/esm/blue/entities.js +2 -2
  128. package/lib/esm/blue/errors.d.ts +2 -2
  129. package/lib/esm/blue/errors.js +2 -2
  130. package/lib/esm/blue/fetch.d.ts +2 -2
  131. package/lib/esm/blue/fetch.js +2 -2
  132. package/lib/esm/blue/utils.d.ts +1 -1
  133. package/lib/esm/blue/utils.js +1 -1
  134. package/lib/esm/entities/blue/blue.d.ts +34 -28
  135. package/lib/esm/entities/blue/blue.js +99 -73
  136. package/lib/esm/entities/index.d.ts +4 -4
  137. package/lib/esm/entities/index.js +2 -2
  138. package/lib/esm/entities/midnight/deadline.d.ts +2 -2
  139. package/lib/esm/entities/midnight/deadline.js +2 -2
  140. package/lib/esm/entities/midnight/midnight.d.ts +49 -51
  141. package/lib/esm/entities/midnight/midnight.js +145 -132
  142. package/lib/esm/entities/midnight/publication.d.ts +2 -0
  143. package/lib/esm/entities/midnight/publication.js +126 -100
  144. package/lib/esm/entities/midnight/types.d.ts +4 -4
  145. package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +3 -5
  146. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +17 -17
  147. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +3 -4
  148. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +1 -1
  149. package/lib/esm/entities/vaultV1/vaultV1.d.ts +12 -12
  150. package/lib/esm/entities/vaultV1/vaultV1.js +83 -57
  151. package/lib/esm/entities/vaultV2/vaultV2.d.ts +50 -24
  152. package/lib/esm/entities/vaultV2/vaultV2.js +166 -90
  153. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +17 -2
  154. package/lib/esm/entities/vaultV2BlueReallocationData.js +1410 -806
  155. package/lib/esm/errors.d.ts +4 -4
  156. package/lib/esm/errors.js +4 -4
  157. package/lib/esm/fetch.d.ts +2 -2
  158. package/lib/esm/fetch.js +2 -2
  159. package/lib/esm/helpers/deadShares.js +56 -35
  160. package/lib/esm/helpers/metadata.d.ts +14 -2
  161. package/lib/esm/helpers/metadata.js +38 -4
  162. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +34 -22
  163. package/lib/esm/helpers/previewVaultV2InKindRedeem.js +7 -1
  164. package/lib/esm/helpers/validate.js +76 -61
  165. package/lib/esm/helpers/validateMidnightTakeFeasibility.js +153 -102
  166. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +31 -20
  167. package/lib/esm/index.d.ts +1 -0
  168. package/lib/esm/index.js +1 -0
  169. package/lib/esm/midnight/errors.d.ts +2 -1
  170. package/lib/esm/midnight/errors.js +2 -1
  171. package/lib/esm/transactionPlan/plan.js +6 -3
  172. package/lib/esm/transactionPlan/serde.js +7 -7
  173. package/lib/esm/transactionPlan/vaultv2/deposit.d.ts +6 -4
  174. package/lib/esm/transactionPlan/vaultv2/deposit.js +5 -3
  175. package/lib/esm/transactionPlan/vaultv2/withdraw.d.ts +6 -4
  176. package/lib/esm/transactionPlan/vaultv2/withdraw.js +5 -3
  177. package/lib/esm/types/action.d.ts +26 -2
  178. package/lib/esm/types/action.js +1 -1
  179. package/lib/esm/types/error.js +11 -5
  180. package/lib/esm/types/metadata.d.ts +12 -2
  181. package/lib/esm/utils.d.ts +2 -2
  182. package/lib/esm/utils.js +2 -2
  183. package/lib/esm/version.d.ts +2 -0
  184. package/lib/esm/version.js +3 -0
  185. package/package.json +8 -7
@@ -1,7 +1,7 @@
1
1
  import { type AccrualPosition, type Market, type MidnightFetchParams } from "@morpho-org/midnight-sdk";
2
2
  import { type Address, type Hex } from "viem";
3
3
  import type { MorphoClientType } from "../../types/client.js";
4
- import { type MidnightCancelAndMakeAction, type MidnightGroupCancellation, type MidnightRedeemAction, type MidnightRepayWithdrawCollateralAction, type MidnightSupplyCollateralAction, type MidnightSupplyCollateralBatchAction, type MidnightSupplyCollateralTakeBorrowAction, type MidnightTakeBorrowAction, type MidnightTakeLendAction, type MidnightTakeRepayWithdrawCollateralAction, type MidnightTakeWithdrawAction, type MidnightWithdrawCollateralAction, type MidnightWithdrawCollateralBatchAction } from "../../types/index.js";
4
+ import { type MidnightCancelOffersAction, type MidnightRedeemAction, type MidnightRepayWithdrawCollateralAction, type MidnightSupplyCollateralAction, type MidnightSupplyCollateralBatchAction, type MidnightSupplyCollateralTakeBorrowAction, type MidnightTakeBorrowAction, type MidnightTakeLendAction, type MidnightTakeRepayWithdrawCollateralAction, type MidnightTakeWithdrawAction, type MidnightWithdrawCollateralAction, type MidnightWithdrawCollateralBatchAction, type ReferenceTimestampParams } from "../../types/index.js";
5
5
  import type { GetOffersDataParams, GetPositionDataParams, MakeLendParams, MakeOffersOutput, MakeOffersParams, MidnightActionOutput, OffersData, RedeemParams, RepayWithdrawCollateralParams, SupplyBlueMakeLendParams, SupplyCollateralBatchParams, SupplyCollateralMakeBorrowParams, SupplyCollateralParams, SupplyCollateralTakeBorrowParams, TakeBorrowParams, TakeLendParams, TakeRepayWithdrawCollateralParams, TakeWithdrawParams, WithdrawCollateralBatchParams, WithdrawCollateralParams } from "./types.js";
6
6
  /**
7
7
  * Entity methods exposed by `client.morpho.midnight(chainId)`.
@@ -24,7 +24,8 @@ import type { GetOffersDataParams, GetPositionDataParams, MakeLendParams, MakeOf
24
24
  * target: { type: "assets", assets: 1_000_000n, minUnits: 900_000n },
25
25
  * takeableOffers: quote.data.takeableOffers,
26
26
  * maxContinuousFee: maxUint256,
27
- * deadline: Time.timestamp() + 600n,
27
+ * now: (await client.getBlock()).timestamp,
28
+ * deadline: (await client.getBlock()).timestamp + 600n,
28
29
  * });
29
30
  * const requirements = await output.getRequirements();
30
31
  * const tx = output.buildTx();
@@ -218,7 +219,8 @@ export declare class MorphoMidnight {
218
219
  * target: { type: "assets", assets: 1_000_000n, minUnits: 900_000n },
219
220
  * takeableOffers: quote.data.takeableOffers,
220
221
  * maxContinuousFee: maxUint256,
221
- * deadline: Time.timestamp() + 600n,
222
+ * now: (await client.getBlock()).timestamp,
223
+ * deadline: (await client.getBlock()).timestamp + 600n,
222
224
  * });
223
225
  * ```
224
226
  */
@@ -313,7 +315,8 @@ export declare class MorphoMidnight {
313
315
  * collateralPrices,
314
316
  * target: { type: "assets", assets: 1_000_000n, maxUnits: 1_100_000n },
315
317
  * takeableOffers: quote.data.takeableOffers,
316
- * deadline: Time.timestamp() + 600n,
318
+ * now: (await client.getBlock()).timestamp,
319
+ * deadline: (await client.getBlock()).timestamp + 600n,
317
320
  * });
318
321
  * ```
319
322
  */
@@ -382,7 +385,8 @@ export declare class MorphoMidnight {
382
385
  * marketData,
383
386
  * target: { type: "units", units: credit, minSellerAssets: 990_000n },
384
387
  * takeableOffers: quote.data.takeableOffers,
385
- * deadline: Time.timestamp() + 600n,
388
+ * now: (await client.getBlock()).timestamp,
389
+ * deadline: (await client.getBlock()).timestamp + 600n,
386
390
  * });
387
391
  * ```
388
392
  */
@@ -478,7 +482,8 @@ export declare class MorphoMidnight {
478
482
  * collateralSupplies: [{ collateralIndex: 0n, assets: 2_000_000n }],
479
483
  * target: { type: "assets", assets: 1_000_000n, maxUnits: 1_100_000n },
480
484
  * takeableOffers: quote.data.takeableOffers,
481
- * deadline: Time.timestamp() + 600n,
485
+ * now: (await client.getBlock()).timestamp,
486
+ * deadline: (await client.getBlock()).timestamp + 600n,
482
487
  * });
483
488
  * ```
484
489
  */
@@ -586,7 +591,8 @@ export declare class MorphoMidnight {
586
591
  * repayEnabled: true,
587
592
  * collateralWithdrawals: [{ collateralIndex: 0n, assets: maxUint256 }],
588
593
  * maxContinuousFee: maxUint256,
589
- * deadline: Time.timestamp() + 600n,
594
+ * now: (await client.getBlock()).timestamp,
595
+ * deadline: (await client.getBlock()).timestamp + 600n,
590
596
  * });
591
597
  * ```
592
598
  */
@@ -805,7 +811,7 @@ export declare class MorphoMidnight {
805
811
  * @throws {MidnightMarketLiquidationCursorNotEnabledError} when an uncreated market uses a disabled liquidation cursor.
806
812
  * @throws {MidnightMarketOracleWithoutCodeError} when an uncreated market's oracle has no code.
807
813
  * @throws {viem.BaseError} when a pinned block, contract, or oracle-code read fails.
808
- * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
814
+ * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
809
815
  * @example
810
816
  * ```ts
811
817
  * const output = await midnight.makeLend({
@@ -870,7 +876,7 @@ export declare class MorphoMidnight {
870
876
  * @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
871
877
  * @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
872
878
  * @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
873
- * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
879
+ * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
874
880
  * @example
875
881
  * ```ts
876
882
  * const output = await midnight.makeBorrow({
@@ -973,7 +979,7 @@ export declare class MorphoMidnight {
973
979
  * @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
974
980
  * @throws {InvalidMidnightHexInputError} when a cancellation group or `callbackSalt` is not 32-byte hex.
975
981
  * @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
976
- * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
982
+ * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
977
983
  * @example
978
984
  * ```ts
979
985
  * const callback = getMidnightBlueBuyCallbackAddress({ chainId, owner: maker, salt: callbackSalt });
@@ -1050,7 +1056,7 @@ export declare class MorphoMidnight {
1050
1056
  * @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
1051
1057
  * @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
1052
1058
  * @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
1053
- * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
1059
+ * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
1054
1060
  * @example
1055
1061
  * ```ts
1056
1062
  * const output = await midnight.makeWithdraw({
@@ -1124,7 +1130,7 @@ export declare class MorphoMidnight {
1124
1130
  * @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
1125
1131
  * @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
1126
1132
  * @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
1127
- * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
1133
+ * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
1128
1134
  * @example
1129
1135
  * ```ts
1130
1136
  * const output = await midnight.makeRepay({
@@ -1207,7 +1213,7 @@ export declare class MorphoMidnight {
1207
1213
  * @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
1208
1214
  * @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
1209
1215
  * @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
1210
- * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
1216
+ * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
1211
1217
  * @example
1212
1218
  * ```ts
1213
1219
  * const output = await midnight.supplyCollateralMakeBorrow({
@@ -1326,7 +1332,7 @@ export declare class MorphoMidnight {
1326
1332
  * during this method call, before the lazy output is returned.
1327
1333
  * @throws {MidnightContractReceiverError} when `collateralReceiver` is a Midnight protocol
1328
1334
  * contract or a market token contract.
1329
- * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
1335
+ * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
1330
1336
  * @example
1331
1337
  * ```ts
1332
1338
  * // Close the position: repay all debt, withdraw all collateral.
@@ -1343,42 +1349,37 @@ export declare class MorphoMidnight {
1343
1349
  */
1344
1350
  repayWithdrawCollateral(params: RepayWithdrawCollateralParams): MidnightActionOutput<MidnightRepayWithdrawCollateralAction>;
1345
1351
  /**
1346
- * Prepares guarded cancellation of several maker offer groups through `MidnightBundlesV2`.
1352
+ * Prepares a full cancellation of one or more maker offer groups as a direct call to Midnight.
1347
1353
  *
1348
- * The transaction reverts as a whole when any group's consumption exceeds its
1349
- * `maxConsumed` ceiling, so fills landing before execution never leave a partial cancel.
1354
+ * One group builds a bare `setConsumed(group, maxUint128, accountAddress)`. Two or more groups
1355
+ * build one Midnight `multicall` of such calls, in list order, which cancels every group or
1356
+ * none. Only the single-group transaction is matchable by a wallet policy that allows
1357
+ * `setConsumed` by method name; cancel one group per transaction when the signer's policy names
1358
+ * `setConsumed`.
1350
1359
  *
1351
- * @param params - Maker account, groups with consumption ceilings, and deadline.
1352
- * @param params.accountAddress - Maker that must send the transaction. It is used only to check
1353
- * the maker's Midnight authorization of `MidnightBundlesV2`; the bundle cancels the groups of
1354
- * `msg.sender`. A transaction sent from another account that has also authorized
1355
- * `MidnightBundlesV2` does not revert: it cancels that account's groups and leaves the maker's
1356
- * offers fillable.
1357
- * @param params.cancellations - Offer groups and the largest consumption accepted for each.
1358
- * To cancel unconditionally, set `maxConsumed` to `maxUint128`; the contract treats
1359
- * `type(uint128).max` as no limit.
1360
- * Cancellation is per group: it does not unratify roots or revoke
1361
- * `MidnightBundlesV2` or ratifier authorization.
1362
- * @param params.deadline - Bundle execution deadline timestamp.
1363
- * @returns Lazy Midnight authorization requirement for `MidnightBundlesV2` and a synchronous transaction builder.
1364
- * @throws {ChainIdMismatchError} when the client targets another chain, or from
1365
- * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
1366
- * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as an out-of-range integer.
1367
- * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
1368
- * RPC read fails.
1369
- * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
1370
- * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` deployment.
1371
- * @throws {EmptyMidnightGroupCancellationsError} when no groups are provided.
1360
+ * Nothing is required before sending: no Midnight authorization, approval, signature or
1361
+ * deadline. Cancellation is per group and always full; it does not unratify roots or revoke
1362
+ * authorizations, and cancelling a group again succeeds.
1363
+ *
1364
+ * @param params - Maker account and the offer groups to cancel.
1365
+ * @param params.accountAddress - Maker whose groups are cancelled. The maker, or an operator it
1366
+ * authorized on Midnight, must send the transaction; a transaction from any other account
1367
+ * reverts `Unauthorized()` and changes no group.
1368
+ * @param params.groups - Nonempty list of distinct 32-byte offer groups to cancel.
1369
+ * @param params.now - Optional reference timestamp used to resolve `metadata.timestamp: true`.
1370
+ * @returns A handle whose `getRequirements()` resolves to an empty list without reading the
1371
+ * chain, and whose synchronous `buildTx()` returns the transaction targeting `Midnight`.
1372
+ * @throws {ChainIdMismatchError} when the client targets another chain.
1372
1373
  * @throws {MidnightInvalidAccountAddressError} when `accountAddress` is malformed or zero.
1373
- * @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
1374
+ * @throws {EmptyMidnightGroupCancellationsError} when no groups are provided.
1375
+ * @throws {InvalidMidnightHexInputError} when a group is not 32-byte hex.
1374
1376
  * @throws {DuplicateMidnightGroupCancellationError} when a group appears more than once.
1375
- * @throws {NegativeInputError} when a `maxConsumed` ceiling is negative.
1376
- * @throws {InputExceedsMaxError} when `deadline` exceeds `uint256` or a `maxConsumed` ceiling exceeds `uint128`.
1377
- * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
1377
+ * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
1378
+ * @throws {UnknownAddressError} when the chain has no `midnight` deployment.
1378
1379
  * @example
1379
1380
  * ```ts
1380
1381
  * import { morphoViemExtension } from "@morpho-org/morpho-sdk";
1381
- * import { createPublicClient, http, maxUint256, type Address, type Hex } from "viem";
1382
+ * import { createPublicClient, http, type Address, type Hex } from "viem";
1382
1383
  * import { base } from "viem/chains";
1383
1384
  *
1384
1385
  * declare const maker: Address;
@@ -1387,17 +1388,14 @@ export declare class MorphoMidnight {
1387
1388
  * morphoViemExtension(),
1388
1389
  * );
1389
1390
  * const midnight = client.morpho.midnight(base.id);
1390
- * const output = midnight.cancelOffers({
1391
- * accountAddress: maker,
1392
- * cancellations: [{ group, maxConsumed: 0n }],
1393
- * deadline: maxUint256,
1394
- * });
1391
+ * const output = midnight.cancelOffers({ accountAddress: maker, groups: [group] });
1392
+ * await output.getRequirements(); // => []
1393
+ * const tx = output.buildTx(); // calldata: setConsumed(group, maxUint128, maker)
1395
1394
  * ```
1396
1395
  */
1397
1396
  cancelOffers(params: {
1398
1397
  readonly accountAddress: Address;
1399
- readonly cancellations: readonly MidnightGroupCancellation[];
1400
- readonly deadline: bigint;
1401
- }): MidnightActionOutput<MidnightCancelAndMakeAction>;
1398
+ readonly groups: readonly Hex[];
1399
+ } & ReferenceTimestampParams): MidnightActionOutput<MidnightCancelOffersAction>;
1402
1400
  private getBundlesV2AuthorizationRequirements;
1403
1401
  }