@morpho-org/morpho-sdk 6.0.0-next.3 → 6.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 (123) hide show
  1. package/MIGRATION-v5-to-v6.md +24 -16
  2. package/README.md +6 -4
  3. package/lib/cjs/abis.d.ts +5 -1
  4. package/lib/cjs/abis.js +2 -0
  5. package/lib/cjs/actions/bundles/common.d.ts +20 -25
  6. package/lib/cjs/actions/bundles/common.js +46 -85
  7. package/lib/cjs/actions/bundles/index.d.ts +1 -1
  8. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +6 -2
  9. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +6 -2
  10. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +1 -0
  11. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -0
  12. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +11 -3
  13. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +19 -1
  14. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -1
  15. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +12 -0
  16. package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +2 -1
  17. package/lib/cjs/actions/vaultV1/inKindRedeem.js +2 -1
  18. package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +62 -17
  19. package/lib/cjs/actions/vaultV1/migrateToV2.js +48 -17
  20. package/lib/cjs/actions/vaultV1/redeem.d.ts +28 -1
  21. package/lib/cjs/actions/vaultV1/redeem.js +17 -1
  22. package/lib/cjs/actions/vaultV1/withdraw.d.ts +1 -1
  23. package/lib/cjs/actions/vaultV1/withdraw.js +1 -1
  24. package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +3 -2
  25. package/lib/cjs/actions/vaultV2/forceWithdraw.js +3 -2
  26. package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +2 -1
  27. package/lib/cjs/actions/vaultV2/inKindRedeem.js +2 -1
  28. package/lib/cjs/actions/vaultV2/redeem.d.ts +28 -1
  29. package/lib/cjs/actions/vaultV2/redeem.js +17 -1
  30. package/lib/cjs/actions/vaultV2/withdraw.d.ts +1 -1
  31. package/lib/cjs/actions/vaultV2/withdraw.js +1 -1
  32. package/lib/cjs/augment/AccrualPosition.d.ts +1 -0
  33. package/lib/cjs/blue/abis.d.ts +5 -1
  34. package/lib/cjs/blue/abis.js +2 -0
  35. package/lib/cjs/blue/entities.d.ts +10 -2
  36. package/lib/cjs/blue/entities.js +2 -0
  37. package/lib/cjs/blue/errors.d.ts +4 -2
  38. package/lib/cjs/blue/errors.js +3 -1
  39. package/lib/cjs/blue/fetch.d.ts +5 -1
  40. package/lib/cjs/blue/fetch.js +2 -0
  41. package/lib/cjs/blue/utils.d.ts +5 -1
  42. package/lib/cjs/blue/utils.js +2 -0
  43. package/lib/cjs/entities/index.d.ts +10 -2
  44. package/lib/cjs/entities/index.js +2 -0
  45. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -2
  46. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -3
  47. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +31 -21
  48. package/lib/cjs/entities/vaultV1/vaultV1.js +50 -83
  49. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +52 -35
  50. package/lib/cjs/entities/vaultV2/vaultV2.js +71 -81
  51. package/lib/cjs/errors.d.ts +5 -3
  52. package/lib/cjs/errors.js +4 -1
  53. package/lib/cjs/fetch.d.ts +5 -1
  54. package/lib/cjs/fetch.js +2 -0
  55. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +11 -5
  56. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +48 -15
  57. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +48 -15
  58. package/lib/cjs/midnight/errors.d.ts +1 -1
  59. package/lib/cjs/midnight/errors.js +2 -1
  60. package/lib/cjs/types/action.d.ts +1 -0
  61. package/lib/cjs/utils.d.ts +5 -1
  62. package/lib/cjs/utils.js +2 -0
  63. package/lib/esm/abis.d.ts +5 -1
  64. package/lib/esm/abis.js +5 -1
  65. package/lib/esm/actions/bundles/common.d.ts +20 -25
  66. package/lib/esm/actions/bundles/common.js +44 -82
  67. package/lib/esm/actions/bundles/index.d.ts +1 -1
  68. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +6 -2
  69. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +6 -2
  70. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +1 -0
  71. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -0
  72. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +11 -3
  73. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +21 -3
  74. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -1
  75. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +14 -2
  76. package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +2 -1
  77. package/lib/esm/actions/vaultV1/inKindRedeem.js +2 -1
  78. package/lib/esm/actions/vaultV1/migrateToV2.d.ts +62 -17
  79. package/lib/esm/actions/vaultV1/migrateToV2.js +48 -17
  80. package/lib/esm/actions/vaultV1/redeem.d.ts +28 -1
  81. package/lib/esm/actions/vaultV1/redeem.js +17 -1
  82. package/lib/esm/actions/vaultV1/withdraw.d.ts +1 -1
  83. package/lib/esm/actions/vaultV1/withdraw.js +1 -1
  84. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +3 -2
  85. package/lib/esm/actions/vaultV2/forceWithdraw.js +3 -2
  86. package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +2 -1
  87. package/lib/esm/actions/vaultV2/inKindRedeem.js +2 -1
  88. package/lib/esm/actions/vaultV2/redeem.d.ts +28 -1
  89. package/lib/esm/actions/vaultV2/redeem.js +17 -1
  90. package/lib/esm/actions/vaultV2/withdraw.d.ts +1 -1
  91. package/lib/esm/actions/vaultV2/withdraw.js +1 -1
  92. package/lib/esm/augment/AccrualPosition.d.ts +1 -0
  93. package/lib/esm/blue/abis.d.ts +5 -1
  94. package/lib/esm/blue/abis.js +5 -1
  95. package/lib/esm/blue/entities.d.ts +10 -2
  96. package/lib/esm/blue/entities.js +5 -1
  97. package/lib/esm/blue/errors.d.ts +4 -2
  98. package/lib/esm/blue/errors.js +4 -2
  99. package/lib/esm/blue/fetch.d.ts +5 -1
  100. package/lib/esm/blue/fetch.js +5 -1
  101. package/lib/esm/blue/utils.d.ts +5 -1
  102. package/lib/esm/blue/utils.js +5 -1
  103. package/lib/esm/entities/index.d.ts +10 -2
  104. package/lib/esm/entities/index.js +5 -1
  105. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -2
  106. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +8 -3
  107. package/lib/esm/entities/vaultV1/vaultV1.d.ts +31 -21
  108. package/lib/esm/entities/vaultV1/vaultV1.js +52 -85
  109. package/lib/esm/entities/vaultV2/vaultV2.d.ts +52 -35
  110. package/lib/esm/entities/vaultV2/vaultV2.js +73 -83
  111. package/lib/esm/errors.d.ts +5 -3
  112. package/lib/esm/errors.js +5 -3
  113. package/lib/esm/fetch.d.ts +5 -1
  114. package/lib/esm/fetch.js +5 -1
  115. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +11 -5
  116. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +48 -15
  117. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +48 -15
  118. package/lib/esm/midnight/errors.d.ts +1 -1
  119. package/lib/esm/midnight/errors.js +1 -1
  120. package/lib/esm/types/action.d.ts +1 -0
  121. package/lib/esm/utils.d.ts +5 -1
  122. package/lib/esm/utils.js +5 -1
  123. package/package.json +6 -9
@@ -8,7 +8,7 @@ import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets, getBund
8
8
  * Encodes an exact-assets Vault V2 withdrawal through VaultBundlesV1.
9
9
  *
10
10
  * This low-level builder does not bind `permit.value` to a share cap; use
11
- * `MorphoVaultV2.withdraw().buildTx()` to validate it against the cap from `getRequirements()`.
11
+ * `MorphoVaultV2.withdraw().buildTx()` to validate it against the share cap derived from the handle's `vaultData`.
12
12
  *
13
13
  * @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
14
14
  * @param params.vault.address - Vault V2 whose shares are burned for the withdrawal.
@@ -3,6 +3,7 @@ import { fetchAccrualPosition, fetchPreLiquidationPosition } from "@morpho-org/b
3
3
  declare module "@morpho-org/blue-sdk" {
4
4
  namespace AccrualPosition {
5
5
  let fetch: typeof fetchAccrualPosition;
6
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
7
  let fetchPreLiquidation: typeof fetchPreLiquidationPosition;
7
8
  }
8
9
  }
@@ -1,2 +1,6 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
+ preLiquidationAbi,
5
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
+ preLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
@@ -1,2 +1,6 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
+ preLiquidationAbi,
5
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
+ preLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
@@ -1,2 +1,10 @@
1
- export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition, IPreLiquidationParams, IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
2
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position, PreLiquidationParams, PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
1
+ export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ IPreLiquidationParams,
4
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
+ IPreLiquidationPosition, 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, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
7
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
8
+ PreLiquidationParams,
9
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
10
+ PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1 +1,5 @@
1
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position, PreLiquidationParams, PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
1
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ PreLiquidationParams,
4
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
+ PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1,2 +1,4 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError, UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
2
- export { getUnsupportedVaultV2Adapter, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,2 +1,4 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError, UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
2
- export { getUnsupportedVaultV2Adapter, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1 +1,5 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition, fetchPreLiquidationParams, fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ fetchPreLiquidationParams,
4
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
+ fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -1 +1,5 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition, fetchPreLiquidationParams, fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ fetchPreLiquidationParams,
4
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
+ fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -1,3 +1,7 @@
1
1
  export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
2
- export { AdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
2
+ export { AdaptiveCurveIrmLib, CapacityLimitReason,
3
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
+ defaultPreLiquidationParamsRegistry,
5
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
+ getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
3
7
  export { decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -1,2 +1,6 @@
1
- export { AdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
1
+ export { AdaptiveCurveIrmLib, CapacityLimitReason,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ defaultPreLiquidationParamsRegistry,
4
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
+ getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
2
6
  export { decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -1,5 +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, IPreLiquidationParams as IBluePreLiquidationParams, 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";
2
- export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition, PreLiquidationParams as BluePreLiquidationParams, 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";
1
+ export type { IAccrualPosition as IBlueAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket as IBlueMarket, IMarketParams as IBlueMarketParams, IPosition as IBluePosition,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ IPreLiquidationParams as IBluePreLiquidationParams,
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,
7
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
8
+ PreLiquidationParams as BluePreLiquidationParams,
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";
3
11
  export type { BuildOfferParams as MidnightBuildOfferParams, CollateralParams as MidnightCollateralParams, 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, RatifierTreeInput as MidnightRatifierTreeInput, SettlementFeeCbps as MidnightSettlementFeeCbps, TreeCreateParams as MidnightTreeCreateParams, TreeDescriptor as MidnightTreeDescriptor, TreeInput as MidnightTreeInput, TreeLike as MidnightTreeLike, TreeMempoolValidateParams as MidnightTreeMempoolValidateParams, TreeMempoolValidateRatification as MidnightTreeMempoolValidateRatification, TreeProof as MidnightTreeProof, } from "@morpho-org/midnight-sdk";
4
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";
5
13
  export type { BlueActions, BlueTokenRequirementsParams, } from "./blue/index.js";
@@ -1,4 +1,8 @@
1
- export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition, PreLiquidationParams as BluePreLiquidationParams, 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";
1
+ export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
2
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
+ PreLiquidationParams as BluePreLiquidationParams,
4
+ /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
+ 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";
2
6
  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";
3
7
  export { MorphoBlue } from "./blue/index.js";
4
8
  export { MorphoMidnight, } from "./midnight/index.js";
@@ -6,14 +6,17 @@ import { type ActionRequirement } from "../../types/index.js";
6
6
  *
7
7
  * The exit burns however many shares the vault prices at execution time, so the share allowance is
8
8
  * the only cap on that burn. A leftover allowance above `requiredShareAllowance` therefore does not
9
- * satisfy the requirement: it is replaced by an approval or permit for exactly the computed cap.
9
+ * satisfy the requirement: it is replaced by an onchain approval for exactly the computed cap. Only
10
+ * an insufficient allowance may be raised through an ERC-2612 permit, because VaultBundlesV1 skips a
11
+ * permit whose nonce was already consumed and the leftover allowance would then stay in force.
10
12
  *
11
13
  * @internal
12
14
  *
13
15
  * @param viemClient - Client used to read the current share allowance and permit nonce.
14
16
  * @param params - Vault snapshot, owner, exact allowance, and deadline values.
15
17
  * @returns No requirement when the allowance already equals `requiredShareAllowance`, otherwise one
16
- * permit or approval that sets it to exactly that cap.
18
+ * approval that sets it to exactly that cap, or one permit when the allowance is below the cap
19
+ * and signatures are supported.
17
20
  * @throws {ExpiredDeadlineError} when the bundles deadline has elapsed.
18
21
  * @throws {viem.BaseError} when an allowance or nonce read fails.
19
22
  */
@@ -10,14 +10,17 @@ import { ExpiredDeadlineError, } from "../../types/index.js";
10
10
  *
11
11
  * The exit burns however many shares the vault prices at execution time, so the share allowance is
12
12
  * the only cap on that burn. A leftover allowance above `requiredShareAllowance` therefore does not
13
- * satisfy the requirement: it is replaced by an approval or permit for exactly the computed cap.
13
+ * satisfy the requirement: it is replaced by an onchain approval for exactly the computed cap. Only
14
+ * an insufficient allowance may be raised through an ERC-2612 permit, because VaultBundlesV1 skips a
15
+ * permit whose nonce was already consumed and the leftover allowance would then stay in force.
14
16
  *
15
17
  * @internal
16
18
  *
17
19
  * @param viemClient - Client used to read the current share allowance and permit nonce.
18
20
  * @param params - Vault snapshot, owner, exact allowance, and deadline values.
19
21
  * @returns No requirement when the allowance already equals `requiredShareAllowance`, otherwise one
20
- * permit or approval that sets it to exactly that cap.
22
+ * approval that sets it to exactly that cap, or one permit when the allowance is below the cap
23
+ * and signatures are supported.
21
24
  * @throws {ExpiredDeadlineError} when the bundles deadline has elapsed.
22
25
  * @throws {viem.BaseError} when an allowance or nonce read fails.
23
26
  */
@@ -39,7 +42,9 @@ export const getVaultBundlesSharesRequirements = async (viemClient, params) => {
39
42
  // so only an exact match skips the approval or permit that resets it to the computed cap.
40
43
  if (allowance === params.requiredShareAllowance)
41
44
  return [];
42
- if (params.supportSignature) {
45
+ // An oversized allowance is only ever lowered onchain: `TokenLib.submitPermit` skips a permit
46
+ // whose nonce was already consumed, which would silently leave the stale cap in force.
47
+ if (allowance < params.requiredShareAllowance && params.supportSignature) {
43
48
  const nonce = await readContract(viemClient, {
44
49
  address: params.vaultData.address,
45
50
  abi: erc2612Abi,
@@ -9,6 +9,7 @@ export interface VaultV1Actions {
9
9
  *
10
10
  * @param {FetchParameters} [parameters] - Optional fetch parameters (block number, state overrides, etc.).
11
11
  * @returns {Promise<Awaited<ReturnType<typeof fetchAccrualVault>>>} The requested vault state.
12
+ * @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
12
13
  */
13
14
  getData: (parameters?: FetchParameters) => Promise<Awaited<ReturnType<typeof fetchAccrualVault>>>;
14
15
  /**
@@ -19,7 +20,7 @@ export interface VaultV1Actions {
19
20
  * Permit2 nonce state. Native funding is exclusive and skips token requirements. Shares are
20
21
  * always minted to the transaction sender, which must be `userAddress`.
21
22
  * Concurrent requirement reads share the first caller's options; later calls refresh on-chain
22
- * state using their own options. `buildTx()` accepts signatures from the latest completed read.
23
+ * state using their own options.
23
24
  *
24
25
  * @param params.userAddress - Account that funds, signs, submits, and receives the vault shares.
25
26
  * @param params.vaultData - Pre-fetched Vault V1 snapshot used for asset and share conversion.
@@ -55,8 +56,9 @@ export interface VaultV1Actions {
55
56
  * `getRequirements()` when the Permit2 nonce exceeds uint256.
56
57
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
57
58
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
58
- * @throws {BundlesPermitMismatchError} from `buildTx()` when the signature was not produced for
59
- * this prepared handle.
59
+ * @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
60
+ * deadline differ from this operation's, or when the signature's carried action nonce is
61
+ * inconsistent with its signed nonce.
60
62
  * @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
61
63
  * @throws {DepositAssetMismatchError} from `buildTx()` when the signed asset differs from the vault asset.
62
64
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when signature metadata is malformed.
@@ -95,13 +97,14 @@ export interface VaultV1Actions {
95
97
  /**
96
98
  * Prepares an exact-assets Vault V1 withdrawal through VaultBundlesV1.
97
99
  *
98
- * Reads the vault accrual state on the first `getRequirements()` call, then reads the live
99
- * vault-share allowance and, when a signature is needed, the permit nonce on each call.
100
- * Captures the requested amount and owner at creation, so later changes to `params` do not
101
- * change this handle's requirements or transaction.
100
+ * Derives the share-burn cap from the supplied `vaultData` snapshot at handle creation, then
101
+ * reads the live vault-share allowance and, when a signature is needed, the permit nonce on
102
+ * each `getRequirements()` call. Captures the requested amount and owner at creation, so later
103
+ * changes to `params` do not change this handle's requirements or transaction.
102
104
  *
103
105
  * @param params.amount - Positive gross withdrawal in underlying asset base units, before fees.
104
106
  * @param params.userAddress - Share owner that must sign and submit; receives the net assets.
107
+ * @param params.vaultData - Pre-fetched Vault V1 snapshot used to derive the share cap.
105
108
  * @param params.slippageTolerance - Optional WAD-scaled share-price loss tolerance applied to
106
109
  * the share cap for MetaMorpho 1.0; MetaMorpho 1.1 retains its lost-assets clamp.
107
110
  * Defaults to 0.03% and cannot exceed 10%.
@@ -112,9 +115,13 @@ export interface VaultV1Actions {
112
115
  * defaults to two hours from handle creation.
113
116
  * @returns A frozen handle with lazy `getRequirements()` and synchronous `buildTx(signatures?)`,
114
117
  * which returns a deep-frozen `Transaction<VaultV1WithdrawAction>`. Requirements are empty
115
- * when the allowance equals the cap; otherwise they contain an exact approval or, with
116
- * signature support, an ERC-2612 request. The cap stays pinned to the first resolution while
117
- * each call re-reads the allowance. Confirm the approval or pass its signed permit to `buildTx`.
118
+ * when the allowance equals the cap; an oversized allowance is always reset with an exact
119
+ * onchain approval, and an insufficient one is raised by an approval or, with signature
120
+ * support, an ERC-2612 request. The cap is fixed at handle creation while each call re-reads
121
+ * the allowance. Confirm the approval or pass its signed permit to `buildTx`.
122
+ * @remarks VaultBundlesV1 skips a share permit whose nonce was already consumed and proceeds
123
+ * under the live allowance, so execute every requirement returned by the latest
124
+ * `getRequirements()` — including the oversized-allowance reset — before submitting.
118
125
  * @throws {ChainIdMismatchError} when the connected client targets another chain.
119
126
  * @throws {NonPositiveInputError} when `amount` or the computed share cap is not positive.
120
127
  * @throws {ExpiredDeadlineError} when `deadline` is not in the future at handle creation or
@@ -124,14 +131,14 @@ export interface VaultV1Actions {
124
131
  * @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
125
132
  * @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no nonzero recipient.
126
133
  * @throws {ExcessiveSlippageToleranceError} when `slippageTolerance` exceeds 10%.
134
+ * @throws {VaultAddressMismatchError} when `vaultData` belongs to another vault.
127
135
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
128
136
  * @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
129
137
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
130
138
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permits are supplied.
131
- * @throws {BundlesPermitMismatchError} from `buildTx()` when the share permit is malformed,
132
- * was not resolved for this handle, or has incompatible vault, owner, spender, amount,
133
- * deadline, or nonce values.
134
- * @throws {viem.BaseError} when a vault, allowance, or nonce read or transaction encoding fails.
139
+ * @throws {BundlesPermitMismatchError} from `buildTx()` when the share permit is malformed or
140
+ * its spender, amount or deadline differ from this operation's.
141
+ * @throws {viem.BaseError} when an allowance or nonce read or transaction encoding fails.
135
142
  * @example
136
143
  * ```ts
137
144
  * import { morphoViemExtension } from "@morpho-org/morpho-sdk";
@@ -143,7 +150,8 @@ export interface VaultV1Actions {
143
150
  * const client = createPublicClient({ chain: mainnet, transport: http() })
144
151
  * .extend(morphoViemExtension({ supportSignature: false }));
145
152
  * const vault = client.morpho.vaultV1(vaultAddress, mainnet.id);
146
- * const action = vault.withdraw({ amount: 1_000_000n, userAddress });
153
+ * const vaultData = await vault.getData();
154
+ * const action = vault.withdraw({ amount: 1_000_000n, userAddress, vaultData });
147
155
  * const requirements = await action.getRequirements();
148
156
  * // Send and confirm each approval before calling action.buildTx().
149
157
  * // action.buildTx() returns Readonly<Transaction<VaultV1WithdrawAction>>.
@@ -154,6 +162,7 @@ export interface VaultV1Actions {
154
162
  withdraw: (params: {
155
163
  readonly amount: bigint;
156
164
  readonly userAddress: Address;
165
+ readonly vaultData: AccrualVault;
157
166
  readonly slippageTolerance?: bigint;
158
167
  readonly referralFeePct?: bigint;
159
168
  readonly referralFeeRecipient?: Address;
@@ -165,7 +174,6 @@ export interface VaultV1Actions {
165
174
  * Captures `shares` and `userAddress` at handle creation for both requirements and `buildTx()`.
166
175
  * The caller must satisfy the exact vault-share allowance returned by `getRequirements()` before
167
176
  * `buildTx()`; every requirement resolution re-reads the live allowance and checks the deadline.
168
- * `buildTx()` accepts permits from the latest completed requirement resolution.
169
177
  *
170
178
  * @param params.shares - Exact vault shares to burn.
171
179
  * @param params.userAddress - Account that signs and submits the transaction; VaultBundlesV1
@@ -179,6 +187,7 @@ export interface VaultV1Actions {
179
187
  * @throws {ChainIdMismatchError} when the connected client targets another chain.
180
188
  * @throws {NonPositiveInputError} when `shares` is not positive.
181
189
  * @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
190
+ * @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256.
182
191
  * @throws {NegativeInputError} when `referralFeePct` is negative.
183
192
  * @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
184
193
  * @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
@@ -187,8 +196,8 @@ export interface VaultV1Actions {
187
196
  * @throws {viem.BaseError} from `getRequirements()` when an allowance or permit-nonce read fails.
188
197
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permit signatures are supplied.
189
198
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when a non-permit signature is supplied.
190
- * @throws {BundlesPermitMismatchError} from `buildTx()` when the supplied permit does not match
191
- * the resolved share amount, spender, owner, nonce, or deadline.
199
+ * @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
200
+ * deadline differ from this operation's.
192
201
  * @example
193
202
  * ```ts
194
203
  * import { vaults } from "@morpho-org/morpho-test";
@@ -313,7 +322,6 @@ export interface VaultV1Actions {
313
322
  * VaultBundlesV1. Only the destination deposit has an onchain share-price bound. The caller must
314
323
  * satisfy the exact source-vault share requirement before building the transaction.
315
324
  * Captures vault identities, permit-domain metadata, and the owner at handle creation.
316
- * `buildTx()` accepts permits from the latest completed requirement resolution.
317
325
  *
318
326
  * @param params.userAddress - Account that signs and submits the transaction; VaultBundlesV1
319
327
  * burns and mints shares for `msg.sender`.
@@ -346,6 +354,7 @@ export interface VaultV1Actions {
346
354
  * @throws {NegativeInputError} when slippage tolerance or `referralFeePct` is negative.
347
355
  * @throws {ExcessiveSlippageToleranceError} when slippage tolerance exceeds the SDK maximum.
348
356
  * @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
357
+ * @throws {InputExceedsMaxError} when the selected amount, `maxSharePriceVaultV2`, or `deadline` exceeds uint256.
349
358
  * @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
350
359
  * @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
351
360
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
@@ -353,8 +362,8 @@ export interface VaultV1Actions {
353
362
  * @throws {viem.BaseError} from `getRequirements()` when an allowance or permit-nonce read fails.
354
363
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permit signatures are supplied.
355
364
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when a non-permit signature is supplied.
356
- * @throws {BundlesPermitMismatchError} from `buildTx()` when the supplied permit does not match
357
- * the prepared source share cap, spender, owner, nonce, or deadline.
365
+ * @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
366
+ * deadline differ from this operation's.
358
367
  * @example
359
368
  * ```ts
360
369
  * import { vaults } from "@morpho-org/morpho-test";
@@ -426,6 +435,7 @@ export declare class MorphoVaultV1 implements VaultV1Actions {
426
435
  withdraw(params: {
427
436
  readonly amount: bigint;
428
437
  readonly userAddress: Address;
438
+ readonly vaultData: AccrualVault;
429
439
  readonly slippageTolerance?: bigint;
430
440
  readonly referralFeePct?: bigint;
431
441
  readonly referralFeeRecipient?: Address;