@morpho-org/morpho-sdk 8.3.0 → 9.1.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 (203) hide show
  1. package/MIGRATION-v8-to-v9.md +54 -0
  2. package/README.md +13 -7
  3. package/lib/cjs/abis.d.ts +1 -1
  4. package/lib/cjs/abis.js +5 -1
  5. package/lib/cjs/actions/bundles/common.d.ts +4 -7
  6. package/lib/cjs/actions/bundles/common.js +8 -14
  7. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -5
  8. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +1 -8
  9. package/lib/cjs/actions/midnight/authorization.d.ts +3 -1
  10. package/lib/cjs/actions/midnight/authorization.js +11 -1
  11. package/lib/cjs/actions/midnight/cancelAndMake.d.ts +2 -0
  12. package/lib/cjs/actions/midnight/cancelAndMake.js +10 -2
  13. package/lib/cjs/actions/midnight/redeem.d.ts +3 -1
  14. package/lib/cjs/actions/midnight/redeem.js +9 -3
  15. package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +1 -0
  16. package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +7 -3
  17. package/lib/cjs/actions/midnight/supplyCollateral.d.ts +4 -1
  18. package/lib/cjs/actions/midnight/supplyCollateral.js +10 -3
  19. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +3 -1
  20. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +9 -3
  21. package/lib/cjs/actions/midnight/takeBorrow.d.ts +3 -1
  22. package/lib/cjs/actions/midnight/takeBorrow.js +9 -3
  23. package/lib/cjs/actions/midnight/takeLend.d.ts +1 -0
  24. package/lib/cjs/actions/midnight/takeLend.js +7 -2
  25. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -0
  26. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +8 -2
  27. package/lib/cjs/actions/midnight/takeWithdraw.d.ts +3 -1
  28. package/lib/cjs/actions/midnight/takeWithdraw.js +10 -3
  29. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +1 -5
  30. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +5 -7
  31. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +7 -11
  32. package/lib/cjs/actions/requirements/getRequirementsApproval.js +8 -15
  33. package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +5 -10
  34. package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +11 -8
  35. package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +2 -0
  36. package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +5 -0
  37. package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +1 -1
  38. package/lib/cjs/actions/vaultV1/inKindRedeem.js +1 -1
  39. package/lib/cjs/actions/vaultV1/withdraw.d.ts +4 -4
  40. package/lib/cjs/actions/vaultV1/withdraw.js +4 -4
  41. package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +1 -1
  42. package/lib/cjs/actions/vaultV2/forceWithdraw.js +1 -1
  43. package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +1 -1
  44. package/lib/cjs/actions/vaultV2/inKindRedeem.js +1 -1
  45. package/lib/cjs/actions/vaultV2/withdraw.d.ts +4 -4
  46. package/lib/cjs/actions/vaultV2/withdraw.js +4 -4
  47. package/lib/cjs/blue/abis.d.ts +1 -1
  48. package/lib/cjs/blue/abis.js +5 -1
  49. package/lib/cjs/blue/entities.d.ts +4 -4
  50. package/lib/cjs/blue/entities.js +3 -1
  51. package/lib/cjs/blue/errors.d.ts +2 -2
  52. package/lib/cjs/blue/errors.js +5 -1
  53. package/lib/cjs/blue/fetch.d.ts +2 -2
  54. package/lib/cjs/blue/fetch.js +3 -1
  55. package/lib/cjs/blue/utils.d.ts +1 -1
  56. package/lib/cjs/blue/utils.js +2 -1
  57. package/lib/cjs/entities/blue/blue.d.ts +2 -12
  58. package/lib/cjs/entities/blue/blue.js +0 -4
  59. package/lib/cjs/entities/index.d.ts +4 -4
  60. package/lib/cjs/entities/index.js +3 -1
  61. package/lib/cjs/entities/midnight/midnight.d.ts +63 -18
  62. package/lib/cjs/entities/midnight/midnight.js +138 -53
  63. package/lib/cjs/entities/midnight/types.d.ts +3 -10
  64. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +0 -4
  65. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +0 -7
  66. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -14
  67. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -20
  68. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +40 -37
  69. package/lib/cjs/entities/vaultV1/vaultV1.js +5 -34
  70. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +69 -43
  71. package/lib/cjs/entities/vaultV2/vaultV2.js +41 -35
  72. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +5 -3
  73. package/lib/cjs/entities/vaultV2BlueReallocationData.js +9 -3
  74. package/lib/cjs/errors.d.ts +4 -4
  75. package/lib/cjs/errors.js +10 -5
  76. package/lib/cjs/fetch.d.ts +2 -2
  77. package/lib/cjs/fetch.js +3 -1
  78. package/lib/cjs/helpers/encodeMidnightCalldata.d.ts +48 -0
  79. package/lib/cjs/helpers/encodeMidnightCalldata.js +74 -0
  80. package/lib/cjs/helpers/slippage.d.ts +9 -25
  81. package/lib/cjs/helpers/slippage.js +10 -27
  82. package/lib/cjs/helpers/validate.d.ts +1 -0
  83. package/lib/cjs/helpers/validate.js +5 -0
  84. package/lib/cjs/helpers/validateMidnightAccount.d.ts +34 -0
  85. package/lib/cjs/helpers/validateMidnightAccount.js +47 -0
  86. package/lib/cjs/helpers/validateMidnightAuthorizationTarget.d.ts +1 -0
  87. package/lib/cjs/helpers/validateMidnightAuthorizationTarget.js +4 -0
  88. package/lib/cjs/helpers/validateMidnightMarket.d.ts +2 -0
  89. package/lib/cjs/helpers/validateMidnightMarket.js +5 -0
  90. package/lib/cjs/helpers/validateMidnightPublication.d.ts +11 -0
  91. package/lib/cjs/helpers/validateMidnightPublication.js +12 -1
  92. package/lib/cjs/helpers/validateMidnightReceiver.d.ts +1 -0
  93. package/lib/cjs/helpers/validateMidnightReceiver.js +8 -0
  94. package/lib/cjs/helpers/validateTakeableOffers.d.ts +2 -1
  95. package/lib/cjs/helpers/validateTakeableOffers.js +4 -3
  96. package/lib/cjs/midnight/errors.d.ts +2 -1
  97. package/lib/cjs/midnight/errors.js +5 -4
  98. package/lib/cjs/types/action.d.ts +3 -1
  99. package/lib/cjs/types/error.d.ts +60 -6
  100. package/lib/cjs/types/error.js +143 -11
  101. package/lib/cjs/utils.d.ts +2 -2
  102. package/lib/cjs/utils.js +4 -2
  103. package/lib/esm/abis.d.ts +1 -1
  104. package/lib/esm/abis.js +1 -1
  105. package/lib/esm/actions/bundles/common.d.ts +4 -7
  106. package/lib/esm/actions/bundles/common.js +8 -14
  107. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -5
  108. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +2 -9
  109. package/lib/esm/actions/midnight/authorization.d.ts +3 -1
  110. package/lib/esm/actions/midnight/authorization.js +12 -2
  111. package/lib/esm/actions/midnight/cancelAndMake.d.ts +2 -0
  112. package/lib/esm/actions/midnight/cancelAndMake.js +11 -3
  113. package/lib/esm/actions/midnight/redeem.d.ts +3 -1
  114. package/lib/esm/actions/midnight/redeem.js +10 -4
  115. package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +1 -0
  116. package/lib/esm/actions/midnight/repayWithdrawCollateral.js +8 -4
  117. package/lib/esm/actions/midnight/supplyCollateral.d.ts +4 -1
  118. package/lib/esm/actions/midnight/supplyCollateral.js +11 -4
  119. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +3 -1
  120. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +10 -4
  121. package/lib/esm/actions/midnight/takeBorrow.d.ts +3 -1
  122. package/lib/esm/actions/midnight/takeBorrow.js +10 -4
  123. package/lib/esm/actions/midnight/takeLend.d.ts +1 -0
  124. package/lib/esm/actions/midnight/takeLend.js +8 -3
  125. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -0
  126. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +9 -3
  127. package/lib/esm/actions/midnight/takeWithdraw.d.ts +3 -1
  128. package/lib/esm/actions/midnight/takeWithdraw.js +11 -4
  129. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +1 -5
  130. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +6 -8
  131. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +7 -11
  132. package/lib/esm/actions/requirements/getRequirementsApproval.js +9 -16
  133. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +5 -10
  134. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +12 -9
  135. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +2 -0
  136. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +5 -0
  137. package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +1 -1
  138. package/lib/esm/actions/vaultV1/inKindRedeem.js +1 -1
  139. package/lib/esm/actions/vaultV1/withdraw.d.ts +4 -4
  140. package/lib/esm/actions/vaultV1/withdraw.js +4 -4
  141. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +1 -1
  142. package/lib/esm/actions/vaultV2/forceWithdraw.js +1 -1
  143. package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +1 -1
  144. package/lib/esm/actions/vaultV2/inKindRedeem.js +1 -1
  145. package/lib/esm/actions/vaultV2/withdraw.d.ts +4 -4
  146. package/lib/esm/actions/vaultV2/withdraw.js +4 -4
  147. package/lib/esm/blue/abis.d.ts +1 -1
  148. package/lib/esm/blue/abis.js +1 -1
  149. package/lib/esm/blue/entities.d.ts +4 -4
  150. package/lib/esm/blue/entities.js +2 -2
  151. package/lib/esm/blue/errors.d.ts +2 -2
  152. package/lib/esm/blue/errors.js +2 -2
  153. package/lib/esm/blue/fetch.d.ts +2 -2
  154. package/lib/esm/blue/fetch.js +2 -2
  155. package/lib/esm/blue/utils.d.ts +1 -1
  156. package/lib/esm/blue/utils.js +1 -1
  157. package/lib/esm/entities/blue/blue.d.ts +2 -12
  158. package/lib/esm/entities/blue/blue.js +0 -4
  159. package/lib/esm/entities/index.d.ts +4 -4
  160. package/lib/esm/entities/index.js +2 -2
  161. package/lib/esm/entities/midnight/midnight.d.ts +63 -18
  162. package/lib/esm/entities/midnight/midnight.js +139 -54
  163. package/lib/esm/entities/midnight/types.d.ts +3 -10
  164. package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +0 -4
  165. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +1 -8
  166. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -14
  167. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +9 -21
  168. package/lib/esm/entities/vaultV1/vaultV1.d.ts +40 -37
  169. package/lib/esm/entities/vaultV1/vaultV1.js +6 -35
  170. package/lib/esm/entities/vaultV2/vaultV2.d.ts +69 -43
  171. package/lib/esm/entities/vaultV2/vaultV2.js +41 -35
  172. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +5 -3
  173. package/lib/esm/entities/vaultV2BlueReallocationData.js +9 -3
  174. package/lib/esm/errors.d.ts +4 -4
  175. package/lib/esm/errors.js +4 -4
  176. package/lib/esm/fetch.d.ts +2 -2
  177. package/lib/esm/fetch.js +2 -2
  178. package/lib/esm/helpers/encodeMidnightCalldata.d.ts +48 -0
  179. package/lib/esm/helpers/encodeMidnightCalldata.js +69 -0
  180. package/lib/esm/helpers/slippage.d.ts +9 -25
  181. package/lib/esm/helpers/slippage.js +9 -25
  182. package/lib/esm/helpers/validate.d.ts +1 -0
  183. package/lib/esm/helpers/validate.js +5 -0
  184. package/lib/esm/helpers/validateMidnightAccount.d.ts +34 -0
  185. package/lib/esm/helpers/validateMidnightAccount.js +43 -0
  186. package/lib/esm/helpers/validateMidnightAuthorizationTarget.d.ts +1 -0
  187. package/lib/esm/helpers/validateMidnightAuthorizationTarget.js +4 -0
  188. package/lib/esm/helpers/validateMidnightMarket.d.ts +2 -0
  189. package/lib/esm/helpers/validateMidnightMarket.js +5 -0
  190. package/lib/esm/helpers/validateMidnightPublication.d.ts +11 -0
  191. package/lib/esm/helpers/validateMidnightPublication.js +10 -0
  192. package/lib/esm/helpers/validateMidnightReceiver.d.ts +1 -0
  193. package/lib/esm/helpers/validateMidnightReceiver.js +8 -0
  194. package/lib/esm/helpers/validateTakeableOffers.d.ts +2 -1
  195. package/lib/esm/helpers/validateTakeableOffers.js +4 -3
  196. package/lib/esm/midnight/errors.d.ts +2 -1
  197. package/lib/esm/midnight/errors.js +2 -1
  198. package/lib/esm/types/action.d.ts +3 -1
  199. package/lib/esm/types/error.d.ts +60 -6
  200. package/lib/esm/types/error.js +138 -7
  201. package/lib/esm/utils.d.ts +2 -2
  202. package/lib/esm/utils.js +2 -2
  203. package/package.json +8 -7
@@ -1,13 +1,13 @@
1
- export type { IAccrualPosition as IBlueAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket as IBlueMarket, IMarketParams as IBlueMarketParams, IPosition as IBluePosition,
1
+ export type { IAccrualPosition as IBlueAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MidnightAdapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket as IBlueMarket, IMarketParams as IBlueMarketParams, IPosition as IBluePosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  IPreLiquidationParams as IBluePreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- IPreLiquidationPosition as IBluePreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
6
- export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
5
+ IPreLiquidationPosition as IBluePreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MidnightAdapter, IVaultV2MidnightAdapterAccrualMarket, IVaultV2MidnightAdapterCollateralParams, IVaultV2MidnightAdapterMarket, IVaultV2MidnightAdapterMarketData, IVaultV2MidnightAdapterMarketState, IVaultV2MidnightAdapterPosition, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, VaultV2MidnightAdapterAccrualMarket, VaultV2MidnightAdapterMarketData, } from "@morpho-org/blue-sdk";
6
+ export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MidnightAdapter, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
7
7
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
8
8
  PreLiquidationParams as BluePreLiquidationParams,
9
9
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
10
- PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
10
+ PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MidnightAdapter, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
11
11
  export type { AnyTree as MidnightAnyTree, AnyTreeSnapshot as MidnightAnyTreeSnapshot, BuildOfferParams as MidnightBuildOfferParams, CollateralParams as MidnightCollateralParams, EcrecoverTreeCreateRequest as MidnightEcrecoverTreeCreateRequest, GroupInput as MidnightGroupInput, IAccrualPosition as IMidnightAccrualPosition, ICollateralParams as IMidnightCollateralParams, IGroup as IMidnightGroup, IMarket as IMidnightMarket, IMarketParams as IMidnightMarketParams, IOffer as IMidnightOffer, IPosition as IMidnightPosition, MarketInput as MidnightMarketInput, OfferStruct as MidnightOfferStruct, PriceRatifierV1TreeCreateRequest as MidnightPriceRatifierV1TreeCreateRequest, RateRatifierV1TreeCreateRequest as MidnightRateRatifierV1TreeCreateRequest, RatifierKind as MidnightRatifierKind, RatifierTreeInput as MidnightRatifierTreeInput, RatifierTypes as MidnightRatifierTypes, SetterTreeCreateRequest as MidnightSetterTreeCreateRequest, SettlementFeeCbps as MidnightSettlementFeeCbps, TreeCreateParams as MidnightTreeCreateParams, TreeCreateRequest as MidnightTreeCreateRequest, TreeData as MidnightTreeData, TreeDescriptor as MidnightTreeDescriptor, TreeEntry as MidnightTreeEntry, TreeInput as MidnightTreeInput, TreeLike as MidnightTreeLike, TreeMempoolValidateParams as MidnightTreeMempoolValidateParams, TreeMempoolValidateRatification as MidnightTreeMempoolValidateRatification, TreeProof as MidnightTreeProof, TreeSnapshot as MidnightTreeSnapshot, TypedRatifierTreeInput as MidnightTypedRatifierTreeInput, TypedTreeMempoolValidateParams as MidnightTypedTreeMempoolValidateParams, } from "@morpho-org/midnight-sdk";
12
12
  export { AccrualPosition as MidnightAccrualPosition, Group as MidnightGroup, Market as MidnightMarket, MarketParams as MidnightMarketParams, Offer as MidnightOffer, Position as MidnightPosition, Tree as MidnightTree, } from "@morpho-org/midnight-sdk";
13
13
  export type { BlueActions, BlueTokenRequirementsParams, } from "./blue/index.js";
@@ -14,11 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.VaultV2BlueReallocationData = exports.MorphoVaultV2 = exports.MorphoVaultV1 = exports.MorphoMidnight = exports.MorphoBlue = exports.MidnightTree = exports.MidnightPosition = exports.MidnightOffer = exports.MidnightMarketParams = exports.MidnightMarket = exports.MidnightGroup = exports.MidnightAccrualPosition = exports.WrappedToken = exports.VaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoMarketV1AdapterV2 = exports.VaultV2MorphoMarketV1Adapter = exports.VaultV2BluePublicAllocatorConfig = exports.VaultV2BlueMarketPublicAllocatorConfig = exports.VaultV2Adapter = exports.VaultV2 = exports.VaultUser = exports.VaultToken = exports.VaultMarketConfig = exports.VaultMarketAllocation = exports.VaultConfig = exports.Vault = exports.BlueUser = exports.Token = exports.BluePreLiquidationPosition = exports.BluePreLiquidationParams = exports.BluePosition = exports.BlueMarketParams = exports.BlueMarket = exports.Holding = exports.ExchangeRateWrappedToken = exports.Eip5267Domain = exports.ConstantWrappedToken = exports.AssetBalances = exports.AccrualVaultV2MorphoVaultV1Adapter = exports.AccrualVaultV2MorphoMarketV1AdapterV2 = exports.AccrualVaultV2MorphoMarketV1Adapter = exports.AccrualVaultV2 = exports.AccrualVault = exports.BlueAccrualPosition = void 0;
17
+ exports.VaultV2BlueReallocationData = exports.MorphoVaultV2 = exports.MorphoVaultV1 = exports.MorphoMidnight = exports.MorphoBlue = exports.MidnightTree = exports.MidnightPosition = exports.MidnightOffer = exports.MidnightMarketParams = exports.MidnightMarket = exports.MidnightGroup = exports.MidnightAccrualPosition = exports.WrappedToken = exports.VaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoMarketV1AdapterV2 = exports.VaultV2MorphoMarketV1Adapter = exports.VaultV2MidnightAdapter = exports.VaultV2BluePublicAllocatorConfig = exports.VaultV2BlueMarketPublicAllocatorConfig = exports.VaultV2Adapter = exports.VaultV2 = exports.VaultUser = exports.VaultToken = exports.VaultMarketConfig = exports.VaultMarketAllocation = exports.VaultConfig = exports.Vault = exports.BlueUser = exports.Token = exports.BluePreLiquidationPosition = exports.BluePreLiquidationParams = exports.BluePosition = exports.BlueMarketParams = exports.BlueMarket = exports.Holding = exports.ExchangeRateWrappedToken = exports.Eip5267Domain = exports.ConstantWrappedToken = exports.AssetBalances = exports.AccrualVaultV2MorphoVaultV1Adapter = exports.AccrualVaultV2MorphoMarketV1AdapterV2 = exports.AccrualVaultV2MorphoMarketV1Adapter = exports.AccrualVaultV2MidnightAdapter = exports.AccrualVaultV2 = exports.AccrualVault = exports.BlueAccrualPosition = void 0;
18
18
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
19
19
  Object.defineProperty(exports, "BlueAccrualPosition", { enumerable: true, get: function () { return blue_sdk_1.AccrualPosition; } });
20
20
  Object.defineProperty(exports, "AccrualVault", { enumerable: true, get: function () { return blue_sdk_1.AccrualVault; } });
21
21
  Object.defineProperty(exports, "AccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2; } });
22
+ Object.defineProperty(exports, "AccrualVaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MidnightAdapter; } });
22
23
  Object.defineProperty(exports, "AccrualVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter; } });
23
24
  Object.defineProperty(exports, "AccrualVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2; } });
24
25
  Object.defineProperty(exports, "AccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter; } });
@@ -46,6 +47,7 @@ Object.defineProperty(exports, "VaultV2", { enumerable: true, get: function () {
46
47
  Object.defineProperty(exports, "VaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Adapter; } });
47
48
  Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfig; } });
48
49
  Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfig; } });
50
+ Object.defineProperty(exports, "VaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MidnightAdapter; } });
49
51
  Object.defineProperty(exports, "VaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoMarketV1Adapter; } });
50
52
  Object.defineProperty(exports, "VaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoMarketV1AdapterV2; } });
51
53
  Object.defineProperty(exports, "VaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoVaultV1Adapter; } });
@@ -114,6 +114,7 @@ export declare class MorphoMidnight {
114
114
  * @returns Prepared tree, groups, ratifier, and encoded payload used by maker flows.
115
115
  * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId`, another chain than this entity's.
116
116
  * @throws {InvalidTreeError} when the input does not form a non-empty valid tree.
117
+ * @throws {InvalidMidnightOfferGroupError} when a priceV1/rateV1 `Tree.create` request has explicit groups that break `OfferUtils.validateOfferGroup` rules.
117
118
  * @throws {MidnightMempoolValidationError} when the Midnight mempool API rejects the offer tree
118
119
  * (not thrown when `validation` is `false`).
119
120
  * @throws {MidnightOfferMakerMismatchError} when an offer belongs to another maker.
@@ -123,6 +124,8 @@ export declare class MorphoMidnight {
123
124
  * @throws {MidnightOfferMarketAddressMismatchError} when an offer targets another Midnight deployment.
124
125
  * @throws {UnknownAddressError} when the chain has no deployment for the tree's V1 ratifier.
125
126
  * @throws {MidnightOfferRatifierMismatchError} when an offer does not use its tree's ratifier.
127
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
128
+ * @throws {MidnightCalldataEncodingError} when an offer cannot be ABI-encoded, such as an out-of-range integer, or `accountAddress` is not a well-formed address.
126
129
  * @throws {viem.BaseError} when a pinned block, multicall, or oracle-code read fails.
127
130
  * @throws {MidnightOfferExpiredError} when an offer expiry is not later than the pinned block timestamp.
128
131
  * @throws {MidnightOfferExpiryAfterMaturityError} when an offer expiry exceeds its market maturity.
@@ -171,6 +174,8 @@ export declare class MorphoMidnight {
171
174
  * @returns Lazy loan-token approval and `MidnightBundlesV2` authorization requirements, and a synchronous transaction builder.
172
175
  * @throws {ChainIdMismatchError} when client or market data targets another chain, or from
173
176
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
177
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
178
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
174
179
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
175
180
  * RPC read fails.
176
181
  * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` deployment.
@@ -204,7 +209,6 @@ export declare class MorphoMidnight {
204
209
  * offers plus the fallback.
205
210
  * @throws {MidnightContractReceiverError} when `referralFeeRecipient` is a Midnight protocol
206
211
  * contract or a market token contract with a positive referral fee.
207
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below the pulled loan assets.
208
212
  * @example
209
213
  * ```ts
210
214
  * const output = midnight.takeLend({
@@ -245,11 +249,14 @@ export declare class MorphoMidnight {
245
249
  * Midnight protocol and market token contracts are rejected.
246
250
  * @param params.takeableOffers - Lend-side offers returned by the Midnight API.
247
251
  * @param params.deadline - Bounded bundle execution deadline timestamp.
248
- * @param params.referralFeePct - Optional WAD-scaled referral fee taken from the received assets.
252
+ * @param params.referralFeePct - Optional WAD-scaled referral fee taken from the sale
253
+ * proceeds; on an assets target it is added on top of `target.assets`.
249
254
  * @param params.referralFeeRecipient - Referral fee recipient; required with a positive fee.
250
255
  * @returns Lazy `MidnightBundlesV2` authorization requirement and a synchronous transaction builder.
251
256
  * @throws {ChainIdMismatchError} when client or market data targets another chain, or from
252
257
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
258
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
259
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
253
260
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
254
261
  * RPC read fails.
255
262
  * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` deployment.
@@ -329,11 +336,14 @@ export declare class MorphoMidnight {
329
336
  * Midnight protocol and market token contracts are rejected.
330
337
  * @param params.takeableOffers - Lend-side offers returned by the Midnight API.
331
338
  * @param params.deadline - Bundle execution deadline timestamp.
332
- * @param params.referralFeePct - Optional WAD-scaled referral fee taken from the received assets.
339
+ * @param params.referralFeePct - Optional WAD-scaled referral fee taken from the sale
340
+ * proceeds; on an assets target it is added on top of `target.assets`.
333
341
  * @param params.referralFeeRecipient - Referral fee recipient; required with a positive fee.
334
342
  * @returns Lazy `MidnightBundlesV2` authorization requirement and a synchronous transaction builder.
335
343
  * @throws {ChainIdMismatchError} when client or market data targets another chain, or from
336
344
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
345
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
346
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
337
347
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
338
348
  * RPC read fails.
339
349
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
@@ -409,11 +419,14 @@ export declare class MorphoMidnight {
409
419
  * Midnight protocol and market token contracts are rejected.
410
420
  * @param params.takeableOffers - Lend-side offers returned by the Midnight API.
411
421
  * @param params.deadline - Bounded bundle execution deadline timestamp.
412
- * @param params.referralFeePct - Optional WAD-scaled referral fee taken from the received assets.
422
+ * @param params.referralFeePct - Optional WAD-scaled referral fee taken from the sale
423
+ * proceeds; on an assets target it is added on top of `target.assets`.
413
424
  * @param params.referralFeeRecipient - Referral fee recipient; required with a positive fee.
414
425
  * @returns Lazy collateral approvals and `MidnightBundlesV2` authorization requirements, and a synchronous transaction builder.
415
426
  * @throws {ChainIdMismatchError} when client or market data targets another chain, or from
416
427
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
428
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
429
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
417
430
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
418
431
  * RPC read fails.
419
432
  * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` deployment.
@@ -454,7 +467,6 @@ export declare class MorphoMidnight {
454
467
  * withdrawal.
455
468
  * @throws {MidnightTakeTargetUnreachableError} when the live offers cannot hold the target, or
456
469
  * its bounds cannot hold at any fill.
457
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below a collateral token's pulled assets.
458
470
  * @example
459
471
  * ```ts
460
472
  * const output = midnight.supplyCollateralTakeBorrow({
@@ -514,6 +526,8 @@ export declare class MorphoMidnight {
514
526
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
515
527
  * @throws {ChainIdMismatchError} when client or market data targets another chain, or from
516
528
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
529
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
530
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
517
531
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
518
532
  * RPC read fails.
519
533
  * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` deployment.
@@ -558,7 +572,6 @@ export declare class MorphoMidnight {
558
572
  * @throws {MidnightContractReceiverError} when `collateralReceiver` is a Midnight protocol
559
573
  * contract or a market token contract, or when `referralFeeRecipient` is either with a
560
574
  * positive referral fee.
561
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below the pulled loan assets.
562
575
  * @example
563
576
  * ```ts
564
577
  * const output = midnight.takeRepayWithdrawCollateral({
@@ -580,23 +593,30 @@ export declare class MorphoMidnight {
580
593
  * Prepares a direct collateral supply using a caller-provided market snapshot.
581
594
  *
582
595
  * @param params - Supplier, market snapshot, collateral amount, reserve, and optional collateral index.
583
- * @param params.accountAddress - Account receiving the supplied collateral position.
596
+ * @param params.accountAddress - Account receiving the supplied collateral position. It must send
597
+ * the transaction: Midnight pulls the collateral from `msg.sender` and only lets the position owner
598
+ * or its operators supply for it, and the approval requirements are resolved for this account.
584
599
  * @param params.marketData - Hydrated market snapshot used for validation and transaction construction.
585
600
  * @param params.collateralAssets - Collateral assets supplied in this transaction.
586
601
  * @param params.reservedCollateralAssets - Existing collateral reserved by other open maker groups.
587
- * @param params.collateralIndex - Optional collateral index; defaults to `0n`.
602
+ * Only raises the approval requirement so those groups keep their allowance; the transaction
603
+ * transfers only `collateralAssets`.
604
+ * @param params.collateralIndex - Optional collateral index; defaults to `0n`. Indexes follow the
605
+ * market's collateral parameters, which Midnight sorts by token address, not the order they were
606
+ * listed in when the market was built; check `marketData.getCollateralByIndex(index).token`.
588
607
  * @returns Lazy token-approval requirements and a synchronous transaction builder.
589
608
  * @throws {ChainIdMismatchError} when client or market data targets another chain, or from
590
609
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
610
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
591
611
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
592
612
  * RPC read fails.
593
613
  * @throws {MidnightMarketAddressMismatchError} when market data targets another Midnight deployment.
594
614
  * @throws {NonPositiveInputError} when `collateralAssets` is non-positive.
595
615
  * @throws {InputExceedsMaxError} when `collateralAssets` exceeds `uint128`.
596
616
  * @throws {NegativeInputError} when `reservedCollateralAssets` is negative.
597
- * @throws {MidnightZeroOnBehalfError} from `buildTx()` when `accountAddress` is the zero address.
617
+ * @throws {MidnightZeroOnBehalfError} from `getRequirements()` and `buildTx()` when `accountAddress`
618
+ * is the zero address.
598
619
  * @throws {UnknownCollateralIndexError} when the selected collateral is not configured.
599
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below the pulled collateral assets.
600
620
  * @example
601
621
  * ```ts
602
622
  * const output = midnight.supplyCollateral({
@@ -627,9 +647,12 @@ export declare class MorphoMidnight {
627
647
  * @param params.reservedLoanAssets - Existing loan assets reserved by other open groups, excluding groups in `cancellations`.
628
648
  * @returns Prepared group metadata, lazy approval/authorization requirements, and a synchronous transaction builder.
629
649
  * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId` during `getOffersData()` or `getRequirements`, another chain than this entity's.
650
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
651
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
630
652
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
631
653
  * RPC read fails.
632
654
  * @throws {InvalidTreeError} when the input does not form a non-empty valid tree.
655
+ * @throws {InvalidMidnightOfferGroupError} when a priceV1/rateV1 `Tree.create` request has explicit groups that break `OfferUtils.validateOfferGroup` rules.
633
656
  * @throws {MidnightOfferReduceOnlyError} when an offer is reduce-only.
634
657
  * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` or V1 ratifier deployment.
635
658
  * @throws {NonPositiveInputError} when `loanAssets` is non-positive.
@@ -660,7 +683,6 @@ export declare class MorphoMidnight {
660
683
  * @throws {MidnightMarketLiquidationCursorNotEnabledError} when an uncreated market uses a disabled liquidation cursor.
661
684
  * @throws {MidnightMarketOracleWithoutCodeError} when an uncreated market's oracle has no code.
662
685
  * @throws {viem.BaseError} when a pinned block, multicall, or oracle-code read fails.
663
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below `loanAssets + reservedLoanAssets`.
664
686
  * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
665
687
  * @example
666
688
  * ```ts
@@ -691,9 +713,12 @@ export declare class MorphoMidnight {
691
713
  * @param params.validation - Midnight mempool API request controls, or `false` to skip the API call.
692
714
  * @returns Prepared group metadata, lazy authorization requirements, and a synchronous transaction builder.
693
715
  * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId` during `getOffersData()` or `getRequirements`, another chain than this entity's.
716
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
717
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
694
718
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
695
719
  * RPC read fails.
696
720
  * @throws {InvalidTreeError} when the input does not form a non-empty valid tree.
721
+ * @throws {InvalidMidnightOfferGroupError} when a priceV1/rateV1 `Tree.create` request has explicit groups that break `OfferUtils.validateOfferGroup` rules.
697
722
  * @throws {MidnightOfferReduceOnlyError} when an offer is reduce-only.
698
723
  * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` or V1 ratifier deployment.
699
724
  * @throws {NegativeInputError} when a `maxConsumed` ceiling is negative.
@@ -756,6 +781,12 @@ export declare class MorphoMidnight {
756
781
  * `midnightBlueBuyCallbackFactory`, `accountAddress` and `callbackSalt`, and fetches the Morpho Blue market,
757
782
  * accruing interest to the current time before previewing parked shares (markets whose
758
783
  * IRM the SDK cannot accrue are previewed on their last-updated state).
784
+ * The share check runs once, before signing: the bundle supplies `assetsToPark` with no
785
+ * minimum-shares bound, so interest accrued before inclusion can still round the supply down
786
+ * to zero shares if `assetsToPark` is worth less than one share at inclusion. A preview above
787
+ * one share does not rule this out: interest accrued while the transaction waits, or not
788
+ * accrued by the SDK for an IRM it cannot accrue, raises the share price. Choosing a market
789
+ * whose share price makes that impossible is the caller's responsibility.
759
790
  * The caller is responsible for trusting the Blue market's oracle and IRM. If Blue liquidity is
760
791
  * drained, callback offers cannot fill until liquidity returns. `assetsToPark` may underfund the
761
792
  * offers; top-ups are allowed.
@@ -777,6 +808,8 @@ export declare class MorphoMidnight {
777
808
  * @returns Prepared group metadata, lazy approval/authorization requirements, and a synchronous transaction builder.
778
809
  * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId`,
779
810
  * another chain than `this.chainId`.
811
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
812
+ * @throws {MidnightCalldataEncodingError} when the offer tree or `blueMarket` cannot be ABI-encoded.
780
813
  * @throws {viem.BaseError} when the `eth_chainId` request, a Blue market RPC read, or a
781
814
  * requirement RPC read fails.
782
815
  * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2`, `midnightBlueBuyCallbackFactory`, `midnight`, `blue` or V1 ratifier deployment.
@@ -788,6 +821,7 @@ export declare class MorphoMidnight {
788
821
  * @throws {ChainWNativeMissingError} when wNative is not configured for the chain.
789
822
  * @throws {NativeAmountOnNonWNativeAssetError} when `blueMarket.loanToken` is not wNative.
790
823
  * @throws {InvalidTreeError} when the input does not form a non-empty valid tree.
824
+ * @throws {InvalidMidnightOfferGroupError} when a priceV1/rateV1 `Tree.create` request has explicit groups that break `OfferUtils.validateOfferGroup` rules.
791
825
  * @throws {MidnightMempoolValidationError} when the Midnight mempool API rejects the offer tree
792
826
  * (not thrown when `validation` is `false`).
793
827
  * @throws {MidnightOfferMarketChainMismatchError} when an offer targets another chain.
@@ -813,11 +847,10 @@ export declare class MorphoMidnight {
813
847
  * @throws {MidnightMarketOracleWithoutCodeError} when an uncreated market's oracle has no code.
814
848
  * @throws {viem.BaseError} when a pinned block, multicall, or oracle-code read fails.
815
849
  * @throws {EmptyBlueParkingMarketError} when `blueMarket` has no supply shares.
816
- * @throws {ZeroBlueParkingSharesError} when `assetsToPark` would mint no supply shares at the current share price.
850
+ * @throws {ZeroBlueParkingSharesError} when `assetsToPark` would mint no supply shares at the current share price (checked at preparation time only).
817
851
  * @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
818
852
  * @throws {InvalidMidnightHexInputError} when a cancellation group or `callbackSalt` is not 32-byte hex.
819
853
  * @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
820
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below `assetsToPark`.
821
854
  * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
822
855
  * @example
823
856
  * ```ts
@@ -859,9 +892,12 @@ export declare class MorphoMidnight {
859
892
  * @param params.validation - Midnight mempool API request controls, or `false` to skip the API call.
860
893
  * @returns Prepared root and groups, lazy requirements, and a synchronous publication builder.
861
894
  * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId` during `getOffersData()` or `getRequirements`, another chain than this entity's.
895
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
896
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
862
897
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
863
898
  * RPC read fails.
864
899
  * @throws {InvalidTreeError} when the input does not form a non-empty valid tree.
900
+ * @throws {InvalidMidnightOfferGroupError} when a priceV1/rateV1 `Tree.create` request has explicit groups that break `OfferUtils.validateOfferGroup` rules.
865
901
  * @throws {MidnightOfferSideMismatchError} when an offer is not a sell offer (`buy = false`).
866
902
  * @throws {MidnightOfferNotReduceOnlyError} when any offer can increase a position.
867
903
  * @throws {MidnightOfferCallbackNotSupportedError} when an offer has a nonzero callback.
@@ -929,9 +965,12 @@ export declare class MorphoMidnight {
929
965
  * @param params.reservedLoanAssets - Existing loan assets reserved by other open groups.
930
966
  * @returns Prepared root and groups, lazy requirements, and a synchronous publication builder.
931
967
  * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId` during `getOffersData()` or `getRequirements`, another chain than this entity's.
968
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
969
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
932
970
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
933
971
  * RPC read fails.
934
972
  * @throws {InvalidTreeError} when the input does not form a non-empty valid tree.
973
+ * @throws {InvalidMidnightOfferGroupError} when a priceV1/rateV1 `Tree.create` request has explicit groups that break `OfferUtils.validateOfferGroup` rules.
935
974
  * @throws {MidnightOfferSideMismatchError} when an offer is not a buy offer (`buy = true`).
936
975
  * @throws {MidnightOfferNotReduceOnlyError} when any offer can increase a position.
937
976
  * @throws {MidnightOfferCallbackNotSupportedError} when an offer has a nonzero callback.
@@ -963,7 +1002,6 @@ export declare class MorphoMidnight {
963
1002
  * @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
964
1003
  * @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
965
1004
  * @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
966
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below `loanAssets + reservedLoanAssets`.
967
1005
  * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
968
1006
  * @example
969
1007
  * ```ts
@@ -1004,6 +1042,8 @@ export declare class MorphoMidnight {
1004
1042
  * required for the full pulled amount.
1005
1043
  * @returns Prepared group metadata, lazy approval/authorization requirements, and a synchronous transaction builder.
1006
1044
  * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId` during `getOffersData()` or `getRequirements`, another chain than this entity's.
1045
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
1046
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
1007
1047
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
1008
1048
  * RPC read fails.
1009
1049
  * @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` or V1 ratifier deployment.
@@ -1016,6 +1056,7 @@ export declare class MorphoMidnight {
1016
1056
  * @throws {ChainWNativeMissingError} when wNative is not configured for the chain.
1017
1057
  * @throws {NativeAmountOnNonWNativeAssetError} when no collateral pull uses wNative.
1018
1058
  * @throws {InvalidTreeError} when the input does not form a non-empty valid tree.
1059
+ * @throws {InvalidMidnightOfferGroupError} when a priceV1/rateV1 `Tree.create` request has explicit groups that break `OfferUtils.validateOfferGroup` rules.
1019
1060
  * @throws {MidnightMempoolValidationError} when the Midnight mempool API rejects the offer tree
1020
1061
  * (not thrown when `validation` is `false`).
1021
1062
  * @throws {MidnightOfferMarketChainMismatchError} when an offer targets another chain.
@@ -1044,7 +1085,6 @@ export declare class MorphoMidnight {
1044
1085
  * @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
1045
1086
  * @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
1046
1087
  * @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
1047
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below a collateral token's pulled assets.
1048
1088
  * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
1049
1089
  * @example
1050
1090
  * ```ts
@@ -1064,7 +1104,9 @@ export declare class MorphoMidnight {
1064
1104
  * Prepares redemption of accrued Midnight credit from a position snapshot.
1065
1105
  *
1066
1106
  * @param params - Position owner, accrued position, optional unit amount, and receiver.
1067
- * @param params.accountAddress - Position owner whose credit is redeemed.
1107
+ * @param params.accountAddress - Position owner whose credit is redeemed. It must send the
1108
+ * transaction (or authorize the sender): Midnight reverts `Unauthorized()` otherwise, which
1109
+ * `getRequirements()` cannot detect because it does not know the sender.
1068
1110
  * @param params.positionData - Owner-bound position snapshot returned by `getPositionData`.
1069
1111
  * @param params.receiver - Optional credit receiver; defaults to the position owner.
1070
1112
  * Midnight protocol and market token contracts are rejected.
@@ -1077,6 +1119,7 @@ export declare class MorphoMidnight {
1077
1119
  * is left. Redeem again after maturity to empty the position.
1078
1120
  * @returns No requirements and a synchronous redemption transaction builder.
1079
1121
  * @throws {ChainIdMismatchError} when the position market targets another chain.
1122
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
1080
1123
  * @throws {MidnightMarketAddressMismatchError} when the position market targets another Midnight deployment.
1081
1124
  * @throws {MissingAccrualPositionError} when no position snapshot is supplied.
1082
1125
  * @throws {AccrualPositionUserMismatchError} when the position snapshot belongs to another account.
@@ -1119,7 +1162,7 @@ export declare class MorphoMidnight {
1119
1162
  * scaled by `ORACLE_PRICE_SCALE`. An empty array is safe only when
1120
1163
  * `collateralWithdrawals` is empty or the conservative post-operation debt is zero: a `full`
1121
1164
  * repay, or `repay.assets` covering `positionData.debt`.
1122
- * @param params.repay - `{ type: "assets", assets }` (`0n` to only withdraw) or `{ type: "full", maxBuyerAssets }`; a loan-token approval to `MidnightBundlesV2` is required when the allowance is below the pulled amount — unlimited (`maxUint256`) by default, or `approvalAmount` when passed to `getRequirements()` — and any unused part is refunded.
1165
+ * @param params.repay - `{ type: "assets", assets }` (`0n` to only withdraw) or `{ type: "full", maxBuyerAssets }`; a loan-token approval to `MidnightBundlesV2` is required when the allowance is below the pulled amount (unlimited: `maxUint256`, capped per token by `MAX_TOKEN_APPROVALS`), and any unused part is refunded.
1123
1166
  * @param params.nativeAmount - Optional native ETH sent as `value`; the bundle wraps it into the
1124
1167
  * chain's wNative and transfers it to `msg.sender` before pulling. It may cover part or all of
1125
1168
  * the maximum wNative amount this call can pull, but not more. Any wrapped native not pulled
@@ -1135,6 +1178,8 @@ export declare class MorphoMidnight {
1135
1178
  * @returns Lazy loan approval/authorization requirements and a synchronous transaction builder.
1136
1179
  * @throws {ChainIdMismatchError} when client or market data targets another chain, or from
1137
1180
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
1181
+ * @throws {MidnightZeroAccountError} when `accountAddress` is the zero address.
1182
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as a malformed `bytes32` or an out-of-range integer.
1138
1183
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
1139
1184
  * RPC read fails.
1140
1185
  * @throws {MidnightMarketAddressMismatchError} when market data targets another Midnight deployment.
@@ -1159,7 +1204,6 @@ export declare class MorphoMidnight {
1159
1204
  * during this method call, before the lazy output is returned.
1160
1205
  * @throws {MidnightContractReceiverError} when `collateralReceiver` is a Midnight protocol
1161
1206
  * contract or a market token contract.
1162
- * @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when `approvalAmount` is below the pulled loan assets.
1163
1207
  * @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
1164
1208
  * @example
1165
1209
  * ```ts
@@ -1197,6 +1241,7 @@ export declare class MorphoMidnight {
1197
1241
  * @returns Lazy Midnight authorization requirement for `MidnightBundlesV2` and a synchronous transaction builder.
1198
1242
  * @throws {ChainIdMismatchError} when the client targets another chain, or from
1199
1243
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
1244
+ * @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as an out-of-range integer.
1200
1245
  * @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
1201
1246
  * RPC read fails.
1202
1247
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.