@morpho-org/morpho-sdk 5.1.2 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -2
- package/lib/cjs/abis.d.ts +1 -0
- package/lib/cjs/abis.js +6 -1
- package/lib/cjs/actions/blue/borrow.d.ts +3 -7
- package/lib/cjs/actions/blue/borrow.js +5 -9
- package/lib/cjs/actions/blue/buildReallocationActions.d.ts +3 -4
- package/lib/cjs/actions/blue/buildReallocationActions.js +3 -4
- package/lib/cjs/actions/blue/refinance.d.ts +4 -8
- package/lib/cjs/actions/blue/refinance.js +10 -14
- package/lib/cjs/actions/blue/repay.d.ts +2 -5
- package/lib/cjs/actions/blue/repay.js +2 -5
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +3 -6
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +4 -7
- package/lib/cjs/actions/blue/resolveRepayFunding.d.ts +2 -5
- package/lib/cjs/actions/blue/resolveRepayFunding.js +15 -12
- package/lib/cjs/actions/blue/supply.d.ts +2 -4
- package/lib/cjs/actions/blue/supply.js +6 -8
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -3
- package/lib/cjs/actions/blue/supplyCollateral.js +5 -6
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +4 -9
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +9 -14
- package/lib/cjs/actions/blue/withdraw.d.ts +9 -7
- package/lib/cjs/actions/blue/withdraw.js +18 -10
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +1 -1
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
- package/lib/cjs/actions/index.d.ts +2 -0
- package/lib/cjs/actions/index.js +1 -0
- package/lib/cjs/actions/midnight/authorization.d.ts +37 -0
- package/lib/cjs/actions/midnight/authorization.js +69 -0
- package/lib/cjs/actions/midnight/cancelOffer.d.ts +38 -0
- package/lib/cjs/actions/midnight/cancelOffer.js +73 -0
- package/lib/cjs/actions/midnight/index.d.ts +11 -0
- package/lib/cjs/actions/midnight/index.js +27 -0
- package/lib/cjs/actions/midnight/mempoolSubmitOffers.d.ts +52 -0
- package/lib/cjs/actions/midnight/mempoolSubmitOffers.js +72 -0
- package/lib/cjs/actions/midnight/redeem.d.ts +43 -0
- package/lib/cjs/actions/midnight/redeem.js +79 -0
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +53 -0
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +121 -0
- package/lib/cjs/actions/midnight/setterRatifierRatifyRoot.d.ts +40 -0
- package/lib/cjs/actions/midnight/setterRatifierRatifyRoot.js +59 -0
- package/lib/cjs/actions/midnight/supplyCollateral.d.ts +45 -0
- package/lib/cjs/actions/midnight/supplyCollateral.js +83 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +51 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +128 -0
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +57 -0
- package/lib/cjs/actions/midnight/takeBorrow.js +110 -0
- package/lib/cjs/actions/midnight/takeLend.d.ts +57 -0
- package/lib/cjs/actions/midnight/takeLend.js +110 -0
- package/lib/cjs/actions/midnight/types.d.ts +39 -0
- package/lib/cjs/actions/midnight/types.js +15 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +1 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +5 -16
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +5 -4
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +10 -14
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +2 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +11 -28
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +1 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +5 -17
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +1 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +10 -4
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +10 -4
- package/lib/cjs/actions/requirements/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/index.js +1 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +49 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +76 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +44 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +78 -0
- package/lib/cjs/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.d.ts +42 -0
- package/lib/cjs/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.js +70 -0
- package/lib/cjs/actions/requirements/midnight/index.d.ts +3 -0
- package/lib/cjs/actions/requirements/midnight/index.js +19 -0
- package/lib/cjs/actions/vaultV1/deposit.d.ts +3 -4
- package/lib/cjs/actions/vaultV1/deposit.js +7 -8
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +2 -3
- package/lib/cjs/actions/vaultV1/migrateToV2.js +5 -6
- package/lib/cjs/actions/vaultV1/redeem.d.ts +1 -1
- package/lib/cjs/actions/vaultV1/redeem.js +2 -2
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +1 -1
- package/lib/cjs/actions/vaultV1/withdraw.js +2 -2
- package/lib/cjs/actions/vaultV2/deposit.d.ts +3 -4
- package/lib/cjs/actions/vaultV2/deposit.js +7 -8
- package/lib/cjs/actions/vaultV2/forceRedeem.d.ts +2 -3
- package/lib/cjs/actions/vaultV2/forceRedeem.js +3 -4
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +1 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +2 -2
- package/lib/cjs/actions/vaultV2/redeem.d.ts +1 -1
- package/lib/cjs/actions/vaultV2/redeem.js +2 -2
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +1 -1
- package/lib/cjs/actions/vaultV2/withdraw.js +2 -2
- package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
- package/lib/cjs/client/morphoViemExtension.js +5 -2
- package/lib/cjs/constants.d.ts +1 -0
- package/lib/cjs/constants.js +15 -1
- package/lib/cjs/entities/blue/blue.d.ts +5 -5
- package/lib/cjs/entities/blue/blue.js +105 -86
- package/lib/cjs/entities/index.d.ts +1 -0
- package/lib/cjs/entities/index.js +15 -0
- package/lib/cjs/entities/midnight/index.d.ts +2 -0
- package/lib/cjs/entities/midnight/index.js +18 -0
- package/lib/cjs/entities/midnight/midnight.d.ts +402 -0
- package/lib/cjs/entities/midnight/midnight.js +1036 -0
- package/lib/cjs/entities/midnight/types.d.ts +164 -0
- package/lib/cjs/entities/midnight/types.js +2 -0
- package/lib/cjs/entities/vaultV1/vaultV1.js +10 -17
- package/lib/cjs/entities/vaultV2/vaultV2.js +19 -21
- package/lib/cjs/errors.d.ts +1 -0
- package/lib/cjs/errors.js +17 -1
- package/lib/cjs/helpers/encodeDeallocation.d.ts +1 -0
- package/lib/cjs/helpers/encodeDeallocation.js +2 -1
- package/lib/cjs/helpers/index.d.ts +4 -1
- package/lib/cjs/helpers/index.js +8 -1
- package/lib/cjs/helpers/signAndVerifyTypedData.d.ts +34 -0
- package/lib/cjs/helpers/signAndVerifyTypedData.js +58 -0
- package/lib/cjs/helpers/validate.d.ts +40 -1
- package/lib/cjs/helpers/validate.js +47 -5
- package/lib/cjs/helpers/validateMidnightAuthorizationTarget.d.ts +15 -0
- package/lib/cjs/helpers/validateMidnightAuthorizationTarget.js +32 -0
- package/lib/cjs/helpers/validateMidnightMarket.d.ts +10 -0
- package/lib/cjs/helpers/validateMidnightMarket.js +24 -0
- package/lib/cjs/helpers/validateOfferSides.d.ts +21 -0
- package/lib/cjs/helpers/validateOfferSides.js +36 -0
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +29 -0
- package/lib/cjs/helpers/validateRequirementSpender.js +49 -0
- package/lib/cjs/helpers/validateTakeableOffers.d.ts +18 -0
- package/lib/cjs/helpers/validateTakeableOffers.js +35 -0
- package/lib/cjs/midnight-api.d.ts +1 -0
- package/lib/cjs/midnight-api.js +17 -0
- package/lib/cjs/types/action.d.ts +189 -23
- package/lib/cjs/types/action.js +27 -7
- package/lib/cjs/types/client.d.ts +3 -2
- package/lib/cjs/types/error.d.ts +288 -114
- package/lib/cjs/types/error.js +259 -175
- package/lib/cjs/utils.d.ts +1 -0
- package/lib/cjs/utils.js +12 -2
- package/lib/esm/abis.d.ts +1 -0
- package/lib/esm/abis.js +1 -0
- package/lib/esm/actions/blue/borrow.d.ts +3 -7
- package/lib/esm/actions/blue/borrow.js +6 -10
- package/lib/esm/actions/blue/buildReallocationActions.d.ts +3 -4
- package/lib/esm/actions/blue/buildReallocationActions.js +3 -4
- package/lib/esm/actions/blue/refinance.d.ts +4 -8
- package/lib/esm/actions/blue/refinance.js +11 -15
- package/lib/esm/actions/blue/repay.d.ts +2 -5
- package/lib/esm/actions/blue/repay.js +2 -5
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +3 -6
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +5 -8
- package/lib/esm/actions/blue/resolveRepayFunding.d.ts +2 -5
- package/lib/esm/actions/blue/resolveRepayFunding.js +16 -13
- package/lib/esm/actions/blue/supply.d.ts +2 -4
- package/lib/esm/actions/blue/supply.js +7 -9
- package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -3
- package/lib/esm/actions/blue/supplyCollateral.js +6 -7
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +4 -9
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +10 -15
- package/lib/esm/actions/blue/withdraw.d.ts +9 -7
- package/lib/esm/actions/blue/withdraw.js +19 -11
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +1 -1
- package/lib/esm/actions/blue/withdrawCollateral.js +3 -3
- package/lib/esm/actions/index.d.ts +2 -0
- package/lib/esm/actions/index.js +1 -0
- package/lib/esm/actions/midnight/authorization.d.ts +37 -0
- package/lib/esm/actions/midnight/authorization.js +65 -0
- package/lib/esm/actions/midnight/cancelOffer.d.ts +38 -0
- package/lib/esm/actions/midnight/cancelOffer.js +69 -0
- package/lib/esm/actions/midnight/index.d.ts +11 -0
- package/lib/esm/actions/midnight/index.js +11 -0
- package/lib/esm/actions/midnight/mempoolSubmitOffers.d.ts +52 -0
- package/lib/esm/actions/midnight/mempoolSubmitOffers.js +68 -0
- package/lib/esm/actions/midnight/redeem.d.ts +43 -0
- package/lib/esm/actions/midnight/redeem.js +75 -0
- package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +53 -0
- package/lib/esm/actions/midnight/repayWithdrawCollateral.js +117 -0
- package/lib/esm/actions/midnight/setterRatifierRatifyRoot.d.ts +40 -0
- package/lib/esm/actions/midnight/setterRatifierRatifyRoot.js +55 -0
- package/lib/esm/actions/midnight/supplyCollateral.d.ts +45 -0
- package/lib/esm/actions/midnight/supplyCollateral.js +79 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +51 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +124 -0
- package/lib/esm/actions/midnight/takeBorrow.d.ts +57 -0
- package/lib/esm/actions/midnight/takeBorrow.js +106 -0
- package/lib/esm/actions/midnight/takeLend.d.ts +57 -0
- package/lib/esm/actions/midnight/takeLend.js +106 -0
- package/lib/esm/actions/midnight/types.d.ts +39 -0
- package/lib/esm/actions/midnight/types.js +12 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +1 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +6 -17
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +5 -4
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +12 -16
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +2 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +12 -29
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +1 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +5 -17
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +1 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +10 -4
- package/lib/esm/actions/requirements/getRequirementsApproval.js +10 -4
- package/lib/esm/actions/requirements/index.d.ts +1 -0
- package/lib/esm/actions/requirements/index.js +1 -0
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +49 -0
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +72 -0
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +44 -0
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +74 -0
- package/lib/esm/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.d.ts +42 -0
- package/lib/esm/actions/requirements/midnight/getSetterRatifierRatifyRootRequirement.js +66 -0
- package/lib/esm/actions/requirements/midnight/index.d.ts +3 -0
- package/lib/esm/actions/requirements/midnight/index.js +3 -0
- package/lib/esm/actions/vaultV1/deposit.d.ts +3 -4
- package/lib/esm/actions/vaultV1/deposit.js +8 -9
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +2 -3
- package/lib/esm/actions/vaultV1/migrateToV2.js +6 -7
- package/lib/esm/actions/vaultV1/redeem.d.ts +1 -1
- package/lib/esm/actions/vaultV1/redeem.js +3 -3
- package/lib/esm/actions/vaultV1/withdraw.d.ts +1 -1
- package/lib/esm/actions/vaultV1/withdraw.js +3 -3
- package/lib/esm/actions/vaultV2/deposit.d.ts +3 -4
- package/lib/esm/actions/vaultV2/deposit.js +8 -9
- package/lib/esm/actions/vaultV2/forceRedeem.d.ts +2 -3
- package/lib/esm/actions/vaultV2/forceRedeem.js +4 -5
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +1 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +3 -3
- package/lib/esm/actions/vaultV2/redeem.d.ts +1 -1
- package/lib/esm/actions/vaultV2/redeem.js +3 -3
- package/lib/esm/actions/vaultV2/withdraw.d.ts +1 -1
- package/lib/esm/actions/vaultV2/withdraw.js +3 -3
- package/lib/esm/client/morphoViemExtension.d.ts +1 -1
- package/lib/esm/client/morphoViemExtension.js +6 -3
- package/lib/esm/constants.d.ts +1 -0
- package/lib/esm/constants.js +1 -0
- package/lib/esm/entities/blue/blue.d.ts +5 -5
- package/lib/esm/entities/blue/blue.js +107 -88
- package/lib/esm/entities/index.d.ts +1 -0
- package/lib/esm/entities/index.js +1 -0
- package/lib/esm/entities/midnight/index.d.ts +2 -0
- package/lib/esm/entities/midnight/index.js +2 -0
- package/lib/esm/entities/midnight/midnight.d.ts +402 -0
- package/lib/esm/entities/midnight/midnight.js +1032 -0
- package/lib/esm/entities/midnight/types.d.ts +164 -0
- package/lib/esm/entities/midnight/types.js +1 -0
- package/lib/esm/entities/vaultV1/vaultV1.js +13 -20
- package/lib/esm/entities/vaultV2/vaultV2.js +9 -11
- package/lib/esm/errors.d.ts +1 -0
- package/lib/esm/errors.js +1 -0
- package/lib/esm/helpers/encodeDeallocation.d.ts +1 -0
- package/lib/esm/helpers/encodeDeallocation.js +3 -2
- package/lib/esm/helpers/index.d.ts +4 -1
- package/lib/esm/helpers/index.js +4 -1
- package/lib/esm/helpers/signAndVerifyTypedData.d.ts +34 -0
- package/lib/esm/helpers/signAndVerifyTypedData.js +54 -0
- package/lib/esm/helpers/validate.d.ts +40 -1
- package/lib/esm/helpers/validate.js +46 -5
- package/lib/esm/helpers/validateMidnightAuthorizationTarget.d.ts +15 -0
- package/lib/esm/helpers/validateMidnightAuthorizationTarget.js +28 -0
- package/lib/esm/helpers/validateMidnightMarket.d.ts +10 -0
- package/lib/esm/helpers/validateMidnightMarket.js +20 -0
- package/lib/esm/helpers/validateOfferSides.d.ts +21 -0
- package/lib/esm/helpers/validateOfferSides.js +32 -0
- package/lib/esm/helpers/validateRequirementSpender.d.ts +29 -0
- package/lib/esm/helpers/validateRequirementSpender.js +45 -0
- package/lib/esm/helpers/validateTakeableOffers.d.ts +18 -0
- package/lib/esm/helpers/validateTakeableOffers.js +31 -0
- package/lib/esm/midnight-api.d.ts +1 -0
- package/lib/esm/midnight-api.js +1 -0
- package/lib/esm/types/action.d.ts +189 -23
- package/lib/esm/types/action.js +26 -7
- package/lib/esm/types/client.d.ts +3 -2
- package/lib/esm/types/error.d.ts +288 -114
- package/lib/esm/types/error.js +232 -149
- package/lib/esm/utils.d.ts +1 -0
- package/lib/esm/utils.js +1 -0
- package/package.json +13 -4
package/lib/cjs/types/error.js
CHANGED
|
@@ -1,8 +1,108 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.RefinanceSharesMissingBorrowAssetsError = exports.RefinanceExceedsBorrowAssetsError = exports.RefinanceExceedsBorrowSharesError = exports.RefinanceExceedsCollateralError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.
|
|
3
|
+
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 = exports.ZeroSupplyAmountError = exports.NonPositiveWithdrawCollateralAmountError = exports.NonPositiveRepayMaxSharePriceError = exports.NonPositiveRepayAmountError = exports.NonPositiveReallocationAmountError = exports.ZeroCollateralAmountError = exports.NonPositiveBorrowAmountError = exports.ZeroDepositAmountError = exports.NonPositiveMaxSharePriceError = exports.NonPositiveSharesAmountError = exports.NonPositiveAssetAmountError = exports.NonPositiveInputError = exports.NegativeInputError = void 0;
|
|
4
|
+
exports.RefinanceSharesMissingBorrowAssetsError = exports.RefinanceExceedsBorrowAssetsError = exports.RefinanceExceedsBorrowSharesError = exports.RefinanceExceedsCollateralError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.BorrowAmountAndSharesExclusiveError = 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.UnknownReallocationPositionError = exports.UnknownReallocationVaultMarketConfigError = exports.UnknownReallocationVaultError = exports.UnknownReallocationMarketError = exports.InsufficientSharedLiquidityError = exports.DisabledReallocationMarketError = exports.MissingPublicAllocatorConfigError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.ShareDivideByZeroError = exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.MutuallyExclusiveRepayAmountsError = exports.TransferAmountNotEqualToAssetsError = exports.UnsortedReallocationWithdrawalsError = exports.ReallocationWithdrawalOnTargetMarketError = exports.EmptyReallocationWithdrawalsError = exports.AccrualPositionUserMismatchError = void 0;
|
|
5
5
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
6
|
+
/**
|
|
7
|
+
* Thrown when a morpho-sdk input that must be non-negative is negative.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { NegativeInputError } from "@morpho-org/morpho-sdk";
|
|
12
|
+
*
|
|
13
|
+
* const error = new NegativeInputError("amount", -1n);
|
|
14
|
+
* if (error instanceof NegativeInputError) {
|
|
15
|
+
* console.error(error.field, error.value);
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
class NegativeInputError extends Error {
|
|
20
|
+
field;
|
|
21
|
+
value;
|
|
22
|
+
/**
|
|
23
|
+
* @param field - Public input field whose value is invalid.
|
|
24
|
+
* @param value - Negative bigint supplied for the field.
|
|
25
|
+
*/
|
|
26
|
+
constructor(field, value) {
|
|
27
|
+
super(`Input "${field}" must be non-negative, got "${value}".`);
|
|
28
|
+
this.field = field;
|
|
29
|
+
this.value = value;
|
|
30
|
+
this.name = "NegativeInputError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.NegativeInputError = NegativeInputError;
|
|
34
|
+
/**
|
|
35
|
+
* Thrown when a morpho-sdk input that must be positive is zero or negative.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { NonPositiveInputError } from "@morpho-org/morpho-sdk";
|
|
40
|
+
*
|
|
41
|
+
* const error = new NonPositiveInputError("shares", 0n);
|
|
42
|
+
* if (error instanceof NonPositiveInputError) {
|
|
43
|
+
* console.error(error.field, error.value);
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
class NonPositiveInputError extends Error {
|
|
48
|
+
field;
|
|
49
|
+
value;
|
|
50
|
+
/**
|
|
51
|
+
* @param field - Public input field whose value is invalid.
|
|
52
|
+
* @param value - Zero or negative bigint supplied for the field.
|
|
53
|
+
*/
|
|
54
|
+
constructor(field, value) {
|
|
55
|
+
super(`Input "${field}" must be positive, got "${value}".`);
|
|
56
|
+
this.field = field;
|
|
57
|
+
this.value = value;
|
|
58
|
+
this.name = "NonPositiveInputError";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.NonPositiveInputError = NonPositiveInputError;
|
|
62
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
63
|
+
exports.NonPositiveAssetAmountError = NonPositiveInputError;
|
|
64
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
65
|
+
exports.NonPositiveSharesAmountError = NonPositiveInputError;
|
|
66
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
67
|
+
exports.NonPositiveMaxSharePriceError = NonPositiveInputError;
|
|
68
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
69
|
+
exports.ZeroDepositAmountError = NonPositiveInputError;
|
|
70
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
71
|
+
exports.NonPositiveBorrowAmountError = NonPositiveInputError;
|
|
72
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
73
|
+
exports.ZeroCollateralAmountError = NonPositiveInputError;
|
|
74
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
75
|
+
exports.NonPositiveReallocationAmountError = NonPositiveInputError;
|
|
76
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
77
|
+
exports.NonPositiveRepayAmountError = NonPositiveInputError;
|
|
78
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
79
|
+
exports.NonPositiveRepayMaxSharePriceError = NonPositiveInputError;
|
|
80
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
81
|
+
exports.NonPositiveWithdrawCollateralAmountError = NonPositiveInputError;
|
|
82
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
83
|
+
exports.ZeroSupplyAmountError = NonPositiveInputError;
|
|
84
|
+
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
85
|
+
exports.NonPositiveWithdrawAmountError = NonPositiveInputError;
|
|
86
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
87
|
+
exports.NegativeSlippageToleranceError = NegativeInputError;
|
|
88
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
89
|
+
exports.NegativeNativeAmountError = NegativeInputError;
|
|
90
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
91
|
+
exports.NegativeReallocationFeeError = NegativeInputError;
|
|
92
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
93
|
+
exports.NonPositiveMinBorrowSharePriceError = NegativeInputError;
|
|
94
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
95
|
+
exports.NegativeSupplyAmountError = NegativeInputError;
|
|
96
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
97
|
+
exports.NegativeSupplyMaxSharePriceError = NegativeInputError;
|
|
98
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
99
|
+
exports.NegativeWithdrawMinSharePriceError = NegativeInputError;
|
|
100
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
101
|
+
exports.NegativeMinSharePriceError = NegativeInputError;
|
|
102
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
103
|
+
exports.NegativeBorrowSharesError = NegativeInputError;
|
|
104
|
+
/** @deprecated Use {@link NegativeInputError}. */
|
|
105
|
+
exports.NegativeMaxRepaySharePriceError = NegativeInputError;
|
|
6
106
|
/**
|
|
7
107
|
* Typed errors thrown while encoding supported Bundler3 actions.
|
|
8
108
|
*
|
|
@@ -79,21 +179,21 @@ var BundlerErrors;
|
|
|
79
179
|
/**
|
|
80
180
|
* Thrown when `buildTx` receives more than one requirement signature of the same kind.
|
|
81
181
|
*
|
|
82
|
-
* A bundled path consumes at most one
|
|
83
|
-
*
|
|
182
|
+
* A bundled path consumes at most one signature per accepted kind; passing several of the same
|
|
183
|
+
* kind is ambiguous and would silently drop all but the first, so it is rejected instead.
|
|
84
184
|
*
|
|
85
185
|
* @example
|
|
86
186
|
* ```ts
|
|
87
187
|
* import { AmbiguousRequirementSignaturesError } from "@morpho-org/morpho-sdk";
|
|
88
188
|
*
|
|
89
189
|
* if (error instanceof AmbiguousRequirementSignaturesError) {
|
|
90
|
-
* // Pass a single
|
|
190
|
+
* // Pass a single signature per accepted kind to buildTx.
|
|
91
191
|
* }
|
|
92
192
|
* ```
|
|
93
193
|
*/
|
|
94
194
|
class AmbiguousRequirementSignaturesError extends Error {
|
|
95
195
|
/**
|
|
96
|
-
* @param kind - The over-supplied signature kind
|
|
196
|
+
* @param kind - The over-supplied signature kind.
|
|
97
197
|
* @param count - How many signatures of that kind were received.
|
|
98
198
|
*/
|
|
99
199
|
constructor(kind, count) {
|
|
@@ -102,9 +202,8 @@ class AmbiguousRequirementSignaturesError extends Error {
|
|
|
102
202
|
}
|
|
103
203
|
exports.AmbiguousRequirementSignaturesError = AmbiguousRequirementSignaturesError;
|
|
104
204
|
/**
|
|
105
|
-
* Thrown when `buildTx` receives a requirement signature of a kind the operation does not consume
|
|
106
|
-
*
|
|
107
|
-
* authorization or permit from being silently ignored.
|
|
205
|
+
* Thrown when `buildTx` receives a requirement signature of a kind the operation does not consume.
|
|
206
|
+
* Surfacing it prevents a signed requirement from being silently ignored.
|
|
108
207
|
*
|
|
109
208
|
* @example
|
|
110
209
|
* ```ts
|
|
@@ -117,34 +216,13 @@ exports.AmbiguousRequirementSignaturesError = AmbiguousRequirementSignaturesErro
|
|
|
117
216
|
*/
|
|
118
217
|
class UnexpectedRequirementSignatureError extends Error {
|
|
119
218
|
/**
|
|
120
|
-
* @param kind - The unexpected signature kind
|
|
219
|
+
* @param kind - The unexpected signature kind.
|
|
121
220
|
*/
|
|
122
221
|
constructor(kind) {
|
|
123
222
|
super(`Received a ${kind} signature that this operation does not consume. Remove it from the buildTx signatures array.`);
|
|
124
223
|
}
|
|
125
224
|
}
|
|
126
225
|
exports.UnexpectedRequirementSignatureError = UnexpectedRequirementSignatureError;
|
|
127
|
-
/** Thrown when an asset amount is required to be positive but is zero or negative. */
|
|
128
|
-
class NonPositiveAssetAmountError extends Error {
|
|
129
|
-
constructor(origin) {
|
|
130
|
-
super(`Asset amount must be positive for address ${origin}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.NonPositiveAssetAmountError = NonPositiveAssetAmountError;
|
|
134
|
-
/** Thrown when a shares amount is required to be positive but is zero or negative. */
|
|
135
|
-
class NonPositiveSharesAmountError extends Error {
|
|
136
|
-
constructor(vault) {
|
|
137
|
-
super(`Shares amount must be positive for address: ${vault}`);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
exports.NonPositiveSharesAmountError = NonPositiveSharesAmountError;
|
|
141
|
-
/** Thrown when a vault deposit's `maxSharePrice` slippage bound is zero or negative. */
|
|
142
|
-
class NonPositiveMaxSharePriceError extends Error {
|
|
143
|
-
constructor(vault) {
|
|
144
|
-
super(`Max share price must be positive for vault: ${vault}`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.NonPositiveMaxSharePriceError = NonPositiveMaxSharePriceError;
|
|
148
226
|
/** Thrown when a viem client's account address does not match the address required by the call. */
|
|
149
227
|
class AddressMismatchError extends Error {
|
|
150
228
|
constructor(clientAddress, argsAddress) {
|
|
@@ -159,6 +237,13 @@ class ChainIdMismatchError extends Error {
|
|
|
159
237
|
}
|
|
160
238
|
}
|
|
161
239
|
exports.ChainIdMismatchError = ChainIdMismatchError;
|
|
240
|
+
/** Thrown when a runtime crypto API is required but unavailable. */
|
|
241
|
+
class CryptoUnavailableError extends Error {
|
|
242
|
+
constructor(feature) {
|
|
243
|
+
super(`Crypto API is required for ${feature} but is unavailable.`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.CryptoUnavailableError = CryptoUnavailableError;
|
|
162
247
|
/** Thrown when the viem client is missing a property the call requires (e.g. `account.address`). */
|
|
163
248
|
class MissingClientPropertyError extends Error {
|
|
164
249
|
constructor(property) {
|
|
@@ -188,17 +273,19 @@ class UnsupportedErc20ApprovalSpenderError extends Error {
|
|
|
188
273
|
}
|
|
189
274
|
}
|
|
190
275
|
exports.UnsupportedErc20ApprovalSpenderError = UnsupportedErc20ApprovalSpenderError;
|
|
191
|
-
/** Thrown when a
|
|
192
|
-
class
|
|
193
|
-
constructor(
|
|
194
|
-
super(`
|
|
276
|
+
/** Thrown when a Midnight authorization requirement targets an unsupported operator. */
|
|
277
|
+
class UnsupportedMidnightAuthorizationTargetError extends Error {
|
|
278
|
+
constructor(params) {
|
|
279
|
+
super(`Midnight authorization target "${params.authorized}" is not supported on chain "${params.chainId}". Use "${params.supportedTargets.join('", "')}".`);
|
|
195
280
|
}
|
|
196
281
|
}
|
|
197
|
-
exports.
|
|
198
|
-
/** Thrown when a Morpho accrual position
|
|
282
|
+
exports.UnsupportedMidnightAuthorizationTargetError = UnsupportedMidnightAuthorizationTargetError;
|
|
283
|
+
/** Thrown when a Morpho accrual position required by a call is missing. */
|
|
199
284
|
class MissingAccrualPositionError extends Error {
|
|
200
285
|
constructor(market) {
|
|
201
|
-
super(
|
|
286
|
+
super(market == null
|
|
287
|
+
? "Accrual position is missing. Fetch the position data and try again."
|
|
288
|
+
: `Accrual position is missing for market: ${market}`);
|
|
202
289
|
}
|
|
203
290
|
}
|
|
204
291
|
exports.MissingAccrualPositionError = MissingAccrualPositionError;
|
|
@@ -230,6 +317,20 @@ class DepositAssetMismatchError extends Error {
|
|
|
230
317
|
}
|
|
231
318
|
}
|
|
232
319
|
exports.DepositAssetMismatchError = DepositAssetMismatchError;
|
|
320
|
+
/** Thrown when a deposit's owner differs from the owner the supplied permit / permit2 signature was issued for. */
|
|
321
|
+
class DepositOwnerMismatchError extends Error {
|
|
322
|
+
constructor(depositOwner, signatureOwner) {
|
|
323
|
+
super(`Deposit owner "${depositOwner}" does not match requirement signature owner "${signatureOwner}"`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
exports.DepositOwnerMismatchError = DepositOwnerMismatchError;
|
|
327
|
+
/** Thrown when a deposit's spender differs from the spender the supplied permit / permit2 signature was issued for. */
|
|
328
|
+
class DepositSpenderMismatchError extends Error {
|
|
329
|
+
constructor(depositSpender, signatureSpender) {
|
|
330
|
+
super(`Deposit spender "${depositSpender}" does not match requirement signature spender "${signatureSpender}"`);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
exports.DepositSpenderMismatchError = DepositSpenderMismatchError;
|
|
233
334
|
/** Thrown when a `permit2` requirement signature is missing the `expiration` field. */
|
|
234
335
|
class Permit2ExpirationMissingError extends Error {
|
|
235
336
|
constructor() {
|
|
@@ -251,20 +352,6 @@ class ChainWNativeMissingError extends Error {
|
|
|
251
352
|
}
|
|
252
353
|
}
|
|
253
354
|
exports.ChainWNativeMissingError = ChainWNativeMissingError;
|
|
254
|
-
/** Thrown when `nativeAmount` is negative. */
|
|
255
|
-
class NegativeNativeAmountError extends Error {
|
|
256
|
-
constructor(nativeAmount) {
|
|
257
|
-
super(`Native amount must not be negative, got ${nativeAmount}`);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
exports.NegativeNativeAmountError = NegativeNativeAmountError;
|
|
261
|
-
/** Thrown when both `amount` and `nativeAmount` resolve to zero on a vault deposit. */
|
|
262
|
-
class ZeroDepositAmountError extends Error {
|
|
263
|
-
constructor(vault) {
|
|
264
|
-
super(`Total deposit amount must be positive for vault: ${vault}. Both amount and nativeAmount are zero.`);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
exports.ZeroDepositAmountError = ZeroDepositAmountError;
|
|
268
355
|
/** Thrown when a vault entity's address does not match the vault address embedded in the call's args. */
|
|
269
356
|
class VaultAddressMismatchError extends Error {
|
|
270
357
|
constructor(vaultAddress, argsVaultAddress) {
|
|
@@ -272,20 +359,6 @@ class VaultAddressMismatchError extends Error {
|
|
|
272
359
|
}
|
|
273
360
|
}
|
|
274
361
|
exports.VaultAddressMismatchError = VaultAddressMismatchError;
|
|
275
|
-
/** Thrown when a market borrow amount is zero or negative. */
|
|
276
|
-
class NonPositiveBorrowAmountError extends Error {
|
|
277
|
-
constructor(market) {
|
|
278
|
-
super(`Borrow amount must be positive for market: ${market}`);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
exports.NonPositiveBorrowAmountError = NonPositiveBorrowAmountError;
|
|
282
|
-
/** Thrown when both `amount` and `nativeAmount` resolve to zero on a market collateral supply. */
|
|
283
|
-
class ZeroCollateralAmountError extends Error {
|
|
284
|
-
constructor(market) {
|
|
285
|
-
super(`Total collateral amount must be positive for market: ${market}. Both amount and nativeAmount are zero.`);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
exports.ZeroCollateralAmountError = ZeroCollateralAmountError;
|
|
289
362
|
/** Thrown when an action uses `nativeAmount` but the target asset is not the chain's wNative. */
|
|
290
363
|
class NativeAmountOnNonWNativeAssetError extends Error {
|
|
291
364
|
constructor(asset, wNative) {
|
|
@@ -323,13 +396,6 @@ class AccrualPositionUserMismatchError extends Error {
|
|
|
323
396
|
}
|
|
324
397
|
}
|
|
325
398
|
exports.AccrualPositionUserMismatchError = AccrualPositionUserMismatchError;
|
|
326
|
-
/** Thrown when a reallocation's fee is negative. */
|
|
327
|
-
class NegativeReallocationFeeError extends Error {
|
|
328
|
-
constructor(vault) {
|
|
329
|
-
super(`Reallocation fee must not be negative for vault: ${vault}`);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
exports.NegativeReallocationFeeError = NegativeReallocationFeeError;
|
|
333
399
|
/** Thrown when a reallocation has no withdrawals. */
|
|
334
400
|
class EmptyReallocationWithdrawalsError extends Error {
|
|
335
401
|
constructor(vault) {
|
|
@@ -337,13 +403,6 @@ class EmptyReallocationWithdrawalsError extends Error {
|
|
|
337
403
|
}
|
|
338
404
|
}
|
|
339
405
|
exports.EmptyReallocationWithdrawalsError = EmptyReallocationWithdrawalsError;
|
|
340
|
-
/** Thrown when a reallocation withdrawal amount is zero or negative. */
|
|
341
|
-
class NonPositiveReallocationAmountError extends Error {
|
|
342
|
-
constructor(vault, market) {
|
|
343
|
-
super(`Reallocation withdrawal amount must be positive for vault ${vault} on market ${market}`);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
exports.NonPositiveReallocationAmountError = NonPositiveReallocationAmountError;
|
|
347
406
|
/** Thrown when a reallocation withdrawal references the operation's target market (which would be a no-op or self-deal). */
|
|
348
407
|
class ReallocationWithdrawalOnTargetMarketError extends Error {
|
|
349
408
|
constructor(vault, marketId) {
|
|
@@ -358,20 +417,6 @@ class UnsortedReallocationWithdrawalsError extends Error {
|
|
|
358
417
|
}
|
|
359
418
|
}
|
|
360
419
|
exports.UnsortedReallocationWithdrawalsError = UnsortedReallocationWithdrawalsError;
|
|
361
|
-
/**
|
|
362
|
-
* Thrown when a market repay's `transferAmount` is zero or negative.
|
|
363
|
-
*
|
|
364
|
-
* @deprecated No longer thrown. The repay action layer no longer validates `transferAmount`
|
|
365
|
-
* directly (assets mode uses {@link NonPositiveRepayAmountError}; shares mode allows a zero
|
|
366
|
-
* ERC-20 transfer for fully-native repays). Retained as exported API for back-compat; slated
|
|
367
|
-
* for removal in a future major.
|
|
368
|
-
*/
|
|
369
|
-
class NonPositiveTransferAmountError extends Error {
|
|
370
|
-
constructor(market) {
|
|
371
|
-
super(`Transfer amount must be positive for market: ${market}`);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
exports.NonPositiveTransferAmountError = NonPositiveTransferAmountError;
|
|
375
420
|
/**
|
|
376
421
|
* Thrown when a market repay in assets mode has `transferAmount !== amount + nativeAmount` — the
|
|
377
422
|
* pre-resolved ERC-20 pull plus the wrapped native must equal the assets repaid, so the bundle
|
|
@@ -383,16 +428,6 @@ class TransferAmountNotEqualToAssetsError extends Error {
|
|
|
383
428
|
}
|
|
384
429
|
}
|
|
385
430
|
exports.TransferAmountNotEqualToAssetsError = TransferAmountNotEqualToAssetsError;
|
|
386
|
-
/**
|
|
387
|
-
* Thrown when a shares-mode repay's `nativeAmount` exceeds `transferAmount`, which
|
|
388
|
-
* would make the ERC-20 amount to pull (`transferAmount − nativeAmount`) negative.
|
|
389
|
-
*/
|
|
390
|
-
class NativeAmountExceedsTransferAmountError extends Error {
|
|
391
|
-
constructor(params) {
|
|
392
|
-
super(`Native amount ${params.nativeAmount} exceeds transfer amount ${params.transferAmount} for market: ${params.market}. Reduce nativeAmount to at most transferAmount.`);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
exports.NativeAmountExceedsTransferAmountError = NativeAmountExceedsTransferAmountError;
|
|
396
431
|
/** Thrown when a market repay specifies both `assets` and `shares` as non-zero (modes are mutually exclusive). */
|
|
397
432
|
class MutuallyExclusiveRepayAmountsError extends Error {
|
|
398
433
|
constructor(market) {
|
|
@@ -400,27 +435,6 @@ class MutuallyExclusiveRepayAmountsError extends Error {
|
|
|
400
435
|
}
|
|
401
436
|
}
|
|
402
437
|
exports.MutuallyExclusiveRepayAmountsError = MutuallyExclusiveRepayAmountsError;
|
|
403
|
-
/** Thrown when a market repay has non-positive amounts: both `assets` and `shares` are zero, or either is negative. */
|
|
404
|
-
class NonPositiveRepayAmountError extends Error {
|
|
405
|
-
constructor(market) {
|
|
406
|
-
super(`Repay amount must be positive for market: ${market}`);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
exports.NonPositiveRepayAmountError = NonPositiveRepayAmountError;
|
|
410
|
-
/** Thrown when a market repay's `maxSharePrice` slippage bound is zero or negative. */
|
|
411
|
-
class NonPositiveRepayMaxSharePriceError extends Error {
|
|
412
|
-
constructor(market) {
|
|
413
|
-
super(`Max share price must be positive for market: ${market}`);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
exports.NonPositiveRepayMaxSharePriceError = NonPositiveRepayMaxSharePriceError;
|
|
417
|
-
/** Thrown when a market `withdrawCollateral` amount is zero or negative. */
|
|
418
|
-
class NonPositiveWithdrawCollateralAmountError extends Error {
|
|
419
|
-
constructor(market) {
|
|
420
|
-
super(`Withdraw collateral amount must be positive for market: ${market}`);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
exports.NonPositiveWithdrawCollateralAmountError = NonPositiveWithdrawCollateralAmountError;
|
|
424
438
|
/** Thrown when a withdraw amount exceeds the position's available collateral. */
|
|
425
439
|
class WithdrawExceedsCollateralError extends Error {
|
|
426
440
|
constructor(params) {
|
|
@@ -550,48 +564,139 @@ class UnknownReallocationPositionError extends blue_sdk_1.UnknownDataError {
|
|
|
550
564
|
}
|
|
551
565
|
}
|
|
552
566
|
exports.UnknownReallocationPositionError = UnknownReallocationPositionError;
|
|
553
|
-
/** Thrown when a
|
|
554
|
-
class
|
|
555
|
-
constructor(
|
|
556
|
-
super(`
|
|
567
|
+
/** Thrown when a Midnight amount exceeds the maximum offer-cap value accepted onchain. */
|
|
568
|
+
class MidnightAmountExceedsMaxOfferCapError extends Error {
|
|
569
|
+
constructor(params) {
|
|
570
|
+
super(`Midnight ${params.label} "${params.amount}" exceeds maximum offer cap "${params.maxOfferCap}". Reduce the amount to the maximum offer cap or less.`);
|
|
557
571
|
}
|
|
558
572
|
}
|
|
559
|
-
exports.
|
|
560
|
-
/** Thrown when a
|
|
561
|
-
class
|
|
562
|
-
constructor(
|
|
563
|
-
super(
|
|
573
|
+
exports.MidnightAmountExceedsMaxOfferCapError = MidnightAmountExceedsMaxOfferCapError;
|
|
574
|
+
/** Thrown when a Midnight flow needs at least one takeable offer. */
|
|
575
|
+
class EmptyMidnightTakeableOffersError extends Error {
|
|
576
|
+
constructor() {
|
|
577
|
+
super("Midnight takeable offers cannot be empty. Refresh the quote and try again.");
|
|
564
578
|
}
|
|
565
579
|
}
|
|
566
|
-
exports.
|
|
567
|
-
/** Thrown when a
|
|
568
|
-
class
|
|
569
|
-
constructor(
|
|
570
|
-
super(`
|
|
580
|
+
exports.EmptyMidnightTakeableOffersError = EmptyMidnightTakeableOffersError;
|
|
581
|
+
/** Thrown when a Midnight offer has the wrong maker side for the requested flow. */
|
|
582
|
+
class MidnightOfferSideMismatchError extends Error {
|
|
583
|
+
constructor(params) {
|
|
584
|
+
super(`Midnight offer "${params.index}" has buy="${params.actualBuy}", expected "${params.expectedBuy}". Use the matching flow or rebuild the offer list.`);
|
|
571
585
|
}
|
|
572
586
|
}
|
|
573
|
-
exports.
|
|
574
|
-
/** Thrown when
|
|
575
|
-
class
|
|
576
|
-
constructor(
|
|
577
|
-
super(`
|
|
587
|
+
exports.MidnightOfferSideMismatchError = MidnightOfferSideMismatchError;
|
|
588
|
+
/** Thrown when a Midnight maker offer belongs to a different account than the action flow. */
|
|
589
|
+
class MidnightOfferMakerMismatchError extends Error {
|
|
590
|
+
constructor(params) {
|
|
591
|
+
super(`Midnight offer "${params.index}" belongs to maker "${params.actualMaker}", expected "${params.expectedMaker}". Rebuild the offer set for the active account.`);
|
|
578
592
|
}
|
|
579
593
|
}
|
|
580
|
-
exports.
|
|
581
|
-
/** Thrown when a
|
|
582
|
-
class
|
|
583
|
-
constructor(
|
|
584
|
-
super(`
|
|
594
|
+
exports.MidnightOfferMakerMismatchError = MidnightOfferMakerMismatchError;
|
|
595
|
+
/** Thrown when a Midnight maker offer targets a different chain than the action flow. */
|
|
596
|
+
class MidnightOfferMarketChainMismatchError extends Error {
|
|
597
|
+
constructor(params) {
|
|
598
|
+
super(`Midnight offer "${params.index}" targets chain "${params.actualChainId}", expected "${params.expectedChainId}". Rebuild the offer set for the selected chain.`);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
exports.MidnightOfferMarketChainMismatchError = MidnightOfferMarketChainMismatchError;
|
|
602
|
+
/** Thrown when a Midnight maker offer targets a different Midnight contract than the action flow. */
|
|
603
|
+
class MidnightOfferMarketAddressMismatchError extends Error {
|
|
604
|
+
constructor(params) {
|
|
605
|
+
super(`Midnight offer "${params.index}" targets Midnight "${params.actualMidnight}", expected "${params.expectedMidnight}". Rebuild the offer set for the selected chain.`);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
exports.MidnightOfferMarketAddressMismatchError = MidnightOfferMarketAddressMismatchError;
|
|
609
|
+
/** Thrown when a Midnight market targets a different deployment than the selected chain. */
|
|
610
|
+
class MidnightMarketAddressMismatchError extends Error {
|
|
611
|
+
constructor(params) {
|
|
612
|
+
super(`Midnight market targets contract "${params.actualMidnight}", expected "${params.expectedMidnight}". Use market data from the selected chain deployment.`);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
exports.MidnightMarketAddressMismatchError = MidnightMarketAddressMismatchError;
|
|
616
|
+
/** Thrown when a Midnight make-lend offer does not use the approved loan token. */
|
|
617
|
+
class MidnightOfferMarketLoanTokenMismatchError extends Error {
|
|
618
|
+
constructor(params) {
|
|
619
|
+
super(`Midnight offer "${params.index}" uses loan token "${params.actualLoanToken}", expected "${params.expectedLoanToken}". Rebuild the lend offer set for the approved loan token.`);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
exports.MidnightOfferMarketLoanTokenMismatchError = MidnightOfferMarketLoanTokenMismatchError;
|
|
623
|
+
/** Thrown when a quoted Midnight takeable offer belongs to a different market than the requested flow. */
|
|
624
|
+
class MidnightTakeableOfferMarketMismatchError extends Error {
|
|
625
|
+
constructor(params) {
|
|
626
|
+
super(`Midnight takeable offer "${params.index}" belongs to market "${params.actualMarket}", expected "${params.expectedMarket}". Refresh the quote and try again.`);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
exports.MidnightTakeableOfferMarketMismatchError = MidnightTakeableOfferMarketMismatchError;
|
|
630
|
+
/** Thrown when a Midnight offer tree uses an unsupported ratifier address. */
|
|
631
|
+
class UnknownMidnightRatifierError extends Error {
|
|
632
|
+
constructor(params) {
|
|
633
|
+
super(`Midnight offer tree uses ratifier "${params.ratifier}", expected "${params.ecrecoverRatifier}" or "${params.setterRatifier}". Rebuild the tree with a supported ratifier.`);
|
|
585
634
|
}
|
|
586
635
|
}
|
|
587
|
-
exports.
|
|
588
|
-
/** Thrown when a
|
|
589
|
-
class
|
|
636
|
+
exports.UnknownMidnightRatifierError = UnknownMidnightRatifierError;
|
|
637
|
+
/** Thrown when a Midnight Ecrecover maker flow builds the submit transaction before signing. */
|
|
638
|
+
class MissingMidnightOfferRootSignatureError extends Error {
|
|
639
|
+
constructor() {
|
|
640
|
+
super("Midnight offer root signature is missing. Sign the offer-root requirement before building the submit transaction.");
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
exports.MissingMidnightOfferRootSignatureError = MissingMidnightOfferRootSignatureError;
|
|
644
|
+
/** Thrown when a Midnight offer-root signature does not match the prepared tree root. */
|
|
645
|
+
class MidnightOfferRootMismatchError extends Error {
|
|
646
|
+
constructor(params) {
|
|
647
|
+
super(`Midnight offer root mismatch: expected "${params.expectedRoot}", got "${params.actualRoot}". Rebuild the flow and sign again.`);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
exports.MidnightOfferRootMismatchError = MidnightOfferRootMismatchError;
|
|
651
|
+
/** Thrown when a Midnight offer-root signature was produced by another maker account. */
|
|
652
|
+
class MidnightOfferRootOwnerMismatchError extends Error {
|
|
653
|
+
constructor(params) {
|
|
654
|
+
super(`Midnight offer root owner mismatch: expected "${params.expectedOwner}", got "${params.actualOwner}". Rebuild the flow and sign again.`);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
exports.MidnightOfferRootOwnerMismatchError = MidnightOfferRootOwnerMismatchError;
|
|
658
|
+
/** Thrown when a Midnight offer-root signature targets another ratifier. */
|
|
659
|
+
class MidnightOfferRootRatifierMismatchError extends Error {
|
|
660
|
+
constructor(params) {
|
|
661
|
+
super(`Midnight offer root ratifier mismatch: expected "${params.expectedRatifier}", got "${params.actualRatifier}". Rebuild the flow and sign again.`);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
exports.MidnightOfferRootRatifierMismatchError = MidnightOfferRootRatifierMismatchError;
|
|
665
|
+
/** Thrown when a Midnight offer-root signature was produced for another offer count. */
|
|
666
|
+
class MidnightOfferRootOfferCountMismatchError extends Error {
|
|
667
|
+
constructor(params) {
|
|
668
|
+
super(`Midnight offer root offer-count mismatch: expected "${params.expectedOffers}", got "${params.actualOffers}". Rebuild the flow and sign again.`);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
exports.MidnightOfferRootOfferCountMismatchError = MidnightOfferRootOfferCountMismatchError;
|
|
672
|
+
/** Thrown when a Midnight offer-root signature was not prepared by this maker flow. */
|
|
673
|
+
class UnpreparedMidnightOfferRootSignatureError extends Error {
|
|
674
|
+
constructor() {
|
|
675
|
+
super("Midnight offer root signature was not prepared for this offer tree. Sign this flow's offer-root requirement before building the submit transaction.");
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
exports.UnpreparedMidnightOfferRootSignatureError = UnpreparedMidnightOfferRootSignatureError;
|
|
679
|
+
/** Thrown when a Midnight redeem flow finds no credit units for the user. */
|
|
680
|
+
class NoMidnightCreditToRedeemError extends Error {
|
|
590
681
|
constructor(market) {
|
|
591
|
-
super(`
|
|
682
|
+
super(`No Midnight credit is available to redeem for market "${market}".`);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
exports.NoMidnightCreditToRedeemError = NoMidnightCreditToRedeemError;
|
|
686
|
+
/** Thrown when a Midnight redeem amount exceeds the user's accrued credit. */
|
|
687
|
+
class MidnightRedeemExceedsCreditError extends Error {
|
|
688
|
+
constructor(params) {
|
|
689
|
+
super(`Midnight redeem amount exceeds position credit on market "${params.market}": units "${params.units}", credit "${params.credit}". Redeem less or refresh the position data.`);
|
|
592
690
|
}
|
|
593
691
|
}
|
|
594
|
-
exports.
|
|
692
|
+
exports.MidnightRedeemExceedsCreditError = MidnightRedeemExceedsCreditError;
|
|
693
|
+
/** Thrown when a Midnight redeem amount exceeds the market's currently withdrawable liquidity. */
|
|
694
|
+
class InsufficientMidnightWithdrawableLiquidityError extends Error {
|
|
695
|
+
constructor(params) {
|
|
696
|
+
super(`Midnight withdrawable liquidity is insufficient on market "${params.market}": units "${params.units}", withdrawable "${params.withdrawable}". Try again later or redeem less.`);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
exports.InsufficientMidnightWithdrawableLiquidityError = InsufficientMidnightWithdrawableLiquidityError;
|
|
595
700
|
/** Thrown when a loan-asset withdraw specifies both `assets` and `shares` as non-zero (modes are mutually exclusive). */
|
|
596
701
|
class MutuallyExclusiveWithdrawAmountsError extends Error {
|
|
597
702
|
constructor(market) {
|
|
@@ -635,20 +740,6 @@ class VaultAssetMismatchError extends Error {
|
|
|
635
740
|
}
|
|
636
741
|
}
|
|
637
742
|
exports.VaultAssetMismatchError = VaultAssetMismatchError;
|
|
638
|
-
/** Thrown when a vault redeem's `minSharePrice` slippage bound is negative. */
|
|
639
|
-
class NegativeMinSharePriceError extends Error {
|
|
640
|
-
constructor(vault) {
|
|
641
|
-
super(`Min share price must be non-negative for vault: ${vault}`);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
exports.NegativeMinSharePriceError = NegativeMinSharePriceError;
|
|
645
|
-
/** Thrown when a refinance's `borrowShares` argument is negative. */
|
|
646
|
-
class NegativeBorrowSharesError extends Error {
|
|
647
|
-
constructor(market) {
|
|
648
|
-
super(`Borrow shares must be non-negative for market: ${market}`);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
exports.NegativeBorrowSharesError = NegativeBorrowSharesError;
|
|
652
743
|
/** Thrown when a refinance specifies both `borrowAssets` and `borrowShares` as non-zero (modes are mutually exclusive). */
|
|
653
744
|
class BorrowAmountAndSharesExclusiveError extends Error {
|
|
654
745
|
constructor(market) {
|
|
@@ -656,13 +747,6 @@ class BorrowAmountAndSharesExclusiveError extends Error {
|
|
|
656
747
|
}
|
|
657
748
|
}
|
|
658
749
|
exports.BorrowAmountAndSharesExclusiveError = BorrowAmountAndSharesExclusiveError;
|
|
659
|
-
/** Thrown when a refinance's `maxRepaySharePrice` slippage bound is negative. */
|
|
660
|
-
class NegativeMaxRepaySharePriceError extends Error {
|
|
661
|
-
constructor(market) {
|
|
662
|
-
super(`Max repay share price must be non-negative for market: ${market}`);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
exports.NegativeMaxRepaySharePriceError = NegativeMaxRepaySharePriceError;
|
|
666
750
|
/** Thrown when a refinance has identical source and target market ids (a refinance to the same market is a costly no-op). */
|
|
667
751
|
class RefinanceSameMarketError extends Error {
|
|
668
752
|
constructor(market) {
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
|
|
2
2
|
export { AdaptiveCurveIrmLib, CapacityLimitReason, MarketUtils, MathLib, SharesMath, VaultUtils, } from "@morpho-org/blue-sdk";
|
|
3
3
|
export { decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
4
|
+
export { EcrecoverRatifierUtils, GroupUtils, OfferUtils, Payload, RatifierUtils, SetterRatifierUtils, TakeAmountsLib, TickLib, TreeUtils, } from "@morpho-org/midnight-sdk";
|
|
4
5
|
export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDottedKeys, WithId, WithIndex, } from "@morpho-org/morpho-ts";
|
|
5
6
|
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";
|
|
6
7
|
export { computeReallocations } from "./helpers/computeReallocations.js";
|
package/lib/cjs/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.validateUserAddress = exports.validateSlippageTolerance = void 0;
|
|
3
|
+
exports.computeMaxRepaySharePrice = exports.addTransactionMetadata = 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 = exports.TreeUtils = exports.TickLib = exports.TakeAmountsLib = exports.SetterRatifierUtils = exports.RatifierUtils = exports.Payload = exports.OfferUtils = exports.GroupUtils = exports.EcrecoverRatifierUtils = exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getAuthorizationTypedData = exports.decodeBytes32String = exports.VaultUtils = exports.SharesMath = exports.MathLib = exports.MarketUtils = exports.CapacityLimitReason = exports.AdaptiveCurveIrmLib = 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 = void 0;
|
|
5
5
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
6
6
|
Object.defineProperty(exports, "AdaptiveCurveIrmLib", { enumerable: true, get: function () { return blue_sdk_1.AdaptiveCurveIrmLib; } });
|
|
7
7
|
Object.defineProperty(exports, "CapacityLimitReason", { enumerable: true, get: function () { return blue_sdk_1.CapacityLimitReason; } });
|
|
@@ -21,6 +21,16 @@ Object.defineProperty(exports, "restructure", { enumerable: true, get: function
|
|
|
21
21
|
Object.defineProperty(exports, "safeGetAddress", { enumerable: true, get: function () { return blue_sdk_viem_1.safeGetAddress; } });
|
|
22
22
|
Object.defineProperty(exports, "safeParseNumber", { enumerable: true, get: function () { return blue_sdk_viem_1.safeParseNumber; } });
|
|
23
23
|
Object.defineProperty(exports, "safeParseUnits", { enumerable: true, get: function () { return blue_sdk_viem_1.safeParseUnits; } });
|
|
24
|
+
var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
25
|
+
Object.defineProperty(exports, "EcrecoverRatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.EcrecoverRatifierUtils; } });
|
|
26
|
+
Object.defineProperty(exports, "GroupUtils", { enumerable: true, get: function () { return midnight_sdk_1.GroupUtils; } });
|
|
27
|
+
Object.defineProperty(exports, "OfferUtils", { enumerable: true, get: function () { return midnight_sdk_1.OfferUtils; } });
|
|
28
|
+
Object.defineProperty(exports, "Payload", { enumerable: true, get: function () { return midnight_sdk_1.Payload; } });
|
|
29
|
+
Object.defineProperty(exports, "RatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.RatifierUtils; } });
|
|
30
|
+
Object.defineProperty(exports, "SetterRatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.SetterRatifierUtils; } });
|
|
31
|
+
Object.defineProperty(exports, "TakeAmountsLib", { enumerable: true, get: function () { return midnight_sdk_1.TakeAmountsLib; } });
|
|
32
|
+
Object.defineProperty(exports, "TickLib", { enumerable: true, get: function () { return midnight_sdk_1.TickLib; } });
|
|
33
|
+
Object.defineProperty(exports, "TreeUtils", { enumerable: true, get: function () { return midnight_sdk_1.TreeUtils; } });
|
|
24
34
|
var morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
25
35
|
Object.defineProperty(exports, "bigIntComparator", { enumerable: true, get: function () { return morpho_ts_1.bigIntComparator; } });
|
|
26
36
|
Object.defineProperty(exports, "createGetValue", { enumerable: true, get: function () { return morpho_ts_1.createGetValue; } });
|
package/lib/esm/abis.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { marketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
2
|
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi, preLiquidationAbi, preLiquidationFactoryAbi, publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi, vaultV2Abi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
export { ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
|
|
3
4
|
/** ABI for the Bundler3 multicall contract. */
|
|
4
5
|
export declare const bundler3Abi: readonly [{
|
|
5
6
|
readonly type: "function";
|