@morpho-org/morpho-sdk 10.1.0-next.0 → 10.1.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 +6 -2
- package/lib/cjs/abis.d.ts +1 -1
- package/lib/cjs/abis.js +1 -5
- package/lib/cjs/actions/blue/borrow.d.ts +2 -1
- package/lib/cjs/actions/blue/borrow.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/borrow.internal.js +35 -0
- package/lib/cjs/actions/blue/borrow.js +4 -16
- package/lib/cjs/actions/blue/common.d.ts +50 -28
- package/lib/cjs/actions/blue/common.js +21 -34
- package/lib/cjs/actions/blue/encode.d.ts +23 -0
- package/lib/cjs/actions/blue/encode.js +171 -0
- package/lib/cjs/actions/blue/refinance.d.ts +3 -2
- package/lib/cjs/actions/blue/refinance.internal.d.ts +42 -0
- package/lib/cjs/actions/blue/refinance.internal.js +62 -0
- package/lib/cjs/actions/blue/refinance.js +5 -63
- package/lib/cjs/actions/blue/refinanceValidation.d.ts +4 -5
- package/lib/cjs/actions/blue/refinanceValidation.js +1 -3
- package/lib/cjs/actions/blue/repay.d.ts +1 -1
- package/lib/cjs/actions/blue/repay.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/repay.internal.js +38 -0
- package/lib/cjs/actions/blue/repay.js +2 -17
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.internal.d.ts +61 -0
- package/lib/cjs/actions/blue/repayWithdrawCollateral.internal.js +112 -0
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +3 -116
- package/lib/cjs/actions/blue/signatures.d.ts +30 -0
- package/lib/cjs/actions/blue/signatures.js +90 -0
- package/lib/cjs/actions/blue/supply.d.ts +1 -1
- package/lib/cjs/actions/blue/supply.internal.d.ts +32 -0
- package/lib/cjs/actions/blue/supply.internal.js +101 -0
- package/lib/cjs/actions/blue/supply.js +2 -67
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +1 -1
- package/lib/cjs/actions/blue/supplyCollateral.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/supplyCollateral.internal.js +37 -0
- package/lib/cjs/actions/blue/supplyCollateral.js +2 -17
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +4 -3
- package/lib/cjs/actions/blue/supplyCollateralBorrow.internal.d.ts +63 -0
- package/lib/cjs/actions/blue/supplyCollateralBorrow.internal.js +94 -0
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +5 -106
- package/lib/cjs/actions/blue/withdraw.d.ts +4 -3
- package/lib/cjs/actions/blue/withdraw.internal.d.ts +56 -0
- package/lib/cjs/actions/blue/withdraw.internal.js +84 -0
- package/lib/cjs/actions/blue/withdraw.js +5 -78
- package/lib/cjs/actions/blue/withdrawBuyCallback.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawBuyCallback.internal.d.ts +20 -0
- package/lib/cjs/actions/blue/withdrawBuyCallback.internal.js +58 -0
- package/lib/cjs/actions/blue/withdrawBuyCallback.js +2 -39
- package/lib/cjs/actions/blue/withdrawCollateral.internal.d.ts +16 -0
- package/lib/cjs/actions/blue/withdrawCollateral.internal.js +39 -0
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -17
- package/lib/cjs/actions/bundles/common.d.ts +9 -0
- package/lib/cjs/actions/bundles/common.js +18 -6
- package/lib/cjs/actions/bundles/index.d.ts +1 -1
- package/lib/cjs/actions/bundles/index.js +3 -16
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +14 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +59 -60
- package/lib/cjs/actions/midnight/cancelAndMake.d.ts +22 -1
- package/lib/cjs/actions/midnight/cancelAndMake.js +46 -87
- package/lib/cjs/actions/midnight/cancelOffers.d.ts +11 -0
- package/lib/cjs/actions/midnight/cancelOffers.js +22 -4
- package/lib/cjs/actions/midnight/encode.d.ts +36 -0
- package/lib/cjs/actions/midnight/encode.js +554 -0
- package/lib/cjs/actions/midnight/index.d.ts +14 -13
- package/lib/cjs/actions/midnight/index.js +29 -13
- package/lib/cjs/actions/midnight/parse.d.ts +35 -0
- package/lib/cjs/actions/midnight/parse.js +73 -0
- package/lib/cjs/actions/midnight/parseCollateralBatch.d.ts +58 -0
- package/lib/cjs/actions/midnight/parseCollateralBatch.js +216 -0
- package/lib/cjs/actions/midnight/redeem.d.ts +16 -3
- package/lib/cjs/actions/midnight/redeem.js +22 -51
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +13 -0
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +42 -67
- package/lib/cjs/actions/midnight/supplyCollateral.d.ts +40 -5
- package/lib/cjs/actions/midnight/supplyCollateral.js +60 -54
- package/lib/cjs/actions/midnight/supplyCollateralBatch.d.ts +3 -3
- package/lib/cjs/actions/midnight/supplyCollateralBatch.js +3 -62
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +24 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +39 -66
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.d.ts +77 -0
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.js +142 -0
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +17 -2
- package/lib/cjs/actions/midnight/takeBorrow.js +25 -55
- package/lib/cjs/actions/midnight/takeLend.d.ts +21 -1
- package/lib/cjs/actions/midnight/takeLend.js +30 -57
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -2
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +34 -61
- package/lib/cjs/actions/midnight/takeWithdraw.d.ts +17 -2
- package/lib/cjs/actions/midnight/takeWithdraw.js +78 -115
- package/lib/cjs/actions/midnight/withdrawCollateral.d.ts +16 -3
- package/lib/cjs/actions/midnight/withdrawCollateral.js +25 -56
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.d.ts +3 -3
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +3 -71
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +13 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +39 -19
- package/lib/cjs/actions/requirements/blue/index.d.ts +1 -1
- package/lib/cjs/actions/requirements/blue/index.js +3 -15
- package/lib/cjs/actions/requirements/chainCheck.d.ts +5 -0
- package/lib/cjs/actions/requirements/chainCheck.js +10 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +40 -27
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +11 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +36 -17
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +14 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +44 -9
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +61 -24
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +25 -4
- package/lib/cjs/actions/requirements/encode/index.d.ts +5 -5
- package/lib/cjs/actions/requirements/encode/index.js +11 -19
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +26 -11
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +40 -12
- package/lib/cjs/actions/requirements/index.d.ts +1 -1
- package/lib/cjs/actions/requirements/index.js +3 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +11 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +34 -19
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +26 -12
- package/lib/cjs/actions/requirements/midnight/index.d.ts +2 -2
- package/lib/cjs/actions/requirements/midnight/index.js +5 -16
- package/lib/cjs/actions/vaultV1/deposit.d.ts +21 -0
- package/lib/cjs/actions/vaultV1/deposit.js +46 -10
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +18 -1
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +36 -16
- package/lib/cjs/actions/vaultV1/index.d.ts +5 -5
- package/lib/cjs/actions/vaultV1/index.js +11 -19
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +21 -0
- package/lib/cjs/actions/vaultV1/migrateToV2.js +49 -11
- package/lib/cjs/actions/vaultV1/redeem.d.ts +19 -0
- package/lib/cjs/actions/vaultV1/redeem.js +28 -7
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +19 -0
- package/lib/cjs/actions/vaultV1/withdraw.js +28 -7
- package/lib/cjs/actions/vaultV2/deposit.d.ts +21 -0
- package/lib/cjs/actions/vaultV2/deposit.js +46 -10
- package/lib/cjs/actions/vaultV2/forceRedeem.d.ts +20 -2
- package/lib/cjs/actions/vaultV2/forceRedeem.js +39 -8
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +23 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +36 -14
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +18 -1
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +35 -15
- package/lib/cjs/actions/vaultV2/index.d.ts +6 -6
- package/lib/cjs/actions/vaultV2/index.js +13 -20
- package/lib/cjs/actions/vaultV2/redeem.d.ts +19 -0
- package/lib/cjs/actions/vaultV2/redeem.js +28 -7
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +19 -0
- package/lib/cjs/actions/vaultV2/withdraw.js +28 -7
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +1 -5
- package/lib/cjs/blue/entities.d.ts +4 -4
- package/lib/cjs/blue/entities.js +1 -3
- package/lib/cjs/blue/errors.d.ts +2 -2
- package/lib/cjs/blue/errors.js +1 -5
- package/lib/cjs/blue/fetch.d.ts +2 -2
- package/lib/cjs/blue/fetch.js +1 -3
- package/lib/cjs/blue/utils.d.ts +1 -1
- package/lib/cjs/blue/utils.js +1 -2
- package/lib/cjs/entities/blue/blue.d.ts +35 -8
- package/lib/cjs/entities/blue/blue.js +467 -406
- package/lib/cjs/entities/index.d.ts +4 -4
- package/lib/cjs/entities/index.js +1 -3
- package/lib/cjs/entities/midnight/midnight.d.ts +117 -41
- package/lib/cjs/entities/midnight/midnight.js +472 -843
- package/lib/cjs/entities/midnight/parse.d.ts +74 -0
- package/lib/cjs/entities/midnight/parse.js +336 -0
- package/lib/cjs/entities/midnight/prepare.d.ts +47 -0
- package/lib/cjs/entities/midnight/prepare.js +293 -0
- package/lib/cjs/entities/midnight/publication.d.ts +7 -3
- package/lib/cjs/entities/midnight/publication.js +10 -7
- package/lib/cjs/entities/midnight/types.d.ts +7 -0
- package/lib/cjs/entities/requirements/assertContractCode.d.ts +10 -5
- package/lib/cjs/entities/requirements/assertContractCode.js +24 -15
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +15 -0
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +59 -51
- package/lib/cjs/entities/requirements/getErc2612Permit.d.ts +7 -3
- package/lib/cjs/entities/requirements/getErc2612Permit.js +20 -4
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.d.ts +15 -0
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.js +24 -7
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +14 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +27 -7
- package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.js +4 -3
- package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.js +4 -3
- package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.js +4 -3
- package/lib/cjs/entities/requirements/index.d.ts +2 -2
- package/lib/cjs/entities/requirements/index.js +5 -16
- package/lib/cjs/entities/requirements/validateNativeRequirements.d.ts +21 -0
- package/lib/cjs/entities/requirements/validateNativeRequirements.js +37 -0
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.d.ts +2 -2
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.js +1 -7
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +17 -40
- package/lib/cjs/entities/vaultV1/vaultV1.js +228 -159
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.d.ts +4 -0
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.js +9 -4
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.d.ts +2 -2
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.js +1 -7
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +29 -86
- package/lib/cjs/entities/vaultV2/vaultV2.js +226 -188
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +2 -3
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +2 -6
- package/lib/cjs/errors.d.ts +4 -4
- package/lib/cjs/errors.js +5 -7
- package/lib/cjs/fetch.d.ts +2 -2
- package/lib/cjs/fetch.js +1 -3
- package/lib/cjs/helpers/deadShares.js +0 -3
- package/lib/cjs/helpers/parse.d.ts +33 -0
- package/lib/cjs/helpers/parse.js +71 -0
- package/lib/cjs/helpers/parseMidnight.d.ts +48 -0
- package/lib/cjs/helpers/parseMidnight.js +95 -0
- package/lib/cjs/helpers/parseMidnightMaker.d.ts +44 -0
- package/lib/cjs/helpers/parseMidnightMaker.js +154 -0
- package/lib/cjs/helpers/validate.d.ts +3 -2
- package/lib/cjs/helpers/validate.js +4 -0
- package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.d.ts +8 -0
- package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.js +4 -4
- package/lib/cjs/helpers/validateMidnightPublication.d.ts +17 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/midnight/errors.d.ts +1 -2
- package/lib/cjs/midnight/errors.js +4 -5
- package/lib/cjs/transactionPlan/blue/refinance.js +17 -9
- package/lib/cjs/transactionPlan/blue/repay.js +2 -1
- package/lib/cjs/transactionPlan/blue/repayWithdrawCollateral.js +23 -4
- package/lib/cjs/transactionPlan/blue/supplyCollateralBorrow.js +2 -2
- package/lib/cjs/transactionPlan/blue/withdraw.d.ts +2 -2
- package/lib/cjs/transactionPlan/blue/withdraw.js +3 -3
- package/lib/cjs/transactionPlan/blue/withdrawCollateral.js +6 -2
- package/lib/cjs/transactionPlan/validation.d.ts +1 -1
- package/lib/cjs/transactionPlan/validation.js +3 -0
- package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +2 -2
- package/lib/cjs/transactionPlan/vaultv1/deposit.js +2 -2
- package/lib/cjs/types/action.d.ts +13 -2
- package/lib/cjs/types/error.d.ts +20 -2
- package/lib/cjs/types/error.js +32 -3
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +2 -4
- 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/borrow.d.ts +2 -1
- package/lib/esm/actions/blue/borrow.internal.d.ts +13 -0
- package/lib/esm/actions/blue/borrow.internal.js +30 -0
- package/lib/esm/actions/blue/borrow.js +4 -16
- package/lib/esm/actions/blue/common.d.ts +50 -28
- package/lib/esm/actions/blue/common.js +21 -33
- package/lib/esm/actions/blue/encode.d.ts +23 -0
- package/lib/esm/actions/blue/encode.js +164 -0
- package/lib/esm/actions/blue/refinance.d.ts +3 -2
- package/lib/esm/actions/blue/refinance.internal.d.ts +42 -0
- package/lib/esm/actions/blue/refinance.internal.js +56 -0
- package/lib/esm/actions/blue/refinance.js +5 -63
- package/lib/esm/actions/blue/refinanceValidation.d.ts +4 -5
- package/lib/esm/actions/blue/refinanceValidation.js +2 -4
- package/lib/esm/actions/blue/repay.d.ts +1 -1
- package/lib/esm/actions/blue/repay.internal.d.ts +13 -0
- package/lib/esm/actions/blue/repay.internal.js +33 -0
- package/lib/esm/actions/blue/repay.js +2 -17
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.internal.d.ts +61 -0
- package/lib/esm/actions/blue/repayWithdrawCollateral.internal.js +104 -0
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +3 -116
- package/lib/esm/actions/blue/signatures.d.ts +30 -0
- package/lib/esm/actions/blue/signatures.js +82 -0
- package/lib/esm/actions/blue/supply.d.ts +1 -1
- package/lib/esm/actions/blue/supply.internal.d.ts +32 -0
- package/lib/esm/actions/blue/supply.internal.js +95 -0
- package/lib/esm/actions/blue/supply.js +2 -67
- package/lib/esm/actions/blue/supplyCollateral.d.ts +1 -1
- package/lib/esm/actions/blue/supplyCollateral.internal.d.ts +13 -0
- package/lib/esm/actions/blue/supplyCollateral.internal.js +32 -0
- package/lib/esm/actions/blue/supplyCollateral.js +2 -17
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +4 -3
- package/lib/esm/actions/blue/supplyCollateralBorrow.internal.d.ts +63 -0
- package/lib/esm/actions/blue/supplyCollateralBorrow.internal.js +87 -0
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +5 -106
- package/lib/esm/actions/blue/withdraw.d.ts +4 -3
- package/lib/esm/actions/blue/withdraw.internal.d.ts +56 -0
- package/lib/esm/actions/blue/withdraw.internal.js +77 -0
- package/lib/esm/actions/blue/withdraw.js +5 -78
- package/lib/esm/actions/blue/withdrawBuyCallback.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawBuyCallback.internal.d.ts +20 -0
- package/lib/esm/actions/blue/withdrawBuyCallback.internal.js +53 -0
- package/lib/esm/actions/blue/withdrawBuyCallback.js +2 -39
- package/lib/esm/actions/blue/withdrawCollateral.internal.d.ts +16 -0
- package/lib/esm/actions/blue/withdrawCollateral.internal.js +34 -0
- package/lib/esm/actions/blue/withdrawCollateral.js +2 -17
- package/lib/esm/actions/bundles/common.d.ts +9 -0
- package/lib/esm/actions/bundles/common.js +15 -4
- package/lib/esm/actions/bundles/index.d.ts +1 -1
- package/lib/esm/actions/bundles/index.js +1 -1
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +14 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +58 -61
- package/lib/esm/actions/midnight/cancelAndMake.d.ts +22 -1
- package/lib/esm/actions/midnight/cancelAndMake.js +43 -85
- package/lib/esm/actions/midnight/cancelOffers.d.ts +11 -0
- package/lib/esm/actions/midnight/cancelOffers.js +18 -2
- package/lib/esm/actions/midnight/encode.d.ts +36 -0
- package/lib/esm/actions/midnight/encode.js +539 -0
- package/lib/esm/actions/midnight/index.d.ts +14 -13
- package/lib/esm/actions/midnight/index.js +14 -13
- package/lib/esm/actions/midnight/parse.d.ts +35 -0
- package/lib/esm/actions/midnight/parse.js +68 -0
- package/lib/esm/actions/midnight/parseCollateralBatch.d.ts +58 -0
- package/lib/esm/actions/midnight/parseCollateralBatch.js +209 -0
- package/lib/esm/actions/midnight/redeem.d.ts +16 -3
- package/lib/esm/actions/midnight/redeem.js +20 -50
- package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +13 -0
- package/lib/esm/actions/midnight/repayWithdrawCollateral.js +38 -64
- package/lib/esm/actions/midnight/supplyCollateral.d.ts +40 -5
- package/lib/esm/actions/midnight/supplyCollateral.js +57 -53
- package/lib/esm/actions/midnight/supplyCollateralBatch.d.ts +3 -3
- package/lib/esm/actions/midnight/supplyCollateralBatch.js +3 -62
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +24 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +33 -61
- package/lib/esm/actions/midnight/supplyCollateralWithNative.d.ts +77 -0
- package/lib/esm/actions/midnight/supplyCollateralWithNative.js +137 -0
- package/lib/esm/actions/midnight/takeBorrow.d.ts +17 -2
- package/lib/esm/actions/midnight/takeBorrow.js +20 -51
- package/lib/esm/actions/midnight/takeLend.d.ts +21 -1
- package/lib/esm/actions/midnight/takeLend.js +26 -54
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -2
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +30 -58
- package/lib/esm/actions/midnight/takeWithdraw.d.ts +17 -2
- package/lib/esm/actions/midnight/takeWithdraw.js +76 -114
- package/lib/esm/actions/midnight/withdrawCollateral.d.ts +16 -3
- package/lib/esm/actions/midnight/withdrawCollateral.js +23 -55
- package/lib/esm/actions/midnight/withdrawCollateralBatch.d.ts +3 -3
- package/lib/esm/actions/midnight/withdrawCollateralBatch.js +3 -71
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +13 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +36 -18
- package/lib/esm/actions/requirements/blue/index.d.ts +1 -1
- package/lib/esm/actions/requirements/blue/index.js +1 -1
- package/lib/esm/actions/requirements/chainCheck.d.ts +5 -0
- package/lib/esm/actions/requirements/chainCheck.js +6 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +36 -25
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +11 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +33 -16
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +14 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +41 -8
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +59 -24
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +21 -2
- package/lib/esm/actions/requirements/encode/index.d.ts +5 -5
- package/lib/esm/actions/requirements/encode/index.js +5 -5
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +26 -11
- package/lib/esm/actions/requirements/getRequirementsApproval.js +38 -12
- package/lib/esm/actions/requirements/index.d.ts +1 -1
- package/lib/esm/actions/requirements/index.js +1 -1
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +11 -0
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +31 -18
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -0
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +22 -10
- package/lib/esm/actions/requirements/midnight/index.d.ts +2 -2
- package/lib/esm/actions/requirements/midnight/index.js +2 -2
- package/lib/esm/actions/vaultV1/deposit.d.ts +21 -0
- package/lib/esm/actions/vaultV1/deposit.js +43 -9
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +18 -1
- package/lib/esm/actions/vaultV1/inKindRedeem.js +33 -15
- package/lib/esm/actions/vaultV1/index.d.ts +5 -5
- package/lib/esm/actions/vaultV1/index.js +5 -5
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +21 -0
- package/lib/esm/actions/vaultV1/migrateToV2.js +47 -11
- package/lib/esm/actions/vaultV1/redeem.d.ts +19 -0
- package/lib/esm/actions/vaultV1/redeem.js +26 -7
- package/lib/esm/actions/vaultV1/withdraw.d.ts +19 -0
- package/lib/esm/actions/vaultV1/withdraw.js +26 -7
- package/lib/esm/actions/vaultV2/deposit.d.ts +21 -0
- package/lib/esm/actions/vaultV2/deposit.js +43 -9
- package/lib/esm/actions/vaultV2/forceRedeem.d.ts +20 -2
- package/lib/esm/actions/vaultV2/forceRedeem.js +35 -6
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +23 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +33 -13
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +18 -1
- package/lib/esm/actions/vaultV2/inKindRedeem.js +32 -14
- package/lib/esm/actions/vaultV2/index.d.ts +6 -6
- package/lib/esm/actions/vaultV2/index.js +6 -6
- package/lib/esm/actions/vaultV2/redeem.d.ts +19 -0
- package/lib/esm/actions/vaultV2/redeem.js +26 -7
- package/lib/esm/actions/vaultV2/withdraw.d.ts +19 -0
- package/lib/esm/actions/vaultV2/withdraw.js +26 -7
- 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/blue/blue.d.ts +35 -8
- package/lib/esm/entities/blue/blue.js +449 -388
- 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 +117 -41
- package/lib/esm/entities/midnight/midnight.js +455 -826
- package/lib/esm/entities/midnight/parse.d.ts +74 -0
- package/lib/esm/entities/midnight/parse.js +320 -0
- package/lib/esm/entities/midnight/prepare.d.ts +47 -0
- package/lib/esm/entities/midnight/prepare.js +282 -0
- package/lib/esm/entities/midnight/publication.d.ts +7 -3
- package/lib/esm/entities/midnight/publication.js +7 -3
- package/lib/esm/entities/midnight/types.d.ts +7 -0
- package/lib/esm/entities/requirements/assertContractCode.d.ts +10 -5
- package/lib/esm/entities/requirements/assertContractCode.js +24 -15
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +15 -0
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +53 -47
- package/lib/esm/entities/requirements/getErc2612Permit.d.ts +7 -3
- package/lib/esm/entities/requirements/getErc2612Permit.js +19 -4
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.d.ts +15 -0
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.js +20 -5
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +14 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +23 -5
- package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.js +4 -3
- package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.js +4 -3
- package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.js +4 -3
- package/lib/esm/entities/requirements/index.d.ts +2 -2
- package/lib/esm/entities/requirements/index.js +2 -2
- package/lib/esm/entities/requirements/validateNativeRequirements.d.ts +21 -0
- package/lib/esm/entities/requirements/validateNativeRequirements.js +33 -0
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.d.ts +2 -2
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.js +1 -7
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +17 -40
- package/lib/esm/entities/vaultV1/vaultV1.js +208 -139
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.d.ts +4 -0
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.js +10 -5
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.d.ts +2 -2
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.js +1 -7
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +29 -86
- package/lib/esm/entities/vaultV2/vaultV2.js +210 -172
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +2 -3
- package/lib/esm/entities/vaultV2BlueReallocationData.js +2 -6
- 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/deadShares.js +1 -4
- package/lib/esm/helpers/parse.d.ts +33 -0
- package/lib/esm/helpers/parse.js +61 -0
- package/lib/esm/helpers/parseMidnight.d.ts +48 -0
- package/lib/esm/helpers/parseMidnight.js +80 -0
- package/lib/esm/helpers/parseMidnightMaker.d.ts +44 -0
- package/lib/esm/helpers/parseMidnightMaker.js +147 -0
- package/lib/esm/helpers/validate.d.ts +3 -2
- package/lib/esm/helpers/validate.js +5 -1
- package/lib/esm/helpers/validateMidnightCancelAndMakePublication.d.ts +8 -0
- package/lib/esm/helpers/validateMidnightCancelAndMakePublication.js +2 -2
- package/lib/esm/helpers/validateMidnightPublication.d.ts +17 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/midnight/errors.d.ts +1 -2
- package/lib/esm/midnight/errors.js +1 -2
- package/lib/esm/transactionPlan/blue/refinance.js +18 -10
- package/lib/esm/transactionPlan/blue/repay.js +3 -2
- package/lib/esm/transactionPlan/blue/repayWithdrawCollateral.js +24 -5
- package/lib/esm/transactionPlan/blue/supplyCollateralBorrow.js +2 -2
- package/lib/esm/transactionPlan/blue/withdraw.d.ts +2 -2
- package/lib/esm/transactionPlan/blue/withdraw.js +3 -3
- package/lib/esm/transactionPlan/blue/withdrawCollateral.js +6 -2
- package/lib/esm/transactionPlan/validation.d.ts +1 -1
- package/lib/esm/transactionPlan/validation.js +3 -0
- package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +2 -2
- package/lib/esm/transactionPlan/vaultv1/deposit.js +2 -2
- package/lib/esm/types/action.d.ts +13 -2
- package/lib/esm/types/error.d.ts +20 -2
- package/lib/esm/types/error.js +27 -0
- 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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getChainAddress } from "@morpho-org/morpho-ts";
|
|
2
2
|
import { encodeFunctionData } from "viem";
|
|
3
3
|
import { vaultBundlesV1Abi } from "../../abis.js";
|
|
4
|
-
import {
|
|
4
|
+
import { parseUint256 } from "../../helpers/parse.js";
|
|
5
5
|
import { NonPositiveInputError, } from "../../types/index.js";
|
|
6
|
-
import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets,
|
|
6
|
+
import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets, getParsedBundlesSharesPermit, normalizeBundlesCommonParams as parseBundlesCommon, } from "../bundles/common.js";
|
|
7
7
|
/**
|
|
8
8
|
* Encodes an exact-assets Vault V1 withdrawal through VaultBundlesV1.
|
|
9
9
|
*
|
|
@@ -56,15 +56,34 @@ import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets, getBund
|
|
|
56
56
|
* }
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
export const vaultV1Withdraw = (params) =>
|
|
59
|
+
export const vaultV1Withdraw = (params) => buildVaultV1Withdraw(parseVaultV1Withdraw(params));
|
|
60
|
+
/** Parses the amount and common fields in standalone order. @internal */
|
|
61
|
+
export const parseVaultV1Withdraw = (params) => {
|
|
60
62
|
if (params.args.amount <= 0n) {
|
|
61
63
|
throw new NonPositiveInputError("amount", params.args.amount);
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
const amount = parseUint256("amount", params.args.amount);
|
|
66
|
+
const common = parseBundlesCommon(params.args);
|
|
67
|
+
return {
|
|
68
|
+
vault: { chainId: params.vault.chainId, address: params.vault.address },
|
|
69
|
+
args: { amount, userAddress: params.args.userAddress, ...common },
|
|
70
|
+
common,
|
|
71
|
+
metadata: params.metadata,
|
|
72
|
+
requirementSignature: params.args.requirementSignature,
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/** Encodes parsed inputs and validates a fresh share signature. @internal */
|
|
76
|
+
export const buildVaultV1Withdraw = (parsed, signatures = parsed) => {
|
|
77
|
+
const { common } = parsed;
|
|
78
|
+
const params = {
|
|
79
|
+
...parsed,
|
|
80
|
+
args: {
|
|
81
|
+
...parsed.args,
|
|
82
|
+
requirementSignature: signatures.requirementSignature,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
66
85
|
const spender = getChainAddress(params.vault.chainId, "bundles.vaultBundlesV1");
|
|
67
|
-
const sharesPermit =
|
|
86
|
+
const sharesPermit = getParsedBundlesSharesPermit({
|
|
68
87
|
vault: params.vault.address,
|
|
69
88
|
deadline: common.deadline,
|
|
70
89
|
owner: params.args.userAddress,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
2
|
import { type BundlesFundingArgs, type BundlesTokenRequirementSignature, type Metadata, type Transaction, type VaultV2DepositAction } from "../../types/index.js";
|
|
3
|
+
import { normalizeBundlesCommonParams } from "../bundles/common.js";
|
|
3
4
|
/** Parameters for {@link vaultV2Deposit}. */
|
|
4
5
|
export interface VaultV2DepositParams {
|
|
5
6
|
readonly vault: {
|
|
@@ -18,6 +19,21 @@ export interface VaultV2DepositParams {
|
|
|
18
19
|
};
|
|
19
20
|
readonly metadata?: Metadata;
|
|
20
21
|
}
|
|
22
|
+
declare const vaultV2DepositInput: unique symbol;
|
|
23
|
+
/** Validated deposit values without a carried signature. @internal */
|
|
24
|
+
export interface VaultV2DepositInput {
|
|
25
|
+
readonly vault: Readonly<VaultV2DepositParams["vault"]>;
|
|
26
|
+
readonly userAddress: Address;
|
|
27
|
+
readonly funding: {
|
|
28
|
+
readonly assets: bigint;
|
|
29
|
+
readonly value: bigint;
|
|
30
|
+
};
|
|
31
|
+
readonly maxSharePrice: bigint;
|
|
32
|
+
readonly common: ReturnType<typeof normalizeBundlesCommonParams>;
|
|
33
|
+
readonly metadata?: Metadata;
|
|
34
|
+
readonly requirementSignature?: VaultV2DepositParams["args"]["requirementSignature"];
|
|
35
|
+
readonly [vaultV2DepositInput]: true;
|
|
36
|
+
}
|
|
21
37
|
/**
|
|
22
38
|
* Encodes a Vault V2 deposit through the registered VaultBundlesV1 contract.
|
|
23
39
|
*
|
|
@@ -85,3 +101,8 @@ export interface VaultV2DepositParams {
|
|
|
85
101
|
* ```
|
|
86
102
|
*/
|
|
87
103
|
export declare const vaultV2Deposit: (params: VaultV2DepositParams) => Readonly<Transaction<VaultV2DepositAction>>;
|
|
104
|
+
/** Constructs the complete standalone deposit from raw funding and bounds. @internal */
|
|
105
|
+
export declare const parseVaultV2DepositInput: (params: VaultV2DepositParams) => VaultV2DepositInput;
|
|
106
|
+
/** Encodes parsed funding and binds the supplied token signature. @internal */
|
|
107
|
+
export declare const buildVaultV2Deposit: (parsed: VaultV2DepositInput, signatures?: Pick<VaultV2DepositParams["args"], "requirementSignature">) => Readonly<Transaction<VaultV2DepositAction>>;
|
|
108
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getChainAddress } from "@morpho-org/morpho-ts";
|
|
2
2
|
import { encodeFunctionData } from "viem";
|
|
3
3
|
import { vaultBundlesV1Abi } from "../../abis.js";
|
|
4
|
-
import {
|
|
4
|
+
import { parseUint256 } from "../../helpers/parse.js";
|
|
5
|
+
import { validateNativeVaultAsset } from "../../helpers/validate.js";
|
|
5
6
|
import { NonPositiveInputError, UnexpectedRequirementSignatureError, } from "../../types/index.js";
|
|
6
7
|
import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets, getBundlesTokenPermit, normalizeBundlesCommonParams, resolveBundlesFunding, } from "../bundles/common.js";
|
|
7
8
|
/**
|
|
@@ -70,22 +71,55 @@ import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets, getBund
|
|
|
70
71
|
* }
|
|
71
72
|
* ```
|
|
72
73
|
*/
|
|
73
|
-
export const vaultV2Deposit = (params) =>
|
|
74
|
+
export const vaultV2Deposit = (params) => buildVaultV2Deposit(parseVaultV2DepositInput(params));
|
|
75
|
+
/** Constructs the complete standalone deposit from raw funding and bounds. @internal */
|
|
76
|
+
export const parseVaultV2DepositInput = (params) => {
|
|
74
77
|
const funding = resolveBundlesFunding(params.args);
|
|
75
78
|
if (params.args.maxSharePrice <= 0n) {
|
|
76
79
|
throw new NonPositiveInputError("maxSharePrice", params.args.maxSharePrice);
|
|
77
80
|
}
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
// Check ABI bounds after both positive-only checks, preserving first-error order.
|
|
82
|
+
parseUint256(funding.value > 0n ? "nativeAmount" : "amount", funding.assets);
|
|
83
|
+
const maxSharePrice = parseUint256("maxSharePrice", params.args.maxSharePrice);
|
|
81
84
|
if (funding.value > 0n) {
|
|
82
|
-
//
|
|
85
|
+
// Native deposits must wrap the vault's underlying asset.
|
|
83
86
|
validateNativeVaultAsset(params.vault.chainId, params.vault.asset);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
}
|
|
88
|
+
// Standalone native/signature exclusivity precedes common-field validation.
|
|
89
|
+
if (funding.value > 0n && params.args.requirementSignature != null) {
|
|
90
|
+
throw new UnexpectedRequirementSignatureError(params.args.requirementSignature.action.type);
|
|
87
91
|
}
|
|
88
92
|
const common = normalizeBundlesCommonParams(params.args);
|
|
93
|
+
return {
|
|
94
|
+
vault: {
|
|
95
|
+
chainId: params.vault.chainId,
|
|
96
|
+
address: params.vault.address,
|
|
97
|
+
asset: params.vault.asset,
|
|
98
|
+
},
|
|
99
|
+
userAddress: params.args.userAddress,
|
|
100
|
+
funding,
|
|
101
|
+
maxSharePrice,
|
|
102
|
+
common,
|
|
103
|
+
metadata: params.metadata,
|
|
104
|
+
requirementSignature: params.args.requirementSignature,
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
/** Encodes parsed funding and binds the supplied token signature. @internal */
|
|
108
|
+
export const buildVaultV2Deposit = (parsed, signatures = parsed) => {
|
|
109
|
+
const { funding, common, maxSharePrice, vault, userAddress, metadata } = parsed;
|
|
110
|
+
const params = {
|
|
111
|
+
vault,
|
|
112
|
+
args: {
|
|
113
|
+
maxSharePrice,
|
|
114
|
+
userAddress,
|
|
115
|
+
requirementSignature: signatures.requirementSignature,
|
|
116
|
+
},
|
|
117
|
+
metadata,
|
|
118
|
+
};
|
|
119
|
+
// Signatures are supplied independently of parsed funding.
|
|
120
|
+
if (funding.value > 0n && signatures.requirementSignature != null) {
|
|
121
|
+
throw new UnexpectedRequirementSignatureError(signatures.requirementSignature.action.type);
|
|
122
|
+
}
|
|
89
123
|
const referralFeeAssets = getBundlesReferralFeeAssets(funding.assets, common.referralFeePct);
|
|
90
124
|
const netAssets = funding.assets - referralFeeAssets;
|
|
91
125
|
const spender = getChainAddress(params.vault.chainId, "bundles.vaultBundlesV1");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
2
|
import { type Deallocation, type Metadata, type Transaction, type VaultV2ForceRedeemAction } from "../../types/index.js";
|
|
3
3
|
/** Parameters for {@link vaultV2ForceRedeem}. */
|
|
4
4
|
export interface VaultV2ForceRedeemParams {
|
|
@@ -15,6 +15,19 @@ export interface VaultV2ForceRedeemParams {
|
|
|
15
15
|
};
|
|
16
16
|
metadata?: Metadata;
|
|
17
17
|
}
|
|
18
|
+
declare const vaultV2ForceRedeemInput: unique symbol;
|
|
19
|
+
/** Owned force-redeem inputs whose positive-only checks have completed. @internal */
|
|
20
|
+
export type VaultV2ForceRedeemInput = {
|
|
21
|
+
readonly vault: Readonly<VaultV2ForceRedeemParams["vault"]>;
|
|
22
|
+
readonly args: {
|
|
23
|
+
readonly deallocations: readonly Readonly<Deallocation>[];
|
|
24
|
+
readonly redeem: Readonly<VaultV2ForceRedeemParams["args"]["redeem"]>;
|
|
25
|
+
readonly onBehalf: Address;
|
|
26
|
+
};
|
|
27
|
+
readonly deallocationCalls: readonly Hex[];
|
|
28
|
+
readonly metadata?: Metadata;
|
|
29
|
+
readonly [vaultV2ForceRedeemInput]: true;
|
|
30
|
+
};
|
|
18
31
|
/**
|
|
19
32
|
* Prepares a force-redeem transaction for a VaultV2 contract via the vault's native `multicall`.
|
|
20
33
|
*
|
|
@@ -60,4 +73,9 @@ export interface VaultV2ForceRedeemParams {
|
|
|
60
73
|
* // tx satisfies Readonly<Transaction<VaultV2ForceRedeemAction>>
|
|
61
74
|
* ```
|
|
62
75
|
*/
|
|
63
|
-
export declare const vaultV2ForceRedeem: (
|
|
76
|
+
export declare const vaultV2ForceRedeem: (params: VaultV2ForceRedeemParams) => Readonly<Transaction<VaultV2ForceRedeemAction>>;
|
|
77
|
+
/** Preserves empty-list, shares, then per-deallocation validation and ABI order. @internal */
|
|
78
|
+
export declare const parseVaultV2ForceRedeem: (params: VaultV2ForceRedeemParams) => VaultV2ForceRedeemInput;
|
|
79
|
+
/** Encodes owned force-redeem inputs without rechecking them. @internal */
|
|
80
|
+
export declare const buildVaultV2ForceRedeem: ({ vault: { address: vaultAddress }, args: { deallocations, redeem, onBehalf }, deallocationCalls, metadata, }: VaultV2ForceRedeemInput) => Readonly<Transaction<VaultV2ForceRedeemAction>>;
|
|
81
|
+
export {};
|
|
@@ -49,17 +49,46 @@ import { EmptyDeallocationsError, NonPositiveInputError, } from "../../types/ind
|
|
|
49
49
|
* // tx satisfies Readonly<Transaction<VaultV2ForceRedeemAction>>
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
export const vaultV2ForceRedeem = (
|
|
52
|
+
export const vaultV2ForceRedeem = (params) => buildVaultV2ForceRedeem(parseVaultV2ForceRedeem(params));
|
|
53
|
+
/** Preserves empty-list, shares, then per-deallocation validation and ABI order. @internal */
|
|
54
|
+
export const parseVaultV2ForceRedeem = (params) => {
|
|
55
|
+
const { vault, args: { deallocations, redeem, onBehalf }, metadata, } = params;
|
|
53
56
|
if (deallocations.length === 0) {
|
|
54
|
-
throw new EmptyDeallocationsError(
|
|
57
|
+
throw new EmptyDeallocationsError(vault.address);
|
|
55
58
|
}
|
|
56
59
|
if (redeem.shares <= 0n) {
|
|
57
60
|
throw new NonPositiveInputError("redeem.shares", redeem.shares);
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
// Encode the same owned entry used in metadata, even for caller-owned getters.
|
|
63
|
+
// Preserve the original per-deallocation validation and ABI error order.
|
|
64
|
+
const deallocationCalls = [];
|
|
65
|
+
const deallocationSnapshots = Object.freeze(
|
|
66
|
+
// Visit sparse entries too: a missing deallocation must fail before encoding a transaction.
|
|
67
|
+
Array.from(deallocations, ({ adapter, marketParams, amount }) => {
|
|
68
|
+
const snapshot = Object.freeze({
|
|
69
|
+
adapter,
|
|
70
|
+
amount,
|
|
71
|
+
...(marketParams && {
|
|
72
|
+
marketParams: Object.freeze({ ...marketParams }),
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
75
|
+
deallocationCalls.push(encodeForceDeallocateCall(snapshot, onBehalf));
|
|
76
|
+
return snapshot;
|
|
77
|
+
}));
|
|
78
|
+
return {
|
|
79
|
+
vault: { address: vault.address },
|
|
80
|
+
args: {
|
|
81
|
+
deallocations: deallocationSnapshots,
|
|
82
|
+
redeem: { shares: redeem.shares, recipient: redeem.recipient },
|
|
83
|
+
onBehalf,
|
|
84
|
+
},
|
|
85
|
+
deallocationCalls: Object.freeze(deallocationCalls),
|
|
86
|
+
metadata,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/** Encodes owned force-redeem inputs without rechecking them. @internal */
|
|
90
|
+
export const buildVaultV2ForceRedeem = ({ vault: { address: vaultAddress }, args: { deallocations, redeem, onBehalf }, deallocationCalls, metadata, }) => {
|
|
91
|
+
const calls = [...deallocationCalls];
|
|
63
92
|
calls.push(encodeFunctionData({
|
|
64
93
|
abi: vaultV2Abi,
|
|
65
94
|
functionName: "redeem",
|
|
@@ -18,6 +18,23 @@ export interface VaultV2ForceWithdrawParams {
|
|
|
18
18
|
};
|
|
19
19
|
readonly metadata?: Metadata;
|
|
20
20
|
}
|
|
21
|
+
declare const vaultV2ForceWithdrawInput: unique symbol;
|
|
22
|
+
/** Checked force-withdraw fields, independent of snapshot and clock checks. @internal */
|
|
23
|
+
export type VaultV2ForceWithdrawInput = {
|
|
24
|
+
readonly vault: Readonly<VaultV2ForceWithdrawParams["vault"]>;
|
|
25
|
+
readonly args: Omit<VaultV2ForceWithdrawParams["args"], "requirementSignature" | "exitAssets" | "minSharePriceE27" | "deadline" | "referralFeePct" | "referralFeeRecipient"> & {
|
|
26
|
+
readonly exitAssets: bigint;
|
|
27
|
+
readonly minSharePriceE27: bigint;
|
|
28
|
+
readonly deadline: bigint;
|
|
29
|
+
};
|
|
30
|
+
readonly referral: {
|
|
31
|
+
readonly referralFeePct: bigint;
|
|
32
|
+
readonly referralFeeRecipient: Address;
|
|
33
|
+
};
|
|
34
|
+
readonly metadata?: Metadata;
|
|
35
|
+
readonly requirementSignature?: VaultV2ForceWithdrawParams["args"]["requirementSignature"];
|
|
36
|
+
readonly [vaultV2ForceWithdrawInput]: true;
|
|
37
|
+
};
|
|
21
38
|
/**
|
|
22
39
|
* Prepares a Vault V2 force withdrawal through VaultExitBundlesV1.
|
|
23
40
|
*
|
|
@@ -86,4 +103,9 @@ export interface VaultV2ForceWithdrawParams {
|
|
|
86
103
|
* }
|
|
87
104
|
* ```
|
|
88
105
|
*/
|
|
89
|
-
export declare const vaultV2ForceWithdraw: (
|
|
106
|
+
export declare const vaultV2ForceWithdraw: (params: VaultV2ForceWithdrawParams) => Readonly<Transaction<VaultV2ForceWithdrawAction>>;
|
|
107
|
+
/** Runs standalone force-withdraw stages in their established order. @internal */
|
|
108
|
+
export declare const parseVaultV2ForceWithdraw: (params: VaultV2ForceWithdrawParams) => VaultV2ForceWithdrawInput;
|
|
109
|
+
/** Encodes parsed fields and binds a fresh share permit. @internal */
|
|
110
|
+
export declare const buildVaultV2ForceWithdraw: (parsed: VaultV2ForceWithdrawInput, signatures?: Pick<VaultV2ForceWithdrawParams["args"], "requirementSignature">) => Readonly<Transaction<VaultV2ForceWithdrawAction>>;
|
|
111
|
+
export {};
|
|
@@ -2,9 +2,9 @@ import { deepFreeze, getChainAddress } from "@morpho-org/morpho-ts";
|
|
|
2
2
|
import { encodeFunctionData } from "viem";
|
|
3
3
|
import { vaultExitBundlesV1Abi } from "../../abis.js";
|
|
4
4
|
import { addTransactionMetadata } from "../../helpers/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { parseDeadline, parseReferralFee, parseUint256, } from "../../helpers/parse.js";
|
|
6
6
|
import { NonPositiveInputError, } from "../../types/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getParsedBundlesSharesPermit } from "../bundles/common.js";
|
|
8
8
|
/**
|
|
9
9
|
* Prepares a Vault V2 force withdrawal through VaultExitBundlesV1.
|
|
10
10
|
*
|
|
@@ -73,19 +73,39 @@ import { getBundlesSharesPermit } from "../bundles/common.js";
|
|
|
73
73
|
* }
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
|
-
export const vaultV2ForceWithdraw = (
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
export const vaultV2ForceWithdraw = (params) => buildVaultV2ForceWithdraw(parseVaultV2ForceWithdraw(params));
|
|
77
|
+
/** Runs standalone force-withdraw stages in their established order. @internal */
|
|
78
|
+
export const parseVaultV2ForceWithdraw = (params) => {
|
|
79
|
+
if (params.args.exitAssets <= 0n) {
|
|
80
|
+
throw new NonPositiveInputError("exitAssets", params.args.exitAssets);
|
|
79
81
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const exitAssets = parseUint256("exitAssets", params.args.exitAssets);
|
|
83
|
+
const deadline = parseDeadline(params.args.deadline);
|
|
84
|
+
const minSharePriceE27 = parseUint256("minSharePriceE27", params.args.minSharePriceE27);
|
|
85
|
+
const referral = parseReferralFee(params.args);
|
|
86
|
+
return {
|
|
87
|
+
vault: { chainId: params.vault.chainId, address: params.vault.address },
|
|
88
|
+
args: {
|
|
89
|
+
adapter: params.args.adapter,
|
|
90
|
+
userAddress: params.args.userAddress,
|
|
91
|
+
exitAssets,
|
|
92
|
+
deadline,
|
|
93
|
+
minSharePriceE27,
|
|
94
|
+
},
|
|
95
|
+
referral,
|
|
96
|
+
metadata: params.metadata,
|
|
97
|
+
requirementSignature: params.args.requirementSignature,
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/** Encodes parsed fields and binds a fresh share permit. @internal */
|
|
101
|
+
export const buildVaultV2ForceWithdraw = (parsed, signatures = parsed) => {
|
|
102
|
+
const { vault, metadata, referral: { referralFeePct, referralFeeRecipient }, } = parsed;
|
|
103
|
+
const args = {
|
|
104
|
+
...parsed.args,
|
|
105
|
+
requirementSignature: signatures.requirementSignature,
|
|
106
|
+
};
|
|
87
107
|
const to = getChainAddress(vault.chainId, "bundles.vaultExitBundlesV1");
|
|
88
|
-
const sharesPermit =
|
|
108
|
+
const sharesPermit = getParsedBundlesSharesPermit({
|
|
89
109
|
vault: vault.address,
|
|
90
110
|
deadline: args.deadline,
|
|
91
111
|
owner: args.userAddress,
|
|
@@ -17,6 +17,18 @@ export interface VaultV2InKindRedeemParams {
|
|
|
17
17
|
};
|
|
18
18
|
readonly metadata?: Metadata;
|
|
19
19
|
}
|
|
20
|
+
declare const vaultV2InKindRedeemInput: unique symbol;
|
|
21
|
+
/** Checked static in-kind fields; signatures and snapshots remain untrusted. @internal */
|
|
22
|
+
export type VaultV2InKindRedeemInput = {
|
|
23
|
+
readonly vault: Readonly<VaultV2InKindRedeemParams["vault"]>;
|
|
24
|
+
readonly args: Omit<VaultV2InKindRedeemParams["args"], "requirementSignature" | "amount" | "deadline"> & {
|
|
25
|
+
readonly amount: bigint;
|
|
26
|
+
readonly deadline: bigint;
|
|
27
|
+
};
|
|
28
|
+
readonly metadata?: Metadata;
|
|
29
|
+
readonly requirementSignature?: VaultV2InKindRedeemParams["args"]["requirementSignature"];
|
|
30
|
+
readonly [vaultV2InKindRedeemInput]: true;
|
|
31
|
+
};
|
|
20
32
|
/**
|
|
21
33
|
* Prepares a Vault V2 in-kind redemption into idle assets and Morpho Blue supply positions.
|
|
22
34
|
*
|
|
@@ -56,4 +68,9 @@ export interface VaultV2InKindRedeemParams {
|
|
|
56
68
|
* // tx satisfies Readonly<Transaction<VaultV2InKindRedeemAction>>
|
|
57
69
|
* ```
|
|
58
70
|
*/
|
|
59
|
-
export declare const vaultV2InKindRedeem: (
|
|
71
|
+
export declare const vaultV2InKindRedeem: (params: VaultV2InKindRedeemParams) => Readonly<Transaction<VaultV2InKindRedeemAction>>;
|
|
72
|
+
/** Constructs a complete in-kind operation, owning the ordered market tuples. @internal */
|
|
73
|
+
export declare const parseVaultV2InKindRedeem: (params: VaultV2InKindRedeemParams) => VaultV2InKindRedeemInput;
|
|
74
|
+
/** Encodes parsed fields and independently binds a fresh share permit. @internal */
|
|
75
|
+
export declare const buildVaultV2InKindRedeem: (parsed: VaultV2InKindRedeemInput, signatures?: Pick<VaultV2InKindRedeemParams["args"], "requirementSignature">) => Readonly<Transaction<VaultV2InKindRedeemAction>>;
|
|
76
|
+
export {};
|
|
@@ -2,9 +2,9 @@ import { deepFreeze, getChainAddress } from "@morpho-org/morpho-ts";
|
|
|
2
2
|
import { encodeFunctionData } from "viem";
|
|
3
3
|
import { vaultExitBundlesV1Abi } from "../../abis.js";
|
|
4
4
|
import { addTransactionMetadata } from "../../helpers/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { parseDeadline } from "../../helpers/parse.js";
|
|
6
6
|
import { NonPositiveInputError, } from "../../types/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getParsedBundlesSharesPermit } from "../bundles/common.js";
|
|
8
8
|
/**
|
|
9
9
|
* Prepares a Vault V2 in-kind redemption into idle assets and Morpho Blue supply positions.
|
|
10
10
|
*
|
|
@@ -44,20 +44,38 @@ import { getBundlesSharesPermit } from "../bundles/common.js";
|
|
|
44
44
|
* // tx satisfies Readonly<Transaction<VaultV2InKindRedeemAction>>
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
|
-
export const vaultV2InKindRedeem = (
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
export const vaultV2InKindRedeem = (params) => buildVaultV2InKindRedeem(parseVaultV2InKindRedeem(params));
|
|
48
|
+
/** Constructs a complete in-kind operation, owning the ordered market tuples. @internal */
|
|
49
|
+
export const parseVaultV2InKindRedeem = (params) => {
|
|
50
|
+
const amount = params.args.amount;
|
|
51
|
+
if (amount <= 0n) {
|
|
52
|
+
throw new NonPositiveInputError("amount", amount);
|
|
50
53
|
}
|
|
51
|
-
|
|
54
|
+
const deadline = parseDeadline(params.args.deadline);
|
|
55
|
+
const marketParamsList = params.args.marketParamsList.map(({ loanToken, collateralToken, oracle, irm, lltv }) => Object.freeze({ loanToken, collateralToken, oracle, irm, lltv }));
|
|
56
|
+
return {
|
|
57
|
+
vault: { chainId: params.vault.chainId, address: params.vault.address },
|
|
58
|
+
args: {
|
|
59
|
+
adapter: params.args.adapter,
|
|
60
|
+
userAddress: params.args.userAddress,
|
|
61
|
+
amount,
|
|
62
|
+
deadline,
|
|
63
|
+
marketParamsList: Object.freeze(marketParamsList),
|
|
64
|
+
},
|
|
65
|
+
metadata: params.metadata,
|
|
66
|
+
requirementSignature: params.args.requirementSignature,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/** Encodes parsed fields and independently binds a fresh share permit. @internal */
|
|
70
|
+
export const buildVaultV2InKindRedeem = (parsed, signatures = parsed) => {
|
|
71
|
+
const { vault, metadata } = parsed;
|
|
72
|
+
const args = {
|
|
73
|
+
...parsed.args,
|
|
74
|
+
requirementSignature: signatures.requirementSignature,
|
|
75
|
+
};
|
|
52
76
|
const to = getChainAddress(vault.chainId, "bundles.vaultExitBundlesV1");
|
|
53
|
-
const marketParamsList = args.marketParamsList
|
|
54
|
-
|
|
55
|
-
collateralToken: marketParams.collateralToken,
|
|
56
|
-
oracle: marketParams.oracle,
|
|
57
|
-
irm: marketParams.irm,
|
|
58
|
-
lltv: marketParams.lltv,
|
|
59
|
-
}));
|
|
60
|
-
const sharesPermit = getBundlesSharesPermit({
|
|
77
|
+
const marketParamsList = args.marketParamsList;
|
|
78
|
+
const sharesPermit = getParsedBundlesSharesPermit({
|
|
61
79
|
vault: vault.address,
|
|
62
80
|
deadline: args.deadline,
|
|
63
81
|
owner: args.userAddress,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
1
|
+
export { type VaultV2DepositParams, vaultV2Deposit } from "./deposit.js";
|
|
2
|
+
export { type VaultV2ForceRedeemParams, vaultV2ForceRedeem, } from "./forceRedeem.js";
|
|
3
|
+
export { type VaultV2ForceWithdrawParams, vaultV2ForceWithdraw, } from "./forceWithdraw.js";
|
|
4
|
+
export { type VaultV2InKindRedeemParams, vaultV2InKindRedeem, } from "./inKindRedeem.js";
|
|
5
|
+
export { type VaultV2RedeemParams, vaultV2Redeem } from "./redeem.js";
|
|
6
|
+
export { type VaultV2WithdrawParams, vaultV2Withdraw } from "./withdraw.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
1
|
+
export { vaultV2Deposit } from "./deposit.js";
|
|
2
|
+
export { vaultV2ForceRedeem, } from "./forceRedeem.js";
|
|
3
|
+
export { vaultV2ForceWithdraw, } from "./forceWithdraw.js";
|
|
4
|
+
export { vaultV2InKindRedeem, } from "./inKindRedeem.js";
|
|
5
|
+
export { vaultV2Redeem } from "./redeem.js";
|
|
6
|
+
export { vaultV2Withdraw } from "./withdraw.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
2
|
import { type Erc2612RequirementSignature, type Metadata, type Transaction, type VaultV2RedeemAction } from "../../types/index.js";
|
|
3
|
+
import { normalizeBundlesCommonParams as parseBundlesCommon } from "../bundles/common.js";
|
|
3
4
|
/** Parameters for {@link vaultV2Redeem}. */
|
|
4
5
|
export interface VaultV2RedeemParams {
|
|
5
6
|
readonly vault: {
|
|
@@ -29,6 +30,19 @@ export interface VaultV2RedeemParams {
|
|
|
29
30
|
/** Optional analytics metadata appended to the transaction calldata. */
|
|
30
31
|
readonly metadata?: Metadata;
|
|
31
32
|
}
|
|
33
|
+
declare const parsedVaultV2Redeem: unique symbol;
|
|
34
|
+
/** Validated redeem inputs, independent of signatures. @internal */
|
|
35
|
+
export type VaultV2RedeemInput = {
|
|
36
|
+
readonly vault: Readonly<VaultV2RedeemParams["vault"]>;
|
|
37
|
+
readonly args: Omit<VaultV2RedeemParams["args"], "requirementSignature" | "shares" | "deadline"> & {
|
|
38
|
+
readonly shares: bigint;
|
|
39
|
+
readonly deadline: ReturnType<typeof parseBundlesCommon>["deadline"];
|
|
40
|
+
};
|
|
41
|
+
readonly common: ReturnType<typeof parseBundlesCommon>;
|
|
42
|
+
readonly metadata?: Metadata;
|
|
43
|
+
readonly requirementSignature?: VaultV2RedeemParams["args"]["requirementSignature"];
|
|
44
|
+
readonly [parsedVaultV2Redeem]: true;
|
|
45
|
+
};
|
|
32
46
|
/**
|
|
33
47
|
* Encodes an exact-shares Vault V2 redemption through VaultBundlesV1.
|
|
34
48
|
*
|
|
@@ -71,3 +85,8 @@ export interface VaultV2RedeemParams {
|
|
|
71
85
|
* ```
|
|
72
86
|
*/
|
|
73
87
|
export declare const vaultV2Redeem: (params: VaultV2RedeemParams) => Readonly<Transaction<VaultV2RedeemAction>>;
|
|
88
|
+
/** Parses the amount and common fields in standalone order. @internal */
|
|
89
|
+
export declare const parseVaultV2Redeem: (params: VaultV2RedeemParams) => VaultV2RedeemInput;
|
|
90
|
+
/** Encodes parsed inputs and validates a fresh share signature. @internal */
|
|
91
|
+
export declare const buildVaultV2Redeem: (parsed: VaultV2RedeemInput, signatures?: Pick<VaultV2RedeemParams["args"], "requirementSignature">) => Readonly<Transaction<VaultV2RedeemAction>>;
|
|
92
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getChainAddress } from "@morpho-org/morpho-ts";
|
|
2
2
|
import { encodeFunctionData } from "viem";
|
|
3
3
|
import { vaultBundlesV1Abi } from "../../abis.js";
|
|
4
|
-
import {
|
|
4
|
+
import { parseUint256 } from "../../helpers/parse.js";
|
|
5
5
|
import { NonPositiveInputError, } from "../../types/index.js";
|
|
6
|
-
import { finalizeVaultBundlesV1Transaction,
|
|
6
|
+
import { finalizeVaultBundlesV1Transaction, getParsedBundlesSharesPermit, normalizeBundlesCommonParams as parseBundlesCommon, } from "../bundles/common.js";
|
|
7
7
|
/**
|
|
8
8
|
* Encodes an exact-shares Vault V2 redemption through VaultBundlesV1.
|
|
9
9
|
*
|
|
@@ -45,15 +45,34 @@ import { finalizeVaultBundlesV1Transaction, getBundlesSharesPermit, normalizeBun
|
|
|
45
45
|
* // tx.action.type === "vaultV2Redeem"
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
|
-
export const vaultV2Redeem = (params) =>
|
|
48
|
+
export const vaultV2Redeem = (params) => buildVaultV2Redeem(parseVaultV2Redeem(params));
|
|
49
|
+
/** Parses the amount and common fields in standalone order. @internal */
|
|
50
|
+
export const parseVaultV2Redeem = (params) => {
|
|
49
51
|
if (params.args.shares <= 0n) {
|
|
50
52
|
throw new NonPositiveInputError("shares", params.args.shares);
|
|
51
53
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
const shares = parseUint256("shares", params.args.shares);
|
|
55
|
+
const common = parseBundlesCommon(params.args);
|
|
56
|
+
return {
|
|
57
|
+
vault: { chainId: params.vault.chainId, address: params.vault.address },
|
|
58
|
+
args: { shares, userAddress: params.args.userAddress, ...common },
|
|
59
|
+
common,
|
|
60
|
+
metadata: params.metadata,
|
|
61
|
+
requirementSignature: params.args.requirementSignature,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/** Encodes parsed inputs and validates a fresh share signature. @internal */
|
|
65
|
+
export const buildVaultV2Redeem = (parsed, signatures = parsed) => {
|
|
66
|
+
const { common } = parsed;
|
|
67
|
+
const params = {
|
|
68
|
+
...parsed,
|
|
69
|
+
args: {
|
|
70
|
+
...parsed.args,
|
|
71
|
+
requirementSignature: signatures.requirementSignature,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
55
74
|
const spender = getChainAddress(params.vault.chainId, "bundles.vaultBundlesV1");
|
|
56
|
-
const sharesPermit =
|
|
75
|
+
const sharesPermit = getParsedBundlesSharesPermit({
|
|
57
76
|
vault: params.vault.address,
|
|
58
77
|
deadline: common.deadline,
|
|
59
78
|
owner: params.args.userAddress,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
2
|
import { type Erc2612RequirementSignature, type Metadata, type Transaction, type VaultV2WithdrawAction } from "../../types/index.js";
|
|
3
|
+
import { normalizeBundlesCommonParams as parseBundlesCommon } from "../bundles/common.js";
|
|
3
4
|
/** Parameters for {@link vaultV2Withdraw}. */
|
|
4
5
|
export interface VaultV2WithdrawParams {
|
|
5
6
|
readonly vault: {
|
|
@@ -18,6 +19,19 @@ export interface VaultV2WithdrawParams {
|
|
|
18
19
|
};
|
|
19
20
|
readonly metadata?: Metadata;
|
|
20
21
|
}
|
|
22
|
+
declare const parsedVaultV2Withdraw: unique symbol;
|
|
23
|
+
/** Validated withdraw inputs, independent of signatures. @internal */
|
|
24
|
+
export type VaultV2WithdrawInput = {
|
|
25
|
+
readonly vault: Readonly<VaultV2WithdrawParams["vault"]>;
|
|
26
|
+
readonly args: Omit<VaultV2WithdrawParams["args"], "requirementSignature" | "amount" | "deadline"> & {
|
|
27
|
+
readonly amount: bigint;
|
|
28
|
+
readonly deadline: ReturnType<typeof parseBundlesCommon>["deadline"];
|
|
29
|
+
};
|
|
30
|
+
readonly common: ReturnType<typeof parseBundlesCommon>;
|
|
31
|
+
readonly metadata?: Metadata;
|
|
32
|
+
readonly requirementSignature?: VaultV2WithdrawParams["args"]["requirementSignature"];
|
|
33
|
+
readonly [parsedVaultV2Withdraw]: true;
|
|
34
|
+
};
|
|
21
35
|
/**
|
|
22
36
|
* Encodes an exact-assets Vault V2 withdrawal through VaultBundlesV1.
|
|
23
37
|
*
|
|
@@ -71,3 +85,8 @@ export interface VaultV2WithdrawParams {
|
|
|
71
85
|
* ```
|
|
72
86
|
*/
|
|
73
87
|
export declare const vaultV2Withdraw: (params: VaultV2WithdrawParams) => Readonly<Transaction<VaultV2WithdrawAction>>;
|
|
88
|
+
/** Parses the amount and common fields in standalone order. @internal */
|
|
89
|
+
export declare const parseVaultV2Withdraw: (params: VaultV2WithdrawParams) => VaultV2WithdrawInput;
|
|
90
|
+
/** Encodes parsed inputs and validates a fresh share signature. @internal */
|
|
91
|
+
export declare const buildVaultV2Withdraw: (parsed: VaultV2WithdrawInput, signatures?: Pick<VaultV2WithdrawParams["args"], "requirementSignature">) => Readonly<Transaction<VaultV2WithdrawAction>>;
|
|
92
|
+
export {};
|