@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.3
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 +199 -34
- package/README.md +23 -15
- package/lib/cjs/abis.d.ts +3 -2829
- package/lib/cjs/abis.js +1 -1938
- package/lib/cjs/actions/blue/borrow.d.ts +3 -2
- package/lib/cjs/actions/blue/borrow.js +3 -2
- package/lib/cjs/actions/blue/common.js +6 -35
- package/lib/cjs/actions/blue/refinance.d.ts +2 -2
- package/lib/cjs/actions/blue/refinance.js +2 -2
- package/lib/cjs/actions/blue/repay.d.ts +1 -1
- package/lib/cjs/actions/blue/repay.js +1 -1
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/cjs/actions/blue/supply.d.ts +2 -2
- package/lib/cjs/actions/blue/supply.js +4 -9
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
- package/lib/cjs/actions/blue/withdraw.js +3 -3
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
- package/lib/cjs/actions/bundles/common.d.ts +38 -4
- package/lib/cjs/actions/bundles/common.js +91 -35
- package/lib/cjs/actions/index.d.ts +0 -1
- package/lib/cjs/actions/index.js +0 -1
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +17 -26
- 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 +20 -14
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +24 -25
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -38
- 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/encode/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/encode/index.js +0 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/cjs/actions/requirements/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/index.js +0 -1
- package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV1/deposit.js +1 -2
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV2/deposit.js +1 -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 +6 -4
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/cjs/augment.d.ts +0 -1
- package/lib/cjs/augment.js +0 -1
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +1 -5
- package/lib/cjs/blue/entities.d.ts +2 -2
- package/lib/cjs/blue/entities.js +1 -2
- package/lib/cjs/blue/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +2 -1
- package/lib/cjs/blue/fetch.d.ts +1 -1
- package/lib/cjs/blue/fetch.js +1 -2
- package/lib/cjs/blue/types.d.ts +2 -4
- package/lib/cjs/blue/utils.d.ts +1 -3
- package/lib/cjs/blue/utils.js +1 -3
- package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
- package/lib/cjs/client/morphoViemExtension.js +1 -1
- package/lib/cjs/constants.d.ts +3 -37
- package/lib/cjs/constants.js +1 -39
- package/lib/cjs/entities/blue/blue.d.ts +38 -264
- package/lib/cjs/entities/blue/blue.js +2 -203
- package/lib/cjs/entities/index.d.ts +3 -60
- package/lib/cjs/entities/index.js +1 -20
- 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 +18 -6
- package/lib/cjs/entities/vaultV1/vaultV1.js +25 -8
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/cjs/entities/vaultV2/vaultV2.js +249 -23
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +50 -34
- package/lib/cjs/errors.d.ts +2 -46
- package/lib/cjs/errors.js +2 -46
- package/lib/cjs/fetch.d.ts +1 -15
- package/lib/cjs/fetch.js +1 -16
- package/lib/cjs/helpers/constant.d.ts +0 -2
- package/lib/cjs/helpers/constant.js +0 -2
- package/lib/cjs/helpers/index.d.ts +4 -3
- package/lib/cjs/helpers/index.js +10 -9
- 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 +34 -90
- package/lib/cjs/helpers/slippage.js +52 -137
- package/lib/cjs/helpers/utilization.d.ts +12 -10
- package/lib/cjs/helpers/utilization.js +27 -12
- package/lib/cjs/helpers/validate.d.ts +66 -32
- package/lib/cjs/helpers/validate.js +84 -57
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
- package/lib/cjs/types/action.d.ts +102 -68
- package/lib/cjs/types/action.js +11 -4
- package/lib/cjs/types/error.d.ts +332 -385
- package/lib/cjs/types/error.js +369 -412
- package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
- package/lib/cjs/types.d.ts +2 -18
- package/lib/cjs/utils.d.ts +8 -35
- package/lib/cjs/utils.js +11 -36
- package/lib/esm/abis.d.ts +3 -2829
- package/lib/esm/abis.js +3 -1935
- package/lib/esm/actions/blue/borrow.d.ts +3 -2
- package/lib/esm/actions/blue/borrow.js +3 -2
- package/lib/esm/actions/blue/common.js +8 -37
- package/lib/esm/actions/blue/refinance.d.ts +2 -2
- package/lib/esm/actions/blue/refinance.js +2 -2
- package/lib/esm/actions/blue/repay.d.ts +1 -1
- package/lib/esm/actions/blue/repay.js +1 -1
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/esm/actions/blue/supply.d.ts +2 -2
- package/lib/esm/actions/blue/supply.js +6 -11
- package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/supplyCollateral.js +2 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/esm/actions/blue/withdraw.d.ts +3 -3
- package/lib/esm/actions/blue/withdraw.js +3 -3
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
- package/lib/esm/actions/bundles/common.d.ts +38 -4
- package/lib/esm/actions/bundles/common.js +91 -36
- package/lib/esm/actions/index.d.ts +0 -1
- package/lib/esm/actions/index.js +0 -1
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +20 -29
- 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 +20 -14
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +25 -26
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -39
- 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/encode/index.d.ts +0 -1
- package/lib/esm/actions/requirements/encode/index.js +0 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/esm/actions/requirements/index.d.ts +0 -1
- package/lib/esm/actions/requirements/index.js +0 -1
- package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV1/deposit.js +1 -2
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV2/deposit.js +1 -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 +6 -4
- package/lib/esm/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/esm/augment.d.ts +0 -1
- package/lib/esm/augment.js +0 -1
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/entities.d.ts +2 -2
- package/lib/esm/blue/entities.js +1 -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 +1 -1
- package/lib/esm/blue/fetch.js +1 -1
- package/lib/esm/blue/types.d.ts +2 -4
- package/lib/esm/blue/utils.d.ts +1 -3
- package/lib/esm/blue/utils.js +1 -3
- package/lib/esm/client/morphoViemExtension.d.ts +1 -1
- package/lib/esm/client/morphoViemExtension.js +1 -1
- package/lib/esm/constants.d.ts +3 -37
- package/lib/esm/constants.js +3 -37
- package/lib/esm/entities/blue/blue.d.ts +38 -264
- package/lib/esm/entities/blue/blue.js +5 -206
- package/lib/esm/entities/index.d.ts +3 -60
- package/lib/esm/entities/index.js +1 -16
- 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 +18 -6
- package/lib/esm/entities/vaultV1/vaultV1.js +29 -12
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/esm/entities/vaultV2/vaultV2.js +256 -30
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.js +48 -32
- package/lib/esm/errors.d.ts +2 -46
- package/lib/esm/errors.js +2 -46
- package/lib/esm/fetch.d.ts +1 -15
- package/lib/esm/fetch.js +1 -15
- package/lib/esm/helpers/constant.d.ts +0 -2
- package/lib/esm/helpers/constant.js +0 -2
- package/lib/esm/helpers/index.d.ts +4 -3
- package/lib/esm/helpers/index.js +4 -3
- 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 +34 -90
- package/lib/esm/helpers/slippage.js +52 -134
- package/lib/esm/helpers/utilization.d.ts +12 -10
- package/lib/esm/helpers/utilization.js +26 -11
- package/lib/esm/helpers/validate.d.ts +66 -32
- package/lib/esm/helpers/validate.js +83 -57
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +1 -3
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
- package/lib/esm/types/action.d.ts +102 -68
- package/lib/esm/types/action.js +12 -5
- package/lib/esm/types/error.d.ts +332 -385
- package/lib/esm/types/error.js +355 -392
- package/lib/esm/types/sharedLiquidity.d.ts +1 -117
- package/lib/esm/types.d.ts +2 -18
- package/lib/esm/utils.d.ts +8 -35
- package/lib/esm/utils.js +7 -34
- package/package.json +7 -15
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -83
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -151
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -50
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
- package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -43
- package/lib/cjs/actions/signatures/index.d.ts +0 -3
- package/lib/cjs/actions/signatures/index.js +0 -19
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
- package/lib/cjs/bundler/actions.d.ts +0 -797
- package/lib/cjs/bundler/actions.js +0 -1371
- package/lib/cjs/bundler/index.d.ts +0 -2
- package/lib/cjs/bundler/index.js +0 -18
- package/lib/cjs/bundler/types.d.ts +0 -235
- package/lib/cjs/bundler/types.js +0 -2
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/cjs/entities/vaultV1ReallocationData.js +0 -542
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -243
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -79
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -147
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -46
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
- package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -39
- package/lib/esm/actions/signatures/index.d.ts +0 -3
- package/lib/esm/actions/signatures/index.js +0 -3
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -5
- package/lib/esm/bundler/actions.d.ts +0 -797
- package/lib/esm/bundler/actions.js +0 -1368
- package/lib/esm/bundler/index.d.ts +0 -2
- package/lib/esm/bundler/index.js +0 -2
- package/lib/esm/bundler/types.d.ts +0 -235
- package/lib/esm/bundler/types.js +0 -1
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/esm/entities/vaultV1ReallocationData.js +0 -544
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -239
- /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/errors.js
CHANGED
|
@@ -1,43 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.RegistryValueAlreadyRegisteredError = exports.NegativeValueError = exports.InvalidBitLengthError = exports.DivisionByZeroError = exports._try = exports.UnknownCollateralIndexError = exports.UnknownMidnightCollateralIndexError = exports.TickOutOfRangeError = exports.MidnightTickOutOfRangeError = exports.SettlementFeeExceedsPriceError = exports.MidnightSettlementFeeExceedsPriceError = exports.PriceGreaterThanOneError = exports.MidnightPriceGreaterThanOneError = exports.MidnightPayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidMidnightTypedDataSignatureError = exports.InvalidTreeHeightError = void 0;
|
|
3
|
+
exports.RegistryValueAlreadyRegisteredError = exports.NegativeValueError = exports.InvalidBitLengthError = exports.DivisionByZeroError = exports._try = exports.UnknownMidnightCollateralIndexError = exports.MidnightTickOutOfRangeError = exports.MidnightSettlementFeeExceedsPriceError = exports.MidnightPriceGreaterThanOneError = exports.MidnightPayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidMidnightTypedDataSignatureError = exports.InvalidMidnightTreeHeightError = exports.InvalidMidnightTreeError = exports.InvalidMidnightTickSpacingError = exports.InvalidMidnightPositionLossFactorError = exports.InvalidMidnightPositionAccrualTimestampError = exports.InvalidMidnightPositionAccrualStateError = exports.InvalidMidnightOfferParameterError = exports.InvalidMidnightOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightMarketParameterError = exports.InvalidMidnightEcrecoverSignatureVError = exports.MidnightChainIdMismatchError = exports.UnsupportedPermitDomainExtensionsError = exports.isBlueUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.getBlueUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedBlueVaultV2AdapterError = exports.UnsupportedBluePreLiquidationParamsError = exports.UnsupportedBlueMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownBlueVaultConfigError = exports.UnknownBlueTokenPriceError = exports.UnknownBlueTokenError = exports.UnknownBlueOfFactory = exports.UnknownBlueMarketParamsError = exports.UnknownBlueMarketAllocationError = exports.UnknownBlueFactory = exports.UnknownBlueDataError = exports.UnknownAddressError = exports.InvalidBlueMarketParamsError = exports.IncompleteChainRegistryError = exports.BlueErrors = void 0;
|
|
5
4
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
6
5
|
Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
|
|
7
6
|
Object.defineProperty(exports, "IncompleteChainRegistryError", { enumerable: true, get: function () { return blue_sdk_1.IncompleteChainRegistryError; } });
|
|
8
7
|
Object.defineProperty(exports, "InvalidBlueMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidMarketParamsError; } });
|
|
9
|
-
/** @deprecated Use InvalidBlueMarketParamsError or the raw protocol subpath. */
|
|
10
|
-
Object.defineProperty(exports, "InvalidMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidMarketParamsError; } });
|
|
11
8
|
Object.defineProperty(exports, "UnknownAddressError", { enumerable: true, get: function () { return blue_sdk_1.UnknownAddressError; } });
|
|
12
9
|
Object.defineProperty(exports, "UnknownBlueDataError", { enumerable: true, get: function () { return blue_sdk_1.UnknownDataError; } });
|
|
13
|
-
/** @deprecated Use UnknownBlueDataError or the raw protocol subpath. */
|
|
14
|
-
Object.defineProperty(exports, "UnknownDataError", { enumerable: true, get: function () { return blue_sdk_1.UnknownDataError; } });
|
|
15
10
|
Object.defineProperty(exports, "UnknownBlueFactory", { enumerable: true, get: function () { return blue_sdk_1.UnknownFactory; } });
|
|
16
|
-
/** @deprecated Use UnknownBlueFactory or the raw protocol subpath. */
|
|
17
|
-
Object.defineProperty(exports, "UnknownFactory", { enumerable: true, get: function () { return blue_sdk_1.UnknownFactory; } });
|
|
18
11
|
Object.defineProperty(exports, "UnknownBlueMarketAllocationError", { enumerable: true, get: function () { return blue_sdk_1.UnknownMarketAllocationError; } });
|
|
19
12
|
Object.defineProperty(exports, "UnknownBlueMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.UnknownMarketParamsError; } });
|
|
20
|
-
/** @deprecated Use UnknownBlueMarketParamsError or the raw protocol subpath. */
|
|
21
|
-
Object.defineProperty(exports, "UnknownMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.UnknownMarketParamsError; } });
|
|
22
13
|
Object.defineProperty(exports, "UnknownBlueOfFactory", { enumerable: true, get: function () { return blue_sdk_1.UnknownOfFactory; } });
|
|
23
|
-
/** @deprecated Use UnknownBlueOfFactory or the raw protocol subpath. */
|
|
24
|
-
Object.defineProperty(exports, "UnknownOfFactory", { enumerable: true, get: function () { return blue_sdk_1.UnknownOfFactory; } });
|
|
25
14
|
Object.defineProperty(exports, "UnknownBlueTokenError", { enumerable: true, get: function () { return blue_sdk_1.UnknownTokenError; } });
|
|
26
|
-
/** @deprecated Use UnknownBlueTokenError or the raw protocol subpath. */
|
|
27
|
-
Object.defineProperty(exports, "UnknownTokenError", { enumerable: true, get: function () { return blue_sdk_1.UnknownTokenError; } });
|
|
28
15
|
Object.defineProperty(exports, "UnknownBlueTokenPriceError", { enumerable: true, get: function () { return blue_sdk_1.UnknownTokenPriceError; } });
|
|
29
|
-
/** @deprecated Use UnknownBlueTokenPriceError or the raw protocol subpath. */
|
|
30
|
-
Object.defineProperty(exports, "UnknownTokenPriceError", { enumerable: true, get: function () { return blue_sdk_1.UnknownTokenPriceError; } });
|
|
31
16
|
Object.defineProperty(exports, "UnknownBlueVaultConfigError", { enumerable: true, get: function () { return blue_sdk_1.UnknownVaultConfigError; } });
|
|
32
|
-
/** @deprecated Use UnknownBlueVaultConfigError or the raw protocol subpath. */
|
|
33
|
-
Object.defineProperty(exports, "UnknownVaultConfigError", { enumerable: true, get: function () { return blue_sdk_1.UnknownVaultConfigError; } });
|
|
34
17
|
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedChainIdError; } });
|
|
18
|
+
Object.defineProperty(exports, "UnsupportedBlueMarketIrmError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedMarketIrmError; } });
|
|
35
19
|
Object.defineProperty(exports, "UnsupportedBluePreLiquidationParamsError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedPreLiquidationParamsError; } });
|
|
36
|
-
/** @deprecated Use UnsupportedBluePreLiquidationParamsError or the raw protocol subpath. */
|
|
37
|
-
Object.defineProperty(exports, "UnsupportedPreLiquidationParamsError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedPreLiquidationParamsError; } });
|
|
38
20
|
Object.defineProperty(exports, "UnsupportedBlueVaultV2AdapterError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedVaultV2AdapterError; } });
|
|
39
|
-
/** @deprecated Use UnsupportedBlueVaultV2AdapterError or the raw protocol subpath. */
|
|
40
|
-
Object.defineProperty(exports, "UnsupportedVaultV2AdapterError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedVaultV2AdapterError; } });
|
|
41
21
|
Object.defineProperty(exports, "VaultV2Errors", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Errors; } });
|
|
42
22
|
var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
43
23
|
Object.defineProperty(exports, "getBlueUnsupportedVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.getUnsupportedVaultV2Adapter; } });
|
|
@@ -51,45 +31,21 @@ Object.defineProperty(exports, "InvalidMidnightEcrecoverSignatureVError", { enum
|
|
|
51
31
|
Object.defineProperty(exports, "InvalidMidnightMarketParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMarketParameterError; } });
|
|
52
32
|
Object.defineProperty(exports, "InvalidMidnightApiResponseError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMidnightApiResponseError; } });
|
|
53
33
|
Object.defineProperty(exports, "InvalidMidnightOfferGroupError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferGroupError; } });
|
|
54
|
-
/** @deprecated Use InvalidMidnightOfferGroupError or the raw protocol subpath. */
|
|
55
|
-
Object.defineProperty(exports, "InvalidOfferGroupError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferGroupError; } });
|
|
56
34
|
Object.defineProperty(exports, "InvalidMidnightOfferParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferParameterError; } });
|
|
57
|
-
/** @deprecated Use InvalidMidnightOfferParameterError or the raw protocol subpath. */
|
|
58
|
-
Object.defineProperty(exports, "InvalidOfferParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferParameterError; } });
|
|
59
35
|
Object.defineProperty(exports, "InvalidMidnightPositionAccrualStateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualStateError; } });
|
|
60
|
-
/** @deprecated Use InvalidMidnightPositionAccrualStateError or the raw protocol subpath. */
|
|
61
|
-
Object.defineProperty(exports, "InvalidPositionAccrualStateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualStateError; } });
|
|
62
36
|
Object.defineProperty(exports, "InvalidMidnightPositionAccrualTimestampError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualTimestampError; } });
|
|
63
|
-
/** @deprecated Use InvalidMidnightPositionAccrualTimestampError or the raw protocol subpath. */
|
|
64
|
-
Object.defineProperty(exports, "InvalidPositionAccrualTimestampError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualTimestampError; } });
|
|
65
37
|
Object.defineProperty(exports, "InvalidMidnightPositionLossFactorError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionLossFactorError; } });
|
|
66
|
-
/** @deprecated Use InvalidMidnightPositionLossFactorError or the raw protocol subpath. */
|
|
67
|
-
Object.defineProperty(exports, "InvalidPositionLossFactorError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionLossFactorError; } });
|
|
68
38
|
Object.defineProperty(exports, "InvalidMidnightTickSpacingError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTickSpacingError; } });
|
|
69
|
-
/** @deprecated Use InvalidMidnightTickSpacingError or the raw protocol subpath. */
|
|
70
|
-
Object.defineProperty(exports, "InvalidTickSpacingError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTickSpacingError; } });
|
|
71
39
|
Object.defineProperty(exports, "InvalidMidnightTreeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeError; } });
|
|
72
|
-
/** @deprecated Use InvalidMidnightTreeError or the raw protocol subpath. */
|
|
73
|
-
Object.defineProperty(exports, "InvalidTreeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeError; } });
|
|
74
40
|
Object.defineProperty(exports, "InvalidMidnightTreeHeightError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeHeightError; } });
|
|
75
|
-
/** @deprecated Use InvalidMidnightTreeHeightError or the raw protocol subpath. */
|
|
76
|
-
Object.defineProperty(exports, "InvalidTreeHeightError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeHeightError; } });
|
|
77
41
|
Object.defineProperty(exports, "InvalidMidnightTypedDataSignatureError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTypedDataSignatureError; } });
|
|
78
42
|
Object.defineProperty(exports, "MidnightApiError", { enumerable: true, get: function () { return midnight_sdk_1.MidnightApiError; } });
|
|
79
43
|
Object.defineProperty(exports, "MidnightMempoolValidationError", { enumerable: true, get: function () { return midnight_sdk_1.MidnightMempoolValidationError; } });
|
|
80
44
|
Object.defineProperty(exports, "MidnightPayloadDecodeError", { enumerable: true, get: function () { return midnight_sdk_1.PayloadDecodeError; } });
|
|
81
45
|
Object.defineProperty(exports, "MidnightPriceGreaterThanOneError", { enumerable: true, get: function () { return midnight_sdk_1.PriceGreaterThanOneError; } });
|
|
82
|
-
/** @deprecated Use MidnightPriceGreaterThanOneError or the raw protocol subpath. */
|
|
83
|
-
Object.defineProperty(exports, "PriceGreaterThanOneError", { enumerable: true, get: function () { return midnight_sdk_1.PriceGreaterThanOneError; } });
|
|
84
46
|
Object.defineProperty(exports, "MidnightSettlementFeeExceedsPriceError", { enumerable: true, get: function () { return midnight_sdk_1.SettlementFeeExceedsPriceError; } });
|
|
85
|
-
/** @deprecated Use MidnightSettlementFeeExceedsPriceError or the raw protocol subpath. */
|
|
86
|
-
Object.defineProperty(exports, "SettlementFeeExceedsPriceError", { enumerable: true, get: function () { return midnight_sdk_1.SettlementFeeExceedsPriceError; } });
|
|
87
47
|
Object.defineProperty(exports, "MidnightTickOutOfRangeError", { enumerable: true, get: function () { return midnight_sdk_1.TickOutOfRangeError; } });
|
|
88
|
-
/** @deprecated Use MidnightTickOutOfRangeError or the raw protocol subpath. */
|
|
89
|
-
Object.defineProperty(exports, "TickOutOfRangeError", { enumerable: true, get: function () { return midnight_sdk_1.TickOutOfRangeError; } });
|
|
90
48
|
Object.defineProperty(exports, "UnknownMidnightCollateralIndexError", { enumerable: true, get: function () { return midnight_sdk_1.UnknownCollateralIndexError; } });
|
|
91
|
-
/** @deprecated Use UnknownMidnightCollateralIndexError or the raw protocol subpath. */
|
|
92
|
-
Object.defineProperty(exports, "UnknownCollateralIndexError", { enumerable: true, get: function () { return midnight_sdk_1.UnknownCollateralIndexError; } });
|
|
93
49
|
var morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
94
50
|
Object.defineProperty(exports, "_try", { enumerable: true, get: function () { return morpho_ts_1._try; } });
|
|
95
51
|
Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return morpho_ts_1.DivisionByZeroError; } });
|
package/lib/cjs/fetch.d.ts
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
export { fetchAccrualPosition as fetchBlueAccrualPosition,
|
|
2
|
-
/** @deprecated Use `fetchBlueAccrualPosition` or the raw `/blue/fetch` subpath. */
|
|
3
|
-
fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket as fetchBlueMarket,
|
|
4
|
-
/** @deprecated Use `fetchBlueMarket` or the raw `/blue/fetch` subpath. */
|
|
5
|
-
fetchMarket, fetchMarketParams as fetchBlueMarketParams,
|
|
6
|
-
/** @deprecated Use `fetchBlueMarketParams` or the raw `/blue/fetch` subpath. */
|
|
7
|
-
fetchMarketParams, fetchPosition as fetchBluePosition,
|
|
8
|
-
/** @deprecated Use `fetchBluePosition` or the raw `/blue/fetch` subpath. */
|
|
9
|
-
fetchPosition, fetchPreLiquidationParams as fetchBluePreLiquidationParams,
|
|
10
|
-
/** @deprecated Use `fetchBluePreLiquidationParams` or the raw `/blue/fetch` subpath. */
|
|
11
|
-
fetchPreLiquidationParams, fetchPreLiquidationPosition as fetchBluePreLiquidationPosition,
|
|
12
|
-
/** @deprecated Use `fetchBluePreLiquidationPosition` or the raw `/blue/fetch` subpath. */
|
|
13
|
-
fetchPreLiquidationPosition, fetchToken, fetchUser as fetchBlueUser,
|
|
14
|
-
/** @deprecated Use `fetchBlueUser` or the raw `/blue/fetch` subpath. */
|
|
15
|
-
fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultMarketPublicAllocatorConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
|
|
1
|
+
export { fetchAccrualPosition as fetchBlueAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket as fetchBlueMarket, fetchMarketParams as fetchBlueMarketParams, fetchPosition as fetchBluePosition, fetchPreLiquidationParams as fetchBluePreLiquidationParams, fetchPreLiquidationPosition as fetchBluePreLiquidationPosition, fetchToken, fetchUser as fetchBlueUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
|
|
16
2
|
export { fetchAccrualPosition as fetchMidnightAccrualPosition, fetchMarket as fetchMidnightMarket, fetchMarketParams as fetchMidnightMarketParams, fetchPosition as fetchMidnightPosition, fetchRatifierInfo as fetchMidnightRatifierInfo, } from "@morpho-org/midnight-sdk";
|
package/lib/cjs/fetch.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchMidnightRatifierInfo = exports.fetchMidnightPosition = exports.fetchMidnightMarketParams = exports.fetchMidnightMarket = exports.fetchMidnightAccrualPosition = exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.
|
|
3
|
+
exports.fetchMidnightRatifierInfo = exports.fetchMidnightPosition = exports.fetchMidnightMarketParams = exports.fetchMidnightMarket = exports.fetchMidnightAccrualPosition = exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.fetchVaultMarketConfig = exports.fetchVaultMarketAllocation = exports.fetchVaultConfig = exports.fetchVault = exports.fetchBlueUser = exports.fetchToken = exports.fetchBluePreLiquidationPosition = exports.fetchBluePreLiquidationParams = exports.fetchBluePosition = exports.fetchBlueMarketParams = exports.fetchBlueMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchBlueAccrualPosition = void 0;
|
|
4
4
|
var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
5
5
|
Object.defineProperty(exports, "fetchBlueAccrualPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualPosition; } });
|
|
6
|
-
/** @deprecated Use `fetchBlueAccrualPosition` or the raw `/blue/fetch` subpath. */
|
|
7
|
-
Object.defineProperty(exports, "fetchAccrualPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualPosition; } });
|
|
8
6
|
Object.defineProperty(exports, "fetchAccrualVault", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVault; } });
|
|
9
7
|
Object.defineProperty(exports, "fetchAccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2; } });
|
|
10
8
|
Object.defineProperty(exports, "fetchAccrualVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2Adapter; } });
|
|
@@ -13,29 +11,16 @@ Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1AdapterV2", { e
|
|
|
13
11
|
Object.defineProperty(exports, "fetchAccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoVaultV1Adapter; } });
|
|
14
12
|
Object.defineProperty(exports, "fetchHolding", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchHolding; } });
|
|
15
13
|
Object.defineProperty(exports, "fetchBlueMarket", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchMarket; } });
|
|
16
|
-
/** @deprecated Use `fetchBlueMarket` or the raw `/blue/fetch` subpath. */
|
|
17
|
-
Object.defineProperty(exports, "fetchMarket", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchMarket; } });
|
|
18
14
|
Object.defineProperty(exports, "fetchBlueMarketParams", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchMarketParams; } });
|
|
19
|
-
/** @deprecated Use `fetchBlueMarketParams` or the raw `/blue/fetch` subpath. */
|
|
20
|
-
Object.defineProperty(exports, "fetchMarketParams", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchMarketParams; } });
|
|
21
15
|
Object.defineProperty(exports, "fetchBluePosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPosition; } });
|
|
22
|
-
/** @deprecated Use `fetchBluePosition` or the raw `/blue/fetch` subpath. */
|
|
23
|
-
Object.defineProperty(exports, "fetchPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPosition; } });
|
|
24
16
|
Object.defineProperty(exports, "fetchBluePreLiquidationParams", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPreLiquidationParams; } });
|
|
25
|
-
/** @deprecated Use `fetchBluePreLiquidationParams` or the raw `/blue/fetch` subpath. */
|
|
26
|
-
Object.defineProperty(exports, "fetchPreLiquidationParams", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPreLiquidationParams; } });
|
|
27
17
|
Object.defineProperty(exports, "fetchBluePreLiquidationPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPreLiquidationPosition; } });
|
|
28
|
-
/** @deprecated Use `fetchBluePreLiquidationPosition` or the raw `/blue/fetch` subpath. */
|
|
29
|
-
Object.defineProperty(exports, "fetchPreLiquidationPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPreLiquidationPosition; } });
|
|
30
18
|
Object.defineProperty(exports, "fetchToken", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchToken; } });
|
|
31
19
|
Object.defineProperty(exports, "fetchBlueUser", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchUser; } });
|
|
32
|
-
/** @deprecated Use `fetchBlueUser` or the raw `/blue/fetch` subpath. */
|
|
33
|
-
Object.defineProperty(exports, "fetchUser", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchUser; } });
|
|
34
20
|
Object.defineProperty(exports, "fetchVault", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVault; } });
|
|
35
21
|
Object.defineProperty(exports, "fetchVaultConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultConfig; } });
|
|
36
22
|
Object.defineProperty(exports, "fetchVaultMarketAllocation", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketAllocation; } });
|
|
37
23
|
Object.defineProperty(exports, "fetchVaultMarketConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketConfig; } });
|
|
38
|
-
Object.defineProperty(exports, "fetchVaultMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketPublicAllocatorConfig; } });
|
|
39
24
|
Object.defineProperty(exports, "fetchVaultUser", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultUser; } });
|
|
40
25
|
Object.defineProperty(exports, "fetchVaultV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2; } });
|
|
41
26
|
Object.defineProperty(exports, "fetchVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2Adapter; } });
|
|
@@ -17,8 +17,6 @@ export declare const DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = 900000000000000000n
|
|
|
17
17
|
/**
|
|
18
18
|
* The default target utilization above which shared liquidity reallocations are
|
|
19
19
|
* triggered (and the level the target market is brought back to), scaled by WAD.
|
|
20
|
-
* Still overridable through the deprecated `supplyTargetUtilization` /
|
|
21
|
-
* `defaultSupplyTargetUtilization` options until the next major.
|
|
22
20
|
*/
|
|
23
21
|
export declare const DEFAULT_SUPPLY_TARGET_UTILIZATION = 900000000000000000n;
|
|
24
22
|
/**
|
|
@@ -21,8 +21,6 @@ exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = 900000000000000000n;
|
|
|
21
21
|
/**
|
|
22
22
|
* The default target utilization above which shared liquidity reallocations are
|
|
23
23
|
* triggered (and the level the target market is brought back to), scaled by WAD.
|
|
24
|
-
* Still overridable through the deprecated `supplyTargetUtilization` /
|
|
25
|
-
* `defaultSupplyTargetUtilization` options until the next major.
|
|
26
24
|
*/
|
|
27
25
|
exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = 900000000000000000n;
|
|
28
26
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { computeReallocations, computeVaultV1Reallocations, } from "./computeVaultV1Reallocations.js";
|
|
2
1
|
export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, } from "./constant.js";
|
|
3
2
|
export { addTransactionMetadata } from "./metadata.js";
|
|
3
|
+
export { type PreviewVaultV2ForceWithdrawParams, previewVaultV2ForceWithdraw, type VaultV2ForceWithdrawPreview, } from "./previewVaultV2ForceWithdraw.js";
|
|
4
4
|
export { type PreviewVaultV2InKindRedeemParams, previewVaultV2InKindRedeem, type VaultV2InKindRedeemMarketPreview, } from "./previewVaultV2InKindRedeem.js";
|
|
5
5
|
export { grossFromNetAssets } from "./referralFee.js";
|
|
6
6
|
export { signAndVerifyTypedData } from "./signAndVerifyTypedData.js";
|
|
7
|
-
export {
|
|
8
|
-
export { validateAccrualPosition, validateChainId, validateMidnightMarketChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw,
|
|
7
|
+
export { computeMinForceWithdrawSharePrice, computeVaultMaxShareAllowance, computeVaultMaxSharePrice, } from "./slippage.js";
|
|
8
|
+
export { validateAccrualPosition, validateChainId, validateMidnightMarketChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateRepayAmount, validateRepayShares, validateSlippageTolerance, validateUserAddress, validateWithdrawAmount, validateWithdrawShares, } from "./validate.js";
|
|
9
9
|
export { validateOfferSides } from "./validateOfferSides.js";
|
|
10
10
|
export { type RequirementSpenderKey, validateRequirementSpender, } from "./validateRequirementSpender.js";
|
|
11
|
+
export { computeVaultV2ForceWithdrawFeeSharesMinted, computeVaultV2ForceWithdrawMinSharesBurnt, computeVaultV2ForceWithdrawPlan, computeVaultV2ForceWithdrawSharesBurnt, resolveVaultV2ForceWithdrawEligibility, type VaultV2ForceWithdrawEligibility, type VaultV2ForceWithdrawPlan, } from "./vaultV2ForceWithdrawPlan.js";
|
package/lib/cjs/helpers/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var computeVaultV1Reallocations_js_1 = require("./computeVaultV1Reallocations.js");
|
|
5
|
-
Object.defineProperty(exports, "computeReallocations", { enumerable: true, get: function () { return computeVaultV1Reallocations_js_1.computeReallocations; } });
|
|
6
|
-
Object.defineProperty(exports, "computeVaultV1Reallocations", { enumerable: true, get: function () { return computeVaultV1Reallocations_js_1.computeVaultV1Reallocations; } });
|
|
3
|
+
exports.resolveVaultV2ForceWithdrawEligibility = exports.computeVaultV2ForceWithdrawSharesBurnt = exports.computeVaultV2ForceWithdrawPlan = exports.computeVaultV2ForceWithdrawMinSharesBurnt = exports.computeVaultV2ForceWithdrawFeeSharesMinted = exports.validateRequirementSpender = exports.validateOfferSides = exports.validateWithdrawShares = exports.validateWithdrawAmount = exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateMidnightMarketChainId = exports.validateChainId = exports.validateAccrualPosition = exports.computeVaultMaxSharePrice = exports.computeVaultMaxShareAllowance = exports.computeMinForceWithdrawSharePrice = exports.signAndVerifyTypedData = exports.grossFromNetAssets = exports.previewVaultV2InKindRedeem = exports.previewVaultV2ForceWithdraw = exports.addTransactionMetadata = exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_REALLOCATION_PENALTY = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_MAX_REALLOCATION_PENALTY = exports.DEFAULT_LLTV_BUFFER = exports.APPROVE_ONLY_ONCE_TOKENS = void 0;
|
|
7
4
|
var constant_js_1 = require("./constant.js");
|
|
8
5
|
Object.defineProperty(exports, "APPROVE_ONLY_ONCE_TOKENS", { enumerable: true, get: function () { return constant_js_1.APPROVE_ONLY_ONCE_TOKENS; } });
|
|
9
6
|
Object.defineProperty(exports, "DEFAULT_LLTV_BUFFER", { enumerable: true, get: function () { return constant_js_1.DEFAULT_LLTV_BUFFER; } });
|
|
@@ -16,6 +13,8 @@ Object.defineProperty(exports, "MAX_SLIPPAGE_TOLERANCE", { enumerable: true, get
|
|
|
16
13
|
Object.defineProperty(exports, "MAX_TOKEN_APPROVALS", { enumerable: true, get: function () { return constant_js_1.MAX_TOKEN_APPROVALS; } });
|
|
17
14
|
var metadata_js_1 = require("./metadata.js");
|
|
18
15
|
Object.defineProperty(exports, "addTransactionMetadata", { enumerable: true, get: function () { return metadata_js_1.addTransactionMetadata; } });
|
|
16
|
+
var previewVaultV2ForceWithdraw_js_1 = require("./previewVaultV2ForceWithdraw.js");
|
|
17
|
+
Object.defineProperty(exports, "previewVaultV2ForceWithdraw", { enumerable: true, get: function () { return previewVaultV2ForceWithdraw_js_1.previewVaultV2ForceWithdraw; } });
|
|
19
18
|
var previewVaultV2InKindRedeem_js_1 = require("./previewVaultV2InKindRedeem.js");
|
|
20
19
|
Object.defineProperty(exports, "previewVaultV2InKindRedeem", { enumerable: true, get: function () { return previewVaultV2InKindRedeem_js_1.previewVaultV2InKindRedeem; } });
|
|
21
20
|
var referralFee_js_1 = require("./referralFee.js");
|
|
@@ -23,10 +22,7 @@ Object.defineProperty(exports, "grossFromNetAssets", { enumerable: true, get: fu
|
|
|
23
22
|
var signAndVerifyTypedData_js_1 = require("./signAndVerifyTypedData.js");
|
|
24
23
|
Object.defineProperty(exports, "signAndVerifyTypedData", { enumerable: true, get: function () { return signAndVerifyTypedData_js_1.signAndVerifyTypedData; } });
|
|
25
24
|
var slippage_js_1 = require("./slippage.js");
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
-
Object.defineProperty(exports, "computeMaxSupplySharePrice", { enumerable: true, get: function () { return slippage_js_1.computeMaxSupplySharePrice; } });
|
|
28
|
-
Object.defineProperty(exports, "computeMinBorrowSharePrice", { enumerable: true, get: function () { return slippage_js_1.computeMinBorrowSharePrice; } });
|
|
29
|
-
Object.defineProperty(exports, "computeMinWithdrawSharePrice", { enumerable: true, get: function () { return slippage_js_1.computeMinWithdrawSharePrice; } });
|
|
25
|
+
Object.defineProperty(exports, "computeMinForceWithdrawSharePrice", { enumerable: true, get: function () { return slippage_js_1.computeMinForceWithdrawSharePrice; } });
|
|
30
26
|
Object.defineProperty(exports, "computeVaultMaxShareAllowance", { enumerable: true, get: function () { return slippage_js_1.computeVaultMaxShareAllowance; } });
|
|
31
27
|
Object.defineProperty(exports, "computeVaultMaxSharePrice", { enumerable: true, get: function () { return slippage_js_1.computeVaultMaxSharePrice; } });
|
|
32
28
|
var validate_js_1 = require("./validate.js");
|
|
@@ -36,7 +32,6 @@ Object.defineProperty(exports, "validateMidnightMarketChainId", { enumerable: tr
|
|
|
36
32
|
Object.defineProperty(exports, "validateNativeAsset", { enumerable: true, get: function () { return validate_js_1.validateNativeAsset; } });
|
|
37
33
|
Object.defineProperty(exports, "validatePositionHealth", { enumerable: true, get: function () { return validate_js_1.validatePositionHealth; } });
|
|
38
34
|
Object.defineProperty(exports, "validatePositionHealthAfterWithdraw", { enumerable: true, get: function () { return validate_js_1.validatePositionHealthAfterWithdraw; } });
|
|
39
|
-
Object.defineProperty(exports, "validateReallocations", { enumerable: true, get: function () { return validate_js_1.validateReallocations; } });
|
|
40
35
|
Object.defineProperty(exports, "validateRepayAmount", { enumerable: true, get: function () { return validate_js_1.validateRepayAmount; } });
|
|
41
36
|
Object.defineProperty(exports, "validateRepayShares", { enumerable: true, get: function () { return validate_js_1.validateRepayShares; } });
|
|
42
37
|
Object.defineProperty(exports, "validateSlippageTolerance", { enumerable: true, get: function () { return validate_js_1.validateSlippageTolerance; } });
|
|
@@ -47,3 +42,9 @@ var validateOfferSides_js_1 = require("./validateOfferSides.js");
|
|
|
47
42
|
Object.defineProperty(exports, "validateOfferSides", { enumerable: true, get: function () { return validateOfferSides_js_1.validateOfferSides; } });
|
|
48
43
|
var validateRequirementSpender_js_1 = require("./validateRequirementSpender.js");
|
|
49
44
|
Object.defineProperty(exports, "validateRequirementSpender", { enumerable: true, get: function () { return validateRequirementSpender_js_1.validateRequirementSpender; } });
|
|
45
|
+
var vaultV2ForceWithdrawPlan_js_1 = require("./vaultV2ForceWithdrawPlan.js");
|
|
46
|
+
Object.defineProperty(exports, "computeVaultV2ForceWithdrawFeeSharesMinted", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawFeeSharesMinted; } });
|
|
47
|
+
Object.defineProperty(exports, "computeVaultV2ForceWithdrawMinSharesBurnt", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawMinSharesBurnt; } });
|
|
48
|
+
Object.defineProperty(exports, "computeVaultV2ForceWithdrawPlan", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawPlan; } });
|
|
49
|
+
Object.defineProperty(exports, "computeVaultV2ForceWithdrawSharesBurnt", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawSharesBurnt; } });
|
|
50
|
+
Object.defineProperty(exports, "resolveVaultV2ForceWithdrawEligibility", { enumerable: true, get: function () { return vaultV2ForceWithdrawPlan_js_1.resolveVaultV2ForceWithdrawEligibility; } });
|
|
@@ -26,11 +26,9 @@ import type { Metadata } from "../types/index.js";
|
|
|
26
26
|
* @param {Metadata} metadata - An object containing optional metadata fields
|
|
27
27
|
* such as `timestamp` and `origin`.
|
|
28
28
|
*
|
|
29
|
-
* @returns
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* If no `data` is present in the original transaction, the function returns
|
|
33
|
-
* the transaction unmodified.
|
|
29
|
+
* @returns The same `tx` object when `data` is missing, an empty string, or
|
|
30
|
+
* canonical empty calldata (`"0x"`); otherwise, a new transaction object
|
|
31
|
+
* with `data` containing any appended metadata. The input is never mutated.
|
|
34
32
|
*/
|
|
35
33
|
export declare function addTransactionMetadata(tx: {
|
|
36
34
|
data: Hex;
|
|
@@ -29,15 +29,13 @@ const viem_1 = require("viem");
|
|
|
29
29
|
* @param {Metadata} metadata - An object containing optional metadata fields
|
|
30
30
|
* such as `timestamp` and `origin`.
|
|
31
31
|
*
|
|
32
|
-
* @returns
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* If no `data` is present in the original transaction, the function returns
|
|
36
|
-
* the transaction unmodified.
|
|
32
|
+
* @returns The same `tx` object when `data` is missing, an empty string, or
|
|
33
|
+
* canonical empty calldata (`"0x"`); otherwise, a new transaction object
|
|
34
|
+
* with `data` containing any appended metadata. The input is never mutated.
|
|
37
35
|
*/
|
|
38
36
|
function addTransactionMetadata(tx, metadata) {
|
|
39
37
|
const { data, ..._tx } = tx;
|
|
40
|
-
if (!data)
|
|
38
|
+
if (!data || data === "0x")
|
|
41
39
|
return tx;
|
|
42
40
|
const concatItems = [data];
|
|
43
41
|
if (metadata.timestamp) {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type AccrualVaultV2, type Address } from "@morpho-org/blue-sdk";
|
|
2
|
+
/** Inputs used to preview a Vault V2 force withdrawal. */
|
|
3
|
+
export interface PreviewVaultV2ForceWithdrawParams {
|
|
4
|
+
/** Penalty-inclusive amount the user wants to exit. */
|
|
5
|
+
readonly requestedExitAssets: bigint;
|
|
6
|
+
/** Timestamp used to accrue every Morpho Blue market before converting adapter shares. */
|
|
7
|
+
readonly timestamp: bigint;
|
|
8
|
+
/** Optional adapter override; defaults to the vault's sole adapter. */
|
|
9
|
+
readonly adapter?: Address;
|
|
10
|
+
/**
|
|
11
|
+
* Account that will call `forceWithdraw`; fee-recipient mints are mirrored when provided. The
|
|
12
|
+
* entity projects the mints to its deadline; pass that as `feeProjectionTimestamp` to mirror it.
|
|
13
|
+
*/
|
|
14
|
+
readonly userAddress?: Address;
|
|
15
|
+
/**
|
|
16
|
+
* Timestamp the fee-recipient mint guard is projected to; defaults to `timestamp`. Pass the
|
|
17
|
+
* `forceWithdraw` deadline you will submit to mirror the entity's guard exactly. The entity
|
|
18
|
+
* rejects deadlines more than one year after handle creation (`InputExceedsMaxError`) rather
|
|
19
|
+
* than clamping them, so a quote projected past that horizon cannot be submitted. Ignored
|
|
20
|
+
* without `userAddress`.
|
|
21
|
+
*/
|
|
22
|
+
readonly feeProjectionTimestamp?: bigint;
|
|
23
|
+
/** Optional WAD-scaled referral fee percentage. Defaults to `0n`. */
|
|
24
|
+
readonly referralFeePct?: bigint;
|
|
25
|
+
/** Optional referral fee recipient. Required when `referralFeePct` is positive, as the entity
|
|
26
|
+
* enforces (`ReferralFeeRecipientMissingError`). When it equals `userAddress`, the fee is paid
|
|
27
|
+
* back to the exiting account and `netAssets` includes it. */
|
|
28
|
+
readonly referralFeeRecipient?: Address;
|
|
29
|
+
}
|
|
30
|
+
/** Frontend-ready preview of a Vault V2 force withdrawal through VaultExitBundlesV1. */
|
|
31
|
+
export interface VaultV2ForceWithdrawPreview {
|
|
32
|
+
/** Largest penalty-inclusive exit the current vault state supports. */
|
|
33
|
+
readonly maxExitAssets: bigint;
|
|
34
|
+
/** Penalty-inclusive exit amount this preview is computed for, capped at `maxExitAssets`. */
|
|
35
|
+
readonly exitAssets: bigint;
|
|
36
|
+
/** Requested penalty-inclusive amount left uncovered by `exitAssets`. */
|
|
37
|
+
readonly remainingExitAssets: bigint;
|
|
38
|
+
/** Portion withdrawn without a force-deallocation penalty (vault idle plus liquidity adapter). */
|
|
39
|
+
readonly assetsToWithdraw: bigint;
|
|
40
|
+
/** Portion force-deallocated from the adapter's markets, net of the penalty. */
|
|
41
|
+
readonly assetsToDeallocate: bigint;
|
|
42
|
+
/**
|
|
43
|
+
* Lower-bound estimate of the assets charged as the force-deallocation penalty,
|
|
44
|
+
* `ceil(assetsToDeallocate × penalty)`. Exact for a single-market exit. Across multiple markets
|
|
45
|
+
* the contract charges `Σ ceil(chunkᵢ × penalty)`, which this order-independent plan cannot
|
|
46
|
+
* reproduce without committing to the adapter's execution order (reordered mid-loop by
|
|
47
|
+
* swap-and-pop); the true charge is at most `penaltyLegs − 1` wei higher. It is never the inflated
|
|
48
|
+
* allowance bound. `netAssets` is exact and does not depend on this field, so the residual never
|
|
49
|
+
* affects the quoted payout.
|
|
50
|
+
*/
|
|
51
|
+
readonly penaltyAssets: bigint;
|
|
52
|
+
/** Assets routed to the referral fee recipient. */
|
|
53
|
+
readonly referralFeeAssets: bigint;
|
|
54
|
+
/** Assets the exiting account actually receives: `withdrawnAssets` minus the referral fee, unless
|
|
55
|
+
* the fee is paid back to `userAddress` itself. */
|
|
56
|
+
readonly netAssets: bigint;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Previews what a Vault V2 force withdrawal delivers, without any RPC.
|
|
60
|
+
*
|
|
61
|
+
* `exitAssets` is **penalty-inclusive**: the contract debits it from the user's position but pays
|
|
62
|
+
* out only `assetsToWithdraw + assetsToDeallocate`. Use `netAssets` to quote what the user
|
|
63
|
+
* receives and `maxExitAssets` to cap an input field.
|
|
64
|
+
*
|
|
65
|
+
* @param vaultData - Pre-fetched Vault V2 accrual snapshot.
|
|
66
|
+
* @param params - Preview parameters.
|
|
67
|
+
* @param params.requestedExitAssets - Penalty-inclusive amount the user wants to exit.
|
|
68
|
+
* @param params.timestamp - Timestamp used to accrue Morpho Blue markets before computing capacity.
|
|
69
|
+
* Must not run ahead of the wall clock at the subsequent `forceWithdraw()` call: market accrual
|
|
70
|
+
* grows the adapter's position, so a forward timestamp reports a `maxExitAssets` the entity will
|
|
71
|
+
* reject.
|
|
72
|
+
* @param params.adapter - Optional adapter override; defaults to the vault's sole adapter.
|
|
73
|
+
* @param params.userAddress - Optional account that will call `forceWithdraw`; when provided,
|
|
74
|
+
* fee shares minted to it by the accrual are mirrored exactly as the entity does. The entity
|
|
75
|
+
* projects the mints to its deadline; pass that as `feeProjectionTimestamp` to mirror it. Omit
|
|
76
|
+
* only for non-fee-recipient users.
|
|
77
|
+
* @param params.feeProjectionTimestamp - Timestamp for the fee-recipient mint guard; defaults to
|
|
78
|
+
* `timestamp`. Pass the `forceWithdraw` deadline you will submit; the entity rejects deadlines
|
|
79
|
+
* more than one year after handle creation (`InputExceedsMaxError`) instead of clamping them, so
|
|
80
|
+
* keep the deadline itself within that horizon. Ignored without `userAddress`.
|
|
81
|
+
* @param params.referralFeePct - Optional WAD-scaled referral fee percentage. Defaults to `0n`.
|
|
82
|
+
* @param params.referralFeeRecipient - Optional referral fee recipient. Required when
|
|
83
|
+
* `referralFeePct` is positive, as the entity enforces (`ReferralFeeRecipientMissingError`).
|
|
84
|
+
* When it equals `userAddress`, the fee is paid back to the exiting account and `netAssets`
|
|
85
|
+
* includes it.
|
|
86
|
+
* @returns The preview, or `undefined` when the exit is not previewable: not exactly one adapter, an
|
|
87
|
+
* `adapter` override that is not the vault's sole adapter, an adapter that is not a
|
|
88
|
+
* MorphoMarketV1AdapterV2, an unresolvable liquidity adapter, undecodable liquidity data, a
|
|
89
|
+
* `referralFeePct` outside `[0, WAD)`, a positive `referralFeePct` without a non-zero
|
|
90
|
+
* `referralFeeRecipient`, a non-positive request, a request that yields nothing, a fee-recipient
|
|
91
|
+
* whose positive fee mints projected to `feeProjectionTimestamp` reach the lower burn bound, an
|
|
92
|
+
* exit whose realized share price rounds down to zero at the default slippage tolerance (which
|
|
93
|
+
* the entity rejects with `VaultV2ForceWithdrawZeroSharePriceError`), or whose derived default
|
|
94
|
+
* floor cannot fit `uint256`.
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* import { previewVaultV2ForceWithdraw } from "@morpho-org/morpho-sdk";
|
|
98
|
+
*
|
|
99
|
+
* const preview = previewVaultV2ForceWithdraw(vaultData, {
|
|
100
|
+
* requestedExitAssets: 1_000_000n,
|
|
101
|
+
* timestamp: block.timestamp,
|
|
102
|
+
* });
|
|
103
|
+
* // preview?.exitAssets is ready to pass to vault.forceWithdraw(...)
|
|
104
|
+
* // preview?.netAssets is what the user receives
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare function previewVaultV2ForceWithdraw(vaultData: AccrualVaultV2, params: PreviewVaultV2ForceWithdrawParams): VaultV2ForceWithdrawPreview | undefined;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.previewVaultV2ForceWithdraw = previewVaultV2ForceWithdraw;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const vaultV2ForceWithdrawPlan_js_1 = require("./vaultV2ForceWithdrawPlan.js");
|
|
7
|
+
/**
|
|
8
|
+
* Previews what a Vault V2 force withdrawal delivers, without any RPC.
|
|
9
|
+
*
|
|
10
|
+
* `exitAssets` is **penalty-inclusive**: the contract debits it from the user's position but pays
|
|
11
|
+
* out only `assetsToWithdraw + assetsToDeallocate`. Use `netAssets` to quote what the user
|
|
12
|
+
* receives and `maxExitAssets` to cap an input field.
|
|
13
|
+
*
|
|
14
|
+
* @param vaultData - Pre-fetched Vault V2 accrual snapshot.
|
|
15
|
+
* @param params - Preview parameters.
|
|
16
|
+
* @param params.requestedExitAssets - Penalty-inclusive amount the user wants to exit.
|
|
17
|
+
* @param params.timestamp - Timestamp used to accrue Morpho Blue markets before computing capacity.
|
|
18
|
+
* Must not run ahead of the wall clock at the subsequent `forceWithdraw()` call: market accrual
|
|
19
|
+
* grows the adapter's position, so a forward timestamp reports a `maxExitAssets` the entity will
|
|
20
|
+
* reject.
|
|
21
|
+
* @param params.adapter - Optional adapter override; defaults to the vault's sole adapter.
|
|
22
|
+
* @param params.userAddress - Optional account that will call `forceWithdraw`; when provided,
|
|
23
|
+
* fee shares minted to it by the accrual are mirrored exactly as the entity does. The entity
|
|
24
|
+
* projects the mints to its deadline; pass that as `feeProjectionTimestamp` to mirror it. Omit
|
|
25
|
+
* only for non-fee-recipient users.
|
|
26
|
+
* @param params.feeProjectionTimestamp - Timestamp for the fee-recipient mint guard; defaults to
|
|
27
|
+
* `timestamp`. Pass the `forceWithdraw` deadline you will submit; the entity rejects deadlines
|
|
28
|
+
* more than one year after handle creation (`InputExceedsMaxError`) instead of clamping them, so
|
|
29
|
+
* keep the deadline itself within that horizon. Ignored without `userAddress`.
|
|
30
|
+
* @param params.referralFeePct - Optional WAD-scaled referral fee percentage. Defaults to `0n`.
|
|
31
|
+
* @param params.referralFeeRecipient - Optional referral fee recipient. Required when
|
|
32
|
+
* `referralFeePct` is positive, as the entity enforces (`ReferralFeeRecipientMissingError`).
|
|
33
|
+
* When it equals `userAddress`, the fee is paid back to the exiting account and `netAssets`
|
|
34
|
+
* includes it.
|
|
35
|
+
* @returns The preview, or `undefined` when the exit is not previewable: not exactly one adapter, an
|
|
36
|
+
* `adapter` override that is not the vault's sole adapter, an adapter that is not a
|
|
37
|
+
* MorphoMarketV1AdapterV2, an unresolvable liquidity adapter, undecodable liquidity data, a
|
|
38
|
+
* `referralFeePct` outside `[0, WAD)`, a positive `referralFeePct` without a non-zero
|
|
39
|
+
* `referralFeeRecipient`, a non-positive request, a request that yields nothing, a fee-recipient
|
|
40
|
+
* whose positive fee mints projected to `feeProjectionTimestamp` reach the lower burn bound, an
|
|
41
|
+
* exit whose realized share price rounds down to zero at the default slippage tolerance (which
|
|
42
|
+
* the entity rejects with `VaultV2ForceWithdrawZeroSharePriceError`), or whose derived default
|
|
43
|
+
* floor cannot fit `uint256`.
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { previewVaultV2ForceWithdraw } from "@morpho-org/morpho-sdk";
|
|
47
|
+
*
|
|
48
|
+
* const preview = previewVaultV2ForceWithdraw(vaultData, {
|
|
49
|
+
* requestedExitAssets: 1_000_000n,
|
|
50
|
+
* timestamp: block.timestamp,
|
|
51
|
+
* });
|
|
52
|
+
* // preview?.exitAssets is ready to pass to vault.forceWithdraw(...)
|
|
53
|
+
* // preview?.netAssets is what the user receives
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
function previewVaultV2ForceWithdraw(vaultData, params) {
|
|
57
|
+
const { requestedExitAssets, timestamp, adapter: adapterOverride, userAddress, feeProjectionTimestamp = timestamp, referralFeePct = 0n, referralFeeRecipient, } = params;
|
|
58
|
+
if (requestedExitAssets <= 0n)
|
|
59
|
+
return undefined;
|
|
60
|
+
// Out of the range the action accepts, `netAssets` would quote a payout the contract can never
|
|
61
|
+
// deliver — above `withdrawnAssets` for a negative fee, non-positive at or beyond WAD.
|
|
62
|
+
if (referralFeePct < 0n || referralFeePct >= blue_sdk_1.MathLib.WAD)
|
|
63
|
+
return undefined;
|
|
64
|
+
if (referralFeePct > 0n &&
|
|
65
|
+
(referralFeeRecipient == null ||
|
|
66
|
+
(0, viem_1.isAddressEqual)(referralFeeRecipient, viem_1.zeroAddress))) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const eligibility = (0, vaultV2ForceWithdrawPlan_js_1.resolveVaultV2ForceWithdrawEligibility)(vaultData, adapterOverride);
|
|
70
|
+
if (eligibility.type !== "eligible")
|
|
71
|
+
return undefined;
|
|
72
|
+
const capacity = (0, vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawPlan)({
|
|
73
|
+
vaultData,
|
|
74
|
+
adapter: eligibility.adapter,
|
|
75
|
+
liquidityMarketId: eligibility.liquidityMarketId,
|
|
76
|
+
exitAssets: requestedExitAssets,
|
|
77
|
+
timestamp,
|
|
78
|
+
});
|
|
79
|
+
const exitAssets = blue_sdk_1.MathLib.min(requestedExitAssets, capacity.maxExitAssets);
|
|
80
|
+
// A vault with no exitable capacity caps `maxExitAssets` to `0`; the planner rejects a
|
|
81
|
+
// non-positive amount, so short-circuit to the "not previewable" verdict before re-planning.
|
|
82
|
+
if (exitAssets <= 0n)
|
|
83
|
+
return undefined;
|
|
84
|
+
// Re-plan at the capped amount so every returned leg describes the same exit.
|
|
85
|
+
const plan = exitAssets === requestedExitAssets
|
|
86
|
+
? capacity
|
|
87
|
+
: (0, vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawPlan)({
|
|
88
|
+
vaultData,
|
|
89
|
+
adapter: eligibility.adapter,
|
|
90
|
+
liquidityMarketId: eligibility.liquidityMarketId,
|
|
91
|
+
exitAssets,
|
|
92
|
+
timestamp,
|
|
93
|
+
});
|
|
94
|
+
if (plan.withdrawnAssets <= 0n)
|
|
95
|
+
return undefined;
|
|
96
|
+
// Mirror the entity's zero-floor guard. `forceWithdraw()` derives its slippage floor from
|
|
97
|
+
// `withdrawnAssets / sharesBurnt` and rejects an exit whose realized share price rounds down to
|
|
98
|
+
// zero (`VaultV2ForceWithdrawZeroSharePriceError`) — a degenerate vault (e.g. `totalSupply`
|
|
99
|
+
// dwarfing `totalAssets`) offers no price protection at all. Screen at the entity's default
|
|
100
|
+
// `DEFAULT_SLIPPAGE_TOLERANCE`, not slippage-free, against the same burn upper bound the entity
|
|
101
|
+
// divides by (accrued to `timestamp` like the plan): a tolerance-free screen clears an exit whose
|
|
102
|
+
// realized price is a single RAY-unit, yet the default tolerance scales that below 1 and rounds it
|
|
103
|
+
// to zero — so the entity would reject with `VaultV2ForceWithdrawZeroSharePriceError` the very
|
|
104
|
+
// `exitAssets` this preview handed back. A caller passing a larger tolerance still relies on the
|
|
105
|
+
// entity's own guard. The entity validates this derived value with
|
|
106
|
+
// `validateUint256Field("minSharePriceE27")`, which throws `InputExceedsMaxError` when it
|
|
107
|
+
// cannot fit uint256.
|
|
108
|
+
const { vault: accruedVaultData } = vaultData.accrueInterest(blue_sdk_1.MathLib.max(timestamp, vaultData.lastUpdate));
|
|
109
|
+
const sharesBurnt = (0, vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawSharesBurnt)({
|
|
110
|
+
vaultData: accruedVaultData,
|
|
111
|
+
deadlineVaultData: accruedVaultData,
|
|
112
|
+
plan,
|
|
113
|
+
});
|
|
114
|
+
const feeShares = userAddress
|
|
115
|
+
? (0, vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawFeeSharesMinted)({
|
|
116
|
+
vaultData,
|
|
117
|
+
owner: userAddress,
|
|
118
|
+
timestamp,
|
|
119
|
+
})
|
|
120
|
+
: 0n;
|
|
121
|
+
const effectiveFeeProjectionTimestamp = blue_sdk_1.MathLib.max(timestamp, feeProjectionTimestamp);
|
|
122
|
+
if (userAddress) {
|
|
123
|
+
const { vault: projectedVaultData } = vaultData.accrueInterest(blue_sdk_1.MathLib.max(effectiveFeeProjectionTimestamp, vaultData.lastUpdate));
|
|
124
|
+
const feeSharesProjected = (0, vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawFeeSharesMinted)({
|
|
125
|
+
vaultData,
|
|
126
|
+
owner: userAddress,
|
|
127
|
+
timestamp: effectiveFeeProjectionTimestamp,
|
|
128
|
+
});
|
|
129
|
+
const minSharesBurntProjected = (0, vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawMinSharesBurnt)({
|
|
130
|
+
vaultData: projectedVaultData,
|
|
131
|
+
plan,
|
|
132
|
+
});
|
|
133
|
+
if (feeSharesProjected > 0n &&
|
|
134
|
+
feeSharesProjected >= minSharesBurntProjected) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const sharesBurntForFloor = sharesBurnt - feeShares;
|
|
139
|
+
const defaultMinSharePriceE27 = sharesBurntForFloor > 0n
|
|
140
|
+
? blue_sdk_1.MathLib.mulDivDown(plan.withdrawnAssets, blue_sdk_1.MathLib.wToRay(blue_sdk_1.MathLib.WAD - blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE), sharesBurntForFloor)
|
|
141
|
+
: 0n;
|
|
142
|
+
if (defaultMinSharePriceE27 <= 0n || defaultMinSharePriceE27 > viem_1.maxUint256) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
const referralFeeAssets = blue_sdk_1.MathLib.mulDivDown(plan.withdrawnAssets, referralFeePct, blue_sdk_1.MathLib.WAD);
|
|
146
|
+
const selfPaidReferralFee = userAddress != null &&
|
|
147
|
+
referralFeeRecipient != null &&
|
|
148
|
+
(0, viem_1.isAddressEqual)(userAddress, referralFeeRecipient);
|
|
149
|
+
return {
|
|
150
|
+
maxExitAssets: capacity.maxExitAssets,
|
|
151
|
+
exitAssets,
|
|
152
|
+
remainingExitAssets: requestedExitAssets - exitAssets,
|
|
153
|
+
assetsToWithdraw: plan.assetsToWithdraw,
|
|
154
|
+
assetsToDeallocate: plan.assetsToDeallocate,
|
|
155
|
+
// The tight per-leg charge `ceil(assetsToDeallocate × penalty)`, not `plan.penaltyAssets`: that
|
|
156
|
+
// bound carries a `+ (penaltyLegs - 1)` allowance slack, which would overstate the quote and
|
|
157
|
+
// break reconciliation with `exitAssets` for a multi-market exit.
|
|
158
|
+
penaltyAssets: blue_sdk_1.MathLib.wMulUp(plan.assetsToDeallocate, plan.penalty),
|
|
159
|
+
referralFeeAssets,
|
|
160
|
+
netAssets: selfPaidReferralFee
|
|
161
|
+
? plan.withdrawnAssets
|
|
162
|
+
: plan.withdrawnAssets - referralFeeAssets,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
@@ -35,6 +35,7 @@ export interface VaultV2InKindRedeemMarketPreview {
|
|
|
35
35
|
* @param params.requestedExitAssets - Positive penalty-inclusive amount the user wants to exit.
|
|
36
36
|
* @param params.timestamp - Timestamp used to accrue Morpho Blue markets before calculating capacity.
|
|
37
37
|
* @returns Frontend-ready market choices, or an empty list when no choices are available.
|
|
38
|
+
* @throws {UnsupportedBlueMarketIrmError} when an adapter-listed market with positive debt uses an unsupported IRM.
|
|
38
39
|
* @example
|
|
39
40
|
* ```ts
|
|
40
41
|
* import { previewVaultV2InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
@@ -14,6 +14,7 @@ const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
|
14
14
|
* @param params.requestedExitAssets - Positive penalty-inclusive amount the user wants to exit.
|
|
15
15
|
* @param params.timestamp - Timestamp used to accrue Morpho Blue markets before calculating capacity.
|
|
16
16
|
* @returns Frontend-ready market choices, or an empty list when no choices are available.
|
|
17
|
+
* @throws {UnsupportedBlueMarketIrmError} when an adapter-listed market with positive debt uses an unsupported IRM.
|
|
17
18
|
* @example
|
|
18
19
|
* ```ts
|
|
19
20
|
* import { previewVaultV2InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
@@ -40,6 +41,7 @@ function previewVaultV2InKindRedeem(vaultData, params) {
|
|
|
40
41
|
const penalty = vaultData.forceDeallocatePenalties[adapter.address] ?? 0n;
|
|
41
42
|
const availableIdleAssets = vaultData.assetBalance;
|
|
42
43
|
const allocations = adapter.markets
|
|
44
|
+
.filter((market) => (adapter.supplyShares[market.id] ?? 0n) !== 0n)
|
|
43
45
|
.map((market) => ({
|
|
44
46
|
market,
|
|
45
47
|
allocationAssets: market
|