@morpho-org/morpho-sdk 10.3.1 → 10.5.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -5
- package/lib/cjs/abis.d.ts +1 -1
- package/lib/cjs/abis.js +5 -1
- package/lib/cjs/actions/blue/common.js +12 -3
- package/lib/cjs/actions/midnight/redeem.d.ts +20 -3
- package/lib/cjs/actions/midnight/redeem.js +58 -1
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.d.ts +24 -1
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.js +41 -0
- package/lib/cjs/actions/midnight/withdrawCollateral.d.ts +16 -2
- package/lib/cjs/actions/midnight/withdrawCollateral.js +26 -1
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +5 -1
- package/lib/cjs/blue/entities.d.ts +4 -4
- package/lib/cjs/blue/entities.js +3 -1
- package/lib/cjs/blue/errors.d.ts +2 -2
- package/lib/cjs/blue/errors.js +5 -1
- package/lib/cjs/blue/fetch.d.ts +2 -2
- package/lib/cjs/blue/fetch.js +3 -1
- package/lib/cjs/blue/utils.d.ts +1 -1
- package/lib/cjs/blue/utils.js +2 -1
- package/lib/cjs/entities/index.d.ts +4 -4
- package/lib/cjs/entities/index.js +3 -1
- package/lib/cjs/entities/midnight/midnight.d.ts +100 -103
- package/lib/cjs/entities/midnight/midnight.js +99 -99
- package/lib/cjs/entities/vaultV1/vaultV1.js +0 -1
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +34 -8
- package/lib/cjs/entities/vaultV2/vaultV2.js +39 -2
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +3 -2
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +6 -2
- package/lib/cjs/errors.d.ts +4 -4
- package/lib/cjs/errors.js +7 -5
- package/lib/cjs/fetch.d.ts +2 -2
- package/lib/cjs/fetch.js +3 -1
- package/lib/cjs/helpers/callback.d.ts +3 -2
- package/lib/cjs/helpers/callback.js +4 -20
- package/lib/cjs/helpers/computeMidnightPostWithdrawalCollateral.d.ts +17 -0
- package/lib/cjs/helpers/computeMidnightPostWithdrawalCollateral.js +30 -0
- package/lib/cjs/helpers/deadShares.js +3 -0
- package/lib/cjs/helpers/parseMidnightMaker.d.ts +21 -0
- package/lib/cjs/helpers/parseMidnightMaker.js +41 -1
- package/lib/cjs/helpers/validate.d.ts +60 -2
- package/lib/cjs/helpers/validate.js +87 -1
- package/lib/cjs/helpers/validateMidnightPublication.d.ts +10 -0
- package/lib/cjs/helpers/validateMidnightPublication.js +18 -1
- package/lib/cjs/helpers/validateMidnightTakeableOfferFields.d.ts +28 -0
- package/lib/cjs/helpers/validateMidnightTakeableOfferFields.js +85 -0
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +23 -1
- package/lib/cjs/midnight/errors.d.ts +2 -1
- package/lib/cjs/midnight/errors.js +5 -4
- package/lib/cjs/midnight/utils.d.ts +1 -1
- package/lib/cjs/midnight/utils.js +2 -1
- package/lib/cjs/transactionPlan/assemble.d.ts +24 -0
- package/lib/cjs/transactionPlan/assemble.js +25 -0
- package/lib/cjs/transactionPlan/blue/borrow.js +14 -64
- package/lib/cjs/transactionPlan/blue/refinance.js +9 -11
- package/lib/cjs/transactionPlan/blue/repay.js +10 -24
- package/lib/cjs/transactionPlan/blue/repayWithdrawCollateral.js +49 -45
- package/lib/cjs/transactionPlan/blue/stored.d.ts +26 -0
- package/lib/cjs/transactionPlan/blue/stored.js +87 -0
- package/lib/cjs/transactionPlan/blue/supply.js +7 -22
- package/lib/cjs/transactionPlan/blue/supplyCollateral.d.ts +1 -1
- package/lib/cjs/transactionPlan/blue/supplyCollateral.js +10 -15
- package/lib/cjs/transactionPlan/blue/supplyCollateralBorrow.js +14 -64
- package/lib/cjs/transactionPlan/blue/withdraw.d.ts +2 -3
- package/lib/cjs/transactionPlan/blue/withdraw.js +67 -79
- package/lib/cjs/transactionPlan/blue/withdrawBuyCallback.d.ts +101 -0
- package/lib/cjs/transactionPlan/blue/withdrawBuyCallback.js +264 -0
- package/lib/cjs/transactionPlan/blue/withdrawCollateral.d.ts +2 -3
- package/lib/cjs/transactionPlan/blue/withdrawCollateral.js +31 -30
- package/lib/cjs/transactionPlan/deposit.js +4 -7
- package/lib/cjs/transactionPlan/error.d.ts +27 -0
- package/lib/cjs/transactionPlan/error.js +30 -1
- package/lib/cjs/transactionPlan/index.d.ts +40 -1
- package/lib/cjs/transactionPlan/index.js +46 -5
- package/lib/cjs/transactionPlan/intent.d.ts +1 -1
- package/lib/cjs/transactionPlan/midnight/authorization.d.ts +15 -0
- package/lib/cjs/transactionPlan/midnight/authorization.js +45 -0
- package/lib/cjs/transactionPlan/midnight/cancelOffers.d.ts +80 -0
- package/lib/cjs/transactionPlan/midnight/cancelOffers.js +125 -0
- package/lib/cjs/transactionPlan/midnight/makeBorrow.d.ts +104 -0
- package/lib/cjs/transactionPlan/midnight/makeBorrow.js +126 -0
- package/lib/cjs/transactionPlan/midnight/makeLend.d.ts +140 -0
- package/lib/cjs/transactionPlan/midnight/makeLend.js +176 -0
- package/lib/cjs/transactionPlan/midnight/makeRepay.d.ts +118 -0
- package/lib/cjs/transactionPlan/midnight/makeRepay.js +118 -0
- package/lib/cjs/transactionPlan/midnight/makeWithdraw.d.ts +104 -0
- package/lib/cjs/transactionPlan/midnight/makeWithdraw.js +126 -0
- package/lib/cjs/transactionPlan/midnight/makerPublication.d.ts +55 -0
- package/lib/cjs/transactionPlan/midnight/makerPublication.js +315 -0
- package/lib/cjs/transactionPlan/midnight/market.d.ts +49 -0
- package/lib/cjs/transactionPlan/midnight/market.js +120 -0
- package/lib/cjs/transactionPlan/midnight/prepare.d.ts +244 -0
- package/lib/cjs/transactionPlan/midnight/prepare.js +547 -0
- package/lib/cjs/transactionPlan/midnight/publicationState.d.ts +24 -0
- package/lib/cjs/transactionPlan/midnight/publicationState.js +50 -0
- package/lib/cjs/transactionPlan/midnight/redeem.d.ts +102 -0
- package/lib/cjs/transactionPlan/midnight/redeem.js +170 -0
- package/lib/cjs/transactionPlan/midnight/reduceOnlySellFeasibility.d.ts +25 -0
- package/lib/cjs/transactionPlan/midnight/reduceOnlySellFeasibility.js +51 -0
- package/lib/cjs/transactionPlan/midnight/repayWithdrawCollateral.d.ts +162 -0
- package/lib/cjs/transactionPlan/midnight/repayWithdrawCollateral.js +328 -0
- package/lib/cjs/transactionPlan/midnight/supplyBlueMakeLend.d.ts +155 -0
- package/lib/cjs/transactionPlan/midnight/supplyBlueMakeLend.js +199 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateral.d.ts +96 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateral.js +190 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralBatch.d.ts +112 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralBatch.js +221 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralMakeBorrow.d.ts +129 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralMakeBorrow.js +179 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralWithNative.d.ts +115 -0
- package/lib/cjs/transactionPlan/midnight/supplyCollateralWithNative.js +259 -0
- package/lib/cjs/transactionPlan/midnight/takeBorrow.d.ts +304 -0
- package/lib/cjs/transactionPlan/midnight/takeBorrow.js +545 -0
- package/lib/cjs/transactionPlan/midnight/takeLend.d.ts +99 -0
- package/lib/cjs/transactionPlan/midnight/takeLend.js +263 -0
- package/lib/cjs/transactionPlan/midnight/takeRepayWithdrawCollateral.d.ts +175 -0
- package/lib/cjs/transactionPlan/midnight/takeRepayWithdrawCollateral.js +440 -0
- package/lib/cjs/transactionPlan/midnight/takeWithdraw.d.ts +139 -0
- package/lib/cjs/transactionPlan/midnight/takeWithdraw.js +240 -0
- package/lib/cjs/transactionPlan/midnight/validation.d.ts +22 -0
- package/lib/cjs/transactionPlan/midnight/validation.js +158 -0
- package/lib/cjs/transactionPlan/midnight/withdrawCollateral.d.ts +130 -0
- package/lib/cjs/transactionPlan/midnight/withdrawCollateral.js +228 -0
- package/lib/cjs/transactionPlan/midnight/withdrawCollateralBatch.d.ts +142 -0
- package/lib/cjs/transactionPlan/midnight/withdrawCollateralBatch.js +232 -0
- package/lib/cjs/transactionPlan/permit.d.ts +15 -2
- package/lib/cjs/transactionPlan/permit.js +26 -68
- package/lib/cjs/transactionPlan/plan.d.ts +99 -15
- package/lib/cjs/transactionPlan/plan.js +159 -31
- package/lib/cjs/transactionPlan/redeem.js +4 -7
- package/lib/cjs/transactionPlan/requirements.d.ts +7 -4
- package/lib/cjs/transactionPlan/requirements.js +2 -2
- package/lib/cjs/transactionPlan/serde.d.ts +13 -2
- package/lib/cjs/transactionPlan/serde.js +68 -21
- package/lib/cjs/transactionPlan/types.d.ts +151 -3
- package/lib/cjs/transactionPlan/validateActions.d.ts +3 -1
- package/lib/cjs/transactionPlan/validateActions.js +31 -3
- package/lib/cjs/transactionPlan/validation.d.ts +1 -1
- package/lib/cjs/transactionPlan/validation.js +37 -1
- package/lib/cjs/transactionPlan/vaultBinding.d.ts +29 -0
- package/lib/cjs/transactionPlan/vaultBinding.js +69 -0
- package/lib/cjs/transactionPlan/vaultRequirements.d.ts +20 -0
- package/lib/cjs/transactionPlan/vaultRequirements.js +37 -0
- package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +1 -1
- package/lib/cjs/transactionPlan/vaultv1/deposit.js +2 -13
- package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.d.ts +2 -2
- package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.js +10 -41
- package/lib/cjs/transactionPlan/vaultv1/migrateToV2.d.ts +1 -1
- package/lib/cjs/transactionPlan/vaultv1/migrateToV2.js +6 -18
- package/lib/cjs/transactionPlan/vaultv1/redeem.js +1 -12
- package/lib/cjs/transactionPlan/vaultv1/withdraw.d.ts +1 -1
- package/lib/cjs/transactionPlan/vaultv1/withdraw.js +2 -13
- package/lib/cjs/transactionPlan/vaultv2/deposit.d.ts +1 -1
- package/lib/cjs/transactionPlan/vaultv2/deposit.js +2 -13
- package/lib/cjs/transactionPlan/vaultv2/forceRedeem.d.ts +1 -1
- package/lib/cjs/transactionPlan/vaultv2/forceRedeem.js +4 -7
- package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.d.ts +2 -2
- package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.js +12 -42
- package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.d.ts +2 -2
- package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.js +10 -41
- package/lib/cjs/transactionPlan/vaultv2/redeem.d.ts +1 -1
- package/lib/cjs/transactionPlan/vaultv2/redeem.js +2 -13
- package/lib/cjs/transactionPlan/vaultv2/withdraw.d.ts +1 -1
- package/lib/cjs/transactionPlan/vaultv2/withdraw.js +2 -13
- package/lib/cjs/transactionPlan/withdraw.js +4 -7
- package/lib/cjs/types/error.d.ts +4 -1
- package/lib/cjs/types/error.js +5 -2
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +4 -2
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/abis.d.ts +1 -1
- package/lib/esm/abis.js +1 -1
- package/lib/esm/actions/blue/common.js +13 -4
- package/lib/esm/actions/midnight/redeem.d.ts +20 -3
- package/lib/esm/actions/midnight/redeem.js +56 -0
- package/lib/esm/actions/midnight/supplyCollateralWithNative.d.ts +24 -1
- package/lib/esm/actions/midnight/supplyCollateralWithNative.js +40 -0
- package/lib/esm/actions/midnight/withdrawCollateral.d.ts +16 -2
- package/lib/esm/actions/midnight/withdrawCollateral.js +25 -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 +4 -4
- package/lib/esm/blue/entities.js +2 -2
- package/lib/esm/blue/errors.d.ts +2 -2
- package/lib/esm/blue/errors.js +2 -2
- package/lib/esm/blue/fetch.d.ts +2 -2
- package/lib/esm/blue/fetch.js +2 -2
- package/lib/esm/blue/utils.d.ts +1 -1
- package/lib/esm/blue/utils.js +1 -1
- package/lib/esm/entities/index.d.ts +4 -4
- package/lib/esm/entities/index.js +2 -2
- package/lib/esm/entities/midnight/midnight.d.ts +100 -103
- package/lib/esm/entities/midnight/midnight.js +99 -99
- package/lib/esm/entities/vaultV1/vaultV1.js +0 -1
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +34 -8
- package/lib/esm/entities/vaultV2/vaultV2.js +40 -3
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +3 -2
- package/lib/esm/entities/vaultV2BlueReallocationData.js +6 -2
- package/lib/esm/errors.d.ts +4 -4
- package/lib/esm/errors.js +4 -4
- package/lib/esm/fetch.d.ts +2 -2
- package/lib/esm/fetch.js +2 -2
- package/lib/esm/helpers/callback.d.ts +3 -2
- package/lib/esm/helpers/callback.js +5 -21
- package/lib/esm/helpers/computeMidnightPostWithdrawalCollateral.d.ts +17 -0
- package/lib/esm/helpers/computeMidnightPostWithdrawalCollateral.js +27 -0
- package/lib/esm/helpers/deadShares.js +4 -1
- package/lib/esm/helpers/parseMidnightMaker.d.ts +21 -0
- package/lib/esm/helpers/parseMidnightMaker.js +40 -1
- package/lib/esm/helpers/validate.d.ts +60 -2
- package/lib/esm/helpers/validate.js +84 -1
- package/lib/esm/helpers/validateMidnightPublication.d.ts +10 -0
- package/lib/esm/helpers/validateMidnightPublication.js +16 -0
- package/lib/esm/helpers/validateMidnightTakeableOfferFields.d.ts +28 -0
- package/lib/esm/helpers/validateMidnightTakeableOfferFields.js +81 -0
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/midnight/errors.d.ts +2 -1
- package/lib/esm/midnight/errors.js +2 -1
- package/lib/esm/midnight/utils.d.ts +1 -1
- package/lib/esm/midnight/utils.js +1 -1
- package/lib/esm/transactionPlan/assemble.d.ts +24 -0
- package/lib/esm/transactionPlan/assemble.js +21 -0
- package/lib/esm/transactionPlan/blue/borrow.js +15 -65
- package/lib/esm/transactionPlan/blue/refinance.js +10 -12
- package/lib/esm/transactionPlan/blue/repay.js +11 -25
- package/lib/esm/transactionPlan/blue/repayWithdrawCollateral.js +50 -46
- package/lib/esm/transactionPlan/blue/stored.d.ts +26 -0
- package/lib/esm/transactionPlan/blue/stored.js +80 -0
- package/lib/esm/transactionPlan/blue/supply.js +7 -22
- package/lib/esm/transactionPlan/blue/supplyCollateral.d.ts +1 -1
- package/lib/esm/transactionPlan/blue/supplyCollateral.js +10 -15
- package/lib/esm/transactionPlan/blue/supplyCollateralBorrow.js +15 -65
- package/lib/esm/transactionPlan/blue/withdraw.d.ts +2 -3
- package/lib/esm/transactionPlan/blue/withdraw.js +70 -82
- package/lib/esm/transactionPlan/blue/withdrawBuyCallback.d.ts +101 -0
- package/lib/esm/transactionPlan/blue/withdrawBuyCallback.js +259 -0
- package/lib/esm/transactionPlan/blue/withdrawCollateral.d.ts +2 -3
- package/lib/esm/transactionPlan/blue/withdrawCollateral.js +32 -31
- package/lib/esm/transactionPlan/deposit.js +5 -8
- package/lib/esm/transactionPlan/error.d.ts +27 -0
- package/lib/esm/transactionPlan/error.js +28 -0
- package/lib/esm/transactionPlan/index.d.ts +40 -1
- package/lib/esm/transactionPlan/index.js +20 -1
- package/lib/esm/transactionPlan/intent.d.ts +1 -1
- package/lib/esm/transactionPlan/midnight/authorization.d.ts +15 -0
- package/lib/esm/transactionPlan/midnight/authorization.js +40 -0
- package/lib/esm/transactionPlan/midnight/cancelOffers.d.ts +80 -0
- package/lib/esm/transactionPlan/midnight/cancelOffers.js +120 -0
- package/lib/esm/transactionPlan/midnight/makeBorrow.d.ts +104 -0
- package/lib/esm/transactionPlan/midnight/makeBorrow.js +123 -0
- package/lib/esm/transactionPlan/midnight/makeLend.d.ts +140 -0
- package/lib/esm/transactionPlan/midnight/makeLend.js +172 -0
- package/lib/esm/transactionPlan/midnight/makeRepay.d.ts +118 -0
- package/lib/esm/transactionPlan/midnight/makeRepay.js +115 -0
- package/lib/esm/transactionPlan/midnight/makeWithdraw.d.ts +104 -0
- package/lib/esm/transactionPlan/midnight/makeWithdraw.js +123 -0
- package/lib/esm/transactionPlan/midnight/makerPublication.d.ts +55 -0
- package/lib/esm/transactionPlan/midnight/makerPublication.js +310 -0
- package/lib/esm/transactionPlan/midnight/market.d.ts +49 -0
- package/lib/esm/transactionPlan/midnight/market.js +112 -0
- package/lib/esm/transactionPlan/midnight/prepare.d.ts +244 -0
- package/lib/esm/transactionPlan/midnight/prepare.js +536 -0
- package/lib/esm/transactionPlan/midnight/publicationState.d.ts +24 -0
- package/lib/esm/transactionPlan/midnight/publicationState.js +47 -0
- package/lib/esm/transactionPlan/midnight/redeem.d.ts +102 -0
- package/lib/esm/transactionPlan/midnight/redeem.js +165 -0
- package/lib/esm/transactionPlan/midnight/reduceOnlySellFeasibility.d.ts +25 -0
- package/lib/esm/transactionPlan/midnight/reduceOnlySellFeasibility.js +47 -0
- package/lib/esm/transactionPlan/midnight/repayWithdrawCollateral.d.ts +162 -0
- package/lib/esm/transactionPlan/midnight/repayWithdrawCollateral.js +323 -0
- package/lib/esm/transactionPlan/midnight/supplyBlueMakeLend.d.ts +155 -0
- package/lib/esm/transactionPlan/midnight/supplyBlueMakeLend.js +196 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateral.d.ts +96 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateral.js +185 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralBatch.d.ts +112 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralBatch.js +216 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralMakeBorrow.d.ts +129 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralMakeBorrow.js +176 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralWithNative.d.ts +115 -0
- package/lib/esm/transactionPlan/midnight/supplyCollateralWithNative.js +254 -0
- package/lib/esm/transactionPlan/midnight/takeBorrow.d.ts +304 -0
- package/lib/esm/transactionPlan/midnight/takeBorrow.js +539 -0
- package/lib/esm/transactionPlan/midnight/takeLend.d.ts +99 -0
- package/lib/esm/transactionPlan/midnight/takeLend.js +258 -0
- package/lib/esm/transactionPlan/midnight/takeRepayWithdrawCollateral.d.ts +175 -0
- package/lib/esm/transactionPlan/midnight/takeRepayWithdrawCollateral.js +435 -0
- package/lib/esm/transactionPlan/midnight/takeWithdraw.d.ts +139 -0
- package/lib/esm/transactionPlan/midnight/takeWithdraw.js +236 -0
- package/lib/esm/transactionPlan/midnight/validation.d.ts +22 -0
- package/lib/esm/transactionPlan/midnight/validation.js +151 -0
- package/lib/esm/transactionPlan/midnight/withdrawCollateral.d.ts +130 -0
- package/lib/esm/transactionPlan/midnight/withdrawCollateral.js +223 -0
- package/lib/esm/transactionPlan/midnight/withdrawCollateralBatch.d.ts +142 -0
- package/lib/esm/transactionPlan/midnight/withdrawCollateralBatch.js +227 -0
- package/lib/esm/transactionPlan/permit.d.ts +15 -2
- package/lib/esm/transactionPlan/permit.js +25 -68
- package/lib/esm/transactionPlan/plan.d.ts +99 -15
- package/lib/esm/transactionPlan/plan.js +154 -27
- package/lib/esm/transactionPlan/redeem.js +5 -8
- package/lib/esm/transactionPlan/requirements.d.ts +7 -4
- package/lib/esm/transactionPlan/requirements.js +2 -2
- package/lib/esm/transactionPlan/serde.d.ts +13 -2
- package/lib/esm/transactionPlan/serde.js +49 -2
- package/lib/esm/transactionPlan/types.d.ts +151 -3
- package/lib/esm/transactionPlan/validateActions.d.ts +3 -1
- package/lib/esm/transactionPlan/validateActions.js +31 -3
- package/lib/esm/transactionPlan/validation.d.ts +1 -1
- package/lib/esm/transactionPlan/validation.js +38 -2
- package/lib/esm/transactionPlan/vaultBinding.d.ts +29 -0
- package/lib/esm/transactionPlan/vaultBinding.js +65 -0
- package/lib/esm/transactionPlan/vaultRequirements.d.ts +20 -0
- package/lib/esm/transactionPlan/vaultRequirements.js +34 -0
- package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +1 -1
- package/lib/esm/transactionPlan/vaultv1/deposit.js +3 -14
- package/lib/esm/transactionPlan/vaultv1/inKindRedeem.d.ts +2 -2
- package/lib/esm/transactionPlan/vaultv1/inKindRedeem.js +12 -43
- package/lib/esm/transactionPlan/vaultv1/migrateToV2.d.ts +1 -1
- package/lib/esm/transactionPlan/vaultv1/migrateToV2.js +9 -21
- package/lib/esm/transactionPlan/vaultv1/redeem.js +2 -13
- package/lib/esm/transactionPlan/vaultv1/withdraw.d.ts +1 -1
- package/lib/esm/transactionPlan/vaultv1/withdraw.js +3 -14
- package/lib/esm/transactionPlan/vaultv2/deposit.d.ts +1 -1
- package/lib/esm/transactionPlan/vaultv2/deposit.js +3 -14
- package/lib/esm/transactionPlan/vaultv2/forceRedeem.d.ts +1 -1
- package/lib/esm/transactionPlan/vaultv2/forceRedeem.js +5 -8
- package/lib/esm/transactionPlan/vaultv2/forceWithdraw.d.ts +2 -2
- package/lib/esm/transactionPlan/vaultv2/forceWithdraw.js +15 -45
- package/lib/esm/transactionPlan/vaultv2/inKindRedeem.d.ts +2 -2
- package/lib/esm/transactionPlan/vaultv2/inKindRedeem.js +12 -43
- package/lib/esm/transactionPlan/vaultv2/redeem.d.ts +1 -1
- package/lib/esm/transactionPlan/vaultv2/redeem.js +3 -14
- package/lib/esm/transactionPlan/vaultv2/withdraw.d.ts +1 -1
- package/lib/esm/transactionPlan/vaultv2/withdraw.js +3 -14
- package/lib/esm/transactionPlan/withdraw.js +5 -8
- package/lib/esm/types/error.d.ts +4 -1
- package/lib/esm/types/error.js +5 -2
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { deepFreeze, getChainAddress, Time } from "@morpho-org/morpho-ts";
|
|
2
|
+
import { midnightWithdrawCollateral, parseMidnightWithdrawCollateralPreparation, } from "../../actions/midnight/withdrawCollateral.js";
|
|
3
|
+
import { createChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
4
|
+
import { assertRegistryTargetsHaveCode } from "../../entities/requirements/assertContractCode.js";
|
|
5
|
+
import { computeMidnightPostWithdrawalCollateral } from "../../helpers/computeMidnightPostWithdrawalCollateral.js";
|
|
6
|
+
import { validateMidnightWithdrawHealth, validateReferenceTime, } from "../../helpers/validate.js";
|
|
7
|
+
import { InvalidBigIntInputError, } from "../../types/index.js";
|
|
8
|
+
import { InvalidTransactionPlanError } from "../error.js";
|
|
9
|
+
import { resolveIntent } from "../intent.js";
|
|
10
|
+
import { getPlanObject, validatePlanFields } from "../validation.js";
|
|
11
|
+
import { validateSignaturelessMidnightAction } from "./authorization.js";
|
|
12
|
+
import { storedMarketTuple, validateCollateralPriceTypes, validateStoredCollateralOrder, } from "./market.js";
|
|
13
|
+
import { validateStoredMidnightMarket } from "./validation.js";
|
|
14
|
+
const actionId = "midnightWithdrawCollateral";
|
|
15
|
+
/**
|
|
16
|
+
* Prepares one direct Midnight core collateral withdrawal. Inputs go through
|
|
17
|
+
* `parseMidnightWithdrawCollateralPreparation`, which applies the entity `withdrawCollateral`
|
|
18
|
+
* checks in the same order: the position is bound to the sender and market, the index is
|
|
19
|
+
* resolved, and `maxUint256` becomes the snapshot balance before the amount, receiver and
|
|
20
|
+
* encoding checks. The withdrawal is then checked against the snapshot balance and, when the
|
|
21
|
+
* snapshot has debt, against the remaining collateral's capacity at LLTV minus
|
|
22
|
+
* `DEFAULT_LLTV_BUFFER`. Restoring and building offline does not refresh those checks;
|
|
23
|
+
* simulate against current state before sending.
|
|
24
|
+
*
|
|
25
|
+
* The account sends the withdrawal itself, so the plan has no approvals, authorizations or
|
|
26
|
+
* signature requests. Expiry is checked during preparation only; it is not an onchain deadline.
|
|
27
|
+
* @param client - Viem client used to check the network and the Midnight core deployment.
|
|
28
|
+
* @param params - Market and position snapshots, collateral selection, amount and optional receiver.
|
|
29
|
+
* @param params.chainId - EIP-155 chain ID of the market and submitting client.
|
|
30
|
+
* @param params.account - Nonzero position owner who sends the withdrawal.
|
|
31
|
+
* @param params.marketData - Hydrated market snapshot from the same block as `positionData`.
|
|
32
|
+
* @param params.positionData - Position snapshot for the same market, owned by `account`.
|
|
33
|
+
* @param params.collateralPrices - Raw `price()` values from each collateral oracle at the snapshot
|
|
34
|
+
* block, indexed like `positionData.collateral` and scaled by `ORACLE_PRICE_SCALE` (1e36). Not
|
|
35
|
+
* needed when the snapshot has no debt.
|
|
36
|
+
* @param params.collateralIndex - Collateral index in token-address order. Defaults to `0n`.
|
|
37
|
+
* @param params.assets - Positive collateral amount in token base units; `maxUint256` withdraws
|
|
38
|
+
* the snapshot balance at that index.
|
|
39
|
+
* @param params.receiver - Optional recipient of the collateral; defaults to `account`. Midnight
|
|
40
|
+
* and market token contracts are rejected.
|
|
41
|
+
* @param params.now - Reference Unix timestamp in seconds, normally the snapshot block's timestamp;
|
|
42
|
+
* omitting it uses the device clock (an untyped JavaScript `null` does too).
|
|
43
|
+
* @param params.expiresAt - Plan expiry in Unix seconds; defaults to two hours after `now`. Midnight does not enforce it onchain.
|
|
44
|
+
* @param params.calldataOrigin - Optional attribution bytes appended to the built transaction.
|
|
45
|
+
* @returns A frozen plan with one withdrawal step and no approvals, authorizations or signature requests.
|
|
46
|
+
* @throws {InvalidBigIntInputError} If a supplied non-null `now`, the amount, the index or a supplied collateral price is not a bigint; checked before any request.
|
|
47
|
+
* @throws {ZeroAccountError} If the account is the zero address.
|
|
48
|
+
* @throws {NonIntegerInputError} If expiry is not a safe integer.
|
|
49
|
+
* @throws {ExpiredDeadlineError} If expiry is at or before the reference time.
|
|
50
|
+
* @throws {InvalidCalldataOriginError} If attribution bytes are empty or malformed.
|
|
51
|
+
* @throws {InvalidTransactionPlanError} If the account is malformed, `collateralPrices` is not an array, or attribution exceeds 1 MiB.
|
|
52
|
+
* @throws {ChainIdMismatchError} If the market, client or RPC targets another chain.
|
|
53
|
+
* @throws {MidnightMarketAddressMismatchError} If the market targets another Midnight deployment.
|
|
54
|
+
* @throws {InvalidMarketParameterError} If the market configuration is invalid.
|
|
55
|
+
* @throws {MarketIdMismatchError} If the position belongs to another market.
|
|
56
|
+
* @throws {AccrualPositionUserMismatchError} If the position is owned by another account.
|
|
57
|
+
* @throws {UnknownCollateralIndexError} If the index is not configured on the market.
|
|
58
|
+
* @throws {NonPositiveInputError} If expiry or the resolved amount is not positive.
|
|
59
|
+
* @throws {InputExceedsMaxError} If the resolved amount exceeds uint128.
|
|
60
|
+
* @throws {MidnightZeroReceiverError} If the receiver is the zero address.
|
|
61
|
+
* @throws {MidnightContractReceiverError} If the receiver is a blocked protocol or market token contract.
|
|
62
|
+
* @throws {MidnightCalldataEncodingError} If a market, position owner or receiver address is malformed, or calldata cannot be encoded.
|
|
63
|
+
* @throws {WithdrawExceedsCollateralError} If the amount exceeds the snapshot balance.
|
|
64
|
+
* @throws {MissingMarketPriceError} If remaining collateral has no price for the health check.
|
|
65
|
+
* @throws {WithdrawMakesPositionUnhealthyError} If the snapshot debt exceeds the remaining buffered capacity.
|
|
66
|
+
* @throws {UnsupportedChainIdError} If the chain is absent from the address registry.
|
|
67
|
+
* @throws {UnknownAddressError} If Midnight core is not registered on the chain.
|
|
68
|
+
* @throws {MissingContractCodeError} If the registered Midnight core has no deployed code.
|
|
69
|
+
* @throws {viem.BaseError} If the `eth_chainId` or bytecode request fails.
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* import {
|
|
73
|
+
* buildTransactions,
|
|
74
|
+
* prepareMidnightWithdrawCollateral,
|
|
75
|
+
* type TransactionPlan,
|
|
76
|
+
* } from "@morpho-org/morpho-sdk";
|
|
77
|
+
* import { fetchMidnightAccrualPosition } from "@morpho-org/morpho-sdk/fetch";
|
|
78
|
+
* import { type Address, type Hash, createPublicClient, http, maxUint256 } from "viem";
|
|
79
|
+
* import { base } from "viem/chains";
|
|
80
|
+
*
|
|
81
|
+
* // For a debt-free position only. With debt, pass each collateral oracle's `price()`
|
|
82
|
+
* // from the same block as `collateralPrices`; an empty list then throws MissingMarketPriceError.
|
|
83
|
+
* async function prepareCollateralExit(account: Address, marketId: Hash) {
|
|
84
|
+
* const client = createPublicClient({ chain: base, transport: http() });
|
|
85
|
+
* const block = await client.getBlock();
|
|
86
|
+
* const positionData = await fetchMidnightAccrualPosition(client, {
|
|
87
|
+
* marketId, user: account, blockNumber: block.number,
|
|
88
|
+
* });
|
|
89
|
+
* const plan: TransactionPlan = await prepareMidnightWithdrawCollateral(client, {
|
|
90
|
+
* chainId: base.id, account, marketData: positionData.market, positionData,
|
|
91
|
+
* collateralPrices: [], // No price check is needed without debt.
|
|
92
|
+
* now: block.timestamp,
|
|
93
|
+
* assets: maxUint256,
|
|
94
|
+
* });
|
|
95
|
+
* // plan.steps: a single "midnightWithdrawCollateral" step; plan.signatureRequests is empty.
|
|
96
|
+
* // Simulate, then send from plan.account on plan.chainId.
|
|
97
|
+
* return buildTransactions(plan);
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
* @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
|
|
101
|
+
*/
|
|
102
|
+
export async function prepareMidnightWithdrawCollateral(client, params) {
|
|
103
|
+
const { account, chainId, marketData, positionData } = params;
|
|
104
|
+
const now = params.now ?? Time.timestamp();
|
|
105
|
+
validateReferenceTime(now);
|
|
106
|
+
const { expiresAt, calldataOrigin } = resolveIntent({
|
|
107
|
+
account,
|
|
108
|
+
chainId,
|
|
109
|
+
expiresAt: params.expiresAt,
|
|
110
|
+
calldataOrigin: params.calldataOrigin,
|
|
111
|
+
}, now);
|
|
112
|
+
if (typeof params.assets !== "bigint") {
|
|
113
|
+
throw new InvalidBigIntInputError("assets", params.assets);
|
|
114
|
+
}
|
|
115
|
+
if (params.collateralIndex !== undefined &&
|
|
116
|
+
typeof params.collateralIndex !== "bigint") {
|
|
117
|
+
throw new InvalidBigIntInputError("collateralIndex", params.collateralIndex);
|
|
118
|
+
}
|
|
119
|
+
validateCollateralPriceTypes(params.collateralPrices);
|
|
120
|
+
const parsed = parseMidnightWithdrawCollateralPreparation({
|
|
121
|
+
chainId,
|
|
122
|
+
accountAddress: account,
|
|
123
|
+
marketData,
|
|
124
|
+
positionData,
|
|
125
|
+
collateralIndex: params.collateralIndex,
|
|
126
|
+
assets: params.assets,
|
|
127
|
+
receiver: params.receiver,
|
|
128
|
+
});
|
|
129
|
+
const { postCollateral, withdrawAmount } = computeMidnightPostWithdrawalCollateral({
|
|
130
|
+
market: marketData.params,
|
|
131
|
+
marketId: marketData.id,
|
|
132
|
+
collateral: positionData.collateral,
|
|
133
|
+
withdrawals: [
|
|
134
|
+
{ collateralIndex: parsed.collateralIndex, assets: parsed.assets },
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
validateMidnightWithdrawHealth({
|
|
138
|
+
market: marketData,
|
|
139
|
+
collateral: postCollateral,
|
|
140
|
+
collateralPrices: params.collateralPrices,
|
|
141
|
+
debt: positionData.debt,
|
|
142
|
+
withdrawAmount,
|
|
143
|
+
});
|
|
144
|
+
const chainCheck = createChainCheck(client, chainId);
|
|
145
|
+
await chainCheck();
|
|
146
|
+
// A code-less core would accept the withdrawal as a silent no-op.
|
|
147
|
+
await assertRegistryTargetsHaveCode(client, chainId, [{ role: "midnight", address: getChainAddress(chainId, "midnight") }], chainCheck);
|
|
148
|
+
return deepFreeze({
|
|
149
|
+
version: 2,
|
|
150
|
+
chainId,
|
|
151
|
+
account,
|
|
152
|
+
expiresAt,
|
|
153
|
+
...(calldataOrigin && { calldataOrigin }),
|
|
154
|
+
steps: [
|
|
155
|
+
{
|
|
156
|
+
id: actionId,
|
|
157
|
+
label: "Withdraw Midnight collateral",
|
|
158
|
+
action: {
|
|
159
|
+
type: actionId,
|
|
160
|
+
inputs: {
|
|
161
|
+
account,
|
|
162
|
+
chainId,
|
|
163
|
+
market: parsed.market.struct,
|
|
164
|
+
collateralIndex: parsed.collateralIndex,
|
|
165
|
+
assets: parsed.assets,
|
|
166
|
+
receiver: parsed.receiver,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
signatureRequests: [],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/** @internal Encodes the stored direct withdrawal without retaining the snapshot. */
|
|
175
|
+
export function buildMidnightWithdrawCollateral({ inputs, }) {
|
|
176
|
+
const { account, chainId, market, collateralIndex, assets, receiver } = inputs;
|
|
177
|
+
// The action builder defaults a missing index to 0n, which would switch the withdrawn token.
|
|
178
|
+
if (typeof collateralIndex !== "bigint") {
|
|
179
|
+
throw new InvalidTransactionPlanError({
|
|
180
|
+
path: "$.inputs.collateralIndex",
|
|
181
|
+
reason: "expected a bigint",
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
validateStoredCollateralOrder(market.collateralParams, "$.inputs.market.collateralParams");
|
|
185
|
+
return midnightWithdrawCollateral({
|
|
186
|
+
chainId,
|
|
187
|
+
market: storedMarketTuple(market),
|
|
188
|
+
collateralIndex,
|
|
189
|
+
assets,
|
|
190
|
+
onBehalf: account,
|
|
191
|
+
receiver,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/** @internal Validates the stored Midnight collateral withdrawal without RPC. */
|
|
195
|
+
export function validateMidnightWithdrawCollateralPlanAction(action, path) {
|
|
196
|
+
const inputsPath = `${path}.inputs`;
|
|
197
|
+
const inputs = getPlanObject(action.inputs, inputsPath);
|
|
198
|
+
validatePlanFields(inputs, {
|
|
199
|
+
path: inputsPath,
|
|
200
|
+
fields: {
|
|
201
|
+
assets: "uint128 bigint",
|
|
202
|
+
collateralIndex: "uint256 bigint",
|
|
203
|
+
receiver: "address",
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
const marketPath = `${inputsPath}.market`;
|
|
207
|
+
const market = getPlanObject(inputs.market, marketPath);
|
|
208
|
+
// Validate the tuple before reading its collateral tokens.
|
|
209
|
+
validateStoredMidnightMarket(market, {
|
|
210
|
+
path: marketPath,
|
|
211
|
+
chainId: inputs.chainId,
|
|
212
|
+
});
|
|
213
|
+
const collaterals = market.collateralParams;
|
|
214
|
+
validateStoredCollateralOrder(collaterals, `${marketPath}.collateralParams`);
|
|
215
|
+
if (inputs.collateralIndex >= BigInt(collaterals.length)) {
|
|
216
|
+
throw new InvalidTransactionPlanError({
|
|
217
|
+
path: `${inputsPath}.collateralIndex`,
|
|
218
|
+
reason: "expected an index configured in the market",
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
// Midnight never consumes a signature reference.
|
|
222
|
+
validateSignaturelessMidnightAction(action, path);
|
|
223
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { type AccrualPosition, type Market } from "@morpho-org/midnight-sdk";
|
|
2
|
+
import type { Address, Client } from "viem";
|
|
3
|
+
import type { MidnightCollateralTransfer, ReferenceTimestampParams } from "../../types/index.js";
|
|
4
|
+
import { type IntentParams } from "../intent.js";
|
|
5
|
+
import type { Action, TransactionPlan } from "../types.js";
|
|
6
|
+
type WithdrawCollateralBatchAction = Extract<Action, {
|
|
7
|
+
type: "midnightWithdrawCollateralBatch";
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Represents an intent to withdraw several collaterals atomically from the submitting account's
|
|
11
|
+
* Midnight position.
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import type { MidnightWithdrawCollateralBatchPlanParams } from "@morpho-org/morpho-sdk";
|
|
15
|
+
* import { maxUint256 } from "viem";
|
|
16
|
+
* const withdrawBoth = (params: MidnightWithdrawCollateralBatchPlanParams) => ({
|
|
17
|
+
* ...params,
|
|
18
|
+
* collateralWithdrawals: [
|
|
19
|
+
* { collateralIndex: 0n, assets: maxUint256 },
|
|
20
|
+
* { collateralIndex: 1n, assets: maxUint256 },
|
|
21
|
+
* ],
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
* @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
|
|
25
|
+
*/
|
|
26
|
+
export interface MidnightWithdrawCollateralBatchPlanParams extends Pick<IntentParams, "chainId" | "account" | "expiresAt" | "calldataOrigin">, ReferenceTimestampParams {
|
|
27
|
+
/** Hydrated market snapshot from the same block as `positionData`. */
|
|
28
|
+
readonly marketData: Market;
|
|
29
|
+
/** Position snapshot for the same market, owned by the submitting account. */
|
|
30
|
+
readonly positionData: AccrualPosition;
|
|
31
|
+
/**
|
|
32
|
+
* Raw values from `price()` on each `marketData.params.collateralParams[i].oracle`,
|
|
33
|
+
* indexed like `positionData.collateral` and scaled by `ORACLE_PRICE_SCALE` (1e36).
|
|
34
|
+
* Use prices from the snapshot block. No prices are needed when the snapshot has no debt.
|
|
35
|
+
*/
|
|
36
|
+
readonly collateralPrices: readonly bigint[];
|
|
37
|
+
/**
|
|
38
|
+
* Nonempty ordered withdrawals with unique `collateralIndex` values in Midnight's
|
|
39
|
+
* token-address order. Amounts are in that token's base units; `maxUint256` withdraws the
|
|
40
|
+
* snapshot balance at that index.
|
|
41
|
+
*/
|
|
42
|
+
readonly collateralWithdrawals: readonly MidnightCollateralTransfer[];
|
|
43
|
+
/** Shared recipient of every withdrawal; defaults to `account`. */
|
|
44
|
+
readonly receiver?: Address;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Prepares ordered collateral withdrawals in one direct Midnight core multicall, even for one
|
|
48
|
+
* entry. Inputs go through `parseMidnightWithdrawCollateralBatchPreparation`, the parse-once
|
|
49
|
+
* constructor the entity `withdrawCollateralBatch` uses, in the same order: the position is bound
|
|
50
|
+
* to the sender and market, every index is resolved, and each `maxUint256` becomes that index's
|
|
51
|
+
* snapshot balance before the receiver, amount and encoding checks. Duplicate indexes are
|
|
52
|
+
* rejected, unlike bundle flows which sum them. The withdrawals are then applied to the snapshot
|
|
53
|
+
* balances in order and, when the snapshot has debt, the remaining collateral must cover it at
|
|
54
|
+
* LLTV minus `DEFAULT_LLTV_BUFFER`. Restoring and building offline does not refresh those checks;
|
|
55
|
+
* simulate against current state before sending.
|
|
56
|
+
*
|
|
57
|
+
* The account sends the multicall itself, so the plan has no approvals, authorizations or
|
|
58
|
+
* signature requests. Expiry is checked during preparation only; it is not an onchain deadline.
|
|
59
|
+
* @param client - Viem client used to check the network and the Midnight core deployment.
|
|
60
|
+
* @param params - Market and position snapshots, ordered withdrawals and optional receiver.
|
|
61
|
+
* @param params.chainId - EIP-155 chain ID of the market and submitting client.
|
|
62
|
+
* @param params.account - Nonzero position owner who sends the multicall.
|
|
63
|
+
* @param params.marketData - Hydrated market snapshot from the same block as `positionData`.
|
|
64
|
+
* @param params.positionData - Position snapshot for the same market, owned by `account`.
|
|
65
|
+
* @param params.collateralPrices - Raw `price()` values from each collateral oracle at the snapshot
|
|
66
|
+
* block, indexed like `positionData.collateral` and scaled by `ORACLE_PRICE_SCALE` (1e36). Not
|
|
67
|
+
* needed when the snapshot has no debt.
|
|
68
|
+
* @param params.collateralWithdrawals - Nonempty ordered withdrawals, one per collateral index;
|
|
69
|
+
* `maxUint256` withdraws the snapshot balance at that index.
|
|
70
|
+
* @param params.receiver - Optional recipient of every withdrawal; defaults to `account`. Midnight
|
|
71
|
+
* and market token contracts are rejected.
|
|
72
|
+
* @param params.now - Reference Unix timestamp in seconds, normally the snapshot block's timestamp;
|
|
73
|
+
* omitting it uses the device clock (an untyped JavaScript `null` does too).
|
|
74
|
+
* @param params.expiresAt - Plan expiry in Unix seconds; defaults to two hours after `now`. Midnight does not enforce it onchain.
|
|
75
|
+
* @param params.calldataOrigin - Optional attribution bytes appended to the built transaction.
|
|
76
|
+
* @returns A frozen plan with one multicall step and no approvals, authorizations or signature requests.
|
|
77
|
+
* @throws {InvalidBigIntInputError} If a supplied non-null `now`, a withdrawal's `collateralIndex` or `assets`, or a supplied collateral price is not a bigint; checked before any request.
|
|
78
|
+
* @throws {ZeroAccountError} If the account is the zero address.
|
|
79
|
+
* @throws {NonIntegerInputError} If expiry is not a safe integer.
|
|
80
|
+
* @throws {ExpiredDeadlineError} If expiry is at or before the reference time.
|
|
81
|
+
* @throws {InvalidCalldataOriginError} If attribution bytes are empty or malformed.
|
|
82
|
+
* @throws {InvalidTransactionPlanError} If the account is malformed, attribution exceeds 1 MiB, the withdrawals or `collateralPrices` are not an array, or an entry is not an object.
|
|
83
|
+
* @throws {ChainIdMismatchError} If the market, client or RPC targets another chain.
|
|
84
|
+
* @throws {MidnightMarketAddressMismatchError} If the market targets another Midnight deployment.
|
|
85
|
+
* @throws {InvalidMarketParameterError} If the market configuration is invalid.
|
|
86
|
+
* @throws {MarketIdMismatchError} If the position belongs to another market.
|
|
87
|
+
* @throws {AccrualPositionUserMismatchError} If the position is owned by another account.
|
|
88
|
+
* @throws {EmptyMidnightCollateralWithdrawalsError} If the list is empty.
|
|
89
|
+
* @throws {DuplicateMidnightCollateralIndexError} If an index repeats.
|
|
90
|
+
* @throws {UnknownCollateralIndexError} If an index is not configured on the market.
|
|
91
|
+
* @throws {NonPositiveInputError} If expiry or a resolved amount is not positive.
|
|
92
|
+
* @throws {InputExceedsMaxError} If a resolved amount exceeds uint128.
|
|
93
|
+
* @throws {MidnightZeroReceiverError} If the receiver is the zero address.
|
|
94
|
+
* @throws {MidnightContractReceiverError} If the receiver is a blocked protocol or market token contract.
|
|
95
|
+
* @throws {MidnightCalldataEncodingError} If a market, position owner or receiver address is malformed, or calldata cannot be encoded.
|
|
96
|
+
* @throws {WithdrawExceedsCollateralError} If a withdrawal exceeds the snapshot balance at its index.
|
|
97
|
+
* @throws {MissingMarketPriceError} If remaining collateral has no price for the health check.
|
|
98
|
+
* @throws {WithdrawMakesPositionUnhealthyError} If the snapshot debt exceeds the remaining buffered capacity.
|
|
99
|
+
* @throws {UnsupportedChainIdError} If the chain is absent from the address registry.
|
|
100
|
+
* @throws {UnknownAddressError} If Midnight core is not registered on the chain.
|
|
101
|
+
* @throws {MissingContractCodeError} If the registered Midnight core has no deployed code.
|
|
102
|
+
* @throws {viem.BaseError} If the `eth_chainId` or bytecode request fails.
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* import {
|
|
106
|
+
* buildTransactions,
|
|
107
|
+
* prepareMidnightWithdrawCollateralBatch,
|
|
108
|
+
* type TransactionPlan,
|
|
109
|
+
* } from "@morpho-org/morpho-sdk";
|
|
110
|
+
* import { fetchMidnightAccrualPosition } from "@morpho-org/morpho-sdk/fetch";
|
|
111
|
+
* import { type Address, type Hash, createPublicClient, http, maxUint256 } from "viem";
|
|
112
|
+
* import { base } from "viem/chains";
|
|
113
|
+
*
|
|
114
|
+
* // A full exit of a debt-free position that holds both collaterals; an empty index throws.
|
|
115
|
+
* async function prepareCollateralExit(account: Address, marketId: Hash) {
|
|
116
|
+
* const client = createPublicClient({ chain: base, transport: http() });
|
|
117
|
+
* const block = await client.getBlock();
|
|
118
|
+
* const positionData = await fetchMidnightAccrualPosition(client, {
|
|
119
|
+
* marketId, user: account, blockNumber: block.number,
|
|
120
|
+
* });
|
|
121
|
+
* const plan: TransactionPlan = await prepareMidnightWithdrawCollateralBatch(client, {
|
|
122
|
+
* chainId: base.id, account, marketData: positionData.market, positionData,
|
|
123
|
+
* collateralPrices: [], // No price check is needed without debt.
|
|
124
|
+
* now: block.timestamp,
|
|
125
|
+
* collateralWithdrawals: [
|
|
126
|
+
* { collateralIndex: 0n, assets: maxUint256 },
|
|
127
|
+
* { collateralIndex: 1n, assets: maxUint256 },
|
|
128
|
+
* ],
|
|
129
|
+
* });
|
|
130
|
+
* // plan.steps: a single "midnightWithdrawCollateralBatch" step; plan.signatureRequests is empty.
|
|
131
|
+
* // Simulate, then send from plan.account on plan.chainId.
|
|
132
|
+
* return buildTransactions(plan);
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
* @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
|
|
136
|
+
*/
|
|
137
|
+
export declare function prepareMidnightWithdrawCollateralBatch(client: Client, params: MidnightWithdrawCollateralBatchPlanParams): Promise<TransactionPlan>;
|
|
138
|
+
/** @internal Encodes the stored direct withdrawal batch without retaining the snapshot. */
|
|
139
|
+
export declare function buildMidnightWithdrawCollateralBatch({ inputs, }: WithdrawCollateralBatchAction): Readonly<import("../../types/action.js").Transaction<import("../../types/action.js").MidnightWithdrawCollateralBatchAction>>;
|
|
140
|
+
/** @internal Validates the stored Midnight collateral withdrawal batch without RPC. */
|
|
141
|
+
export declare function validateMidnightWithdrawCollateralBatchPlanAction(action: Record<string, unknown>, path: string): void;
|
|
142
|
+
export {};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { MarketUtils, } from "@morpho-org/midnight-sdk";
|
|
2
|
+
import { deepFreeze, getChainAddress, Time } from "@morpho-org/morpho-ts";
|
|
3
|
+
import { parseMidnightWithdrawCollateralBatchPreparation } from "../../actions/midnight/parseCollateralBatch.js";
|
|
4
|
+
import { midnightWithdrawCollateralBatch } from "../../actions/midnight/withdrawCollateralBatch.js";
|
|
5
|
+
import { createChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
6
|
+
import { assertRegistryTargetsHaveCode } from "../../entities/requirements/assertContractCode.js";
|
|
7
|
+
import { computeMidnightPostWithdrawalCollateral } from "../../helpers/computeMidnightPostWithdrawalCollateral.js";
|
|
8
|
+
import { validateMidnightWithdrawHealth, validateReferenceTime, } from "../../helpers/validate.js";
|
|
9
|
+
import { InvalidTransactionPlanError } from "../error.js";
|
|
10
|
+
import { resolveIntent } from "../intent.js";
|
|
11
|
+
import { getPlanObject, validatePlanFields } from "../validation.js";
|
|
12
|
+
import { validateSignaturelessMidnightAction } from "./authorization.js";
|
|
13
|
+
import { storedMarketTuple, validateCollateralPriceTypes, validateCollateralTransferInputs, validateStoredCollateralOrder, } from "./market.js";
|
|
14
|
+
import { validateStoredMidnightMarket } from "./validation.js";
|
|
15
|
+
const actionId = "midnightWithdrawCollateralBatch";
|
|
16
|
+
/**
|
|
17
|
+
* Prepares ordered collateral withdrawals in one direct Midnight core multicall, even for one
|
|
18
|
+
* entry. Inputs go through `parseMidnightWithdrawCollateralBatchPreparation`, the parse-once
|
|
19
|
+
* constructor the entity `withdrawCollateralBatch` uses, in the same order: the position is bound
|
|
20
|
+
* to the sender and market, every index is resolved, and each `maxUint256` becomes that index's
|
|
21
|
+
* snapshot balance before the receiver, amount and encoding checks. Duplicate indexes are
|
|
22
|
+
* rejected, unlike bundle flows which sum them. The withdrawals are then applied to the snapshot
|
|
23
|
+
* balances in order and, when the snapshot has debt, the remaining collateral must cover it at
|
|
24
|
+
* LLTV minus `DEFAULT_LLTV_BUFFER`. Restoring and building offline does not refresh those checks;
|
|
25
|
+
* simulate against current state before sending.
|
|
26
|
+
*
|
|
27
|
+
* The account sends the multicall itself, so the plan has no approvals, authorizations or
|
|
28
|
+
* signature requests. Expiry is checked during preparation only; it is not an onchain deadline.
|
|
29
|
+
* @param client - Viem client used to check the network and the Midnight core deployment.
|
|
30
|
+
* @param params - Market and position snapshots, ordered withdrawals and optional receiver.
|
|
31
|
+
* @param params.chainId - EIP-155 chain ID of the market and submitting client.
|
|
32
|
+
* @param params.account - Nonzero position owner who sends the multicall.
|
|
33
|
+
* @param params.marketData - Hydrated market snapshot from the same block as `positionData`.
|
|
34
|
+
* @param params.positionData - Position snapshot for the same market, owned by `account`.
|
|
35
|
+
* @param params.collateralPrices - Raw `price()` values from each collateral oracle at the snapshot
|
|
36
|
+
* block, indexed like `positionData.collateral` and scaled by `ORACLE_PRICE_SCALE` (1e36). Not
|
|
37
|
+
* needed when the snapshot has no debt.
|
|
38
|
+
* @param params.collateralWithdrawals - Nonempty ordered withdrawals, one per collateral index;
|
|
39
|
+
* `maxUint256` withdraws the snapshot balance at that index.
|
|
40
|
+
* @param params.receiver - Optional recipient of every withdrawal; defaults to `account`. Midnight
|
|
41
|
+
* and market token contracts are rejected.
|
|
42
|
+
* @param params.now - Reference Unix timestamp in seconds, normally the snapshot block's timestamp;
|
|
43
|
+
* omitting it uses the device clock (an untyped JavaScript `null` does too).
|
|
44
|
+
* @param params.expiresAt - Plan expiry in Unix seconds; defaults to two hours after `now`. Midnight does not enforce it onchain.
|
|
45
|
+
* @param params.calldataOrigin - Optional attribution bytes appended to the built transaction.
|
|
46
|
+
* @returns A frozen plan with one multicall step and no approvals, authorizations or signature requests.
|
|
47
|
+
* @throws {InvalidBigIntInputError} If a supplied non-null `now`, a withdrawal's `collateralIndex` or `assets`, or a supplied collateral price is not a bigint; checked before any request.
|
|
48
|
+
* @throws {ZeroAccountError} If the account is the zero address.
|
|
49
|
+
* @throws {NonIntegerInputError} If expiry is not a safe integer.
|
|
50
|
+
* @throws {ExpiredDeadlineError} If expiry is at or before the reference time.
|
|
51
|
+
* @throws {InvalidCalldataOriginError} If attribution bytes are empty or malformed.
|
|
52
|
+
* @throws {InvalidTransactionPlanError} If the account is malformed, attribution exceeds 1 MiB, the withdrawals or `collateralPrices` are not an array, or an entry is not an object.
|
|
53
|
+
* @throws {ChainIdMismatchError} If the market, client or RPC targets another chain.
|
|
54
|
+
* @throws {MidnightMarketAddressMismatchError} If the market targets another Midnight deployment.
|
|
55
|
+
* @throws {InvalidMarketParameterError} If the market configuration is invalid.
|
|
56
|
+
* @throws {MarketIdMismatchError} If the position belongs to another market.
|
|
57
|
+
* @throws {AccrualPositionUserMismatchError} If the position is owned by another account.
|
|
58
|
+
* @throws {EmptyMidnightCollateralWithdrawalsError} If the list is empty.
|
|
59
|
+
* @throws {DuplicateMidnightCollateralIndexError} If an index repeats.
|
|
60
|
+
* @throws {UnknownCollateralIndexError} If an index is not configured on the market.
|
|
61
|
+
* @throws {NonPositiveInputError} If expiry or a resolved amount is not positive.
|
|
62
|
+
* @throws {InputExceedsMaxError} If a resolved amount exceeds uint128.
|
|
63
|
+
* @throws {MidnightZeroReceiverError} If the receiver is the zero address.
|
|
64
|
+
* @throws {MidnightContractReceiverError} If the receiver is a blocked protocol or market token contract.
|
|
65
|
+
* @throws {MidnightCalldataEncodingError} If a market, position owner or receiver address is malformed, or calldata cannot be encoded.
|
|
66
|
+
* @throws {WithdrawExceedsCollateralError} If a withdrawal exceeds the snapshot balance at its index.
|
|
67
|
+
* @throws {MissingMarketPriceError} If remaining collateral has no price for the health check.
|
|
68
|
+
* @throws {WithdrawMakesPositionUnhealthyError} If the snapshot debt exceeds the remaining buffered capacity.
|
|
69
|
+
* @throws {UnsupportedChainIdError} If the chain is absent from the address registry.
|
|
70
|
+
* @throws {UnknownAddressError} If Midnight core is not registered on the chain.
|
|
71
|
+
* @throws {MissingContractCodeError} If the registered Midnight core has no deployed code.
|
|
72
|
+
* @throws {viem.BaseError} If the `eth_chainId` or bytecode request fails.
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* import {
|
|
76
|
+
* buildTransactions,
|
|
77
|
+
* prepareMidnightWithdrawCollateralBatch,
|
|
78
|
+
* type TransactionPlan,
|
|
79
|
+
* } from "@morpho-org/morpho-sdk";
|
|
80
|
+
* import { fetchMidnightAccrualPosition } from "@morpho-org/morpho-sdk/fetch";
|
|
81
|
+
* import { type Address, type Hash, createPublicClient, http, maxUint256 } from "viem";
|
|
82
|
+
* import { base } from "viem/chains";
|
|
83
|
+
*
|
|
84
|
+
* // A full exit of a debt-free position that holds both collaterals; an empty index throws.
|
|
85
|
+
* async function prepareCollateralExit(account: Address, marketId: Hash) {
|
|
86
|
+
* const client = createPublicClient({ chain: base, transport: http() });
|
|
87
|
+
* const block = await client.getBlock();
|
|
88
|
+
* const positionData = await fetchMidnightAccrualPosition(client, {
|
|
89
|
+
* marketId, user: account, blockNumber: block.number,
|
|
90
|
+
* });
|
|
91
|
+
* const plan: TransactionPlan = await prepareMidnightWithdrawCollateralBatch(client, {
|
|
92
|
+
* chainId: base.id, account, marketData: positionData.market, positionData,
|
|
93
|
+
* collateralPrices: [], // No price check is needed without debt.
|
|
94
|
+
* now: block.timestamp,
|
|
95
|
+
* collateralWithdrawals: [
|
|
96
|
+
* { collateralIndex: 0n, assets: maxUint256 },
|
|
97
|
+
* { collateralIndex: 1n, assets: maxUint256 },
|
|
98
|
+
* ],
|
|
99
|
+
* });
|
|
100
|
+
* // plan.steps: a single "midnightWithdrawCollateralBatch" step; plan.signatureRequests is empty.
|
|
101
|
+
* // Simulate, then send from plan.account on plan.chainId.
|
|
102
|
+
* return buildTransactions(plan);
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
* @experimental TransactionPlan is in beta; breaking changes may ship in minor releases.
|
|
106
|
+
*/
|
|
107
|
+
export async function prepareMidnightWithdrawCollateralBatch(client, params) {
|
|
108
|
+
const { account, chainId, marketData, positionData } = params;
|
|
109
|
+
const now = params.now ?? Time.timestamp();
|
|
110
|
+
validateReferenceTime(now);
|
|
111
|
+
const { expiresAt, calldataOrigin } = resolveIntent({
|
|
112
|
+
account,
|
|
113
|
+
chainId,
|
|
114
|
+
expiresAt: params.expiresAt,
|
|
115
|
+
calldataOrigin: params.calldataOrigin,
|
|
116
|
+
}, now);
|
|
117
|
+
const { collateralWithdrawals } = params;
|
|
118
|
+
validateCollateralTransferInputs("collateralWithdrawals", collateralWithdrawals);
|
|
119
|
+
validateCollateralPriceTypes(params.collateralPrices);
|
|
120
|
+
const parsed = parseMidnightWithdrawCollateralBatchPreparation({
|
|
121
|
+
chainId,
|
|
122
|
+
accountAddress: account,
|
|
123
|
+
marketData,
|
|
124
|
+
positionData,
|
|
125
|
+
collateralPrices: params.collateralPrices,
|
|
126
|
+
collateralWithdrawals,
|
|
127
|
+
receiver: params.receiver,
|
|
128
|
+
});
|
|
129
|
+
const { postCollateral, withdrawAmount } = computeMidnightPostWithdrawalCollateral({
|
|
130
|
+
market: marketData.params,
|
|
131
|
+
marketId: marketData.id,
|
|
132
|
+
collateral: positionData.collateral,
|
|
133
|
+
withdrawals: parsed.collateralWithdrawals,
|
|
134
|
+
});
|
|
135
|
+
validateMidnightWithdrawHealth({
|
|
136
|
+
market: marketData,
|
|
137
|
+
collateral: postCollateral,
|
|
138
|
+
collateralPrices: params.collateralPrices,
|
|
139
|
+
debt: positionData.debt,
|
|
140
|
+
withdrawAmount,
|
|
141
|
+
});
|
|
142
|
+
// Store the tuple the checks above used, not one read again after the awaits below.
|
|
143
|
+
const market = MarketUtils.toStruct(marketData.params);
|
|
144
|
+
const chainCheck = createChainCheck(client, chainId);
|
|
145
|
+
await chainCheck();
|
|
146
|
+
// A code-less core would accept the multicall as a silent no-op.
|
|
147
|
+
await assertRegistryTargetsHaveCode(client, chainId, [{ role: "midnight", address: getChainAddress(chainId, "midnight") }], chainCheck);
|
|
148
|
+
return deepFreeze({
|
|
149
|
+
version: 2,
|
|
150
|
+
chainId,
|
|
151
|
+
account,
|
|
152
|
+
expiresAt,
|
|
153
|
+
...(calldataOrigin && { calldataOrigin }),
|
|
154
|
+
steps: [
|
|
155
|
+
{
|
|
156
|
+
id: actionId,
|
|
157
|
+
label: "Withdraw Midnight collateral batch",
|
|
158
|
+
action: {
|
|
159
|
+
type: actionId,
|
|
160
|
+
inputs: {
|
|
161
|
+
account,
|
|
162
|
+
chainId,
|
|
163
|
+
market,
|
|
164
|
+
collateralWithdrawals: parsed.collateralWithdrawals.map(({ collateralIndex, assets }) => ({ collateralIndex, assets })),
|
|
165
|
+
receiver: parsed.receiver,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
signatureRequests: [],
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/** @internal Encodes the stored direct withdrawal batch without retaining the snapshot. */
|
|
174
|
+
export function buildMidnightWithdrawCollateralBatch({ inputs, }) {
|
|
175
|
+
const { account, chainId, market, collateralWithdrawals, receiver } = inputs;
|
|
176
|
+
// A directly built step skips restore, so check each entry's shape and index type here.
|
|
177
|
+
validateCollateralTransferInputs("inputs.collateralWithdrawals", collateralWithdrawals);
|
|
178
|
+
validateStoredCollateralOrder(market.collateralParams, "$.inputs.market.collateralParams");
|
|
179
|
+
return midnightWithdrawCollateralBatch({
|
|
180
|
+
chainId,
|
|
181
|
+
market: storedMarketTuple(market),
|
|
182
|
+
collateralWithdrawals,
|
|
183
|
+
onBehalf: account,
|
|
184
|
+
receiver,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/** @internal Validates the stored Midnight collateral withdrawal batch without RPC. */
|
|
188
|
+
export function validateMidnightWithdrawCollateralBatchPlanAction(action, path) {
|
|
189
|
+
const inputsPath = `${path}.inputs`;
|
|
190
|
+
const inputs = getPlanObject(action.inputs, inputsPath);
|
|
191
|
+
validatePlanFields(inputs, {
|
|
192
|
+
path: inputsPath,
|
|
193
|
+
fields: { receiver: "address" },
|
|
194
|
+
});
|
|
195
|
+
const marketPath = `${inputsPath}.market`;
|
|
196
|
+
const market = getPlanObject(inputs.market, marketPath);
|
|
197
|
+
// Validate the tuple before reading its collateral tokens.
|
|
198
|
+
validateStoredMidnightMarket(market, {
|
|
199
|
+
path: marketPath,
|
|
200
|
+
chainId: inputs.chainId,
|
|
201
|
+
});
|
|
202
|
+
const collaterals = market.collateralParams;
|
|
203
|
+
validateStoredCollateralOrder(collaterals, `${marketPath}.collateralParams`);
|
|
204
|
+
const withdrawalsPath = `${inputsPath}.collateralWithdrawals`;
|
|
205
|
+
if (!Array.isArray(inputs.collateralWithdrawals)) {
|
|
206
|
+
throw new InvalidTransactionPlanError({
|
|
207
|
+
path: withdrawalsPath,
|
|
208
|
+
reason: "expected an array",
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
for (const [index, withdrawal] of inputs.collateralWithdrawals.entries()) {
|
|
212
|
+
const itemPath = `${withdrawalsPath}[${index}]`;
|
|
213
|
+
const item = getPlanObject(withdrawal, itemPath);
|
|
214
|
+
validatePlanFields(item, {
|
|
215
|
+
path: itemPath,
|
|
216
|
+
fields: { collateralIndex: "uint256 bigint", assets: "uint128 bigint" },
|
|
217
|
+
});
|
|
218
|
+
if (item.collateralIndex >= BigInt(collaterals.length)) {
|
|
219
|
+
throw new InvalidTransactionPlanError({
|
|
220
|
+
path: `${itemPath}.collateralIndex`,
|
|
221
|
+
reason: "expected an index configured in the market",
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Midnight never consumes a signature reference.
|
|
226
|
+
validateSignaturelessMidnightAction(action, path);
|
|
227
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Erc2612RequirementSignature } from "../types/index.js";
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { BundlesTokenRequirementSignature, Erc2612RequirementSignature } from "../types/index.js";
|
|
3
3
|
import type { Action, SignatureRequest } from "./types.js";
|
|
4
|
+
import { type VaultPermitAction } from "./vaultBinding.js";
|
|
4
5
|
/** @internal Validates the stored ERC-2612 request shape without verifying its signature. */
|
|
5
6
|
export declare function validatePermitPlanRequest(request: Record<string, unknown>, path: string): void;
|
|
6
7
|
/** @internal Checks a permit's signing payload against its referencing action and encoding arguments. */
|
|
@@ -23,5 +24,17 @@ export declare function getSignedTokenPermit(requests: readonly SignatureRequest
|
|
|
23
24
|
readonly asset: Address;
|
|
24
25
|
readonly owner: Address;
|
|
25
26
|
}): Erc2612RequirementSignature | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* @internal Selects the vault action's signed token permit for its bundle pull, as its builder encodes it.
|
|
29
|
+
* @throws {IncompleteTransactionPlanError} If the referenced request is missing or unsigned.
|
|
30
|
+
* @throws {TransactionPlanSignatureMismatchError} If the referenced request is not a permit.
|
|
31
|
+
* @throws {BundlesPermitMismatchError} If the permit does not match the pull's spender, amount or deadline.
|
|
32
|
+
*/
|
|
33
|
+
export declare function selectVaultPermit(action: Extract<VaultPermitAction, {
|
|
34
|
+
readonly type: "vaultV1Deposit" | "vaultV2Deposit";
|
|
35
|
+
}>, requests: readonly SignatureRequest[]): BundlesTokenRequirementSignature | undefined;
|
|
36
|
+
export declare function selectVaultPermit(action: Exclude<VaultPermitAction, {
|
|
37
|
+
readonly type: "vaultV1Deposit" | "vaultV2Deposit";
|
|
38
|
+
}>, requests: readonly SignatureRequest[]): Erc2612RequirementSignature | undefined;
|
|
26
39
|
/** @internal Alias for existing Vault V2 plan builders. */
|
|
27
40
|
export { getSignedTokenPermit as getVaultPermit };
|