@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.2
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.
- package/MIGRATION-v5-to-v6.md +127 -16
- package/README.md +17 -11
- package/lib/cjs/abis.d.ts +17 -2
- package/lib/cjs/abis.js +14 -1
- package/lib/cjs/actions/blue/common.js +5 -26
- package/lib/cjs/actions/blue/supply.js +2 -7
- package/lib/cjs/actions/bundles/common.d.ts +32 -2
- package/lib/cjs/actions/bundles/common.js +68 -30
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +6 -10
- package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/blue/index.js +0 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +15 -8
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +20 -20
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +33 -27
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +15 -10
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +1 -0
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +4 -1
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +5 -2
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +6 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +2 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +1 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +3 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +1 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +3 -2
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
- package/lib/cjs/blue/abis.d.ts +5 -1
- package/lib/cjs/blue/abis.js +2 -0
- package/lib/cjs/blue/entities.d.ts +8 -2
- package/lib/cjs/blue/entities.js +1 -0
- package/lib/cjs/blue/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +2 -1
- package/lib/cjs/blue/fetch.d.ts +3 -1
- package/lib/cjs/blue/fetch.js +1 -0
- package/lib/cjs/entities/blue/blue.d.ts +15 -6
- package/lib/cjs/entities/blue/blue.js +3 -0
- package/lib/cjs/entities/index.d.ts +8 -2
- package/lib/cjs/entities/index.js +1 -0
- package/lib/cjs/entities/midnight/midnight.js +20 -24
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +19 -14
- package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +1 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +10 -5
- package/lib/cjs/entities/vaultV1/vaultV1.js +13 -1
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +6 -0
- package/lib/cjs/entities/vaultV1ReallocationData.js +20 -5
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +140 -34
- package/lib/cjs/entities/vaultV2/vaultV2.js +229 -16
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +46 -13
- package/lib/cjs/errors.d.ts +1 -1
- package/lib/cjs/errors.js +3 -2
- package/lib/cjs/fetch.d.ts +3 -1
- package/lib/cjs/fetch.js +1 -0
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +2 -0
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +2 -0
- package/lib/cjs/helpers/index.d.ts +3 -1
- package/lib/cjs/helpers/index.js +10 -1
- package/lib/cjs/helpers/metadata.d.ts +3 -5
- package/lib/cjs/helpers/metadata.js +4 -6
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/cjs/helpers/slippage.d.ts +46 -0
- package/lib/cjs/helpers/slippage.js +65 -0
- package/lib/cjs/helpers/validate.d.ts +65 -8
- package/lib/cjs/helpers/validate.js +83 -9
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
- package/lib/cjs/types/action.d.ts +95 -13
- package/lib/cjs/types/error.d.ts +290 -12
- package/lib/cjs/types/error.js +312 -24
- package/lib/cjs/types/sharedLiquidity.d.ts +2 -2
- package/lib/cjs/utils.d.ts +3 -1
- package/lib/cjs/utils.js +10 -1
- package/lib/esm/abis.d.ts +17 -2
- package/lib/esm/abis.js +17 -2
- package/lib/esm/actions/blue/common.js +7 -28
- package/lib/esm/actions/blue/supply.js +4 -9
- package/lib/esm/actions/bundles/common.d.ts +32 -2
- package/lib/esm/actions/bundles/common.js +68 -31
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +8 -12
- package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
- package/lib/esm/actions/requirements/blue/index.js +0 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +15 -8
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +21 -21
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +34 -28
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +15 -10
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +1 -0
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +4 -1
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +5 -2
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +6 -0
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +2 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +1 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.js +3 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +1 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.js +3 -2
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +3 -1
- package/lib/esm/blue/abis.d.ts +5 -1
- package/lib/esm/blue/abis.js +5 -1
- package/lib/esm/blue/entities.d.ts +8 -2
- package/lib/esm/blue/entities.js +3 -1
- package/lib/esm/blue/errors.d.ts +1 -1
- package/lib/esm/blue/errors.js +1 -1
- package/lib/esm/blue/fetch.d.ts +3 -1
- package/lib/esm/blue/fetch.js +3 -1
- package/lib/esm/entities/blue/blue.d.ts +15 -6
- package/lib/esm/entities/blue/blue.js +3 -0
- package/lib/esm/entities/index.d.ts +8 -2
- package/lib/esm/entities/index.js +3 -1
- package/lib/esm/entities/midnight/midnight.js +20 -24
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +20 -15
- package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/esm/entities/requirements/index.d.ts +1 -0
- package/lib/esm/entities/requirements/index.js +1 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +10 -5
- package/lib/esm/entities/vaultV1/vaultV1.js +14 -2
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +6 -0
- package/lib/esm/entities/vaultV1ReallocationData.js +20 -5
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +140 -34
- package/lib/esm/entities/vaultV2/vaultV2.js +234 -21
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.js +46 -13
- package/lib/esm/errors.d.ts +1 -1
- package/lib/esm/errors.js +1 -1
- package/lib/esm/fetch.d.ts +3 -1
- package/lib/esm/fetch.js +3 -1
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +2 -0
- package/lib/esm/helpers/computeVaultV1Reallocations.js +2 -0
- package/lib/esm/helpers/index.d.ts +3 -1
- package/lib/esm/helpers/index.js +3 -1
- package/lib/esm/helpers/metadata.d.ts +3 -5
- package/lib/esm/helpers/metadata.js +4 -6
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/esm/helpers/slippage.d.ts +46 -0
- package/lib/esm/helpers/slippage.js +65 -1
- package/lib/esm/helpers/validate.d.ts +65 -8
- package/lib/esm/helpers/validate.js +82 -10
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
- package/lib/esm/types/action.d.ts +95 -13
- package/lib/esm/types/error.d.ts +290 -12
- package/lib/esm/types/error.js +301 -19
- package/lib/esm/types/sharedLiquidity.d.ts +2 -2
- package/lib/esm/utils.d.ts +3 -1
- package/lib/esm/utils.js +3 -1
- package/package.json +7 -7
- /package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
- /package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
package/lib/cjs/types/error.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.RefinanceSharesMissingBorrowAssetsError = exports.RefinanceExceedsBorrowAssetsError = exports.RefinanceExceedsBorrowSharesError = exports.RefinanceExceedsCollateralError = exports.BorrowAmountAndSharesExclusiveError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.VaultAssetMismatchError = exports.ReallocationWithdrawExceedsMarketSupplyError = exports.WithdrawSharesExceedSupplyError = exports.WithdrawExceedsSupplyError = exports.MutuallyExclusiveWithdrawAmountsError = exports.InsufficientMidnightWithdrawableLiquidityError = exports.MidnightRedeemExceedsCreditError = exports.NoMidnightCreditToRedeemError = exports.UnpreparedMidnightOfferRootSignatureError = exports.MidnightOfferRootOfferCountMismatchError = exports.MidnightOfferRootRatifierMismatchError = exports.MidnightOfferRootOwnerMismatchError = exports.MidnightOfferRootMismatchError = exports.MissingMidnightOfferRootSignatureError = exports.UnknownMidnightRatifierError = exports.MidnightTakeableOfferMarketMismatchError = exports.MidnightOfferMarketLoanTokenMismatchError = exports.MidnightMarketAddressMismatchError = exports.MidnightOfferMarketAddressMismatchError = exports.MidnightOfferMarketChainMismatchError = exports.MidnightOfferMakerMismatchError = exports.MidnightOfferSideMismatchError = exports.EmptyMidnightTakeableOffersError = exports.MidnightAmountExceedsMaxOfferCapError = exports.ReallocationAdapterSupplySharesUnderflowError = exports.ReallocationAllocationUnderflowError = exports.UnknownReallocationAdapterError = exports.UnknownReallocationMarketPublicAllocatorConfigError = exports.UnknownReallocationActiveAdaptersError = exports.UnknownReallocationPublicAllocatorConfigError = exports.UnknownReallocationAllocationError = exports.UnknownReallocationPositionError = exports.UnknownReallocationVaultMarketConfigError = exports.UnknownReallocationVaultError = exports.UnknownReallocationMarketError = exports.InsufficientSharedLiquidityError = void 0;
|
|
3
|
+
exports.ZeroSupplyAmountError = exports.NonPositiveWithdrawCollateralAmountError = exports.NonPositiveRepayMaxSharePriceError = exports.NonPositiveRepayAmountError = exports.NonPositiveReallocationAmountError = exports.ZeroCollateralAmountError = exports.NonPositiveBorrowAmountError = exports.ZeroDepositAmountError = exports.NonPositiveMaxSharePriceError = exports.NonPositiveSharesAmountError = exports.NonPositiveAssetAmountError = exports.MaxRepayAssetsBelowRepayAssetsError = exports.ReallocationsRequireBorrowError = exports.UnsupportedAuthorizationOperatorError = exports.ReallocationLoanTokenMismatchError = exports.SameVaultMigrationError = exports.AmountAndSharesExclusiveError = exports.MixedBundlesFundingError = exports.ReferralFeePctExceededError = exports.MissingReferralFeeRecipientError = exports.ReferralFeeRecipientMissingError = exports.NativeFundingAmountMismatchError = exports.Permit2TransferFromNonceAlreadyUsedError = exports.NoUnusedPermit2NonceError = exports.Permit2SignatureTransferNonceAlreadyUsedError = exports.BlueBundlesV1RequirementSignatureMismatchError = exports.BundlesRequirementSignatureMismatchError = exports.VaultExitBundlesV1PermitMismatchError = exports.BundlesPermitMismatchError = exports.VaultIsBlueFeeRecipientError = exports.VaultMorphoMismatchError = exports.InsufficientBlueBalanceForInKindRedeemError = exports.InKindRedeemCoverageError = exports.InKindRedeemZeroDeallocationError = exports.VaultV2ForceWithdrawFeeSharesExceedBurnError = exports.VaultV2ForceWithdrawZeroSharePriceError = exports.VaultV2ForceWithdrawZeroWithdrawalError = exports.VaultV2ForceWithdrawCoverageError = exports.VaultV2UndecodableLiquidityDataError = exports.VaultV2UnsupportedLiquidityAdapterError = exports.UnsupportedInKindAdapterError = exports.VaultV2UnsupportedExitAdapterError = exports.AdapterNotPartOfVaultError = exports.InKindRedeemRequiresSingleAdapterError = exports.VaultV2SingleAdapterRequiredError = exports.ExpiredDeadlineError = exports.EmptyMarketParamsListError = exports.InputExceedsMaxError = exports.NonPositiveInputError = exports.NegativeInputError = void 0;
|
|
4
|
+
exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.MutuallyExclusiveRepayAmountsError = exports.TransferAmountNotEqualToAssetsError = exports.UnsortedReallocationWithdrawalsError = exports.InconsistentReallocationPenaltyError = exports.InvalidReallocationSourceTypeError = exports.InvalidReallocationAddressError = exports.MixedReallocationVersionsError = exports.InvalidReallocationShapeError = exports.ReallocationWithdrawalOnTargetMarketError = exports.EmptyReallocationWithdrawalsError = exports.AccrualPositionUserMismatchError = exports.MarketIdMismatchError = exports.MissingMarketPriceError = exports.BorrowExceedsSafeLtvError = exports.NativeAmountOnNonWNativeCollateralError = exports.NativeAmountOnNonWNativeAssetError = exports.VaultAddressMismatchError = exports.ChainWNativeMissingError = exports.NativeAmountOnNonWNativeVaultError = exports.Permit2ExpirationMissingError = exports.DepositSpenderMismatchError = exports.DepositOwnerMismatchError = exports.DepositAssetMismatchError = exports.DepositAmountMismatchError = exports.EmptyDeallocationsError = exports.ExcessiveSlippageToleranceError = exports.MissingAccrualPositionError = exports.UnsupportedMidnightAuthorizationTargetError = exports.UnsupportedErc20ApprovalSpenderError = exports.ApprovalAmountLessThanSpendAmountError = exports.MissingClientPropertyError = exports.CryptoUnavailableError = exports.ChainIdMismatchError = exports.AddressMismatchError = exports.UnexpectedRequirementSignatureError = exports.AmbiguousRequirementSignaturesError = exports.BundlerErrors = exports.NegativeMaxRepaySharePriceError = exports.NegativeBorrowSharesError = exports.NegativeMinSharePriceError = exports.NegativeWithdrawMinSharePriceError = exports.NegativeSupplyMaxSharePriceError = exports.NegativeSupplyAmountError = exports.NonPositiveMinBorrowSharePriceError = exports.NegativeReallocationFeeError = exports.NegativeNativeAmountError = exports.NegativeSlippageToleranceError = exports.NonPositiveWithdrawAmountError = void 0;
|
|
5
|
+
exports.RefinanceSharesMissingBorrowAssetsError = exports.RefinanceExceedsBorrowAssetsError = exports.RefinanceExceedsBorrowSharesError = exports.RefinanceExceedsCollateralError = exports.BorrowAmountAndSharesExclusiveError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.VaultAssetMismatchError = exports.ReallocationWithdrawExceedsMarketSupplyError = exports.WithdrawSharesExceedSupplyError = exports.WithdrawExceedsSupplyError = exports.MutuallyExclusiveWithdrawAmountsError = exports.InsufficientMidnightWithdrawableLiquidityError = exports.MidnightRedeemExceedsCreditError = exports.NoMidnightCreditToRedeemError = exports.UnpreparedMidnightOfferRootSignatureError = exports.MidnightOfferRootOfferCountMismatchError = exports.MidnightOfferRootRatifierMismatchError = exports.MidnightOfferRootOwnerMismatchError = exports.MidnightOfferRootMismatchError = exports.MissingMidnightOfferRootSignatureError = exports.UnknownMidnightRatifierError = exports.MidnightTakeableOfferMarketMismatchError = exports.MidnightOfferMarketLoanTokenMismatchError = exports.MidnightMarketAddressMismatchError = exports.MidnightOfferMarketAddressMismatchError = exports.MidnightOfferMarketChainMismatchError = exports.MidnightOfferMakerMismatchError = exports.MidnightOfferSideMismatchError = exports.EmptyMidnightTakeableOffersError = exports.MidnightAmountExceedsMaxOfferCapError = exports.ReallocationAdapterSupplySharesUnderflowError = exports.ReallocationAllocationUnderflowError = exports.UnknownReallocationAdapterError = exports.UnknownReallocationMarketPublicAllocatorConfigError = exports.UnknownReallocationActiveAdaptersError = exports.UnknownReallocationPublicAllocatorConfigError = exports.UnknownReallocationAllocationError = exports.UnknownReallocationPositionError = exports.UnknownReallocationVaultMarketConfigError = exports.UnknownReallocationVaultError = exports.UnknownReallocationMarketError = exports.InsufficientSharedLiquidityError = exports.DisabledReallocationMarketError = exports.MissingPublicAllocatorConfigError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.ShareDivideByZeroError = void 0;
|
|
6
6
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
7
7
|
/**
|
|
8
8
|
* Thrown when a morpho-sdk input that must be non-negative is negative.
|
|
@@ -107,8 +107,23 @@ class ExpiredDeadlineError extends Error {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
exports.ExpiredDeadlineError = ExpiredDeadlineError;
|
|
110
|
-
/**
|
|
111
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Thrown when a VaultExitBundlesV1 Vault V2 exit targets a vault without exactly one adapter.
|
|
112
|
+
*
|
|
113
|
+
* Both `vaultExitBundlesV1InKindRedemptionVaultV2` and
|
|
114
|
+
* `vaultExitBundlesV1ForceWithdrawVaultV2` require `adaptersLength() == 1`.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* import { VaultV2SingleAdapterRequiredError } from "@morpho-org/morpho-sdk";
|
|
119
|
+
*
|
|
120
|
+
* const error = new VaultV2SingleAdapterRequiredError(vault, 2);
|
|
121
|
+
* if (error instanceof VaultV2SingleAdapterRequiredError) {
|
|
122
|
+
* console.error(error.vault, error.adapters);
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
class VaultV2SingleAdapterRequiredError extends Error {
|
|
112
127
|
vault;
|
|
113
128
|
adapters;
|
|
114
129
|
/**
|
|
@@ -116,13 +131,15 @@ class InKindRedeemRequiresSingleAdapterError extends Error {
|
|
|
116
131
|
* @param adapters - Number of adapters in the supplied vault snapshot.
|
|
117
132
|
*/
|
|
118
133
|
constructor(vault, adapters) {
|
|
119
|
-
super(`Vault "${vault}" has "${adapters}" adapters.
|
|
134
|
+
super(`Vault "${vault}" has "${adapters}" adapters. VaultExitBundlesV1 exits require exactly one MorphoMarketV1AdapterV2.`);
|
|
120
135
|
this.vault = vault;
|
|
121
136
|
this.adapters = adapters;
|
|
122
|
-
this.name = "
|
|
137
|
+
this.name = "VaultV2SingleAdapterRequiredError";
|
|
123
138
|
}
|
|
124
139
|
}
|
|
125
|
-
exports.
|
|
140
|
+
exports.VaultV2SingleAdapterRequiredError = VaultV2SingleAdapterRequiredError;
|
|
141
|
+
/** @deprecated Use {@link VaultV2SingleAdapterRequiredError}. */
|
|
142
|
+
exports.InKindRedeemRequiresSingleAdapterError = VaultV2SingleAdapterRequiredError;
|
|
126
143
|
/** Thrown when a requested in-kind redemption adapter is not part of the Vault V2 snapshot. */
|
|
127
144
|
class AdapterNotPartOfVaultError extends Error {
|
|
128
145
|
vault;
|
|
@@ -139,19 +156,299 @@ class AdapterNotPartOfVaultError extends Error {
|
|
|
139
156
|
}
|
|
140
157
|
}
|
|
141
158
|
exports.AdapterNotPartOfVaultError = AdapterNotPartOfVaultError;
|
|
142
|
-
/**
|
|
143
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Thrown when the Vault V2 adapter cannot expose MorphoMarketV1AdapterV2 market shares.
|
|
161
|
+
*
|
|
162
|
+
* VaultExitBundlesV1 casts the adapter to `IMorphoMarketV1AdapterV2`, so a legacy
|
|
163
|
+
* positions-based `MorphoMarketV1Adapter` or a `MorphoVaultV1Adapter` cannot be exited.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* import { VaultV2UnsupportedExitAdapterError } from "@morpho-org/morpho-sdk";
|
|
168
|
+
*
|
|
169
|
+
* const error = new VaultV2UnsupportedExitAdapterError(adapter);
|
|
170
|
+
* if (error instanceof VaultV2UnsupportedExitAdapterError) {
|
|
171
|
+
* console.error(error.adapter);
|
|
172
|
+
* }
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
class VaultV2UnsupportedExitAdapterError extends Error {
|
|
144
176
|
adapter;
|
|
145
177
|
/**
|
|
146
178
|
* @param adapter - Unsupported Vault V2 adapter address.
|
|
147
179
|
*/
|
|
148
180
|
constructor(adapter) {
|
|
149
|
-
super(`Adapter "${adapter}" does not support Vault V2
|
|
181
|
+
super(`Adapter "${adapter}" does not support Vault V2 exits through VaultExitBundlesV1. Use a MorphoMarketV1AdapterV2-backed vault.`);
|
|
150
182
|
this.adapter = adapter;
|
|
151
|
-
this.name = "
|
|
183
|
+
this.name = "VaultV2UnsupportedExitAdapterError";
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.VaultV2UnsupportedExitAdapterError = VaultV2UnsupportedExitAdapterError;
|
|
187
|
+
/** @deprecated Use {@link VaultV2UnsupportedExitAdapterError}. */
|
|
188
|
+
exports.UnsupportedInKindAdapterError = VaultV2UnsupportedExitAdapterError;
|
|
189
|
+
/**
|
|
190
|
+
* Thrown when a Vault V2 exit cannot resolve the vault's configured liquidity adapter.
|
|
191
|
+
*
|
|
192
|
+
* `VaultExitBundlesV1.vaultExitBundlesV1ForceWithdrawVaultV2` casts `liquidityAdapter` to
|
|
193
|
+
* `IMorphoMarketV1AdapterV2` and ABI-decodes `liquidityData` as `MarketParams`. Because the exit
|
|
194
|
+
* also requires `adaptersLength() == 1`, the only resolvable configurations are an unset
|
|
195
|
+
* liquidity adapter or the vault's sole adapter.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* import { VaultV2UnsupportedLiquidityAdapterError } from "@morpho-org/morpho-sdk";
|
|
200
|
+
*
|
|
201
|
+
* const error = new VaultV2UnsupportedLiquidityAdapterError({
|
|
202
|
+
* vault,
|
|
203
|
+
* liquidityAdapter,
|
|
204
|
+
* adapter,
|
|
205
|
+
* });
|
|
206
|
+
* if (error instanceof VaultV2UnsupportedLiquidityAdapterError) {
|
|
207
|
+
* console.error(error.liquidityAdapter, error.adapter);
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
class VaultV2UnsupportedLiquidityAdapterError extends Error {
|
|
212
|
+
/** Vault V2 address. */
|
|
213
|
+
vault;
|
|
214
|
+
/** Liquidity adapter configured on the vault. */
|
|
215
|
+
liquidityAdapter;
|
|
216
|
+
/** Sole adapter the exit targets. */
|
|
217
|
+
adapter;
|
|
218
|
+
/**
|
|
219
|
+
* @param params - Liquidity-adapter mismatch details.
|
|
220
|
+
* @param params.vault - Vault V2 address.
|
|
221
|
+
* @param params.liquidityAdapter - Liquidity adapter configured on the vault.
|
|
222
|
+
* @param params.adapter - Sole adapter the exit targets.
|
|
223
|
+
*/
|
|
224
|
+
constructor(params) {
|
|
225
|
+
super(`Vault "${params.vault}" routes liquidity through "${params.liquidityAdapter}", which is neither unset nor its sole adapter "${params.adapter}". Use another exit path until the vault routes liquidity through its sole MorphoMarketV1AdapterV2.`);
|
|
226
|
+
this.vault = params.vault;
|
|
227
|
+
this.liquidityAdapter = params.liquidityAdapter;
|
|
228
|
+
this.adapter = params.adapter;
|
|
229
|
+
this.name = "VaultV2UnsupportedLiquidityAdapterError";
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.VaultV2UnsupportedLiquidityAdapterError = VaultV2UnsupportedLiquidityAdapterError;
|
|
233
|
+
/**
|
|
234
|
+
* Thrown when a Vault V2 exit cannot ABI-decode the vault's `liquidityData` as `MarketParams`.
|
|
235
|
+
*
|
|
236
|
+
* Distinct from {@link VaultV2UnsupportedLiquidityAdapterError}: the liquidity adapter *is* the
|
|
237
|
+
* vault's sole adapter, but the market params stored alongside it are unusable, so the contract's
|
|
238
|
+
* `abi.decode` would revert. Only the vault curator can repair this by re-setting the liquidity
|
|
239
|
+
* adapter and data.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* import { VaultV2UndecodableLiquidityDataError } from "@morpho-org/morpho-sdk";
|
|
244
|
+
*
|
|
245
|
+
* try {
|
|
246
|
+
* vault.forceWithdraw({ exitAssets: 1_000_000n, vaultData, userAddress });
|
|
247
|
+
* } catch (error) {
|
|
248
|
+
* if (error instanceof VaultV2UndecodableLiquidityDataError) {
|
|
249
|
+
* console.error(error.liquidityData, error.cause);
|
|
250
|
+
* }
|
|
251
|
+
* }
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
class VaultV2UndecodableLiquidityDataError extends Error {
|
|
255
|
+
/** Vault V2 address. */
|
|
256
|
+
vault;
|
|
257
|
+
/** Liquidity adapter configured on the vault. */
|
|
258
|
+
liquidityAdapter;
|
|
259
|
+
/** Raw `liquidityData` that failed to decode. */
|
|
260
|
+
liquidityData;
|
|
261
|
+
/**
|
|
262
|
+
* @param params - Undecodable liquidity-data details.
|
|
263
|
+
* @param params.vault - Vault V2 address.
|
|
264
|
+
* @param params.liquidityAdapter - Liquidity adapter configured on the vault.
|
|
265
|
+
* @param params.liquidityData - Raw `liquidityData` that failed to decode.
|
|
266
|
+
* @param params.cause - Underlying decode failure.
|
|
267
|
+
*/
|
|
268
|
+
constructor(params) {
|
|
269
|
+
super(`Vault "${params.vault}" stores liquidity data "${params.liquidityData}" for adapter "${params.liquidityAdapter}" that does not decode as MarketParams. Use another exit path until the vault curator re-sets its liquidity adapter and data.`, { cause: params.cause });
|
|
270
|
+
this.vault = params.vault;
|
|
271
|
+
this.liquidityAdapter = params.liquidityAdapter;
|
|
272
|
+
this.liquidityData = params.liquidityData;
|
|
273
|
+
this.name = "VaultV2UndecodableLiquidityDataError";
|
|
152
274
|
}
|
|
153
275
|
}
|
|
154
|
-
exports.
|
|
276
|
+
exports.VaultV2UndecodableLiquidityDataError = VaultV2UndecodableLiquidityDataError;
|
|
277
|
+
/**
|
|
278
|
+
* Thrown when the adapter's markets cannot cover a Vault V2 force withdrawal.
|
|
279
|
+
*
|
|
280
|
+
* `vaultExitBundlesV1ForceWithdrawVaultV2` loops over the adapter's market list without a bound,
|
|
281
|
+
* so an under-covered request reverts on-chain with a raw `panic 0x32`. This error surfaces that
|
|
282
|
+
* failure before submission.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* import { VaultV2ForceWithdrawCoverageError } from "@morpho-org/morpho-sdk";
|
|
287
|
+
*
|
|
288
|
+
* const error = new VaultV2ForceWithdrawCoverageError({
|
|
289
|
+
* required: 100n,
|
|
290
|
+
* covered: 40n,
|
|
291
|
+
* maxExitAssets: 60n,
|
|
292
|
+
* });
|
|
293
|
+
* if (error instanceof VaultV2ForceWithdrawCoverageError) {
|
|
294
|
+
* console.error(error.maxExitAssets);
|
|
295
|
+
* }
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
class VaultV2ForceWithdrawCoverageError extends Error {
|
|
299
|
+
/** Assets that must be force-deallocated from the adapter's markets. */
|
|
300
|
+
required;
|
|
301
|
+
/** Assets the adapter's markets can actually release. */
|
|
302
|
+
covered;
|
|
303
|
+
/** Largest penalty-inclusive `exitAssets` the current vault state supports. */
|
|
304
|
+
maxExitAssets;
|
|
305
|
+
/**
|
|
306
|
+
* @param params - Coverage values used to explain the rejected exit.
|
|
307
|
+
* @param params.required - Assets that must be force-deallocated.
|
|
308
|
+
* @param params.covered - Assets the adapter's markets can release.
|
|
309
|
+
* @param params.maxExitAssets - Largest supported penalty-inclusive `exitAssets`.
|
|
310
|
+
*/
|
|
311
|
+
constructor(params) {
|
|
312
|
+
super(`Force withdrawal requires "${params.required}" force-deallocated assets but the adapter's markets only release "${params.covered}". Reduce exitAssets to at most "${params.maxExitAssets}" or wait for market liquidity.`);
|
|
313
|
+
this.required = params.required;
|
|
314
|
+
this.covered = params.covered;
|
|
315
|
+
this.maxExitAssets = params.maxExitAssets;
|
|
316
|
+
this.name = "VaultV2ForceWithdrawCoverageError";
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
exports.VaultV2ForceWithdrawCoverageError = VaultV2ForceWithdrawCoverageError;
|
|
320
|
+
/**
|
|
321
|
+
* Thrown when a Vault V2 force withdrawal would withdraw nothing while still consuming its permit.
|
|
322
|
+
*
|
|
323
|
+
* Happens on a dust `exitAssets` when the vault has no penalty-free liquidity and the
|
|
324
|
+
* penalty-adjusted remainder rounds down to zero.
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```ts
|
|
328
|
+
* import { VaultV2ForceWithdrawZeroWithdrawalError } from "@morpho-org/morpho-sdk";
|
|
329
|
+
*
|
|
330
|
+
* const error = new VaultV2ForceWithdrawZeroWithdrawalError({
|
|
331
|
+
* vault,
|
|
332
|
+
* exitAssets: 1n,
|
|
333
|
+
* penalty: 20_000000000000000n,
|
|
334
|
+
* });
|
|
335
|
+
* if (error instanceof VaultV2ForceWithdrawZeroWithdrawalError) {
|
|
336
|
+
* console.error(error.exitAssets, error.penalty);
|
|
337
|
+
* }
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
class VaultV2ForceWithdrawZeroWithdrawalError extends Error {
|
|
341
|
+
/** Vault V2 address. */
|
|
342
|
+
vault;
|
|
343
|
+
/** Positive penalty-inclusive amount requested by the caller. */
|
|
344
|
+
exitAssets;
|
|
345
|
+
/** WAD-scaled force-deallocation penalty applied by the adapter. */
|
|
346
|
+
penalty;
|
|
347
|
+
/**
|
|
348
|
+
* @param params - Values that caused the exit to withdraw nothing.
|
|
349
|
+
* @param params.vault - Vault V2 address.
|
|
350
|
+
* @param params.exitAssets - Positive penalty-inclusive amount requested by the caller.
|
|
351
|
+
* @param params.penalty - WAD-scaled force-deallocation penalty applied by the adapter.
|
|
352
|
+
*/
|
|
353
|
+
constructor(params) {
|
|
354
|
+
super(`Vault "${params.vault}" has no penalty-free liquidity, and force-withdraw exitAssets "${params.exitAssets}" rounds to zero withdrawn assets after applying penalty "${params.penalty}". Increase exitAssets or use another exit path.`);
|
|
355
|
+
this.vault = params.vault;
|
|
356
|
+
this.exitAssets = params.exitAssets;
|
|
357
|
+
this.penalty = params.penalty;
|
|
358
|
+
this.name = "VaultV2ForceWithdrawZeroWithdrawalError";
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
exports.VaultV2ForceWithdrawZeroWithdrawalError = VaultV2ForceWithdrawZeroWithdrawalError;
|
|
362
|
+
/**
|
|
363
|
+
* Thrown when a Vault V2 force withdrawal's derived share-price floor rounds down to zero.
|
|
364
|
+
*
|
|
365
|
+
* VaultExitBundlesV1 reads `minSharePriceE27 == 0` as "no bound at all", so emitting a rounded-down
|
|
366
|
+
* zero would silently ship an exit with none of the slippage protection this path exists to add.
|
|
367
|
+
* Reaching it means the exit burns more shares than `withdrawnAssets` can price at RAY scale — a
|
|
368
|
+
* vault whose share price has collapsed below `1e-27` assets per share, or a dust exit against one.
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* ```ts
|
|
372
|
+
* import { VaultV2ForceWithdrawZeroSharePriceError } from "@morpho-org/morpho-sdk";
|
|
373
|
+
*
|
|
374
|
+
* try {
|
|
375
|
+
* vault.forceWithdraw({ exitAssets, vaultData, userAddress });
|
|
376
|
+
* } catch (error) {
|
|
377
|
+
* if (error instanceof VaultV2ForceWithdrawZeroSharePriceError) {
|
|
378
|
+
* console.error(error.withdrawnAssets, error.sharesBurnt);
|
|
379
|
+
* }
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
class VaultV2ForceWithdrawZeroSharePriceError extends Error {
|
|
384
|
+
/** Assets the exit withdraws in total, before the referral fee. */
|
|
385
|
+
withdrawnAssets;
|
|
386
|
+
/** Upper bound of the vault shares the exit burns. */
|
|
387
|
+
sharesBurnt;
|
|
388
|
+
/** WAD-scaled slippage tolerance applied to the floor. */
|
|
389
|
+
slippageTolerance;
|
|
390
|
+
/**
|
|
391
|
+
* @param params - Values whose ratio rounded down to a zero share-price floor.
|
|
392
|
+
* @param params.withdrawnAssets - Assets the exit withdraws in total, before the referral fee.
|
|
393
|
+
* @param params.sharesBurnt - Upper bound of the vault shares the exit burns.
|
|
394
|
+
* @param params.slippageTolerance - WAD-scaled slippage tolerance applied to the floor.
|
|
395
|
+
*/
|
|
396
|
+
constructor(params) {
|
|
397
|
+
super(`Force-withdraw share-price floor rounds to zero: withdrawnAssets "${params.withdrawnAssets}" over sharesBurnt "${params.sharesBurnt}" at slippageTolerance "${params.slippageTolerance}". The contract reads a zero floor as no bound at all, so this exit cannot be built safely — increase exitAssets or use another exit path.`);
|
|
398
|
+
this.withdrawnAssets = params.withdrawnAssets;
|
|
399
|
+
this.sharesBurnt = params.sharesBurnt;
|
|
400
|
+
this.slippageTolerance = params.slippageTolerance;
|
|
401
|
+
this.name = "VaultV2ForceWithdrawZeroSharePriceError";
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
exports.VaultV2ForceWithdrawZeroSharePriceError = VaultV2ForceWithdrawZeroSharePriceError;
|
|
405
|
+
/**
|
|
406
|
+
* Thrown when fee shares projected to the accepted deadline reach the lower force-withdraw
|
|
407
|
+
* burn bound at that time.
|
|
408
|
+
*
|
|
409
|
+
* VaultExitBundlesV1 measures shares burned after its first withdrawal accrues fees. If the
|
|
410
|
+
* recipient's fee shares are at least the measured burn bound, its share-price check is skipped or
|
|
411
|
+
* reverts due to an underflow.
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```ts
|
|
415
|
+
* import { VaultV2ForceWithdrawFeeSharesExceedBurnError } from "@morpho-org/morpho-sdk";
|
|
416
|
+
*
|
|
417
|
+
* try {
|
|
418
|
+
* vault.forceWithdraw({ exitAssets, vaultData, userAddress });
|
|
419
|
+
* } catch (error) {
|
|
420
|
+
* if (error instanceof VaultV2ForceWithdrawFeeSharesExceedBurnError) {
|
|
421
|
+
* console.error(error.sharesBurnt, error.feeShares);
|
|
422
|
+
* }
|
|
423
|
+
* }
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
class VaultV2ForceWithdrawFeeSharesExceedBurnError extends Error {
|
|
427
|
+
/** Vault V2 address being exited. */
|
|
428
|
+
vault;
|
|
429
|
+
/** Fee-recipient account submitting the exit. */
|
|
430
|
+
userAddress;
|
|
431
|
+
/** Lower bound of shares measured as burned by VaultExitBundlesV1. */
|
|
432
|
+
sharesBurnt;
|
|
433
|
+
/** Fee shares projected for `userAddress` at the accepted deadline. */
|
|
434
|
+
feeShares;
|
|
435
|
+
/**
|
|
436
|
+
* @param params - Fee-share and burn-bound values that make the exit unsafe.
|
|
437
|
+
* @param params.vault - Vault V2 address being exited.
|
|
438
|
+
* @param params.userAddress - Fee-recipient account submitting the exit.
|
|
439
|
+
* @param params.sharesBurnt - Lower bound of shares measured as burned by VaultExitBundlesV1.
|
|
440
|
+
* @param params.feeShares - Fee shares projected for `userAddress` at the accepted deadline.
|
|
441
|
+
*/
|
|
442
|
+
constructor(params) {
|
|
443
|
+
super(`Vault V2 "${params.vault}" fee-recipient account "${params.userAddress}" accrues "${params.feeShares}" fee shares, reaching the lower force-withdraw share-burn bound "${params.sharesBurnt}". VaultExitBundlesV1's share-price check would be skipped or revert. Increase exitAssets or let the vault accrue first.`);
|
|
444
|
+
this.vault = params.vault;
|
|
445
|
+
this.userAddress = params.userAddress;
|
|
446
|
+
this.sharesBurnt = params.sharesBurnt;
|
|
447
|
+
this.feeShares = params.feeShares;
|
|
448
|
+
this.name = "VaultV2ForceWithdrawFeeSharesExceedBurnError";
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
exports.VaultV2ForceWithdrawFeeSharesExceedBurnError = VaultV2ForceWithdrawFeeSharesExceedBurnError;
|
|
155
452
|
/** Thrown when a Vault V2 in-kind redemption rounds to no deallocated assets. */
|
|
156
453
|
class InKindRedeemZeroDeallocationError extends Error {
|
|
157
454
|
/**
|
|
@@ -307,15 +604,6 @@ class BundlesRequirementSignatureMismatchError extends Error {
|
|
|
307
604
|
}
|
|
308
605
|
exports.BundlesRequirementSignatureMismatchError = BundlesRequirementSignatureMismatchError;
|
|
309
606
|
exports.BlueBundlesV1RequirementSignatureMismatchError = BundlesRequirementSignatureMismatchError;
|
|
310
|
-
/** Thrown when Permit2 SignatureTransfer is selected without an explicit unordered nonce. */
|
|
311
|
-
class MissingPermit2SignatureTransferNonceError extends Error {
|
|
312
|
-
constructor() {
|
|
313
|
-
super("Permit2 SignatureTransfer requires an explicit unused permit2Nonce. Generate a unique uint256 nonce, pass it to getRequirements(), and resolve the requirements again.");
|
|
314
|
-
this.name = "MissingPermit2SignatureTransferNonceError";
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
exports.MissingPermit2SignatureTransferNonceError = MissingPermit2SignatureTransferNonceError;
|
|
318
|
-
exports.MissingPermit2TransferFromNonceError = MissingPermit2SignatureTransferNonceError;
|
|
319
607
|
/** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
|
|
320
608
|
class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
|
|
321
609
|
owner;
|
|
@@ -1359,10 +1647,10 @@ class MidnightOfferRootOfferCountMismatchError extends Error {
|
|
|
1359
1647
|
}
|
|
1360
1648
|
}
|
|
1361
1649
|
exports.MidnightOfferRootOfferCountMismatchError = MidnightOfferRootOfferCountMismatchError;
|
|
1362
|
-
/** Thrown when a Midnight offer-root signature
|
|
1650
|
+
/** Thrown when a Midnight offer-root signature carries no encoded payload. */
|
|
1363
1651
|
class UnpreparedMidnightOfferRootSignatureError extends Error {
|
|
1364
1652
|
constructor() {
|
|
1365
|
-
super("Midnight offer root signature
|
|
1653
|
+
super("Midnight offer root signature carries no encoded payload. Sign the offer-root requirement (its signature already includes the payload) before building the submit transaction.");
|
|
1366
1654
|
}
|
|
1367
1655
|
}
|
|
1368
1656
|
exports.UnpreparedMidnightOfferRootSignatureError = UnpreparedMidnightOfferRootSignatureError;
|
|
@@ -24,8 +24,8 @@ export interface PublicAllocatorOptions {
|
|
|
24
24
|
* The maximum utilization each source market may reach when withdrawing
|
|
25
25
|
* shared liquidity, scaled by WAD.
|
|
26
26
|
*
|
|
27
|
-
* @deprecated
|
|
28
|
-
* Use `
|
|
27
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major.
|
|
28
|
+
* Use `VaultV2BluePublicAllocatorOptions.maxWithdrawalUtilization` with the Vault V2 planner.
|
|
29
29
|
*/
|
|
30
30
|
readonly maxWithdrawalUtilization?: Readonly<Record<MarketId, bigint | undefined>>;
|
|
31
31
|
/**
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDotte
|
|
|
34
34
|
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
|
|
35
35
|
export { computeReallocations, computeVaultV1Reallocations, } from "./helpers/computeVaultV1Reallocations.js";
|
|
36
36
|
export { addTransactionMetadata } from "./helpers/metadata.js";
|
|
37
|
+
export { type PreviewVaultV2ForceWithdrawParams, previewVaultV2ForceWithdraw, type VaultV2ForceWithdrawPreview, } from "./helpers/previewVaultV2ForceWithdraw.js";
|
|
37
38
|
export { type PreviewVaultV2InKindRedeemParams, previewVaultV2InKindRedeem, type VaultV2InKindRedeemMarketPreview, } from "./helpers/previewVaultV2InKindRedeem.js";
|
|
38
|
-
export { computeMaxRepaySharePrice, computeMinBorrowSharePrice, } from "./helpers/slippage.js";
|
|
39
|
+
export { computeMaxRepaySharePrice, computeMinBorrowSharePrice, computeMinForceWithdrawSharePrice, } from "./helpers/slippage.js";
|
|
39
40
|
export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
|
|
41
|
+
export { computeVaultV2ForceWithdrawFeeSharesMinted, computeVaultV2ForceWithdrawMinSharesBurnt, computeVaultV2ForceWithdrawPlan, computeVaultV2ForceWithdrawSharesBurnt, resolveVaultV2ForceWithdrawEligibility, type VaultV2ForceWithdrawEligibility, type VaultV2ForceWithdrawPlan, } from "./helpers/vaultV2ForceWithdrawPlan.js";
|
package/lib/cjs/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TreeUtils = exports.MidnightTreeUtils = exports.TickLib = exports.MidnightTickLib = exports.TakeAmountsLib = exports.MidnightTakeAmountsLib = exports.SetterRatifierUtils = exports.MidnightSetterRatifierUtils = exports.RatifierUtils = exports.MidnightRatifierUtils = exports.MidnightPositionUtils = exports.Payload = exports.MidnightPayload = exports.OfferUtils = exports.MidnightOfferUtils = exports.MidnightOfferChainUtils = exports.MidnightMarketUtils = exports.GroupUtils = exports.MidnightGroupUtils = exports.eip712Digest = exports.EcrecoverRatifierUtils = exports.MidnightEcrecoverRatifierUtils = exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.BlueMetaMorphoAction = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getDaiPermitTypedData = exports.getAuthorizationTypedData = exports.getBlueAuthorizationTypedData = exports.decodeBytes32String = exports.VaultV2Utils = exports.VaultV2BluePublicAllocatorConfigUtils = exports.VaultV2BlueMarketPublicAllocatorConfigUtils = exports.VaultUtils = exports.SharesMath = exports.BlueSharesMath = exports.MathLib = exports.MarketUtils = exports.BlueMarketUtils = exports.getBlueDefaultPreLiquidationParams = exports.blueDefaultPreLiquidationParamsRegistry = exports.CapacityLimitReason = exports.AdaptiveCurveIrmLib = exports.BlueAdaptiveCurveIrmLib = void 0;
|
|
4
|
-
exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validateReallocations = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateChainId = exports.validateAccrualPosition = exports.computeMinBorrowSharePrice = exports.computeMaxRepaySharePrice = exports.previewVaultV2InKindRedeem = exports.addTransactionMetadata = exports.computeVaultV1Reallocations = exports.computeReallocations = exports.values = exports.transformValue = exports.Time = exports.retryPromiseLinearBackoff = exports.mergeEntries = exports.keys = exports.isNotUndefined = exports.isNotNull = exports.isDefined = exports.hasValue = exports.getValue = exports.getSubdomainBaseUrl = exports.getLastDefined = exports.getLast = exports.fromEntries = exports.filterDefined = exports.entries = exports.deepFreeze = exports.createHasValue = exports.createGetValue = exports.bigIntComparator = void 0;
|
|
4
|
+
exports.resolveVaultV2ForceWithdrawEligibility = exports.computeVaultV2ForceWithdrawSharesBurnt = exports.computeVaultV2ForceWithdrawPlan = exports.computeVaultV2ForceWithdrawMinSharesBurnt = exports.computeVaultV2ForceWithdrawFeeSharesMinted = exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validateReallocations = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateChainId = exports.validateAccrualPosition = exports.computeMinForceWithdrawSharePrice = exports.computeMinBorrowSharePrice = exports.computeMaxRepaySharePrice = exports.previewVaultV2InKindRedeem = exports.previewVaultV2ForceWithdraw = exports.addTransactionMetadata = exports.computeVaultV1Reallocations = exports.computeReallocations = exports.values = exports.transformValue = exports.Time = exports.retryPromiseLinearBackoff = exports.mergeEntries = exports.keys = exports.isNotUndefined = exports.isNotNull = exports.isDefined = exports.hasValue = exports.getValue = exports.getSubdomainBaseUrl = exports.getLastDefined = exports.getLast = exports.fromEntries = exports.filterDefined = exports.entries = exports.deepFreeze = exports.createHasValue = exports.createGetValue = exports.bigIntComparator = void 0;
|
|
5
5
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
6
6
|
Object.defineProperty(exports, "BlueAdaptiveCurveIrmLib", { enumerable: true, get: function () { return blue_sdk_1.AdaptiveCurveIrmLib; } });
|
|
7
7
|
/** @deprecated Use BlueAdaptiveCurveIrmLib or the raw protocol subpath. */
|
|
@@ -96,11 +96,14 @@ Object.defineProperty(exports, "computeReallocations", { enumerable: true, get:
|
|
|
96
96
|
Object.defineProperty(exports, "computeVaultV1Reallocations", { enumerable: true, get: function () { return computeVaultV1Reallocations_js_1.computeVaultV1Reallocations; } });
|
|
97
97
|
var metadata_js_1 = require("./helpers/metadata.js");
|
|
98
98
|
Object.defineProperty(exports, "addTransactionMetadata", { enumerable: true, get: function () { return metadata_js_1.addTransactionMetadata; } });
|
|
99
|
+
var previewVaultV2ForceWithdraw_js_1 = require("./helpers/previewVaultV2ForceWithdraw.js");
|
|
100
|
+
Object.defineProperty(exports, "previewVaultV2ForceWithdraw", { enumerable: true, get: function () { return previewVaultV2ForceWithdraw_js_1.previewVaultV2ForceWithdraw; } });
|
|
99
101
|
var previewVaultV2InKindRedeem_js_1 = require("./helpers/previewVaultV2InKindRedeem.js");
|
|
100
102
|
Object.defineProperty(exports, "previewVaultV2InKindRedeem", { enumerable: true, get: function () { return previewVaultV2InKindRedeem_js_1.previewVaultV2InKindRedeem; } });
|
|
101
103
|
var slippage_js_1 = require("./helpers/slippage.js");
|
|
102
104
|
Object.defineProperty(exports, "computeMaxRepaySharePrice", { enumerable: true, get: function () { return slippage_js_1.computeMaxRepaySharePrice; } });
|
|
103
105
|
Object.defineProperty(exports, "computeMinBorrowSharePrice", { enumerable: true, get: function () { return slippage_js_1.computeMinBorrowSharePrice; } });
|
|
106
|
+
Object.defineProperty(exports, "computeMinForceWithdrawSharePrice", { enumerable: true, get: function () { return slippage_js_1.computeMinForceWithdrawSharePrice; } });
|
|
104
107
|
var validate_js_1 = require("./helpers/validate.js");
|
|
105
108
|
Object.defineProperty(exports, "validateAccrualPosition", { enumerable: true, get: function () { return validate_js_1.validateAccrualPosition; } });
|
|
106
109
|
Object.defineProperty(exports, "validateChainId", { enumerable: true, get: function () { return validate_js_1.validateChainId; } });
|
|
@@ -112,3 +115,9 @@ Object.defineProperty(exports, "validateRepayAmount", { enumerable: true, get: f
|
|
|
112
115
|
Object.defineProperty(exports, "validateRepayShares", { enumerable: true, get: function () { return validate_js_1.validateRepayShares; } });
|
|
113
116
|
Object.defineProperty(exports, "validateSlippageTolerance", { enumerable: true, get: function () { return validate_js_1.validateSlippageTolerance; } });
|
|
114
117
|
Object.defineProperty(exports, "validateUserAddress", { enumerable: true, get: function () { return validate_js_1.validateUserAddress; } });
|
|
118
|
+
var vaultV2ForceWithdrawPlan_js_1 = require("./helpers/vaultV2ForceWithdrawPlan.js");
|
|
119
|
+
Object.defineProperty(exports, "computeVaultV2ForceWithdrawFeeSharesMinted", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawFeeSharesMinted; } });
|
|
120
|
+
Object.defineProperty(exports, "computeVaultV2ForceWithdrawMinSharesBurnt", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawMinSharesBurnt; } });
|
|
121
|
+
Object.defineProperty(exports, "computeVaultV2ForceWithdrawPlan", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawPlan; } });
|
|
122
|
+
Object.defineProperty(exports, "computeVaultV2ForceWithdrawSharesBurnt", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawSharesBurnt; } });
|
|
123
|
+
Object.defineProperty(exports, "resolveVaultV2ForceWithdrawEligibility", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.resolveVaultV2ForceWithdrawEligibility; } });
|
package/lib/esm/abis.d.ts
CHANGED
|
@@ -7,7 +7,11 @@ adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoA
|
|
|
7
7
|
/** @deprecated Use `bluePreLiquidationAbi` or the raw `/blue/abis` subpath. */
|
|
8
8
|
preLiquidationAbi, preLiquidationFactoryAbi as bluePreLiquidationFactoryAbi,
|
|
9
9
|
/** @deprecated Use `bluePreLiquidationFactoryAbi` or the raw `/blue/abis` subpath. */
|
|
10
|
-
preLiquidationFactoryAbi,
|
|
10
|
+
preLiquidationFactoryAbi,
|
|
11
|
+
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
12
|
+
publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
|
|
13
|
+
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
14
|
+
vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
|
|
11
15
|
export { ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi,
|
|
12
16
|
/** @deprecated Use `midnightEcrecoverRatifierAbi` or the raw `/midnight/abis` subpath. */
|
|
13
17
|
ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi as midnightSetterRatifierAbi,
|
|
@@ -1374,7 +1378,12 @@ export declare const generalAdapter1Abi: readonly [{
|
|
|
1374
1378
|
readonly name: "ZeroShares";
|
|
1375
1379
|
readonly inputs: readonly [];
|
|
1376
1380
|
}];
|
|
1377
|
-
/**
|
|
1381
|
+
/**
|
|
1382
|
+
* ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension.
|
|
1383
|
+
*
|
|
1384
|
+
* MORPHO legacy token wrapping entries are deprecated and will be removed in the next major.
|
|
1385
|
+
* Use the current MORPHO token directly. Native-token and stETH wrapping remain supported.
|
|
1386
|
+
*/
|
|
1378
1387
|
export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
1379
1388
|
readonly type: "receive";
|
|
1380
1389
|
readonly stateMutability: "payable";
|
|
@@ -2043,10 +2052,12 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2043
2052
|
readonly type: "address";
|
|
2044
2053
|
readonly internalType: "address";
|
|
2045
2054
|
}, {
|
|
2055
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2046
2056
|
readonly name: "morphoToken";
|
|
2047
2057
|
readonly type: "address";
|
|
2048
2058
|
readonly internalType: "address";
|
|
2049
2059
|
}, {
|
|
2060
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2050
2061
|
readonly name: "morphoWrapper";
|
|
2051
2062
|
readonly type: "address";
|
|
2052
2063
|
readonly internalType: "address";
|
|
@@ -2054,6 +2065,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2054
2065
|
readonly stateMutability: "nonpayable";
|
|
2055
2066
|
}, {
|
|
2056
2067
|
readonly type: "function";
|
|
2068
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2057
2069
|
readonly name: "MORPHO_TOKEN";
|
|
2058
2070
|
readonly inputs: readonly [];
|
|
2059
2071
|
readonly outputs: readonly [{
|
|
@@ -2064,6 +2076,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2064
2076
|
readonly stateMutability: "view";
|
|
2065
2077
|
}, {
|
|
2066
2078
|
readonly type: "function";
|
|
2079
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2067
2080
|
readonly name: "MORPHO_WRAPPER";
|
|
2068
2081
|
readonly inputs: readonly [];
|
|
2069
2082
|
readonly outputs: readonly [{
|
|
@@ -2094,6 +2107,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2094
2107
|
readonly stateMutability: "view";
|
|
2095
2108
|
}, {
|
|
2096
2109
|
readonly type: "function";
|
|
2110
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2097
2111
|
readonly name: "morphoWrapperDepositFor";
|
|
2098
2112
|
readonly inputs: readonly [{
|
|
2099
2113
|
readonly name: "receiver";
|
|
@@ -2108,6 +2122,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2108
2122
|
readonly stateMutability: "nonpayable";
|
|
2109
2123
|
}, {
|
|
2110
2124
|
readonly type: "function";
|
|
2125
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2111
2126
|
readonly name: "morphoWrapperWithdrawTo";
|
|
2112
2127
|
readonly inputs: readonly [{
|
|
2113
2128
|
readonly name: "receiver";
|
package/lib/esm/abis.js
CHANGED
|
@@ -7,7 +7,11 @@ adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoA
|
|
|
7
7
|
/** @deprecated Use `bluePreLiquidationAbi` or the raw `/blue/abis` subpath. */
|
|
8
8
|
preLiquidationAbi, preLiquidationFactoryAbi as bluePreLiquidationFactoryAbi,
|
|
9
9
|
/** @deprecated Use `bluePreLiquidationFactoryAbi` or the raw `/blue/abis` subpath. */
|
|
10
|
-
preLiquidationFactoryAbi,
|
|
10
|
+
preLiquidationFactoryAbi,
|
|
11
|
+
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
12
|
+
publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
|
|
13
|
+
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
14
|
+
vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
|
|
11
15
|
export { ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi,
|
|
12
16
|
/** @deprecated Use `midnightEcrecoverRatifierAbi` or the raw `/midnight/abis` subpath. */
|
|
13
17
|
ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi as midnightSetterRatifierAbi,
|
|
@@ -1286,7 +1290,12 @@ export const generalAdapter1Abi = [
|
|
|
1286
1290
|
inputs: [],
|
|
1287
1291
|
},
|
|
1288
1292
|
];
|
|
1289
|
-
/**
|
|
1293
|
+
/**
|
|
1294
|
+
* ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension.
|
|
1295
|
+
*
|
|
1296
|
+
* MORPHO legacy token wrapping entries are deprecated and will be removed in the next major.
|
|
1297
|
+
* Use the current MORPHO token directly. Native-token and stETH wrapping remain supported.
|
|
1298
|
+
*/
|
|
1290
1299
|
export const ethereumGeneralAdapter1Abi = [
|
|
1291
1300
|
...generalAdapter1Abi,
|
|
1292
1301
|
{
|
|
@@ -1313,11 +1322,13 @@ export const ethereumGeneralAdapter1Abi = [
|
|
|
1313
1322
|
internalType: "address",
|
|
1314
1323
|
},
|
|
1315
1324
|
{
|
|
1325
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1316
1326
|
name: "morphoToken",
|
|
1317
1327
|
type: "address",
|
|
1318
1328
|
internalType: "address",
|
|
1319
1329
|
},
|
|
1320
1330
|
{
|
|
1331
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1321
1332
|
name: "morphoWrapper",
|
|
1322
1333
|
type: "address",
|
|
1323
1334
|
internalType: "address",
|
|
@@ -1327,6 +1338,7 @@ export const ethereumGeneralAdapter1Abi = [
|
|
|
1327
1338
|
},
|
|
1328
1339
|
{
|
|
1329
1340
|
type: "function",
|
|
1341
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1330
1342
|
name: "MORPHO_TOKEN",
|
|
1331
1343
|
inputs: [],
|
|
1332
1344
|
outputs: [
|
|
@@ -1340,6 +1352,7 @@ export const ethereumGeneralAdapter1Abi = [
|
|
|
1340
1352
|
},
|
|
1341
1353
|
{
|
|
1342
1354
|
type: "function",
|
|
1355
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1343
1356
|
name: "MORPHO_WRAPPER",
|
|
1344
1357
|
inputs: [],
|
|
1345
1358
|
outputs: [
|
|
@@ -1379,6 +1392,7 @@ export const ethereumGeneralAdapter1Abi = [
|
|
|
1379
1392
|
},
|
|
1380
1393
|
{
|
|
1381
1394
|
type: "function",
|
|
1395
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1382
1396
|
name: "morphoWrapperDepositFor",
|
|
1383
1397
|
inputs: [
|
|
1384
1398
|
{
|
|
@@ -1397,6 +1411,7 @@ export const ethereumGeneralAdapter1Abi = [
|
|
|
1397
1411
|
},
|
|
1398
1412
|
{
|
|
1399
1413
|
type: "function",
|
|
1414
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1400
1415
|
name: "morphoWrapperWithdrawTo",
|
|
1401
1416
|
inputs: [
|
|
1402
1417
|
{
|