@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
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSupplyCollateralMakeBorrowParams = exports.parseSupplyBlueMakeLendParams = exports.parseMakeWithdrawParams = exports.parseMakeBorrowParams = exports.parseMakeRepayParams = exports.parseMakeLendParams = exports.getOffersDataInternal = exports.parseGetOffersDataParams = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
6
|
+
const midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
7
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
8
|
+
const cancelAndMake_js_1 = require("../../actions/midnight/cancelAndMake.js");
|
|
9
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
10
|
+
const callback_js_1 = require("../../helpers/callback.js");
|
|
11
|
+
const encodeMidnightCalldata_js_1 = require("../../helpers/encodeMidnightCalldata.js");
|
|
12
|
+
const index_js_1 = require("../../helpers/index.js");
|
|
13
|
+
const metadata_js_1 = require("../../helpers/metadata.js");
|
|
14
|
+
const parse_js_1 = require("../../helpers/parse.js");
|
|
15
|
+
const parseMidnight_js_1 = require("../../helpers/parseMidnight.js");
|
|
16
|
+
const parseMidnightMaker_js_1 = require("../../helpers/parseMidnightMaker.js");
|
|
17
|
+
const validateMidnightAccount_js_1 = require("../../helpers/validateMidnightAccount.js");
|
|
18
|
+
const validateMidnightPublication_js_1 = require("../../helpers/validateMidnightPublication.js");
|
|
19
|
+
const validateOfferSides_js_1 = require("../../helpers/validateOfferSides.js");
|
|
20
|
+
const validatePositiveInput_js_1 = require("../../helpers/validatePositiveInput.js");
|
|
21
|
+
const index_js_2 = require("../../types/index.js");
|
|
22
|
+
const deadline_js_1 = require("./deadline.js");
|
|
23
|
+
const publication_js_1 = require("./publication.js");
|
|
24
|
+
const offersParams = Symbol();
|
|
25
|
+
const preparedMake = Symbol();
|
|
26
|
+
/** Validates the complete raw publication request before state reads. @internal */
|
|
27
|
+
const parseGetOffersDataParams = (params, { client, chainId }) => {
|
|
28
|
+
(0, index_js_1.validateChainId)(client.viemClient.chain?.id, chainId);
|
|
29
|
+
const accountAddress = (0, parseMidnight_js_1.parseMidnightAccount)("accountAddress", params.accountAddress);
|
|
30
|
+
const tree = (0, parseMidnightMaker_js_1.parseMidnightMakerTree)({
|
|
31
|
+
offers: params.offers,
|
|
32
|
+
accountAddress,
|
|
33
|
+
});
|
|
34
|
+
const { ratifier, ratifierType } = (0, parseMidnightMaker_js_1.parseMidnightMakerBinding)({
|
|
35
|
+
tree,
|
|
36
|
+
chainId,
|
|
37
|
+
accountAddress,
|
|
38
|
+
});
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
tree,
|
|
41
|
+
accountAddress,
|
|
42
|
+
ratifier,
|
|
43
|
+
ratifierType,
|
|
44
|
+
validation: params.validation,
|
|
45
|
+
[offersParams]: true,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.parseGetOffersDataParams = parseGetOffersDataParams;
|
|
49
|
+
/** Reads publication state only from the complete constructed request. @internal */
|
|
50
|
+
const getOffersDataInternal = async (params, { client, chainId, marketCreationTime = "expiry", chainCheck = (0, chainCheck_js_1.createChainCheck)(client.viemClient, chainId), }) => {
|
|
51
|
+
const { tree, accountAddress, ratifier, ratifierType } = params;
|
|
52
|
+
const { states, now } = await (0, publication_js_1.fetchMidnightMakerOfferStatesWithChainCheck)({
|
|
53
|
+
client: client.viemClient,
|
|
54
|
+
chainId,
|
|
55
|
+
tree,
|
|
56
|
+
}, chainCheck);
|
|
57
|
+
// RPC facts are checked here, never encoded as a permanent static witness.
|
|
58
|
+
(0, publication_js_1.validateMidnightMakerOfferStates)({ tree, states, now, marketCreationTime });
|
|
59
|
+
const groups = [];
|
|
60
|
+
const seenGroups = new Set();
|
|
61
|
+
for (const offer of tree.offers) {
|
|
62
|
+
const key = offer.group.toLowerCase();
|
|
63
|
+
if (!seenGroups.has(key)) {
|
|
64
|
+
seenGroups.add(key);
|
|
65
|
+
groups.push(offer.group);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (params.validation !== false) {
|
|
69
|
+
await tree.mempoolValidate({ ...params.validation, chainId });
|
|
70
|
+
}
|
|
71
|
+
const items = tree.type === "priceV1"
|
|
72
|
+
? midnight_sdk_1.PriceRatifierV1.ratify({ tree })
|
|
73
|
+
: midnight_sdk_1.RateRatifierV1.ratify({ tree });
|
|
74
|
+
return {
|
|
75
|
+
accountAddress,
|
|
76
|
+
groups,
|
|
77
|
+
tree,
|
|
78
|
+
ratifierType,
|
|
79
|
+
ratifier,
|
|
80
|
+
payload: await midnight_sdk_1.Payload.encode(items),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
exports.getOffersDataInternal = getOffersDataInternal;
|
|
84
|
+
async function parseMakeParams({ params, operation, }, context) {
|
|
85
|
+
const { client, chainId } = context;
|
|
86
|
+
(0, index_js_1.validateChainId)(client.viemClient.chain?.id, chainId);
|
|
87
|
+
const accountAddress = (0, parseMidnight_js_1.parseMidnightAccount)("accountAddress", params.accountAddress);
|
|
88
|
+
// Preserve account and local expiry precedence before constructing the tree.
|
|
89
|
+
(0, deadline_js_1.validateMidnightDeadline)(params.deadline, params.now);
|
|
90
|
+
const lend = operation === "makeLend" || operation === "makeRepay";
|
|
91
|
+
const intent = (0, parseMidnightMaker_js_1.parseMidnightMakerIntent)({
|
|
92
|
+
offers: params.offers,
|
|
93
|
+
accountAddress,
|
|
94
|
+
side: lend ? "lend" : "borrow",
|
|
95
|
+
reduceOnly: operation === "makeRepay" || operation === "makeWithdraw",
|
|
96
|
+
});
|
|
97
|
+
const metadata = (0, metadata_js_1.resolveTransactionMetadata)(client.options.metadata, params.now);
|
|
98
|
+
let loanToken;
|
|
99
|
+
let approvalAmount = 0n;
|
|
100
|
+
if (operation === "makeLend" || operation === "makeRepay") {
|
|
101
|
+
loanToken = params.loanToken;
|
|
102
|
+
// Address and amounts precede opening-side and callback checks for lenders.
|
|
103
|
+
(0, validateMidnightAccount_js_1.validateMidnightAddress)("loanToken", loanToken);
|
|
104
|
+
// Validation only; funding positivity precedes the reserved amount and opening side.
|
|
105
|
+
(0, validatePositiveInput_js_1.validatePositiveInput)("loanAssets", params.loanAssets);
|
|
106
|
+
approvalAmount =
|
|
107
|
+
params.loanAssets +
|
|
108
|
+
(0, parse_js_1.parseNonnegative)("reservedLoanAssets", params.reservedLoanAssets ?? 0n);
|
|
109
|
+
}
|
|
110
|
+
if (!intent.reduceOnly) {
|
|
111
|
+
(0, validateOfferSides_js_1.validateOfferSides)(intent.tree.offers, lend);
|
|
112
|
+
}
|
|
113
|
+
(0, publication_js_1.validateMidnightMakerOfferCallbacks)(intent.tree.offers);
|
|
114
|
+
const data = await (0, exports.getOffersDataInternal)((0, exports.parseGetOffersDataParams)({ ...params, offers: intent.tree }, context), context);
|
|
115
|
+
if (loanToken != null) {
|
|
116
|
+
// Funding relationships deliberately follow pinned publication state and API validation.
|
|
117
|
+
(0, parseMidnightMaker_js_1.parseMidnightMakerFundingBinding)({ tree: data.tree, loanToken });
|
|
118
|
+
}
|
|
119
|
+
const action = (0, cancelAndMake_js_1.parseMidnightCancelAndMake)({
|
|
120
|
+
chainId,
|
|
121
|
+
cancellations: params.cancellations ?? [],
|
|
122
|
+
deadline: params.deadline,
|
|
123
|
+
metadata,
|
|
124
|
+
publication: {
|
|
125
|
+
ratifier: data.ratifier,
|
|
126
|
+
root: data.tree.root,
|
|
127
|
+
groups: data.groups,
|
|
128
|
+
payload: data.payload,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
return Object.freeze({ action, data, loanToken, approvalAmount });
|
|
132
|
+
}
|
|
133
|
+
/** Constructs the complete lend publication and requirement inputs from raw params. @internal */
|
|
134
|
+
const parseMakeLendParams = async (params, context) => {
|
|
135
|
+
const parsed = await parseMakeParams({ params, operation: "makeLend" }, context);
|
|
136
|
+
return Object.freeze({
|
|
137
|
+
...parsed,
|
|
138
|
+
[preparedMake]: "makeLend",
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
exports.parseMakeLendParams = parseMakeLendParams;
|
|
142
|
+
/** Constructs the complete reduce-only repayment publication from raw params. @internal */
|
|
143
|
+
const parseMakeRepayParams = async (params, context) => {
|
|
144
|
+
const parsed = await parseMakeParams({ params, operation: "makeRepay" }, context);
|
|
145
|
+
return Object.freeze({
|
|
146
|
+
...parsed,
|
|
147
|
+
[preparedMake]: "makeRepay",
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
exports.parseMakeRepayParams = parseMakeRepayParams;
|
|
151
|
+
/** Constructs the complete borrow publication from raw params. @internal */
|
|
152
|
+
const parseMakeBorrowParams = (params, context) => parseMakeParams({ params, operation: "makeBorrow" }, context).then((parsed) => Object.freeze({ ...parsed, [preparedMake]: "makeBorrow" }));
|
|
153
|
+
exports.parseMakeBorrowParams = parseMakeBorrowParams;
|
|
154
|
+
/** Constructs the complete reduce-only credit-exit publication from raw params. @internal */
|
|
155
|
+
const parseMakeWithdrawParams = (params, context) => parseMakeParams({ params, operation: "makeWithdraw" }, context).then((parsed) => Object.freeze({ ...parsed, [preparedMake]: "makeWithdraw" }));
|
|
156
|
+
exports.parseMakeWithdrawParams = parseMakeWithdrawParams;
|
|
157
|
+
/** Constructs a complete Blue-funded publication while preserving its RPC/error order. @internal */
|
|
158
|
+
const parseSupplyBlueMakeLendParams = async (params, context) => {
|
|
159
|
+
const { client, chainId } = context;
|
|
160
|
+
const suppliedNow = params.now;
|
|
161
|
+
const metadata = (0, metadata_js_1.resolveTransactionMetadata)(client.options.metadata, suppliedNow);
|
|
162
|
+
const accountAddress = (0, parseMidnight_js_1.parseMidnightAccount)("accountAddress", params.accountAddress);
|
|
163
|
+
// Preserve salt and amount error context before constructing the tree or reading state.
|
|
164
|
+
(0, validateMidnightPublication_js_1.validateMidnightBytes32)("callbackSalt", params.callbackSalt);
|
|
165
|
+
const assets = (0, parseMidnight_js_1.parseMidnightPositiveAmount)("assetsToPark", params.assetsToPark);
|
|
166
|
+
const { loanToken, collateralToken, oracle, irm, lltv } = params.blueMarket;
|
|
167
|
+
const blueSupply = (0, morpho_ts_1.deepFreeze)({
|
|
168
|
+
market: { loanToken, collateralToken, oracle, irm, lltv },
|
|
169
|
+
assets,
|
|
170
|
+
callbackSalt: params.callbackSalt,
|
|
171
|
+
});
|
|
172
|
+
const tree = (0, parseMidnightMaker_js_1.parseMidnightMakerTree)({
|
|
173
|
+
offers: params.offers,
|
|
174
|
+
accountAddress,
|
|
175
|
+
});
|
|
176
|
+
// Side errors precede reduce-only errors on this funded boundary.
|
|
177
|
+
(0, validateOfferSides_js_1.validateOfferSides)(tree.offers, true);
|
|
178
|
+
const intent = (0, parseMidnightMaker_js_1.parseMidnightMakerIntent)({
|
|
179
|
+
offers: tree,
|
|
180
|
+
accountAddress,
|
|
181
|
+
side: "lend",
|
|
182
|
+
reduceOnly: false,
|
|
183
|
+
});
|
|
184
|
+
const chainCheck = (0, chainCheck_js_1.createChainCheck)(client.viemClient, chainId);
|
|
185
|
+
await chainCheck();
|
|
186
|
+
// Freshness belongs to this invocation, after its chain check.
|
|
187
|
+
(0, deadline_js_1.validateMidnightDeadline)(params.deadline, suppliedNow);
|
|
188
|
+
const { callbackSalt, market: blueMarket, assets: assetsToPark } = blueSupply;
|
|
189
|
+
const callbackData = (0, encodeMidnightCalldata_js_1.wrapMidnightEncoding)("blueMarket", () => (0, callback_js_1.getMidnightBlueBuyCallbackData)(blueMarket));
|
|
190
|
+
const blueMarketId = blue_sdk_1.MarketUtils.getMarketId(blueMarket);
|
|
191
|
+
const callback = (0, callback_js_1.getMidnightBlueBuyCallbackAddress)({
|
|
192
|
+
chainId,
|
|
193
|
+
owner: accountAddress,
|
|
194
|
+
salt: callbackSalt,
|
|
195
|
+
});
|
|
196
|
+
const [data, fetched] = await Promise.all([
|
|
197
|
+
(0, exports.getOffersDataInternal)((0, exports.parseGetOffersDataParams)({ ...params, offers: intent.tree }, context), { ...context, chainCheck }),
|
|
198
|
+
(0, blue_sdk_viem_1.fetchMarket)(blueMarketId, client.viemClient, {
|
|
199
|
+
deployless: client.options.supportDeployless,
|
|
200
|
+
}),
|
|
201
|
+
]);
|
|
202
|
+
const market = (0, morpho_ts_1._try)(() => fetched.accrueInterest(blue_sdk_1.MathLib.max(suppliedNow ?? morpho_ts_1.Time.timestamp(), fetched.lastUpdate)), blue_sdk_1.UnsupportedMarketIrmError) ?? fetched;
|
|
203
|
+
if (market.totalSupplyShares === 0n) {
|
|
204
|
+
throw new index_js_2.EmptyBlueParkingMarketError({ marketId: blueMarketId });
|
|
205
|
+
}
|
|
206
|
+
if (market.toSupplyShares(assetsToPark, "Down") === 0n) {
|
|
207
|
+
throw new index_js_2.ZeroBlueParkingSharesError({
|
|
208
|
+
marketId: blueMarketId,
|
|
209
|
+
assets: assetsToPark,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
// Preserve late callback/loan-token relationship errors after the parking-state checks.
|
|
213
|
+
(0, parseMidnightMaker_js_1.parseMidnightMakerFundingBinding)({
|
|
214
|
+
tree: data.tree,
|
|
215
|
+
loanToken: blueMarket.loanToken,
|
|
216
|
+
callback: { address: callback, data: callbackData },
|
|
217
|
+
});
|
|
218
|
+
const action = (0, cancelAndMake_js_1.parseMidnightCancelAndMake)({
|
|
219
|
+
chainId,
|
|
220
|
+
publication: {
|
|
221
|
+
ratifier: data.ratifier,
|
|
222
|
+
root: data.tree.root,
|
|
223
|
+
groups: data.groups,
|
|
224
|
+
payload: data.payload,
|
|
225
|
+
blueSupply: { market: blueMarket, assets: assetsToPark, callbackSalt },
|
|
226
|
+
},
|
|
227
|
+
nativeAmount: params.nativeAmount,
|
|
228
|
+
cancellations: params.cancellations ?? [],
|
|
229
|
+
deadline: params.deadline,
|
|
230
|
+
metadata,
|
|
231
|
+
});
|
|
232
|
+
return Object.freeze({
|
|
233
|
+
action,
|
|
234
|
+
data,
|
|
235
|
+
loanToken: blueMarket.loanToken,
|
|
236
|
+
approvalAmount: assetsToPark,
|
|
237
|
+
[preparedMake]: "supplyBlueMakeLend",
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
exports.parseSupplyBlueMakeLendParams = parseSupplyBlueMakeLendParams;
|
|
241
|
+
/** Constructs the complete collateral-funded borrow publication from its raw request. @internal */
|
|
242
|
+
const parseSupplyCollateralMakeBorrowParams = async (params, context) => {
|
|
243
|
+
const { client, chainId } = context;
|
|
244
|
+
const metadata = (0, metadata_js_1.resolveTransactionMetadata)(client.options.metadata, params.now);
|
|
245
|
+
(0, index_js_1.validateChainId)(client.viemClient.chain?.id, chainId);
|
|
246
|
+
const accountAddress = (0, parseMidnight_js_1.parseMidnightAccount)("accountAddress", params.accountAddress);
|
|
247
|
+
// Preserve local expiry before market/tree construction.
|
|
248
|
+
(0, deadline_js_1.validateMidnightDeadline)(params.deadline, params.now);
|
|
249
|
+
const market = params.collateral.market instanceof midnight_sdk_1.MarketParams
|
|
250
|
+
? params.collateral.market
|
|
251
|
+
: midnight_sdk_1.MarketParams.from(params.collateral.market);
|
|
252
|
+
const tree = (0, parseMidnightMaker_js_1.parseMidnightMakerTree)({
|
|
253
|
+
offers: params.offers,
|
|
254
|
+
accountAddress,
|
|
255
|
+
});
|
|
256
|
+
// Borrow-side and callback guards precede reduce-only guards on this funded boundary.
|
|
257
|
+
(0, validateOfferSides_js_1.validateOfferSides)(tree.offers, false);
|
|
258
|
+
(0, publication_js_1.validateMidnightMakerOfferCallbacks)(tree.offers);
|
|
259
|
+
const intent = (0, parseMidnightMaker_js_1.parseMidnightMakerIntent)({
|
|
260
|
+
offers: tree,
|
|
261
|
+
accountAddress,
|
|
262
|
+
side: "borrow",
|
|
263
|
+
reduceOnly: false,
|
|
264
|
+
});
|
|
265
|
+
const data = await (0, exports.getOffersDataInternal)((0, exports.parseGetOffersDataParams)({ ...params, offers: intent.tree }, context), { ...context, marketCreationTime: "now" });
|
|
266
|
+
const marketId = (0, encodeMidnightCalldata_js_1.encodeMidnightMarketId)(market);
|
|
267
|
+
for (const offer of data.tree.offers) {
|
|
268
|
+
const offerMarketId = (0, encodeMidnightCalldata_js_1.encodeMidnightMarketId)(offer.market);
|
|
269
|
+
if (offerMarketId.toLowerCase() !== marketId.toLowerCase()) {
|
|
270
|
+
throw new index_js_2.MarketIdMismatchError(offerMarketId, marketId);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const action = (0, cancelAndMake_js_1.parseMidnightCancelAndMake)({
|
|
274
|
+
chainId,
|
|
275
|
+
nativeAmount: params.nativeAmount,
|
|
276
|
+
cancellations: params.cancellations ?? [],
|
|
277
|
+
deadline: params.deadline,
|
|
278
|
+
metadata,
|
|
279
|
+
publication: {
|
|
280
|
+
ratifier: data.ratifier,
|
|
281
|
+
root: data.tree.root,
|
|
282
|
+
groups: data.groups,
|
|
283
|
+
payload: data.payload,
|
|
284
|
+
collateral: { market, supplies: params.collateral.supplies },
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
return Object.freeze({
|
|
288
|
+
action,
|
|
289
|
+
data,
|
|
290
|
+
[preparedMake]: "supplyCollateralMakeBorrow",
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
exports.parseSupplyCollateralMakeBorrowParams = parseSupplyCollateralMakeBorrowParams;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Market,
|
|
1
|
+
import { Market, type Tree } from "@morpho-org/midnight-sdk";
|
|
2
2
|
import { type Address, type Client } from "viem";
|
|
3
|
-
|
|
4
|
-
export declare const offerMarketParams: (offer: Offer) => MarketParams;
|
|
3
|
+
import { type ChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
5
4
|
/** Onchain state used to validate one Midnight maker offer before publication.
|
|
6
5
|
*
|
|
7
6
|
* `market` supplies the market id for errors, the maturity used for Rate V1 sell-overflow timing,
|
|
@@ -118,6 +117,11 @@ export declare function fetchMidnightMakerOfferStates(params: {
|
|
|
118
117
|
readonly states: readonly MidnightMakerOfferState[];
|
|
119
118
|
readonly now: bigint;
|
|
120
119
|
}>;
|
|
120
|
+
/** Reads maker state using the invocation's chain check. @internal */
|
|
121
|
+
export declare function fetchMidnightMakerOfferStatesWithChainCheck(params: Parameters<typeof fetchMidnightMakerOfferStates>[0], chainCheck: ChainCheck): Promise<{
|
|
122
|
+
readonly states: readonly MidnightMakerOfferState[];
|
|
123
|
+
readonly now: bigint;
|
|
124
|
+
}>;
|
|
121
125
|
/**
|
|
122
126
|
* Rejects offers with callbacks that the selected maker flow cannot execute.
|
|
123
127
|
*
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.offerMarketParams = void 0;
|
|
4
3
|
exports.validateMidnightMakerOfferStates = validateMidnightMakerOfferStates;
|
|
5
4
|
exports.fetchMidnightMakerOfferStates = fetchMidnightMakerOfferStates;
|
|
5
|
+
exports.fetchMidnightMakerOfferStatesWithChainCheck = fetchMidnightMakerOfferStatesWithChainCheck;
|
|
6
6
|
exports.validateMidnightMakerOfferCallbacks = validateMidnightMakerOfferCallbacks;
|
|
7
7
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
8
8
|
const midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
9
9
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
10
10
|
const viem_1 = require("viem");
|
|
11
11
|
const actions_1 = require("viem/actions");
|
|
12
|
-
const
|
|
12
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
13
13
|
const midnightPublicationError_js_1 = require("../../types/midnightPublicationError.js");
|
|
14
14
|
// Midnight.sol `touchMarket` rejects markets maturing more than 100 years after creation.
|
|
15
15
|
const MAX_TIME_TO_MATURITY = 100n * 365n * 86400n;
|
|
@@ -21,7 +21,6 @@ function requirePublicationState(value) {
|
|
|
21
21
|
}
|
|
22
22
|
/** @internal */
|
|
23
23
|
const offerMarketParams = (offer) => "params" in offer.market ? offer.market.params : offer.market;
|
|
24
|
-
exports.offerMarketParams = offerMarketParams;
|
|
25
24
|
function validateOfferTerms({ offer, state, index, marketId, }) {
|
|
26
25
|
const capacity = BigInt(offer.maxAssets) > 0n
|
|
27
26
|
? BigInt(offer.maxAssets)
|
|
@@ -148,7 +147,7 @@ function validateMidnightMakerOfferStates(params) {
|
|
|
148
147
|
params.tree.offers.forEach((offer, index) => {
|
|
149
148
|
const state = requirePublicationState(params.states[index]);
|
|
150
149
|
const expiry = BigInt(offer.expiry);
|
|
151
|
-
const offerMarket =
|
|
150
|
+
const offerMarket = offerMarketParams(offer);
|
|
152
151
|
const maturity = BigInt(offerMarket.maturity);
|
|
153
152
|
const marketId = state.market.id;
|
|
154
153
|
if (expiry <= params.now) {
|
|
@@ -219,7 +218,11 @@ function validateMidnightMakerOfferStates(params) {
|
|
|
219
218
|
* ```
|
|
220
219
|
*/
|
|
221
220
|
async function fetchMidnightMakerOfferStates(params) {
|
|
222
|
-
|
|
221
|
+
return fetchMidnightMakerOfferStatesWithChainCheck(params, (0, chainCheck_js_1.createChainCheck)(params.client, params.chainId));
|
|
222
|
+
}
|
|
223
|
+
/** Reads maker state using the invocation's chain check. @internal */
|
|
224
|
+
async function fetchMidnightMakerOfferStatesWithChainCheck(params, chainCheck) {
|
|
225
|
+
await chainCheck();
|
|
223
226
|
const blockNumber = params.blockNumber ?? (await (0, actions_1.getBlockNumber)(params.client));
|
|
224
227
|
const block = await (0, actions_1.getBlock)(params.client, { blockNumber });
|
|
225
228
|
const midnight = (0, morpho_ts_1.getChainAddress)(params.chainId, "midnight");
|
|
@@ -258,7 +261,7 @@ async function fetchMidnightMakerOfferStates(params) {
|
|
|
258
261
|
lltvEnabled: collateralStates.map(({ lltvEnabled }) => lltvEnabled),
|
|
259
262
|
liquidationCursorEnabled: collateralStates.map(({ liquidationCursorEnabled }) => liquidationCursorEnabled),
|
|
260
263
|
oracleHasCode: uncreated
|
|
261
|
-
?
|
|
264
|
+
? offerMarketParams(offer).collateralParams.map((collateral) => codeByOracle.get(collateral.oracle.toLowerCase()) !== undefined &&
|
|
262
265
|
codeByOracle.get(collateral.oracle.toLowerCase()) !== "0x")
|
|
263
266
|
: [],
|
|
264
267
|
};
|
|
@@ -269,7 +272,7 @@ async function fetchMidnightMakerOfferStates(params) {
|
|
|
269
272
|
function collectPublicationReadTargets(tree) {
|
|
270
273
|
const markets = [
|
|
271
274
|
...new Map(tree.offers.map((offer) => {
|
|
272
|
-
const market = midnight_sdk_1.MarketParams.from(
|
|
275
|
+
const market = midnight_sdk_1.MarketParams.from(offerMarketParams(offer));
|
|
273
276
|
const id = midnight_sdk_1.MarketUtils.toId(market);
|
|
274
277
|
return [id.toLowerCase(), { id, market }];
|
|
275
278
|
})).values(),
|
|
@@ -235,6 +235,13 @@ export interface SupplyCollateralParams extends MarketActionParams {
|
|
|
235
235
|
readonly reservedCollateralAssets?: bigint;
|
|
236
236
|
readonly collateralIndex?: bigint;
|
|
237
237
|
}
|
|
238
|
+
/** Parameters for a Midnight collateral supply with native wrapping. */
|
|
239
|
+
export interface SupplyCollateralWithNativeParams extends SupplyCollateralParams {
|
|
240
|
+
/** Positive native funding in wei, capped at the supplied wNative collateral. */
|
|
241
|
+
readonly nativeAmount: bigint;
|
|
242
|
+
/** Bundle execution deadline. Pass `maxUint256` explicitly for no expiry. */
|
|
243
|
+
readonly deadline: bigint;
|
|
244
|
+
}
|
|
238
245
|
/** Parameters for an atomic direct Midnight collateral supply batch. */
|
|
239
246
|
export interface SupplyCollateralBatchParams extends MarketActionParams {
|
|
240
247
|
readonly collateralSupplies: readonly {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AddressLabel } from "@morpho-org/morpho-ts";
|
|
2
2
|
import type { Address, Client } from "viem";
|
|
3
|
+
import { type ChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
3
4
|
/**
|
|
4
5
|
* Asserts that a configured contract address holds deployed code on the client's chain.
|
|
5
6
|
*
|
|
@@ -26,16 +27,20 @@ export declare const assertContractCode: (client: Client, params: {
|
|
|
26
27
|
/**
|
|
27
28
|
* Asserts that each distinct target in a flow's write-surface list holds code.
|
|
28
29
|
*
|
|
29
|
-
* One `eth_getCode` per distinct address
|
|
30
|
-
*
|
|
31
|
-
*
|
|
30
|
+
* One `eth_getCode` per distinct address launches concurrently, preserving the
|
|
31
|
+
* first occurrence's reporting order. Each read's rejection handler attaches
|
|
32
|
+
* immediately; outcomes are then consumed in target order, so a known earlier
|
|
33
|
+
* failure does not wait for later reads to settle. Later rejections stay observed
|
|
34
|
+
* even after this assertion returns early.
|
|
35
|
+
* Before any other requirement read, a selected {@link MissingContractCodeError}
|
|
36
|
+
* uses the invocation's lazy chain preflight (reusing an earlier result): a served
|
|
32
37
|
* chain mismatch surfaces as {@link ChainIdMismatchError} (never as missing
|
|
33
38
|
* code), a failed probe keeps the original missing-code error, and a matching
|
|
34
39
|
* chain rethrows it unchanged. Other assertion errors propagate unwrapped.
|
|
35
40
|
*
|
|
36
41
|
* @param client - Connected viem client used for the `eth_getCode` reads.
|
|
37
42
|
* @param chainId - Chain id the flow targets, reported on the errors.
|
|
38
|
-
* @param targets -
|
|
43
|
+
* @param targets - Targets to deduplicate by address and check, in reporting order.
|
|
39
44
|
* @returns Nothing when every target holds code.
|
|
40
45
|
* @throws {MissingContractCodeError} when a target has no deployed bytecode on
|
|
41
46
|
* the endpoint's chain.
|
|
@@ -46,4 +51,4 @@ export declare const assertContractCode: (client: Client, params: {
|
|
|
46
51
|
export declare const assertRegistryTargetsHaveCode: (client: Client, chainId: number, targets: readonly {
|
|
47
52
|
readonly role: AddressLabel;
|
|
48
53
|
readonly address: Address;
|
|
49
|
-
}[]) => Promise<void>;
|
|
54
|
+
}[], chainCheck?: ChainCheck) => Promise<void>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertRegistryTargetsHaveCode = exports.assertContractCode = void 0;
|
|
4
4
|
const actions_1 = require("viem/actions");
|
|
5
|
-
const
|
|
5
|
+
const chainCheck_js_1 = require("../../actions/requirements/chainCheck.js");
|
|
6
6
|
const index_js_1 = require("../../types/index.js");
|
|
7
7
|
/**
|
|
8
8
|
* Asserts that a configured contract address holds deployed code on the client's chain.
|
|
@@ -32,16 +32,20 @@ exports.assertContractCode = assertContractCode;
|
|
|
32
32
|
/**
|
|
33
33
|
* Asserts that each distinct target in a flow's write-surface list holds code.
|
|
34
34
|
*
|
|
35
|
-
* One `eth_getCode` per distinct address
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* One `eth_getCode` per distinct address launches concurrently, preserving the
|
|
36
|
+
* first occurrence's reporting order. Each read's rejection handler attaches
|
|
37
|
+
* immediately; outcomes are then consumed in target order, so a known earlier
|
|
38
|
+
* failure does not wait for later reads to settle. Later rejections stay observed
|
|
39
|
+
* even after this assertion returns early.
|
|
40
|
+
* Before any other requirement read, a selected {@link MissingContractCodeError}
|
|
41
|
+
* uses the invocation's lazy chain preflight (reusing an earlier result): a served
|
|
38
42
|
* chain mismatch surfaces as {@link ChainIdMismatchError} (never as missing
|
|
39
43
|
* code), a failed probe keeps the original missing-code error, and a matching
|
|
40
44
|
* chain rethrows it unchanged. Other assertion errors propagate unwrapped.
|
|
41
45
|
*
|
|
42
46
|
* @param client - Connected viem client used for the `eth_getCode` reads.
|
|
43
47
|
* @param chainId - Chain id the flow targets, reported on the errors.
|
|
44
|
-
* @param targets -
|
|
48
|
+
* @param targets - Targets to deduplicate by address and check, in reporting order.
|
|
45
49
|
* @returns Nothing when every target holds code.
|
|
46
50
|
* @throws {MissingContractCodeError} when a target has no deployed bytecode on
|
|
47
51
|
* the endpoint's chain.
|
|
@@ -50,26 +54,31 @@ exports.assertContractCode = assertContractCode;
|
|
|
50
54
|
* @internal
|
|
51
55
|
*/
|
|
52
56
|
// biome-ignore lint/complexity/useMaxParams: positional (client, chainId, targets) signature
|
|
53
|
-
const assertRegistryTargetsHaveCode = async (client, chainId, targets) => {
|
|
57
|
+
const assertRegistryTargetsHaveCode = async (client, chainId, targets, chainCheck = (0, chainCheck_js_1.createChainCheck)(client, chainId)) => {
|
|
54
58
|
const seen = new Set();
|
|
59
|
+
const checks = [];
|
|
55
60
|
for (const target of targets) {
|
|
56
61
|
if (seen.has(target.address)) {
|
|
57
62
|
continue;
|
|
58
63
|
}
|
|
59
64
|
seen.add(target.address);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
checks.push((0, exports.assertContractCode)(client, {
|
|
66
|
+
address: target.address,
|
|
67
|
+
chainId,
|
|
68
|
+
role: target.role,
|
|
69
|
+
}).then(() => ({ status: "fulfilled", value: undefined }), (reason) => ({ status: "rejected", reason })));
|
|
70
|
+
}
|
|
71
|
+
// Every started read is already observed; await only the next ordered outcome,
|
|
72
|
+
// not all reads together, so stalled later targets cannot hide an earlier error.
|
|
73
|
+
for (const check of checks) {
|
|
74
|
+
const result = await check;
|
|
75
|
+
if (result.status === "rejected") {
|
|
76
|
+
const error = result.reason;
|
|
68
77
|
if (!(error instanceof index_js_1.MissingContractCodeError)) {
|
|
69
78
|
throw error;
|
|
70
79
|
}
|
|
71
80
|
try {
|
|
72
|
-
await (
|
|
81
|
+
await chainCheck();
|
|
73
82
|
}
|
|
74
83
|
catch (probeError) {
|
|
75
84
|
throw probeError instanceof index_js_1.ChainIdMismatchError ? probeError : error;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Address, type Client } from "viem";
|
|
2
|
+
import { type ChainCheck } from "../../actions/requirements/chainCheck.js";
|
|
2
3
|
import { type BundlesTokenSignatureRequirement, type ERC20ApprovalAction, type ReferenceTimestampParams, type Transaction } from "../../types/index.js";
|
|
3
4
|
/** Parameters for {@link getBundlesTokenRequirements}. */
|
|
4
5
|
export interface GetBundlesTokenRequirementsParams extends ReferenceTimestampParams {
|
|
@@ -23,6 +24,14 @@ export interface GetBundlesTokenRequirementsParams extends ReferenceTimestampPar
|
|
|
23
24
|
/** @deprecated Ignored. The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals. */
|
|
24
25
|
readonly permit2Nonce?: bigint;
|
|
25
26
|
}
|
|
27
|
+
declare const bundlesTokenRequirementsInput: unique symbol;
|
|
28
|
+
/** Complete checked token resolver invocation. @internal */
|
|
29
|
+
export type GetBundlesTokenRequirementsInput = Readonly<GetBundlesTokenRequirementsParams> & {
|
|
30
|
+
readonly useSimplePermit: boolean;
|
|
31
|
+
readonly [bundlesTokenRequirementsInput]: true;
|
|
32
|
+
};
|
|
33
|
+
/** Owns static checks and defaults without reading state. @internal */
|
|
34
|
+
export declare const parseGetBundlesTokenRequirements: (viemClient: Client, params: GetBundlesTokenRequirementsParams) => GetBundlesTokenRequirementsInput;
|
|
26
35
|
/**
|
|
27
36
|
* Resolves direct approval or ERC-2612 prerequisites for a registered fixed bundles contract.
|
|
28
37
|
*
|
|
@@ -91,3 +100,9 @@ export interface GetBundlesTokenRequirementsParams extends ReferenceTimestampPar
|
|
|
91
100
|
* ```
|
|
92
101
|
*/
|
|
93
102
|
export declare const getBundlesTokenRequirements: (viemClient: Client, params: GetBundlesTokenRequirementsParams) => Promise<readonly (Readonly<Transaction<ERC20ApprovalAction>> | BundlesTokenSignatureRequirement)[]>;
|
|
103
|
+
/** Consumes a complete invocation while retaining dynamic freshness and RPC order. @internal */
|
|
104
|
+
export declare const getParsedBundlesTokenRequirements: ({ viemClient, chainCheck: providedChainCheck, }: {
|
|
105
|
+
readonly viemClient: Client;
|
|
106
|
+
readonly chainCheck?: ChainCheck;
|
|
107
|
+
}, params: GetBundlesTokenRequirementsInput) => ReturnType<typeof getBundlesTokenRequirements>;
|
|
108
|
+
export {};
|