@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,16 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBundlesTokenRequirements = void 0;
|
|
3
|
+
exports.getParsedBundlesTokenRequirements = exports.getBundlesTokenRequirements = exports.parseGetBundlesTokenRequirements = void 0;
|
|
4
4
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const actions_1 = require("viem/actions");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
9
|
+
const getRequirementsApproval_js_1 = require("../../actions/requirements/getRequirementsApproval.js");
|
|
10
|
+
const index_js_1 = require("../../helpers/index.js");
|
|
11
11
|
const validate_js_1 = require("../../helpers/validate.js");
|
|
12
|
-
const
|
|
12
|
+
const index_js_2 = require("../../types/index.js");
|
|
13
13
|
const getErc2612Permit_js_1 = require("./getErc2612Permit.js");
|
|
14
|
+
/** Owns static checks and defaults without reading state. @internal */
|
|
15
|
+
const parseGetBundlesTokenRequirements = (viemClient, params) => {
|
|
16
|
+
const input = {
|
|
17
|
+
token: params.token,
|
|
18
|
+
spender: params.spender,
|
|
19
|
+
amount: params.amount,
|
|
20
|
+
owner: params.owner,
|
|
21
|
+
chainId: params.chainId,
|
|
22
|
+
deadline: params.deadline,
|
|
23
|
+
supportSignature: params.supportSignature,
|
|
24
|
+
supportDeployless: params.supportDeployless,
|
|
25
|
+
useSimplePermit: params.useSimplePermit,
|
|
26
|
+
permit2Nonce: params.permit2Nonce,
|
|
27
|
+
now: params.now,
|
|
28
|
+
};
|
|
29
|
+
(0, index_js_1.validateChainId)(viemClient.chain?.id, input.chainId);
|
|
30
|
+
(0, index_js_1.validateRequirementSpender)({
|
|
31
|
+
chainId: input.chainId,
|
|
32
|
+
spender: input.spender,
|
|
33
|
+
allowed: ["blueBundlesV1", "vaultBundlesV1"],
|
|
34
|
+
});
|
|
35
|
+
if (input.amount < 0n) {
|
|
36
|
+
throw new index_js_2.NegativeInputError("amount", input.amount);
|
|
37
|
+
}
|
|
38
|
+
if (input.amount > viem_1.maxUint256) {
|
|
39
|
+
throw new index_js_2.InputExceedsMaxError({
|
|
40
|
+
field: "amount",
|
|
41
|
+
value: input.amount,
|
|
42
|
+
max: viem_1.maxUint256,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
(0, validate_js_1.validateDeadline)(input.deadline);
|
|
46
|
+
return {
|
|
47
|
+
...input,
|
|
48
|
+
useSimplePermit: input.useSimplePermit ?? true,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.parseGetBundlesTokenRequirements = parseGetBundlesTokenRequirements;
|
|
14
52
|
/**
|
|
15
53
|
* Resolves direct approval or ERC-2612 prerequisites for a registered fixed bundles contract.
|
|
16
54
|
*
|
|
@@ -79,37 +117,23 @@ const getErc2612Permit_js_1 = require("./getErc2612Permit.js");
|
|
|
79
117
|
* ```
|
|
80
118
|
*/
|
|
81
119
|
const getBundlesTokenRequirements = async (viemClient, params) => {
|
|
82
|
-
(0,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (params.amount < 0n) {
|
|
89
|
-
throw new index_js_3.NegativeInputError("amount", params.amount);
|
|
90
|
-
}
|
|
91
|
-
// Reject oversized inputs before any RPC read so this resolver never asks the user to sign or
|
|
92
|
-
// submit an approval/permit that the eventual BlueBundlesV1 call (uint256 ABI) would reject.
|
|
93
|
-
if (params.amount > viem_1.maxUint256) {
|
|
94
|
-
throw new index_js_3.InputExceedsMaxError({
|
|
95
|
-
field: "amount",
|
|
96
|
-
value: params.amount,
|
|
97
|
-
max: viem_1.maxUint256,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
// Reject deadlines outside the positive uint256 range before reading state.
|
|
101
|
-
(0, validate_js_1.validateDeadline)(params.deadline);
|
|
120
|
+
return (0, exports.getParsedBundlesTokenRequirements)({ viemClient }, (0, exports.parseGetBundlesTokenRequirements)(viemClient, params));
|
|
121
|
+
};
|
|
122
|
+
exports.getBundlesTokenRequirements = getBundlesTokenRequirements;
|
|
123
|
+
/** Consumes a complete invocation while retaining dynamic freshness and RPC order. @internal */
|
|
124
|
+
const getParsedBundlesTokenRequirements = async ({ viemClient, chainCheck: providedChainCheck, }, params) => {
|
|
125
|
+
const chainCheck = providedChainCheck ?? (0, chainCheck_js_1.createChainCheck)(viemClient, params.chainId);
|
|
102
126
|
// Reject an already-expired deadline before the RPC reads so a direct caller of this resolver
|
|
103
127
|
// never signs a permit for a supply the BlueBundlesV1 call would revert. The entity validates
|
|
104
128
|
// this too, but the exported resolver must guard its own callers.
|
|
105
129
|
const timestamp = params.now ?? morpho_ts_1.Time.timestamp();
|
|
106
130
|
if (params.deadline <= timestamp) {
|
|
107
|
-
throw new
|
|
131
|
+
throw new index_js_2.ExpiredDeadlineError(params.deadline, timestamp);
|
|
108
132
|
}
|
|
109
133
|
if (params.amount === 0n) {
|
|
110
134
|
return [];
|
|
111
135
|
}
|
|
112
|
-
await (
|
|
136
|
+
await chainCheck();
|
|
113
137
|
const allowance = await (0, actions_1.readContract)(viemClient, {
|
|
114
138
|
abi: viem_1.erc20Abi,
|
|
115
139
|
address: params.token,
|
|
@@ -123,33 +147,17 @@ const getBundlesTokenRequirements = async (viemClient, params) => {
|
|
|
123
147
|
const isDai = params.supportSignature &&
|
|
124
148
|
(0, morpho_ts_1.isDefined)(dai) &&
|
|
125
149
|
(0, viem_1.isAddressEqual)(params.token, dai);
|
|
126
|
-
if (params.supportSignature &&
|
|
127
|
-
const permit = await (0, getErc2612Permit_js_1.
|
|
128
|
-
token: params.token,
|
|
129
|
-
owner: params.owner,
|
|
130
|
-
spender: params.spender,
|
|
131
|
-
amount: params.amount,
|
|
132
|
-
chainId: params.chainId,
|
|
133
|
-
deadline: params.deadline,
|
|
134
|
-
now: timestamp,
|
|
135
|
-
supportDeployless: params.supportDeployless,
|
|
136
|
-
});
|
|
150
|
+
if (params.supportSignature && params.useSimplePermit && !isDai) {
|
|
151
|
+
const permit = await (0, getErc2612Permit_js_1.getBundlesErc2612Permit)({ viemClient, chainCheck }, { ...params, now: timestamp });
|
|
137
152
|
if ((0, morpho_ts_1.isDefined)(permit)) {
|
|
138
153
|
return [permit];
|
|
139
154
|
}
|
|
140
155
|
}
|
|
141
|
-
return (0,
|
|
142
|
-
|
|
143
|
-
spender: params.spender,
|
|
144
|
-
owner: params.owner,
|
|
156
|
+
return (0, getRequirementsApproval_js_1.getParsedRequirementsApproval)((0, getRequirementsApproval_js_1.parseRequirementsApproval)({
|
|
157
|
+
address: params.token,
|
|
145
158
|
chainId: params.chainId,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
state: {
|
|
150
|
-
type: "approval",
|
|
151
|
-
allowance,
|
|
152
|
-
},
|
|
153
|
-
});
|
|
159
|
+
args: { spender: params.spender, spendAmount: params.amount },
|
|
160
|
+
allowances: allowance,
|
|
161
|
+
}));
|
|
154
162
|
};
|
|
155
|
-
exports.
|
|
163
|
+
exports.getParsedBundlesTokenRequirements = getParsedBundlesTokenRequirements;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { Client } from "viem";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { ChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
3
|
+
import type { GetBundlesTokenRequirementsInput } from "./getBundlesTokenRequirements.js";
|
|
4
|
+
/** Uses the enclosing token resolver's complete checked input, not scalar witnesses. @internal */
|
|
5
|
+
export declare const getBundlesErc2612Permit: ({ viemClient, chainCheck, }: {
|
|
6
|
+
readonly viemClient: Client;
|
|
7
|
+
readonly chainCheck: ChainCheck;
|
|
8
|
+
}, params: GetBundlesTokenRequirementsInput) => Promise<import("../../index.js").Requirement<import("../../index.js").Erc2612RequirementSignature, undefined> | undefined>;
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getBundlesErc2612Permit = void 0;
|
|
4
4
|
const encodeErc20Permit_js_1 = require("../../actions/requirements/encode/encodeErc20Permit.js");
|
|
5
5
|
const readErc2612Permit_js_1 = require("../../reads/readErc2612Permit.js");
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/** Uses the enclosing token resolver's complete checked input, not scalar witnesses. @internal */
|
|
7
|
+
const getBundlesErc2612Permit = ({ viemClient, chainCheck, }, params) => resolveErc2612Permit(viemClient, {
|
|
8
|
+
...params,
|
|
9
|
+
encodePermit: (nonce) => (0, encodeErc20Permit_js_1.encodeParsedErc20Permit)({ viemClient, chainCheck }, (0, encodeErc20Permit_js_1.parseErc20Permit)(viemClient, {
|
|
10
|
+
token: params.token,
|
|
11
|
+
owner: params.owner,
|
|
12
|
+
spender: params.spender,
|
|
13
|
+
amount: params.amount,
|
|
14
|
+
chainId: params.chainId,
|
|
15
|
+
nonce,
|
|
16
|
+
deadline: params.deadline,
|
|
17
|
+
now: params.now,
|
|
18
|
+
supportDeployless: params.supportDeployless,
|
|
19
|
+
})),
|
|
20
|
+
});
|
|
21
|
+
exports.getBundlesErc2612Permit = getBundlesErc2612Permit;
|
|
22
|
+
/** Preserves the shared nonce/domain fallback and transport-error behavior. */
|
|
23
|
+
function resolveErc2612Permit(viemClient, params) {
|
|
8
24
|
return (0, readErc2612Permit_js_1.readErc2612Permit)(viemClient, {
|
|
9
25
|
token: params.token,
|
|
10
26
|
owner: params.owner,
|
|
11
27
|
resolve: async (nonce) => {
|
|
12
|
-
const result = await
|
|
28
|
+
const result = await params.encodePermit(nonce);
|
|
13
29
|
return { domain: result.action.typedData.domain, result };
|
|
14
30
|
},
|
|
15
31
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Address, type Client } from "viem";
|
|
2
|
+
import { type ChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
2
3
|
/**
|
|
3
4
|
* Parameters for {@link getUnusedPermit2Nonce}.
|
|
4
5
|
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
@@ -11,6 +12,14 @@ export interface GetUnusedPermit2NonceParams {
|
|
|
11
12
|
/** Lowest nonce to consider; defaults to 0. */
|
|
12
13
|
readonly startNonce?: bigint;
|
|
13
14
|
}
|
|
15
|
+
declare const unusedPermit2NonceInput: unique symbol;
|
|
16
|
+
/** Complete checked legacy nonce lookup invocation. @internal */
|
|
17
|
+
export type UnusedPermit2NonceInput = Readonly<GetUnusedPermit2NonceParams> & {
|
|
18
|
+
readonly startNonce: bigint;
|
|
19
|
+
readonly [unusedPermit2NonceInput]: true;
|
|
20
|
+
};
|
|
21
|
+
/** Owns the complete lookup's chain declaration, bounds and default start nonce. @internal */
|
|
22
|
+
export declare const parseUnusedPermit2Nonce: (viemClient: Client, params: GetUnusedPermit2NonceParams) => UnusedPermit2NonceInput;
|
|
14
23
|
/**
|
|
15
24
|
* Finds the lowest unused Permit2 unordered nonce for legacy SignatureTransfer integrations.
|
|
16
25
|
*
|
|
@@ -50,3 +59,9 @@ export interface GetUnusedPermit2NonceParams {
|
|
|
50
59
|
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
51
60
|
*/
|
|
52
61
|
export declare const getUnusedPermit2Nonce: (viemClient: Client, params: GetUnusedPermit2NonceParams) => Promise<bigint>;
|
|
62
|
+
/** Scans from the complete checked lookup, preserving registry and RPC ordering. @internal */
|
|
63
|
+
export declare const getParsedUnusedPermit2Nonce: ({ viemClient, chainCheck: providedChainCheck, }: {
|
|
64
|
+
readonly viemClient: Client;
|
|
65
|
+
readonly chainCheck?: ChainCheck;
|
|
66
|
+
}, params: UnusedPermit2NonceInput) => Promise<bigint>;
|
|
67
|
+
export {};
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUnusedPermit2Nonce = void 0;
|
|
3
|
+
exports.getParsedUnusedPermit2Nonce = exports.getUnusedPermit2Nonce = exports.parseUnusedPermit2Nonce = void 0;
|
|
4
4
|
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
5
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const actions_1 = require("viem/actions");
|
|
8
|
-
const
|
|
8
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
9
9
|
const index_js_1 = require("../../helpers/index.js");
|
|
10
10
|
const validate_js_1 = require("../../helpers/validate.js");
|
|
11
11
|
const index_js_2 = require("../../types/index.js");
|
|
12
|
+
/** Owns the complete lookup's chain declaration, bounds and default start nonce. @internal */
|
|
13
|
+
const parseUnusedPermit2Nonce = (viemClient, params) => {
|
|
14
|
+
const input = {
|
|
15
|
+
owner: params.owner,
|
|
16
|
+
chainId: params.chainId,
|
|
17
|
+
startNonce: params.startNonce,
|
|
18
|
+
};
|
|
19
|
+
(0, index_js_1.validateChainId)(viemClient.chain?.id, input.chainId);
|
|
20
|
+
const startNonce = input.startNonce ?? 0n;
|
|
21
|
+
(0, validate_js_1.validateUint256Field)("startNonce", startNonce);
|
|
22
|
+
return { ...input, startNonce };
|
|
23
|
+
};
|
|
24
|
+
exports.parseUnusedPermit2Nonce = parseUnusedPermit2Nonce;
|
|
12
25
|
/** Highest Permit2 nonce-bitmap word index; each word covers 256 unordered nonces. */
|
|
13
26
|
const MAX_PERMIT2_NONCE_WORD = viem_1.maxUint256 >> 8n;
|
|
14
27
|
/**
|
|
@@ -50,10 +63,14 @@ const MAX_PERMIT2_NONCE_WORD = viem_1.maxUint256 >> 8n;
|
|
|
50
63
|
* @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
|
|
51
64
|
*/
|
|
52
65
|
const getUnusedPermit2Nonce = async (viemClient, params) => {
|
|
53
|
-
(0,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
return (0, exports.getParsedUnusedPermit2Nonce)({ viemClient }, (0, exports.parseUnusedPermit2Nonce)(viemClient, params));
|
|
67
|
+
};
|
|
68
|
+
exports.getUnusedPermit2Nonce = getUnusedPermit2Nonce;
|
|
69
|
+
/** Scans from the complete checked lookup, preserving registry and RPC ordering. @internal */
|
|
70
|
+
const getParsedUnusedPermit2Nonce = async ({ viemClient, chainCheck: providedChainCheck, }, params) => {
|
|
71
|
+
const chainCheck = providedChainCheck ?? (0, chainCheck_js_1.createChainCheck)(viemClient, params.chainId);
|
|
72
|
+
const { startNonce } = params;
|
|
73
|
+
await chainCheck();
|
|
57
74
|
const permit2 = (0, morpho_ts_1.getChainAddress)(params.chainId, "permit2");
|
|
58
75
|
const startWord = startNonce >> 8n;
|
|
59
76
|
for (let word = startWord; word <= MAX_PERMIT2_NONCE_WORD; word++) {
|
|
@@ -72,4 +89,4 @@ const getUnusedPermit2Nonce = async (viemClient, params) => {
|
|
|
72
89
|
}
|
|
73
90
|
throw new index_js_2.NoUnusedPermit2NonceError(params.owner, startNonce);
|
|
74
91
|
};
|
|
75
|
-
exports.
|
|
92
|
+
exports.getParsedUnusedPermit2Nonce = getParsedUnusedPermit2Nonce;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { Token } from "@morpho-org/blue-sdk";
|
|
2
2
|
import type { Address, Client } from "viem";
|
|
3
|
+
import { type ChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
3
4
|
import { type ERC20ApprovalAction, type PermitRequirementSignature, type ReferenceTimestampParams, type Requirement, type Transaction } from "../../types/index.js";
|
|
5
|
+
declare const vaultBundlesSharesRequirementsInput: unique symbol;
|
|
6
|
+
/** Complete checked vault-share resolver invocation. @internal */
|
|
7
|
+
export type VaultBundlesSharesRequirementsInput = Readonly<Parameters<typeof getVaultBundlesSharesRequirements>[1]> & {
|
|
8
|
+
readonly [vaultBundlesSharesRequirementsInput]: true;
|
|
9
|
+
};
|
|
10
|
+
/** Owns declared-chain and deadline checks before state is read. @internal */
|
|
11
|
+
export declare const parseVaultBundlesSharesRequirements: (viemClient: Client, params: Parameters<typeof getVaultBundlesSharesRequirements>[1]) => VaultBundlesSharesRequirementsInput;
|
|
4
12
|
/**
|
|
5
13
|
* Resolves the vault-share approval or ERC-2612 requirement for a VaultBundlesV1 exit.
|
|
6
14
|
*
|
|
@@ -29,3 +37,9 @@ export declare const getVaultBundlesSharesRequirements: (viemClient: Client, par
|
|
|
29
37
|
readonly deadline: bigint;
|
|
30
38
|
readonly supportSignature: boolean;
|
|
31
39
|
} & ReferenceTimestampParams) => Promise<readonly (Readonly<Transaction<ERC20ApprovalAction>> | Requirement<PermitRequirementSignature>)[]>;
|
|
40
|
+
/** Consumes the complete invocation without repeating static validation. @internal */
|
|
41
|
+
export declare const getParsedVaultBundlesSharesRequirements: ({ viemClient, chainCheck: providedChainCheck, }: {
|
|
42
|
+
readonly viemClient: Client;
|
|
43
|
+
readonly chainCheck?: ChainCheck;
|
|
44
|
+
}, params: VaultBundlesSharesRequirementsInput) => ReturnType<typeof getVaultBundlesSharesRequirements>;
|
|
45
|
+
export {};
|
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVaultBundlesSharesRequirements = void 0;
|
|
3
|
+
exports.getParsedVaultBundlesSharesRequirements = exports.getVaultBundlesSharesRequirements = exports.parseVaultBundlesSharesRequirements = void 0;
|
|
4
4
|
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
5
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const actions_1 = require("viem/actions");
|
|
8
8
|
const index_js_1 = require("../../actions/index.js");
|
|
9
|
-
const
|
|
9
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
10
10
|
const index_js_2 = require("../../helpers/index.js");
|
|
11
11
|
const validate_js_1 = require("../../helpers/validate.js");
|
|
12
12
|
const index_js_3 = require("../../types/index.js");
|
|
13
|
+
/** Owns declared-chain and deadline checks before state is read. @internal */
|
|
14
|
+
const parseVaultBundlesSharesRequirements = (viemClient, params) => {
|
|
15
|
+
const input = {
|
|
16
|
+
vaultData: params.vaultData,
|
|
17
|
+
version: params.version,
|
|
18
|
+
owner: params.owner,
|
|
19
|
+
chainId: params.chainId,
|
|
20
|
+
requiredShareAllowance: params.requiredShareAllowance,
|
|
21
|
+
deadline: params.deadline,
|
|
22
|
+
supportSignature: params.supportSignature,
|
|
23
|
+
now: params.now,
|
|
24
|
+
};
|
|
25
|
+
(0, index_js_2.validateChainId)(viemClient.chain?.id, input.chainId);
|
|
26
|
+
(0, validate_js_1.validateDeadline)(input.deadline);
|
|
27
|
+
return { ...input };
|
|
28
|
+
};
|
|
29
|
+
exports.parseVaultBundlesSharesRequirements = parseVaultBundlesSharesRequirements;
|
|
13
30
|
/**
|
|
14
31
|
* Resolves the vault-share approval or ERC-2612 requirement for a VaultBundlesV1 exit.
|
|
15
32
|
*
|
|
@@ -30,14 +47,17 @@ const index_js_3 = require("../../types/index.js");
|
|
|
30
47
|
* @throws {viem.BaseError} when an allowance, permit nonce, or `eth_chainId` read fails.
|
|
31
48
|
*/
|
|
32
49
|
const getVaultBundlesSharesRequirements = async (viemClient, params) => {
|
|
33
|
-
(0,
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
return (0, exports.getParsedVaultBundlesSharesRequirements)({ viemClient }, (0, exports.parseVaultBundlesSharesRequirements)(viemClient, params));
|
|
51
|
+
};
|
|
52
|
+
exports.getVaultBundlesSharesRequirements = getVaultBundlesSharesRequirements;
|
|
53
|
+
/** Consumes the complete invocation without repeating static validation. @internal */
|
|
54
|
+
const getParsedVaultBundlesSharesRequirements = async ({ viemClient, chainCheck: providedChainCheck, }, params) => {
|
|
55
|
+
const chainCheck = providedChainCheck ?? (0, chainCheck_js_1.createChainCheck)(viemClient, params.chainId);
|
|
36
56
|
const now = params.now ?? morpho_ts_1.Time.timestamp();
|
|
37
57
|
if (params.deadline <= now) {
|
|
38
58
|
throw new index_js_3.ExpiredDeadlineError(params.deadline, now);
|
|
39
59
|
}
|
|
40
|
-
await (
|
|
60
|
+
await chainCheck();
|
|
41
61
|
const spender = (0, morpho_ts_1.getChainAddress)(params.chainId, "bundles.vaultBundlesV1");
|
|
42
62
|
// The allowance is trusted as returned by the RPC. See THREAT_MODEL.md, RPC.
|
|
43
63
|
const allowance = await (0, actions_1.readContract)(viemClient, {
|
|
@@ -78,4 +98,4 @@ const getVaultBundlesSharesRequirements = async (viemClient, params) => {
|
|
|
78
98
|
}),
|
|
79
99
|
];
|
|
80
100
|
};
|
|
81
|
-
exports.
|
|
101
|
+
exports.getParsedVaultBundlesSharesRequirements = getParsedVaultBundlesSharesRequirements;
|
|
@@ -6,7 +6,7 @@ const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const actions_1 = require("viem/actions");
|
|
8
8
|
const index_js_1 = require("../../actions/index.js");
|
|
9
|
-
const
|
|
9
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
10
10
|
const index_js_2 = require("../../types/index.js");
|
|
11
11
|
const assertContractCode_js_1 = require("./assertContractCode.js");
|
|
12
12
|
/**
|
|
@@ -24,14 +24,15 @@ async function getVaultV1InKindRedeemRequirements(client, params) {
|
|
|
24
24
|
if (deadline <= requirementsTimestamp) {
|
|
25
25
|
throw new index_js_2.ExpiredDeadlineError(deadline, requirementsTimestamp);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const chainCheck = (0, chainCheck_js_1.createChainCheck)(client, chainId);
|
|
28
|
+
await chainCheck();
|
|
28
29
|
await (0, assertContractCode_js_1.assertRegistryTargetsHaveCode)(client, chainId, [
|
|
29
30
|
{
|
|
30
31
|
role: "bundles.vaultExitBundlesV1",
|
|
31
32
|
address: (0, morpho_ts_1.getChainAddress)(chainId, "bundles.vaultExitBundlesV1"),
|
|
32
33
|
},
|
|
33
34
|
{ role: "blue", address: (0, morpho_ts_1.getChainAddress)(chainId, "blue") },
|
|
34
|
-
]);
|
|
35
|
+
], chainCheck);
|
|
35
36
|
const [allowance, nonce, blueBalance, morpho, blueFeeRecipient] = await Promise.all([
|
|
36
37
|
(0, actions_1.readContract)(client, {
|
|
37
38
|
address: vault,
|
|
@@ -6,7 +6,7 @@ const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const actions_1 = require("viem/actions");
|
|
8
8
|
const index_js_1 = require("../../actions/index.js");
|
|
9
|
-
const
|
|
9
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
10
10
|
const index_js_2 = require("../../types/index.js");
|
|
11
11
|
const assertContractCode_js_1 = require("./assertContractCode.js");
|
|
12
12
|
/**
|
|
@@ -23,13 +23,14 @@ async function getVaultV2ForceWithdrawRequirements(client, params) {
|
|
|
23
23
|
if (deadline <= requirementsTimestamp) {
|
|
24
24
|
throw new index_js_2.ExpiredDeadlineError(deadline, requirementsTimestamp);
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
const chainCheck = (0, chainCheck_js_1.createChainCheck)(client, chainId);
|
|
27
|
+
await chainCheck();
|
|
27
28
|
await (0, assertContractCode_js_1.assertRegistryTargetsHaveCode)(client, chainId, [
|
|
28
29
|
{
|
|
29
30
|
role: "bundles.vaultExitBundlesV1",
|
|
30
31
|
address: (0, morpho_ts_1.getChainAddress)(chainId, "bundles.vaultExitBundlesV1"),
|
|
31
32
|
},
|
|
32
|
-
]);
|
|
33
|
+
], chainCheck);
|
|
33
34
|
// Vault gates are intentionally left to the final transaction: the receive-assets gate may
|
|
34
35
|
// inspect VaultExitBundlesV1's transient `initiator`, and a send-shares gate is arbitrary
|
|
35
36
|
// external code re-evaluated after each intermediate penalty burn, so neither is
|
|
@@ -6,7 +6,7 @@ const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const actions_1 = require("viem/actions");
|
|
8
8
|
const index_js_1 = require("../../actions/index.js");
|
|
9
|
-
const
|
|
9
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
10
10
|
const index_js_2 = require("../../types/index.js");
|
|
11
11
|
const assertContractCode_js_1 = require("./assertContractCode.js");
|
|
12
12
|
/**
|
|
@@ -24,14 +24,15 @@ async function getVaultV2InKindRedeemRequirements(client, params) {
|
|
|
24
24
|
if (deadline <= requirementsTimestamp) {
|
|
25
25
|
throw new index_js_2.ExpiredDeadlineError(deadline, requirementsTimestamp);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const chainCheck = (0, chainCheck_js_1.createChainCheck)(client, chainId);
|
|
28
|
+
await chainCheck();
|
|
28
29
|
await (0, assertContractCode_js_1.assertRegistryTargetsHaveCode)(client, chainId, [
|
|
29
30
|
{
|
|
30
31
|
role: "bundles.vaultExitBundlesV1",
|
|
31
32
|
address: (0, morpho_ts_1.getChainAddress)(chainId, "bundles.vaultExitBundlesV1"),
|
|
32
33
|
},
|
|
33
34
|
{ role: "blue", address: (0, morpho_ts_1.getChainAddress)(chainId, "blue") },
|
|
34
|
-
]);
|
|
35
|
+
], chainCheck);
|
|
35
36
|
// Vault gates are intentionally left to the final transaction. A receive gate may inspect
|
|
36
37
|
// VaultExitBundlesV1's transient `initiator`, which is populated only during the actual
|
|
37
38
|
// periphery call. A send-share gate is arbitrary external code and is evaluated repeatedly
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { type GetBundlesTokenRequirementsParams, getBundlesTokenRequirements, } from "./getBundlesTokenRequirements.js";
|
|
2
|
+
export { type GetUnusedPermit2NonceParams, getUnusedPermit2Nonce, } from "./getUnusedPermit2Nonce.js";
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
exports.getUnusedPermit2Nonce = exports.getBundlesTokenRequirements = void 0;
|
|
4
|
+
var getBundlesTokenRequirements_js_1 = require("./getBundlesTokenRequirements.js");
|
|
5
|
+
Object.defineProperty(exports, "getBundlesTokenRequirements", { enumerable: true, get: function () { return getBundlesTokenRequirements_js_1.getBundlesTokenRequirements; } });
|
|
6
|
+
var getUnusedPermit2Nonce_js_1 = require("./getUnusedPermit2Nonce.js");
|
|
7
|
+
Object.defineProperty(exports, "getUnusedPermit2Nonce", { enumerable: true, get: function () { return getUnusedPermit2Nonce_js_1.getUnusedPermit2Nonce; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Client } from "viem";
|
|
2
|
+
import type { ChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
3
|
+
/**
|
|
4
|
+
* Checks native-funded write targets and the served chain concurrently.
|
|
5
|
+
*
|
|
6
|
+
* @param client - Connected viem client.
|
|
7
|
+
* @param params - Validation parameters.
|
|
8
|
+
* @param params.chainId - Expected chain ID.
|
|
9
|
+
* @param params.chainCheck - Optional invocation-local chain validation shared with target checks.
|
|
10
|
+
* @param params.assertWriteTargets - Contract-code validation for the selected flow.
|
|
11
|
+
* @returns Resolves when both validations succeed.
|
|
12
|
+
* @throws {ChainIdMismatchError} when the declared or served chain differs.
|
|
13
|
+
* @throws {MissingContractCodeError} when a write target has no code on the expected chain.
|
|
14
|
+
* @throws {viem.BaseError} when a validation RPC request fails.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const validateNativeRequirements: (client: Client, { chainId, assertWriteTargets, chainCheck, }: {
|
|
18
|
+
readonly chainId: number;
|
|
19
|
+
readonly assertWriteTargets: () => Promise<void>;
|
|
20
|
+
readonly chainCheck?: ChainCheck;
|
|
21
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateNativeRequirements = void 0;
|
|
4
|
+
const validateClientChainId_js_1 = require("../../actions/requirements/validateClientChainId.js");
|
|
5
|
+
const index_js_1 = require("../../types/index.js");
|
|
6
|
+
/**
|
|
7
|
+
* Checks native-funded write targets and the served chain concurrently.
|
|
8
|
+
*
|
|
9
|
+
* @param client - Connected viem client.
|
|
10
|
+
* @param params - Validation parameters.
|
|
11
|
+
* @param params.chainId - Expected chain ID.
|
|
12
|
+
* @param params.chainCheck - Optional invocation-local chain validation shared with target checks.
|
|
13
|
+
* @param params.assertWriteTargets - Contract-code validation for the selected flow.
|
|
14
|
+
* @returns Resolves when both validations succeed.
|
|
15
|
+
* @throws {ChainIdMismatchError} when the declared or served chain differs.
|
|
16
|
+
* @throws {MissingContractCodeError} when a write target has no code on the expected chain.
|
|
17
|
+
* @throws {viem.BaseError} when a validation RPC request fails.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
const validateNativeRequirements = async (client, { chainId, assertWriteTargets, chainCheck = () => (0, validateClientChainId_js_1.validateClientChainId)(client, chainId), }) => {
|
|
21
|
+
const [chain, targets] = await Promise.allSettled([
|
|
22
|
+
chainCheck(),
|
|
23
|
+
assertWriteTargets(),
|
|
24
|
+
]);
|
|
25
|
+
// A served-chain mismatch explains a target failure; other chain errors must not hide it.
|
|
26
|
+
if (chain.status === "rejected" &&
|
|
27
|
+
chain.reason instanceof index_js_1.ChainIdMismatchError) {
|
|
28
|
+
throw chain.reason;
|
|
29
|
+
}
|
|
30
|
+
if (targets.status === "rejected") {
|
|
31
|
+
throw targets.reason;
|
|
32
|
+
}
|
|
33
|
+
if (chain.status === "rejected") {
|
|
34
|
+
throw chain.reason;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.validateNativeRequirements = validateNativeRequirements;
|
|
@@ -13,13 +13,13 @@ export declare function computeVaultV1InKindRedeemQuote({ amount, marketParamsLi
|
|
|
13
13
|
readonly chainId: number;
|
|
14
14
|
}): {
|
|
15
15
|
deadline: bigint;
|
|
16
|
-
marketParamsListSnapshot: {
|
|
16
|
+
marketParamsListSnapshot: readonly Readonly<{
|
|
17
17
|
loanToken: `0x${string}`;
|
|
18
18
|
collateralToken: `0x${string}`;
|
|
19
19
|
oracle: `0x${string}`;
|
|
20
20
|
irm: `0x${string}`;
|
|
21
21
|
lltv: bigint;
|
|
22
|
-
}[];
|
|
22
|
+
}>[];
|
|
23
23
|
requiredShareAllowance: bigint;
|
|
24
24
|
vaultExitBundlesV1: `0x${string}`;
|
|
25
25
|
};
|
|
@@ -18,13 +18,7 @@ function computeVaultV1InKindRedeemQuote({ amount, marketParamsList, vaultData,
|
|
|
18
18
|
if (marketParamsList.length === 0) {
|
|
19
19
|
throw new index_js_2.EmptyMarketParamsListError();
|
|
20
20
|
}
|
|
21
|
-
const marketParamsListSnapshot = marketParamsList.map(({ loanToken, collateralToken, oracle, irm, lltv }) => ({
|
|
22
|
-
loanToken,
|
|
23
|
-
collateralToken,
|
|
24
|
-
oracle,
|
|
25
|
-
irm,
|
|
26
|
-
lltv,
|
|
27
|
-
}));
|
|
21
|
+
const marketParamsListSnapshot = Object.freeze(marketParamsList.map(({ loanToken, collateralToken, oracle, irm, lltv }) => Object.freeze({ loanToken, collateralToken, oracle, irm, lltv })));
|
|
28
22
|
const deadline = deadlineOverride ?? now + morpho_ts_1.Time.s.from.h(2n);
|
|
29
23
|
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|
|
30
24
|
// through a vault-share approval or an EIP-712 permit for a deadline `buildTx()` cannot encode.
|