@morpho-org/morpho-sdk 10.0.2 → 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/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/entities/blue/blue.d.ts +35 -8
- package/lib/cjs/entities/blue/blue.js +467 -406
- 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 +21 -52
- package/lib/cjs/entities/vaultV2/vaultV2.js +226 -150
- 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/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/version.d.ts +1 -1
- package/lib/cjs/version.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/entities/blue/blue.d.ts +35 -8
- package/lib/esm/entities/blue/blue.js +449 -388
- 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 +21 -52
- package/lib/esm/entities/vaultV2/vaultV2.js +209 -133
- 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/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/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.midnightWithdrawCollateral = void 0;
|
|
4
|
-
const midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
3
|
+
exports.parseMidnightWithdrawCollateral = exports.midnightWithdrawCollateral = void 0;
|
|
5
4
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
|
-
const
|
|
7
|
-
const encodeMidnightCalldata_js_1 = require("../../helpers/encodeMidnightCalldata.js");
|
|
8
|
-
const index_js_1 = require("../../helpers/index.js");
|
|
9
|
-
const validateMidnightAccount_js_1 = require("../../helpers/validateMidnightAccount.js");
|
|
10
|
-
const validateMidnightBounds_js_1 = require("../../helpers/validateMidnightBounds.js");
|
|
11
|
-
const validateMidnightMarket_js_1 = require("../../helpers/validateMidnightMarket.js");
|
|
5
|
+
const parseMidnight_js_1 = require("../../helpers/parseMidnight.js");
|
|
12
6
|
const validateMidnightReceiver_js_1 = require("../../helpers/validateMidnightReceiver.js");
|
|
13
|
-
const
|
|
7
|
+
const encode_js_1 = require("./encode.js");
|
|
8
|
+
const parse_js_1 = require("./parse.js");
|
|
14
9
|
/**
|
|
15
10
|
* Encodes a direct Midnight collateral withdrawal.
|
|
16
11
|
*
|
|
@@ -47,59 +42,33 @@ const index_js_2 = require("../../types/index.js");
|
|
|
47
42
|
* });
|
|
48
43
|
* ```
|
|
49
44
|
*/
|
|
50
|
-
const midnightWithdrawCollateral = (params) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(0,
|
|
57
|
-
|
|
58
|
-
throw new index_js_2.MidnightZeroOnBehalfError("onBehalf");
|
|
59
|
-
}
|
|
45
|
+
const midnightWithdrawCollateral = (params) => (0, encode_js_1.encodeMidnightWithdrawCollateral)((0, exports.parseMidnightWithdrawCollateral)(params));
|
|
46
|
+
exports.midnightWithdrawCollateral = midnightWithdrawCollateral;
|
|
47
|
+
const parsedWithdrawCollateral = Symbol();
|
|
48
|
+
/** Parses static withdrawCollateral constraints using the existing error order. @internal */
|
|
49
|
+
const parseMidnightWithdrawCollateral = (params) => {
|
|
50
|
+
const address = (0, parseMidnight_js_1.parseMidnightAddress)("onBehalf", params.onBehalf);
|
|
51
|
+
const assets = (0, parseMidnight_js_1.parseMidnightPositiveAmount)("assets", params.assets);
|
|
52
|
+
const onBehalf = (0, parseMidnight_js_1.parseMidnightOwner)(address);
|
|
60
53
|
// Reject markets from another chain deployment before encoding the call.
|
|
61
|
-
(0,
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const collateralIndex = params.collateralIndex ?? 0n;
|
|
65
|
-
// Validate that the supplied collateral index is configured before encoding.
|
|
66
|
-
midnight_sdk_1.MarketUtils.getCollateralByIndex(params.market, collateralIndex);
|
|
54
|
+
const market = (0, parseMidnight_js_1.parseMidnightMarket)(params.market, params.chainId);
|
|
55
|
+
const collateral = (0, parseMidnight_js_1.parseMidnightCollateral)(market, params.collateralIndex ?? 0n);
|
|
56
|
+
const collateralIndex = collateral.index;
|
|
67
57
|
(0, validateMidnightReceiver_js_1.validateMidnightReceiver)({
|
|
68
58
|
chainId: params.chainId,
|
|
69
|
-
market:
|
|
59
|
+
market: market.struct,
|
|
70
60
|
field: "receiver",
|
|
71
61
|
receiver: params.receiver,
|
|
72
62
|
});
|
|
73
|
-
let tx = {
|
|
74
|
-
to: midnight,
|
|
75
|
-
value: 0n,
|
|
76
|
-
data: (0, encodeMidnightCalldata_js_1.encodeMidnightCalldata)({
|
|
77
|
-
abi: midnight_sdk_1.midnightAbi,
|
|
78
|
-
functionName: "withdrawCollateral",
|
|
79
|
-
args: [
|
|
80
|
-
midnight_sdk_1.MarketUtils.toStruct(params.market),
|
|
81
|
-
collateralIndex,
|
|
82
|
-
params.assets,
|
|
83
|
-
params.onBehalf,
|
|
84
|
-
params.receiver,
|
|
85
|
-
],
|
|
86
|
-
}),
|
|
87
|
-
};
|
|
88
|
-
if (params.metadata) {
|
|
89
|
-
tx = (0, index_js_1.addTransactionMetadata)(tx, params.metadata);
|
|
90
|
-
}
|
|
91
63
|
return (0, morpho_ts_1.deepFreeze)({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
receiver: params.receiver,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
64
|
+
chainId: params.chainId,
|
|
65
|
+
market,
|
|
66
|
+
onBehalf,
|
|
67
|
+
assets,
|
|
68
|
+
collateralIndex,
|
|
69
|
+
receiver: params.receiver,
|
|
70
|
+
metadata: (0, parse_js_1.snapshotMidnightMetadata)(params.metadata),
|
|
71
|
+
[parsedWithdrawCollateral]: true,
|
|
103
72
|
});
|
|
104
73
|
};
|
|
105
|
-
exports.
|
|
74
|
+
exports.parseMidnightWithdrawCollateral = parseMidnightWithdrawCollateral;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { MarketInput } from "@morpho-org/midnight-sdk";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import type { Metadata, MidnightCollateralTransfer, MidnightWithdrawCollateralBatchAction, Transaction } from "../../types/index.js";
|
|
4
4
|
/** Parameters for an atomic direct Midnight collateral withdrawal batch. */
|
|
5
5
|
export interface MidnightWithdrawCollateralBatchParams {
|
|
6
6
|
readonly chainId: number;
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.midnightWithdrawCollateralBatch = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const viem_1 = require("viem");
|
|
7
|
-
const encodeMidnightCalldata_js_1 = require("../../helpers/encodeMidnightCalldata.js");
|
|
8
|
-
const index_js_1 = require("../../helpers/index.js");
|
|
9
|
-
const validateMidnightAccount_js_1 = require("../../helpers/validateMidnightAccount.js");
|
|
10
|
-
const validateMidnightBounds_js_1 = require("../../helpers/validateMidnightBounds.js");
|
|
11
|
-
const validateMidnightCollateralBatch_js_1 = require("../../helpers/validateMidnightCollateralBatch.js");
|
|
12
|
-
const validateMidnightMarket_js_1 = require("../../helpers/validateMidnightMarket.js");
|
|
13
|
-
const validateMidnightReceiver_js_1 = require("../../helpers/validateMidnightReceiver.js");
|
|
14
|
-
const index_js_2 = require("../../types/index.js");
|
|
4
|
+
const encode_js_1 = require("./encode.js");
|
|
5
|
+
const parseCollateralBatch_js_1 = require("./parseCollateralBatch.js");
|
|
15
6
|
/**
|
|
16
7
|
* Encodes ordered collateral withdrawals in one Midnight multicall, even for one entry.
|
|
17
8
|
* Duplicates are rejected: pass one entry per index, unlike bundle flows which sum them.
|
|
@@ -43,64 +34,5 @@ const index_js_2 = require("../../types/index.js");
|
|
|
43
34
|
* });
|
|
44
35
|
* ```
|
|
45
36
|
*/
|
|
46
|
-
const midnightWithdrawCollateralBatch = (params) =>
|
|
47
|
-
// Reject malformed addresses before comparing with zero.
|
|
48
|
-
(0, validateMidnightAccount_js_1.validateMidnightAddress)("onBehalf", params.onBehalf);
|
|
49
|
-
if ((0, viem_1.isAddressEqual)(params.onBehalf, viem_1.zeroAddress)) {
|
|
50
|
-
throw new index_js_2.MidnightZeroOnBehalfError("onBehalf");
|
|
51
|
-
}
|
|
52
|
-
// Reject markets from another deployment before encoding.
|
|
53
|
-
(0, validateMidnightMarket_js_1.validateMidnightMarket)({ market: params.market, chainId: params.chainId });
|
|
54
|
-
(0, validateMidnightReceiver_js_1.validateMidnightReceiver)({
|
|
55
|
-
chainId: params.chainId,
|
|
56
|
-
market: params.market,
|
|
57
|
-
field: "receiver",
|
|
58
|
-
receiver: params.receiver,
|
|
59
|
-
});
|
|
60
|
-
// Direct batches require one entry per index rather than summing duplicates.
|
|
61
|
-
(0, validateMidnightCollateralBatch_js_1.validateMidnightCollateralBatch)(params.collateralWithdrawals, new index_js_2.EmptyMidnightCollateralWithdrawalsError());
|
|
62
|
-
const calls = params.collateralWithdrawals.map(({ collateralIndex, assets }) => {
|
|
63
|
-
if (assets <= 0n) {
|
|
64
|
-
throw new index_js_2.NonPositiveInputError("assets", assets);
|
|
65
|
-
}
|
|
66
|
-
(0, validateMidnightBounds_js_1.validateMidnightUint128Field)("assets", assets);
|
|
67
|
-
// Reject indexes not configured on the market.
|
|
68
|
-
midnight_sdk_1.MarketUtils.getCollateralByIndex(params.market, collateralIndex);
|
|
69
|
-
return (0, encodeMidnightCalldata_js_1.encodeMidnightCalldata)({
|
|
70
|
-
abi: midnight_sdk_1.midnightAbi,
|
|
71
|
-
functionName: "withdrawCollateral",
|
|
72
|
-
args: [
|
|
73
|
-
midnight_sdk_1.MarketUtils.toStruct(params.market),
|
|
74
|
-
collateralIndex,
|
|
75
|
-
assets,
|
|
76
|
-
params.onBehalf,
|
|
77
|
-
params.receiver,
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
let tx = {
|
|
82
|
-
to: (0, morpho_ts_1.getChainAddress)(params.chainId, "midnight"),
|
|
83
|
-
value: 0n,
|
|
84
|
-
data: (0, encodeMidnightCalldata_js_1.encodeMidnightCalldata)({
|
|
85
|
-
abi: midnight_sdk_1.midnightAbi,
|
|
86
|
-
functionName: "multicall",
|
|
87
|
-
args: [calls],
|
|
88
|
-
}),
|
|
89
|
-
};
|
|
90
|
-
if (params.metadata) {
|
|
91
|
-
tx = (0, index_js_1.addTransactionMetadata)(tx, params.metadata);
|
|
92
|
-
}
|
|
93
|
-
return (0, morpho_ts_1.deepFreeze)({
|
|
94
|
-
...tx,
|
|
95
|
-
action: {
|
|
96
|
-
type: "midnightWithdrawCollateralBatch",
|
|
97
|
-
args: {
|
|
98
|
-
market: (0, encodeMidnightCalldata_js_1.encodeMidnightMarketId)(params.market),
|
|
99
|
-
collateralWithdrawals: params.collateralWithdrawals.map(({ collateralIndex, assets }) => ({ collateralIndex, assets })),
|
|
100
|
-
onBehalf: params.onBehalf,
|
|
101
|
-
receiver: params.receiver,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
};
|
|
37
|
+
const midnightWithdrawCollateralBatch = (params) => (0, encode_js_1.encodeMidnightWithdrawCollateralBatch)((0, parseCollateralBatch_js_1.parseMidnightWithdrawCollateralBatch)(params));
|
|
106
38
|
exports.midnightWithdrawCollateralBatch = midnightWithdrawCollateralBatch;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { Client } from "viem";
|
|
2
2
|
import { type Address } from "viem";
|
|
3
3
|
import { type AuthorizationRequirementSignature, type BlueAuthorizationAction, type ReferenceTimestampParams, type Requirement, type Transaction } from "../../../types/index.js";
|
|
4
|
+
import { type ChainCheck } from "../chainCheck.js";
|
|
5
|
+
declare const blueAuthorizationRequirementInput: unique symbol;
|
|
6
|
+
/** Complete checked authorization resolver invocation. @internal */
|
|
7
|
+
export type BlueAuthorizationRequirementInput = Readonly<Parameters<typeof getBlueAuthorizationRequirement>[0]> & {
|
|
8
|
+
readonly authorized: Address;
|
|
9
|
+
readonly morpho: Address;
|
|
10
|
+
readonly [blueAuthorizationRequirementInput]: true;
|
|
11
|
+
};
|
|
12
|
+
/** Owns operator defaults and static checks for this complete resolver call. @internal */
|
|
13
|
+
export declare const parseBlueAuthorizationRequirement: (params: Parameters<typeof getBlueAuthorizationRequirement>[0]) => BlueAuthorizationRequirementInput;
|
|
4
14
|
/**
|
|
5
15
|
* Resolves whether a supported operator needs Blue authorization for the given user, and returns
|
|
6
16
|
* the requirement to satisfy it when it does.
|
|
@@ -64,3 +74,6 @@ export declare const getBlueAuthorizationRequirement: (params: {
|
|
|
64
74
|
readonly authorized?: Address;
|
|
65
75
|
readonly deadline?: bigint;
|
|
66
76
|
} & ReferenceTimestampParams) => Promise<Readonly<Transaction<BlueAuthorizationAction>> | Requirement<AuthorizationRequirementSignature> | null>;
|
|
77
|
+
/** Reads authorization from the complete checked invocation, preserving RPC order. @internal */
|
|
78
|
+
export declare const getParsedBlueAuthorizationRequirement: (params: BlueAuthorizationRequirementInput, chainCheck?: ChainCheck) => Promise<Readonly<Transaction<BlueAuthorizationAction>> | Requirement<AuthorizationRequirementSignature> | null>;
|
|
79
|
+
export {};
|
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBlueAuthorizationRequirement = void 0;
|
|
3
|
+
exports.getParsedBlueAuthorizationRequirement = exports.getBlueAuthorizationRequirement = exports.parseBlueAuthorizationRequirement = void 0;
|
|
4
4
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
6
6
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
7
7
|
const viem_1 = require("viem");
|
|
8
8
|
const validate_js_1 = require("../../../helpers/validate.js");
|
|
9
9
|
const index_js_1 = require("../../../types/index.js");
|
|
10
|
+
const chainCheck_js_1 = require("../chainCheck.js");
|
|
10
11
|
const encodeBlueSignatureAuthorization_js_1 = require("../encode/encodeBlueSignatureAuthorization.js");
|
|
11
|
-
|
|
12
|
+
/** Owns operator defaults and static checks for this complete resolver call. @internal */
|
|
13
|
+
const parseBlueAuthorizationRequirement = (params) => {
|
|
14
|
+
const input = {
|
|
15
|
+
viemClient: params.viemClient,
|
|
16
|
+
chainId: params.chainId,
|
|
17
|
+
userAddress: params.userAddress,
|
|
18
|
+
supportSignature: params.supportSignature,
|
|
19
|
+
authorized: params.authorized,
|
|
20
|
+
deadline: params.deadline,
|
|
21
|
+
now: params.now,
|
|
22
|
+
};
|
|
23
|
+
(0, validate_js_1.validateChainId)(input.viemClient.chain?.id, input.chainId);
|
|
24
|
+
const { blue: morpho } = (0, blue_sdk_1.getChainAddresses)(input.chainId);
|
|
25
|
+
const blueBundlesV1 = (0, morpho_ts_1.getChainAddress)(input.chainId, "bundles.blueBundlesV1");
|
|
26
|
+
const authorized = input.authorized ?? blueBundlesV1;
|
|
27
|
+
if (!(0, viem_1.isAddressEqual)(blueBundlesV1, authorized)) {
|
|
28
|
+
throw new index_js_1.UnsupportedAuthorizationOperatorError(authorized, input.chainId);
|
|
29
|
+
}
|
|
30
|
+
if (input.supportSignature && input.deadline != null) {
|
|
31
|
+
(0, validate_js_1.validateDeadline)(input.deadline);
|
|
32
|
+
}
|
|
33
|
+
return { ...input, authorized, morpho };
|
|
34
|
+
};
|
|
35
|
+
exports.parseBlueAuthorizationRequirement = parseBlueAuthorizationRequirement;
|
|
12
36
|
/**
|
|
13
37
|
* Resolves whether a supported operator needs Blue authorization for the given user, and returns
|
|
14
38
|
* the requirement to satisfy it when it does.
|
|
@@ -65,30 +89,24 @@ const validateClientChainId_js_1 = require("../validateClientChainId.js");
|
|
|
65
89
|
* ```
|
|
66
90
|
*/
|
|
67
91
|
const getBlueAuthorizationRequirement = async (params) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// reject any other override so a misconfigured `authorized` cannot grant an arbitrary address
|
|
75
|
-
// control over the user's Morpho positions.
|
|
76
|
-
if (!(0, viem_1.isAddressEqual)(blueBundlesV1, authorized)) {
|
|
77
|
-
throw new index_js_1.UnsupportedAuthorizationOperatorError(authorized, chainId);
|
|
78
|
-
}
|
|
92
|
+
return (0, exports.getParsedBlueAuthorizationRequirement)((0, exports.parseBlueAuthorizationRequirement)(params));
|
|
93
|
+
};
|
|
94
|
+
exports.getBlueAuthorizationRequirement = getBlueAuthorizationRequirement;
|
|
95
|
+
/** Reads authorization from the complete checked invocation, preserving RPC order. @internal */
|
|
96
|
+
const getParsedBlueAuthorizationRequirement = async (params, chainCheck = (0, chainCheck_js_1.createChainCheck)(params.viemClient, params.chainId)) => {
|
|
97
|
+
const { viemClient, chainId, userAddress, supportSignature, morpho, authorized, } = params;
|
|
79
98
|
const pc = viemClient.extend(viem_1.publicActions);
|
|
80
99
|
if (supportSignature) {
|
|
81
100
|
// The forwarded deadline is only consumed on the signable path; reject an invalid or expired
|
|
82
101
|
// one before the RPC reads so the caller never signs an authorization that cannot be encoded
|
|
83
102
|
// or would revert on-chain. An omitted deadline defaults downstream to two hours from now.
|
|
84
103
|
if (params.deadline != null) {
|
|
85
|
-
(0, validate_js_1.validateDeadline)(params.deadline);
|
|
86
104
|
const timestamp = params.now ?? morpho_ts_1.Time.timestamp();
|
|
87
105
|
if (params.deadline <= timestamp) {
|
|
88
106
|
throw new index_js_1.ExpiredDeadlineError(params.deadline, timestamp);
|
|
89
107
|
}
|
|
90
108
|
}
|
|
91
|
-
await (
|
|
109
|
+
await chainCheck();
|
|
92
110
|
// The signable path needs the user's Morpho nonce; fetch it alongside the
|
|
93
111
|
// authorization status so both reads share a round-trip (batched into a
|
|
94
112
|
// single multicall when the client enables batching) instead of
|
|
@@ -110,16 +128,18 @@ const getBlueAuthorizationRequirement = async (params) => {
|
|
|
110
128
|
if (isAuthorized) {
|
|
111
129
|
return null;
|
|
112
130
|
}
|
|
113
|
-
|
|
131
|
+
// Construct the complete child operation with the fresh nonce; its encoder rechecks expiry now.
|
|
132
|
+
return (0, encodeBlueSignatureAuthorization_js_1.encodeParsedBlueSignatureAuthorization)((0, encodeBlueSignatureAuthorization_js_1.parseBlueSignatureAuthorization)(viemClient, {
|
|
114
133
|
owner: userAddress,
|
|
115
134
|
authorized,
|
|
116
135
|
chainId,
|
|
117
136
|
nonce,
|
|
118
137
|
deadline: params.deadline,
|
|
119
138
|
now: params.now,
|
|
120
|
-
|
|
139
|
+
isAuthorized: true,
|
|
140
|
+
}));
|
|
121
141
|
}
|
|
122
|
-
await (
|
|
142
|
+
await chainCheck();
|
|
123
143
|
const isAuthorized = await pc.readContract({
|
|
124
144
|
address: morpho,
|
|
125
145
|
abi: blue_sdk_viem_1.blueAbi,
|
|
@@ -146,4 +166,4 @@ const getBlueAuthorizationRequirement = async (params) => {
|
|
|
146
166
|
},
|
|
147
167
|
});
|
|
148
168
|
};
|
|
149
|
-
exports.
|
|
169
|
+
exports.getParsedBlueAuthorizationRequirement = getParsedBlueAuthorizationRequirement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { getBlueAuthorizationRequirement } from "./getBlueAuthorizationRequirement.js";
|
|
@@ -1,17 +1,5 @@
|
|
|
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
|
-
|
|
3
|
+
exports.getBlueAuthorizationRequirement = void 0;
|
|
4
|
+
var getBlueAuthorizationRequirement_js_1 = require("./getBlueAuthorizationRequirement.js");
|
|
5
|
+
Object.defineProperty(exports, "getBlueAuthorizationRequirement", { enumerable: true, get: function () { return getBlueAuthorizationRequirement_js_1.getBlueAuthorizationRequirement; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Client } from "viem";
|
|
2
|
+
/** A lazy chain validation shared only within one invocation. @internal */
|
|
3
|
+
export type ChainCheck = () => Promise<void>;
|
|
4
|
+
/** Creates an invocation-local check, retaining both success and failure. @internal */
|
|
5
|
+
export declare const createChainCheck: (client: Client, chainId: number) => ChainCheck;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createChainCheck = void 0;
|
|
4
|
+
const validateClientChainId_js_1 = require("./validateClientChainId.js");
|
|
5
|
+
/** Creates an invocation-local check, retaining both success and failure. @internal */
|
|
6
|
+
const createChainCheck = (client, chainId) => {
|
|
7
|
+
let pending;
|
|
8
|
+
return () => (pending ??= (0, validateClientChainId_js_1.validateClientChainId)(client, chainId));
|
|
9
|
+
};
|
|
10
|
+
exports.createChainCheck = createChainCheck;
|
|
@@ -16,6 +16,14 @@ interface EncodeBlueSignatureAuthorizationParams extends ReferenceTimestampParam
|
|
|
16
16
|
/** Signature deadline in seconds. Defaults to two hours from now. */
|
|
17
17
|
deadline?: bigint;
|
|
18
18
|
}
|
|
19
|
+
declare const blueSignatureAuthorizationInput: unique symbol;
|
|
20
|
+
/** Complete checked authorization signature invocation. @internal */
|
|
21
|
+
export type BlueSignatureAuthorizationInput = Readonly<EncodeBlueSignatureAuthorizationParams> & {
|
|
22
|
+
readonly isAuthorized: boolean;
|
|
23
|
+
readonly [blueSignatureAuthorizationInput]: true;
|
|
24
|
+
};
|
|
25
|
+
/** Checks the standalone invocation without defaulting the required operator. @internal */
|
|
26
|
+
export declare const parseBlueSignatureAuthorization: (viemClient: Client, params: EncodeBlueSignatureAuthorizationParams) => BlueSignatureAuthorizationInput;
|
|
19
27
|
/**
|
|
20
28
|
* Builds a Morpho authorization `Requirement` that, once signed, lets BlueBundlesV1 operate on
|
|
21
29
|
* Morpho on the signer's behalf.
|
|
@@ -71,4 +79,6 @@ interface EncodeBlueSignatureAuthorizationParams extends ReferenceTimestampParam
|
|
|
71
79
|
* ```
|
|
72
80
|
*/
|
|
73
81
|
export declare const encodeBlueSignatureAuthorization: (viemClient: Client, params: EncodeBlueSignatureAuthorizationParams) => Promise<Requirement<AuthorizationRequirementSignature>>;
|
|
82
|
+
/** Completes dynamic deadline defaults and builds the checked authorization. @internal */
|
|
83
|
+
export declare const encodeParsedBlueSignatureAuthorization: (params: BlueSignatureAuthorizationInput) => Promise<Requirement<AuthorizationRequirementSignature>>;
|
|
74
84
|
export {};
|
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeBlueSignatureAuthorization = void 0;
|
|
3
|
+
exports.encodeParsedBlueSignatureAuthorization = exports.encodeBlueSignatureAuthorization = exports.parseBlueSignatureAuthorization = 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 signAndVerifyTypedData_js_1 = require("../../../helpers/signAndVerifyTypedData.js");
|
|
8
8
|
const validate_js_1 = require("../../../helpers/validate.js");
|
|
9
9
|
const index_js_1 = require("../../../types/index.js");
|
|
10
|
+
/** Checks the standalone invocation without defaulting the required operator. @internal */
|
|
11
|
+
const parseBlueSignatureAuthorization = (viemClient, params) => {
|
|
12
|
+
const input = {
|
|
13
|
+
owner: params.owner,
|
|
14
|
+
authorized: params.authorized,
|
|
15
|
+
chainId: params.chainId,
|
|
16
|
+
nonce: params.nonce,
|
|
17
|
+
isAuthorized: params.isAuthorized,
|
|
18
|
+
deadline: params.deadline,
|
|
19
|
+
now: params.now,
|
|
20
|
+
};
|
|
21
|
+
if (viemClient.chain?.id !== input.chainId) {
|
|
22
|
+
throw new index_js_1.ChainIdMismatchError(viemClient.chain?.id, input.chainId);
|
|
23
|
+
}
|
|
24
|
+
const blueBundlesV1 = (0, morpho_ts_1.getChainAddress)(input.chainId, "bundles.blueBundlesV1");
|
|
25
|
+
if (!(0, viem_1.isAddressEqual)(blueBundlesV1, input.authorized)) {
|
|
26
|
+
throw new index_js_1.UnsupportedAuthorizationOperatorError(input.authorized, input.chainId);
|
|
27
|
+
}
|
|
28
|
+
if (input.deadline != null) {
|
|
29
|
+
(0, validate_js_1.validateDeadline)(input.deadline);
|
|
30
|
+
}
|
|
31
|
+
const { isAuthorized = true } = input;
|
|
32
|
+
return {
|
|
33
|
+
...input,
|
|
34
|
+
isAuthorized,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.parseBlueSignatureAuthorization = parseBlueSignatureAuthorization;
|
|
10
38
|
/**
|
|
11
39
|
* Builds a Morpho authorization `Requirement` that, once signed, lets BlueBundlesV1 operate on
|
|
12
40
|
* Morpho on the signer's behalf.
|
|
@@ -62,32 +90,17 @@ const index_js_1 = require("../../../types/index.js");
|
|
|
62
90
|
* ```
|
|
63
91
|
*/
|
|
64
92
|
const encodeBlueSignatureAuthorization = async (viemClient, params) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const blueBundlesV1 = (0, morpho_ts_1.getChainAddress)(chainId, "bundles.blueBundlesV1");
|
|
75
|
-
if (!(0, viem_1.isAddressEqual)(blueBundlesV1, authorized)) {
|
|
76
|
-
throw new index_js_1.UnsupportedAuthorizationOperatorError(authorized, chainId);
|
|
77
|
-
}
|
|
78
|
-
// Reject an invalid or already-expired caller-supplied deadline before signing, so a direct caller
|
|
79
|
-
// is never walked through a wallet EIP-712 prompt for an authorization Morpho would reject with
|
|
80
|
-
// `SIGNATURE_EXPIRED`. Mirrors the sibling `encodeErc20Permit2SignatureTransfer` and the
|
|
81
|
-
// `getBlueAuthorizationRequirement` resolver guards. An omitted deadline defaults to two hours
|
|
82
|
-
// from now and is always valid.
|
|
83
|
-
if (params.deadline != null) {
|
|
84
|
-
(0, validate_js_1.validateDeadline)(params.deadline);
|
|
85
|
-
const timestamp = params.now ?? morpho_ts_1.Time.timestamp();
|
|
86
|
-
if (params.deadline <= timestamp) {
|
|
87
|
-
throw new index_js_1.ExpiredDeadlineError(params.deadline, timestamp);
|
|
88
|
-
}
|
|
93
|
+
return (0, exports.encodeParsedBlueSignatureAuthorization)((0, exports.parseBlueSignatureAuthorization)(viemClient, params));
|
|
94
|
+
};
|
|
95
|
+
exports.encodeBlueSignatureAuthorization = encodeBlueSignatureAuthorization;
|
|
96
|
+
/** Completes dynamic deadline defaults and builds the checked authorization. @internal */
|
|
97
|
+
const encodeParsedBlueSignatureAuthorization = async (params) => {
|
|
98
|
+
const { owner, authorized, chainId, nonce, isAuthorized } = params;
|
|
99
|
+
const timestamp = params.now ?? morpho_ts_1.Time.timestamp();
|
|
100
|
+
if (params.deadline != null && params.deadline <= timestamp) {
|
|
101
|
+
throw new index_js_1.ExpiredDeadlineError(params.deadline, timestamp);
|
|
89
102
|
}
|
|
90
|
-
const deadline = params.deadline ??
|
|
103
|
+
const deadline = params.deadline ?? timestamp + morpho_ts_1.Time.s.from.h(2n);
|
|
91
104
|
const typedData = (0, morpho_ts_1.deepFreeze)((0, blue_sdk_viem_1.getAuthorizationTypedData)({ authorizer: owner, authorized, isAuthorized, nonce, deadline }, chainId));
|
|
92
105
|
const action = {
|
|
93
106
|
type: "authorization",
|
|
@@ -119,4 +132,4 @@ const encodeBlueSignatureAuthorization = async (viemClient, params) => {
|
|
|
119
132
|
},
|
|
120
133
|
};
|
|
121
134
|
};
|
|
122
|
-
exports.
|
|
135
|
+
exports.encodeParsedBlueSignatureAuthorization = encodeParsedBlueSignatureAuthorization;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address } from "@morpho-org/blue-sdk";
|
|
2
2
|
import type { ERC20ApprovalAction, Transaction } from "../../../types/index.js";
|
|
3
3
|
/** Parameters for {@link encodeErc20Approval}. */
|
|
4
4
|
interface EncodeErc20ApprovalParams {
|
|
@@ -7,6 +7,14 @@ interface EncodeErc20ApprovalParams {
|
|
|
7
7
|
amount: bigint;
|
|
8
8
|
chainId: number;
|
|
9
9
|
}
|
|
10
|
+
declare const erc20ApprovalInput: unique symbol;
|
|
11
|
+
/** Complete checked approval and its token-specific cap. @internal */
|
|
12
|
+
export type Erc20ApprovalInput = Readonly<EncodeErc20ApprovalParams> & {
|
|
13
|
+
readonly maxApproval: bigint;
|
|
14
|
+
readonly [erc20ApprovalInput]: true;
|
|
15
|
+
};
|
|
16
|
+
/** Checks the complete standalone approval before encoding. @internal */
|
|
17
|
+
export declare const parseErc20Approval: (params: EncodeErc20ApprovalParams) => Erc20ApprovalInput;
|
|
10
18
|
/**
|
|
11
19
|
* Encodes a deep-frozen ERC-20 approval transaction for a supported SDK spender.
|
|
12
20
|
*
|
|
@@ -37,4 +45,6 @@ interface EncodeErc20ApprovalParams {
|
|
|
37
45
|
* ```
|
|
38
46
|
*/
|
|
39
47
|
export declare const encodeErc20Approval: (params: EncodeErc20ApprovalParams) => Transaction<ERC20ApprovalAction>;
|
|
48
|
+
/** Encodes the complete checked approval without repeating static checks. @internal */
|
|
49
|
+
export declare const encodeParsedErc20Approval: (params: Erc20ApprovalInput) => Transaction<ERC20ApprovalAction>;
|
|
40
50
|
export {};
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeErc20Approval = void 0;
|
|
3
|
+
exports.encodeParsedErc20Approval = exports.encodeErc20Approval = exports.parseErc20Approval = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
4
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
5
6
|
const viem_1 = require("viem");
|
|
6
7
|
const tokenApproval_js_1 = require("../../../helpers/tokenApproval.js");
|
|
7
8
|
const validateRequirementSpender_js_1 = require("../../../helpers/validateRequirementSpender.js");
|
|
9
|
+
/** Checks the complete standalone approval before encoding. @internal */
|
|
10
|
+
const parseErc20Approval = (params) => {
|
|
11
|
+
const input = {
|
|
12
|
+
token: params.token,
|
|
13
|
+
spender: params.spender,
|
|
14
|
+
amount: params.amount,
|
|
15
|
+
chainId: params.chainId,
|
|
16
|
+
};
|
|
17
|
+
(0, validateRequirementSpender_js_1.validateRequirementSpender)({
|
|
18
|
+
chainId: input.chainId,
|
|
19
|
+
spender: input.spender,
|
|
20
|
+
allowed: [
|
|
21
|
+
"permit2",
|
|
22
|
+
"midnight",
|
|
23
|
+
"midnightBundlesV2",
|
|
24
|
+
"vaultExitBundlesV1",
|
|
25
|
+
"vaultBundlesV1",
|
|
26
|
+
"blueBundlesV1",
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
...input,
|
|
31
|
+
maxApproval: (0, tokenApproval_js_1.capTokenApproval)({ ...input, amount: viem_1.maxUint256 }),
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
exports.parseErc20Approval = parseErc20Approval;
|
|
8
35
|
/**
|
|
9
36
|
* Encodes a deep-frozen ERC-20 approval transaction for a supported SDK spender.
|
|
10
37
|
*
|
|
@@ -35,21 +62,13 @@ const validateRequirementSpender_js_1 = require("../../../helpers/validateRequir
|
|
|
35
62
|
* ```
|
|
36
63
|
*/
|
|
37
64
|
const encodeErc20Approval = (params) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"midnight",
|
|
46
|
-
"midnightBundlesV2",
|
|
47
|
-
"vaultExitBundlesV1",
|
|
48
|
-
"vaultBundlesV1",
|
|
49
|
-
"blueBundlesV1",
|
|
50
|
-
],
|
|
51
|
-
});
|
|
52
|
-
const amountValue = (0, tokenApproval_js_1.capTokenApproval)(params);
|
|
65
|
+
return (0, exports.encodeParsedErc20Approval)((0, exports.parseErc20Approval)(params));
|
|
66
|
+
};
|
|
67
|
+
exports.encodeErc20Approval = encodeErc20Approval;
|
|
68
|
+
/** Encodes the complete checked approval without repeating static checks. @internal */
|
|
69
|
+
const encodeParsedErc20Approval = (params) => {
|
|
70
|
+
const { token, spender, amount, maxApproval } = params;
|
|
71
|
+
const amountValue = blue_sdk_1.MathLib.min(amount, maxApproval);
|
|
53
72
|
return (0, morpho_ts_1.deepFreeze)({
|
|
54
73
|
to: token,
|
|
55
74
|
data: (0, viem_1.encodeFunctionData)({
|
|
@@ -64,4 +83,4 @@ const encodeErc20Approval = (params) => {
|
|
|
64
83
|
},
|
|
65
84
|
});
|
|
66
85
|
};
|
|
67
|
-
exports.
|
|
86
|
+
exports.encodeParsedErc20Approval = encodeParsedErc20Approval;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address } from "@morpho-org/blue-sdk";
|
|
2
2
|
import type { Client } from "viem";
|
|
3
|
-
import type
|
|
3
|
+
import { type Erc2612RequirementSignature, type ReferenceTimestampParams, type Requirement } from "../../../types/index.js";
|
|
4
|
+
import { type ChainCheck } from "../chainCheck.js";
|
|
4
5
|
/** Parameters for {@link encodeErc20Permit}. */
|
|
5
6
|
interface EncodeErc20PermitParams extends ReferenceTimestampParams {
|
|
6
7
|
token: Address;
|
|
@@ -13,6 +14,13 @@ interface EncodeErc20PermitParams extends ReferenceTimestampParams {
|
|
|
13
14
|
supportDeployless?: boolean;
|
|
14
15
|
deadline?: bigint;
|
|
15
16
|
}
|
|
17
|
+
declare const erc20PermitInput: unique symbol;
|
|
18
|
+
/** Complete checked ERC-2612 invocation; token metadata remains an RPC concern. @internal */
|
|
19
|
+
export type Erc20PermitInput = Readonly<EncodeErc20PermitParams> & {
|
|
20
|
+
readonly [erc20PermitInput]: true;
|
|
21
|
+
};
|
|
22
|
+
/** Checks the complete direct encoder invocation before RPC. @internal */
|
|
23
|
+
export declare const parseErc20Permit: (viemClient: Client, params: EncodeErc20PermitParams) => Erc20PermitInput;
|
|
16
24
|
/**
|
|
17
25
|
* Builds an EIP-2612 permit `Requirement` that, once signed, lets a supported SDK spender pull
|
|
18
26
|
* `amount` of `token`.
|
|
@@ -82,4 +90,9 @@ interface EncodeErc20PermitParams extends ReferenceTimestampParams {
|
|
|
82
90
|
* ```
|
|
83
91
|
*/
|
|
84
92
|
export declare const encodeErc20Permit: (viemClient: Client, params: EncodeErc20PermitParams) => Promise<Requirement<Erc2612RequirementSignature>>;
|
|
93
|
+
/** Completes dynamic time defaults and consumes the checked permit before RPC. @internal */
|
|
94
|
+
export declare const encodeParsedErc20Permit: ({ viemClient, chainCheck: providedChainCheck, }: {
|
|
95
|
+
readonly viemClient: Client;
|
|
96
|
+
readonly chainCheck?: ChainCheck;
|
|
97
|
+
}, params: Erc20PermitInput) => Promise<Requirement<Erc2612RequirementSignature>>;
|
|
85
98
|
export {};
|