@morpho-org/morpho-sdk 9.8.0 → 10.0.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/MIGRATION-v9-to-v10.md +114 -0
- package/README.md +109 -13
- package/lib/cjs/actions/blue/common.js +4 -2
- package/lib/cjs/actions/blue/withdrawBuyCallback.js +2 -1
- package/lib/cjs/actions/bundles/common.js +20 -14
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +3 -4
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +3 -2
- package/lib/cjs/actions/midnight/cancelAndMake.d.ts +2 -1
- package/lib/cjs/actions/midnight/cancelAndMake.js +2 -1
- package/lib/cjs/actions/midnight/cancelOffers.d.ts +54 -0
- package/lib/cjs/actions/midnight/cancelOffers.js +108 -0
- package/lib/cjs/actions/midnight/index.d.ts +1 -0
- package/lib/cjs/actions/midnight/index.js +1 -0
- package/lib/cjs/actions/midnight/supplyCollateralBatch.js +4 -2
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +1 -1
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +3 -2
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeBorrow.js +3 -2
- package/lib/cjs/actions/midnight/takeLend.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeLend.js +3 -2
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +3 -2
- package/lib/cjs/actions/midnight/takeWithdraw.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeWithdraw.js +3 -2
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +4 -2
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -4
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +4 -6
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +3 -3
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +4 -6
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +3 -3
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -6
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +5 -13
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +3 -5
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +26 -23
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +2 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +2 -1
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +6 -3
- package/lib/cjs/actions/vaultV1/migrateToV2.js +1 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +4 -2
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +4 -2
- package/lib/cjs/entities/blue/blue.d.ts +34 -28
- package/lib/cjs/entities/blue/blue.js +107 -77
- package/lib/cjs/entities/midnight/deadline.d.ts +2 -2
- package/lib/cjs/entities/midnight/deadline.js +4 -3
- package/lib/cjs/entities/midnight/midnight.d.ts +49 -51
- package/lib/cjs/entities/midnight/midnight.js +158 -138
- package/lib/cjs/entities/midnight/publication.d.ts +2 -0
- package/lib/cjs/entities/midnight/publication.js +193 -138
- package/lib/cjs/entities/midnight/types.d.ts +4 -4
- package/lib/cjs/entities/requirements/assertContractCode.js +4 -2
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +3 -5
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +24 -28
- package/lib/cjs/entities/requirements/getErc2612Permit.js +10 -5
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -4
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -2
- package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.d.ts +21 -0
- package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.js +111 -0
- package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.d.ts +20 -0
- package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.js +76 -0
- package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.d.ts +21 -0
- package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.js +93 -0
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.d.ts +25 -0
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.js +85 -0
- package/lib/cjs/entities/vaultV1/migrateToV2Quote.d.ts +20 -0
- package/lib/cjs/entities/vaultV1/migrateToV2Quote.js +37 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +12 -12
- package/lib/cjs/entities/vaultV1/vaultV1.js +90 -194
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.d.ts +25 -0
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.js +189 -0
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.d.ts +28 -0
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.js +110 -0
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +16 -16
- package/lib/cjs/entities/vaultV2/vaultV2.js +94 -385
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +14 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +1599 -883
- package/lib/cjs/errors.d.ts +1 -1
- package/lib/cjs/errors.js +2 -1
- package/lib/cjs/helpers/deadShares.js +83 -47
- package/lib/cjs/helpers/encodeMidnightCalldata.js +4 -2
- package/lib/cjs/helpers/metadata.d.ts +14 -2
- package/lib/cjs/helpers/metadata.js +49 -8
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +44 -27
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +11 -2
- package/lib/cjs/helpers/utilization.js +10 -5
- package/lib/cjs/helpers/validate.js +88 -67
- package/lib/cjs/helpers/validateMidnightBounds.js +2 -1
- package/lib/cjs/helpers/validateMidnightCollateralBatch.js +2 -1
- package/lib/cjs/helpers/validateMidnightPublication.js +4 -2
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +177 -104
- package/lib/cjs/helpers/validatePositiveInput.js +2 -1
- package/lib/cjs/helpers/validateTakeableOffers.js +2 -1
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +40 -22
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +10 -1
- package/lib/cjs/transactionPlan/approval.js +12 -1
- package/lib/cjs/transactionPlan/deposit.d.ts +22 -0
- package/lib/cjs/transactionPlan/deposit.js +139 -0
- package/lib/cjs/transactionPlan/error.d.ts +10 -8
- package/lib/cjs/transactionPlan/error.js +10 -8
- package/lib/cjs/transactionPlan/getTokenPermit.js +2 -1
- package/lib/cjs/transactionPlan/index.d.ts +18 -0
- package/lib/cjs/transactionPlan/index.js +23 -5
- package/lib/cjs/transactionPlan/intent.d.ts +3 -3
- package/lib/cjs/transactionPlan/intent.js +14 -7
- package/lib/cjs/transactionPlan/permit.d.ts +1 -1
- package/lib/cjs/transactionPlan/permit.js +86 -20
- package/lib/cjs/transactionPlan/plan.d.ts +16 -6
- package/lib/cjs/transactionPlan/plan.js +77 -24
- package/lib/cjs/transactionPlan/redeem.d.ts +18 -0
- package/lib/cjs/transactionPlan/redeem.js +63 -0
- package/lib/cjs/transactionPlan/requirements.d.ts +4 -3
- package/lib/cjs/transactionPlan/requirements.js +12 -6
- package/lib/cjs/transactionPlan/serde.d.ts +2 -2
- package/lib/cjs/transactionPlan/serde.js +45 -19
- package/lib/cjs/transactionPlan/shareSpending.d.ts +18 -0
- package/lib/cjs/transactionPlan/shareSpending.js +50 -0
- package/lib/cjs/transactionPlan/types.d.ts +117 -11
- package/lib/cjs/transactionPlan/validateActions.js +11 -1
- package/lib/cjs/transactionPlan/validation.js +6 -3
- package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +93 -0
- package/lib/cjs/transactionPlan/vaultv1/deposit.js +94 -0
- package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.d.ts +96 -0
- package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.js +203 -0
- package/lib/cjs/transactionPlan/vaultv1/migrateToV2.d.ts +94 -0
- package/lib/cjs/transactionPlan/vaultv1/migrateToV2.js +217 -0
- package/lib/cjs/transactionPlan/vaultv1/redeem.d.ts +69 -0
- package/lib/cjs/transactionPlan/vaultv1/redeem.js +78 -0
- package/lib/cjs/transactionPlan/vaultv1/withdraw.d.ts +77 -0
- package/lib/cjs/transactionPlan/vaultv1/withdraw.js +88 -0
- package/lib/cjs/transactionPlan/vaultv2/deposit.d.ts +18 -33
- package/lib/cjs/transactionPlan/vaultv2/deposit.js +19 -143
- package/lib/cjs/transactionPlan/vaultv2/forceRedeem.d.ts +74 -0
- package/lib/cjs/transactionPlan/vaultv2/forceRedeem.js +155 -0
- package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.d.ts +98 -0
- package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.js +206 -0
- package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.d.ts +113 -0
- package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.js +206 -0
- package/lib/cjs/transactionPlan/vaultv2/redeem.d.ts +84 -0
- package/lib/cjs/transactionPlan/vaultv2/redeem.js +86 -0
- package/lib/cjs/transactionPlan/vaultv2/withdraw.d.ts +18 -29
- package/lib/cjs/transactionPlan/vaultv2/withdraw.js +21 -126
- package/lib/cjs/transactionPlan/version.js +2 -1
- package/lib/cjs/transactionPlan/withdraw.d.ts +18 -0
- package/lib/cjs/transactionPlan/withdraw.js +94 -0
- package/lib/cjs/types/action.d.ts +26 -2
- package/lib/cjs/types/action.js +17 -9
- package/lib/cjs/types/error.d.ts +8 -1
- package/lib/cjs/types/error.js +21 -6
- package/lib/cjs/types/metadata.d.ts +12 -2
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/actions/blue/common.js +4 -2
- package/lib/esm/actions/blue/withdrawBuyCallback.js +2 -1
- package/lib/esm/actions/bundles/common.js +20 -14
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +3 -4
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +3 -2
- package/lib/esm/actions/midnight/cancelAndMake.d.ts +2 -1
- package/lib/esm/actions/midnight/cancelAndMake.js +2 -1
- package/lib/esm/actions/midnight/cancelOffers.d.ts +54 -0
- package/lib/esm/actions/midnight/cancelOffers.js +104 -0
- package/lib/esm/actions/midnight/index.d.ts +1 -0
- package/lib/esm/actions/midnight/index.js +1 -0
- package/lib/esm/actions/midnight/supplyCollateralBatch.js +4 -2
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +1 -1
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +3 -2
- package/lib/esm/actions/midnight/takeBorrow.d.ts +1 -1
- package/lib/esm/actions/midnight/takeBorrow.js +3 -2
- package/lib/esm/actions/midnight/takeLend.d.ts +1 -1
- package/lib/esm/actions/midnight/takeLend.js +3 -2
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -1
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +3 -2
- package/lib/esm/actions/midnight/takeWithdraw.d.ts +1 -1
- package/lib/esm/actions/midnight/takeWithdraw.js +3 -2
- package/lib/esm/actions/midnight/withdrawCollateralBatch.js +4 -2
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -4
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +4 -6
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +3 -3
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -6
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +3 -3
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -6
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +7 -15
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +3 -5
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +26 -23
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +2 -1
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +2 -1
- package/lib/esm/actions/vaultV1/inKindRedeem.js +6 -3
- package/lib/esm/actions/vaultV1/migrateToV2.js +1 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +4 -2
- package/lib/esm/actions/vaultV2/inKindRedeem.js +4 -2
- package/lib/esm/entities/blue/blue.d.ts +34 -28
- package/lib/esm/entities/blue/blue.js +107 -77
- package/lib/esm/entities/midnight/deadline.d.ts +2 -2
- package/lib/esm/entities/midnight/deadline.js +4 -3
- package/lib/esm/entities/midnight/midnight.d.ts +49 -51
- package/lib/esm/entities/midnight/midnight.js +159 -139
- package/lib/esm/entities/midnight/publication.d.ts +2 -0
- package/lib/esm/entities/midnight/publication.js +193 -138
- package/lib/esm/entities/midnight/types.d.ts +4 -4
- package/lib/esm/entities/requirements/assertContractCode.js +4 -2
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +3 -5
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +25 -29
- package/lib/esm/entities/requirements/getErc2612Permit.js +10 -5
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -4
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +8 -2
- package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.d.ts +21 -0
- package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.js +108 -0
- package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.d.ts +20 -0
- package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.js +73 -0
- package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.d.ts +21 -0
- package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.js +90 -0
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.d.ts +25 -0
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.js +82 -0
- package/lib/esm/entities/vaultV1/migrateToV2Quote.d.ts +20 -0
- package/lib/esm/entities/vaultV1/migrateToV2Quote.js +34 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +12 -12
- package/lib/esm/entities/vaultV1/vaultV1.js +96 -200
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.d.ts +25 -0
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.js +186 -0
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.d.ts +28 -0
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.js +107 -0
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +16 -16
- package/lib/esm/entities/vaultV2/vaultV2.js +102 -393
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +14 -0
- package/lib/esm/entities/vaultV2BlueReallocationData.js +1599 -883
- package/lib/esm/errors.d.ts +1 -1
- package/lib/esm/errors.js +1 -1
- package/lib/esm/helpers/deadShares.js +83 -47
- package/lib/esm/helpers/encodeMidnightCalldata.js +4 -2
- package/lib/esm/helpers/metadata.d.ts +14 -2
- package/lib/esm/helpers/metadata.js +48 -8
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +44 -27
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +11 -2
- package/lib/esm/helpers/utilization.js +10 -5
- package/lib/esm/helpers/validate.js +88 -67
- package/lib/esm/helpers/validateMidnightBounds.js +2 -1
- package/lib/esm/helpers/validateMidnightCollateralBatch.js +2 -1
- package/lib/esm/helpers/validateMidnightPublication.js +4 -2
- package/lib/esm/helpers/validateMidnightTakeFeasibility.js +176 -103
- package/lib/esm/helpers/validatePositiveInput.js +2 -1
- package/lib/esm/helpers/validateTakeableOffers.js +2 -1
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +40 -22
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/transactionPlan/approval.js +13 -2
- package/lib/esm/transactionPlan/deposit.d.ts +22 -0
- package/lib/esm/transactionPlan/deposit.js +135 -0
- package/lib/esm/transactionPlan/error.d.ts +10 -8
- package/lib/esm/transactionPlan/error.js +10 -8
- package/lib/esm/transactionPlan/getTokenPermit.js +2 -1
- package/lib/esm/transactionPlan/index.d.ts +18 -0
- package/lib/esm/transactionPlan/index.js +9 -0
- package/lib/esm/transactionPlan/intent.d.ts +3 -3
- package/lib/esm/transactionPlan/intent.js +14 -7
- package/lib/esm/transactionPlan/permit.d.ts +1 -1
- package/lib/esm/transactionPlan/permit.js +86 -20
- package/lib/esm/transactionPlan/plan.d.ts +16 -6
- package/lib/esm/transactionPlan/plan.js +73 -20
- package/lib/esm/transactionPlan/redeem.d.ts +18 -0
- package/lib/esm/transactionPlan/redeem.js +59 -0
- package/lib/esm/transactionPlan/requirements.d.ts +4 -3
- package/lib/esm/transactionPlan/requirements.js +12 -6
- package/lib/esm/transactionPlan/serde.d.ts +2 -2
- package/lib/esm/transactionPlan/serde.js +45 -19
- package/lib/esm/transactionPlan/shareSpending.d.ts +18 -0
- package/lib/esm/transactionPlan/shareSpending.js +47 -0
- package/lib/esm/transactionPlan/types.d.ts +117 -11
- package/lib/esm/transactionPlan/validateActions.js +11 -1
- package/lib/esm/transactionPlan/validation.js +6 -3
- package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +93 -0
- package/lib/esm/transactionPlan/vaultv1/deposit.js +90 -0
- package/lib/esm/transactionPlan/vaultv1/inKindRedeem.d.ts +96 -0
- package/lib/esm/transactionPlan/vaultv1/inKindRedeem.js +198 -0
- package/lib/esm/transactionPlan/vaultv1/migrateToV2.d.ts +94 -0
- package/lib/esm/transactionPlan/vaultv1/migrateToV2.js +212 -0
- package/lib/esm/transactionPlan/vaultv1/redeem.d.ts +69 -0
- package/lib/esm/transactionPlan/vaultv1/redeem.js +74 -0
- package/lib/esm/transactionPlan/vaultv1/withdraw.d.ts +77 -0
- package/lib/esm/transactionPlan/vaultv1/withdraw.js +84 -0
- package/lib/esm/transactionPlan/vaultv2/deposit.d.ts +18 -33
- package/lib/esm/transactionPlan/vaultv2/deposit.js +21 -144
- package/lib/esm/transactionPlan/vaultv2/forceRedeem.d.ts +74 -0
- package/lib/esm/transactionPlan/vaultv2/forceRedeem.js +150 -0
- package/lib/esm/transactionPlan/vaultv2/forceWithdraw.d.ts +98 -0
- package/lib/esm/transactionPlan/vaultv2/forceWithdraw.js +201 -0
- package/lib/esm/transactionPlan/vaultv2/inKindRedeem.d.ts +113 -0
- package/lib/esm/transactionPlan/vaultv2/inKindRedeem.js +201 -0
- package/lib/esm/transactionPlan/vaultv2/redeem.d.ts +84 -0
- package/lib/esm/transactionPlan/vaultv2/redeem.js +82 -0
- package/lib/esm/transactionPlan/vaultv2/withdraw.d.ts +18 -29
- package/lib/esm/transactionPlan/vaultv2/withdraw.js +23 -127
- package/lib/esm/transactionPlan/version.js +2 -1
- package/lib/esm/transactionPlan/withdraw.d.ts +18 -0
- package/lib/esm/transactionPlan/withdraw.js +90 -0
- package/lib/esm/types/action.d.ts +26 -2
- package/lib/esm/types/action.js +17 -9
- package/lib/esm/types/error.d.ts +8 -1
- package/lib/esm/types/error.js +21 -6
- package/lib/esm/types/metadata.d.ts +12 -2
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +15 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AccrualPosition, type Market, type MidnightFetchParams } from "@morpho-org/midnight-sdk";
|
|
2
2
|
import { type Address, type Hex } from "viem";
|
|
3
3
|
import type { MorphoClientType } from "../../types/client.js";
|
|
4
|
-
import { type
|
|
4
|
+
import { type MidnightCancelOffersAction, type MidnightRedeemAction, type MidnightRepayWithdrawCollateralAction, type MidnightSupplyCollateralAction, type MidnightSupplyCollateralBatchAction, type MidnightSupplyCollateralTakeBorrowAction, type MidnightTakeBorrowAction, type MidnightTakeLendAction, type MidnightTakeRepayWithdrawCollateralAction, type MidnightTakeWithdrawAction, type MidnightWithdrawCollateralAction, type MidnightWithdrawCollateralBatchAction, type ReferenceTimestampParams } from "../../types/index.js";
|
|
5
5
|
import type { GetOffersDataParams, GetPositionDataParams, MakeLendParams, MakeOffersOutput, MakeOffersParams, MidnightActionOutput, OffersData, RedeemParams, RepayWithdrawCollateralParams, SupplyBlueMakeLendParams, SupplyCollateralBatchParams, SupplyCollateralMakeBorrowParams, SupplyCollateralParams, SupplyCollateralTakeBorrowParams, TakeBorrowParams, TakeLendParams, TakeRepayWithdrawCollateralParams, TakeWithdrawParams, WithdrawCollateralBatchParams, WithdrawCollateralParams } from "./types.js";
|
|
6
6
|
/**
|
|
7
7
|
* Entity methods exposed by `client.morpho.midnight(chainId)`.
|
|
@@ -24,7 +24,8 @@ import type { GetOffersDataParams, GetPositionDataParams, MakeLendParams, MakeOf
|
|
|
24
24
|
* target: { type: "assets", assets: 1_000_000n, minUnits: 900_000n },
|
|
25
25
|
* takeableOffers: quote.data.takeableOffers,
|
|
26
26
|
* maxContinuousFee: maxUint256,
|
|
27
|
-
*
|
|
27
|
+
* now: (await client.getBlock()).timestamp,
|
|
28
|
+
* deadline: (await client.getBlock()).timestamp + 600n,
|
|
28
29
|
* });
|
|
29
30
|
* const requirements = await output.getRequirements();
|
|
30
31
|
* const tx = output.buildTx();
|
|
@@ -218,7 +219,8 @@ export declare class MorphoMidnight {
|
|
|
218
219
|
* target: { type: "assets", assets: 1_000_000n, minUnits: 900_000n },
|
|
219
220
|
* takeableOffers: quote.data.takeableOffers,
|
|
220
221
|
* maxContinuousFee: maxUint256,
|
|
221
|
-
*
|
|
222
|
+
* now: (await client.getBlock()).timestamp,
|
|
223
|
+
* deadline: (await client.getBlock()).timestamp + 600n,
|
|
222
224
|
* });
|
|
223
225
|
* ```
|
|
224
226
|
*/
|
|
@@ -313,7 +315,8 @@ export declare class MorphoMidnight {
|
|
|
313
315
|
* collateralPrices,
|
|
314
316
|
* target: { type: "assets", assets: 1_000_000n, maxUnits: 1_100_000n },
|
|
315
317
|
* takeableOffers: quote.data.takeableOffers,
|
|
316
|
-
*
|
|
318
|
+
* now: (await client.getBlock()).timestamp,
|
|
319
|
+
* deadline: (await client.getBlock()).timestamp + 600n,
|
|
317
320
|
* });
|
|
318
321
|
* ```
|
|
319
322
|
*/
|
|
@@ -382,7 +385,8 @@ export declare class MorphoMidnight {
|
|
|
382
385
|
* marketData,
|
|
383
386
|
* target: { type: "units", units: credit, minSellerAssets: 990_000n },
|
|
384
387
|
* takeableOffers: quote.data.takeableOffers,
|
|
385
|
-
*
|
|
388
|
+
* now: (await client.getBlock()).timestamp,
|
|
389
|
+
* deadline: (await client.getBlock()).timestamp + 600n,
|
|
386
390
|
* });
|
|
387
391
|
* ```
|
|
388
392
|
*/
|
|
@@ -478,7 +482,8 @@ export declare class MorphoMidnight {
|
|
|
478
482
|
* collateralSupplies: [{ collateralIndex: 0n, assets: 2_000_000n }],
|
|
479
483
|
* target: { type: "assets", assets: 1_000_000n, maxUnits: 1_100_000n },
|
|
480
484
|
* takeableOffers: quote.data.takeableOffers,
|
|
481
|
-
*
|
|
485
|
+
* now: (await client.getBlock()).timestamp,
|
|
486
|
+
* deadline: (await client.getBlock()).timestamp + 600n,
|
|
482
487
|
* });
|
|
483
488
|
* ```
|
|
484
489
|
*/
|
|
@@ -586,7 +591,8 @@ export declare class MorphoMidnight {
|
|
|
586
591
|
* repayEnabled: true,
|
|
587
592
|
* collateralWithdrawals: [{ collateralIndex: 0n, assets: maxUint256 }],
|
|
588
593
|
* maxContinuousFee: maxUint256,
|
|
589
|
-
*
|
|
594
|
+
* now: (await client.getBlock()).timestamp,
|
|
595
|
+
* deadline: (await client.getBlock()).timestamp + 600n,
|
|
590
596
|
* });
|
|
591
597
|
* ```
|
|
592
598
|
*/
|
|
@@ -805,7 +811,7 @@ export declare class MorphoMidnight {
|
|
|
805
811
|
* @throws {MidnightMarketLiquidationCursorNotEnabledError} when an uncreated market uses a disabled liquidation cursor.
|
|
806
812
|
* @throws {MidnightMarketOracleWithoutCodeError} when an uncreated market's oracle has no code.
|
|
807
813
|
* @throws {viem.BaseError} when a pinned block, contract, or oracle-code read fails.
|
|
808
|
-
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the
|
|
814
|
+
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
|
|
809
815
|
* @example
|
|
810
816
|
* ```ts
|
|
811
817
|
* const output = await midnight.makeLend({
|
|
@@ -870,7 +876,7 @@ export declare class MorphoMidnight {
|
|
|
870
876
|
* @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
|
|
871
877
|
* @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
|
|
872
878
|
* @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
|
|
873
|
-
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the
|
|
879
|
+
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
|
|
874
880
|
* @example
|
|
875
881
|
* ```ts
|
|
876
882
|
* const output = await midnight.makeBorrow({
|
|
@@ -973,7 +979,7 @@ export declare class MorphoMidnight {
|
|
|
973
979
|
* @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
|
|
974
980
|
* @throws {InvalidMidnightHexInputError} when a cancellation group or `callbackSalt` is not 32-byte hex.
|
|
975
981
|
* @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
|
|
976
|
-
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the
|
|
982
|
+
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
|
|
977
983
|
* @example
|
|
978
984
|
* ```ts
|
|
979
985
|
* const callback = getMidnightBlueBuyCallbackAddress({ chainId, owner: maker, salt: callbackSalt });
|
|
@@ -1050,7 +1056,7 @@ export declare class MorphoMidnight {
|
|
|
1050
1056
|
* @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
|
|
1051
1057
|
* @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
|
|
1052
1058
|
* @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
|
|
1053
|
-
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the
|
|
1059
|
+
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
|
|
1054
1060
|
* @example
|
|
1055
1061
|
* ```ts
|
|
1056
1062
|
* const output = await midnight.makeWithdraw({
|
|
@@ -1124,7 +1130,7 @@ export declare class MorphoMidnight {
|
|
|
1124
1130
|
* @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
|
|
1125
1131
|
* @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
|
|
1126
1132
|
* @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
|
|
1127
|
-
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the
|
|
1133
|
+
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
|
|
1128
1134
|
* @example
|
|
1129
1135
|
* ```ts
|
|
1130
1136
|
* const output = await midnight.makeRepay({
|
|
@@ -1207,7 +1213,7 @@ export declare class MorphoMidnight {
|
|
|
1207
1213
|
* @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
|
|
1208
1214
|
* @throws {InvalidMidnightHexInputError} when a cancellation group is not 32-byte hex.
|
|
1209
1215
|
* @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
|
|
1210
|
-
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the
|
|
1216
|
+
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
|
|
1211
1217
|
* @example
|
|
1212
1218
|
* ```ts
|
|
1213
1219
|
* const output = await midnight.supplyCollateralMakeBorrow({
|
|
@@ -1326,7 +1332,7 @@ export declare class MorphoMidnight {
|
|
|
1326
1332
|
* during this method call, before the lazy output is returned.
|
|
1327
1333
|
* @throws {MidnightContractReceiverError} when `collateralReceiver` is a Midnight protocol
|
|
1328
1334
|
* contract or a market token contract.
|
|
1329
|
-
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the
|
|
1335
|
+
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the reference timestamp (`params.now`, or the deprecated device-clock fallback), including zero or negative values.
|
|
1330
1336
|
* @example
|
|
1331
1337
|
* ```ts
|
|
1332
1338
|
* // Close the position: repay all debt, withdraw all collateral.
|
|
@@ -1343,42 +1349,37 @@ export declare class MorphoMidnight {
|
|
|
1343
1349
|
*/
|
|
1344
1350
|
repayWithdrawCollateral(params: RepayWithdrawCollateralParams): MidnightActionOutput<MidnightRepayWithdrawCollateralAction>;
|
|
1345
1351
|
/**
|
|
1346
|
-
* Prepares
|
|
1352
|
+
* Prepares a full cancellation of one or more maker offer groups as a direct call to Midnight.
|
|
1347
1353
|
*
|
|
1348
|
-
*
|
|
1349
|
-
* `
|
|
1354
|
+
* One group builds a bare `setConsumed(group, maxUint128, accountAddress)`. Two or more groups
|
|
1355
|
+
* build one Midnight `multicall` of such calls, in list order, which cancels every group or
|
|
1356
|
+
* none. Only the single-group transaction is matchable by a wallet policy that allows
|
|
1357
|
+
* `setConsumed` by method name; cancel one group per transaction when the signer's policy names
|
|
1358
|
+
* `setConsumed`.
|
|
1350
1359
|
*
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1353
|
-
*
|
|
1354
|
-
*
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1358
|
-
*
|
|
1359
|
-
*
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
1363
|
-
* @
|
|
1364
|
-
* @throws {ChainIdMismatchError} when the client targets another chain, or from
|
|
1365
|
-
* `getRequirements()` when the RPC reports another chain via `eth_chainId`.
|
|
1366
|
-
* @throws {MidnightCalldataEncodingError} when an input cannot be ABI-encoded, such as an out-of-range integer.
|
|
1367
|
-
* @throws {viem.BaseError} from `getRequirements()` when an `eth_chainId` request or requirement
|
|
1368
|
-
* RPC read fails.
|
|
1369
|
-
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
1370
|
-
* @throws {UnknownAddressError} when the chain has no `midnightBundlesV2` deployment.
|
|
1371
|
-
* @throws {EmptyMidnightGroupCancellationsError} when no groups are provided.
|
|
1360
|
+
* Nothing is required before sending: no Midnight authorization, approval, signature or
|
|
1361
|
+
* deadline. Cancellation is per group and always full; it does not unratify roots or revoke
|
|
1362
|
+
* authorizations, and cancelling a group again succeeds.
|
|
1363
|
+
*
|
|
1364
|
+
* @param params - Maker account and the offer groups to cancel.
|
|
1365
|
+
* @param params.accountAddress - Maker whose groups are cancelled. The maker, or an operator it
|
|
1366
|
+
* authorized on Midnight, must send the transaction; a transaction from any other account
|
|
1367
|
+
* reverts `Unauthorized()` and changes no group.
|
|
1368
|
+
* @param params.groups - Nonempty list of distinct 32-byte offer groups to cancel.
|
|
1369
|
+
* @param params.now - Optional reference timestamp used to resolve `metadata.timestamp: true`.
|
|
1370
|
+
* @returns A handle whose `getRequirements()` resolves to an empty list without reading the
|
|
1371
|
+
* chain, and whose synchronous `buildTx()` returns the transaction targeting `Midnight`.
|
|
1372
|
+
* @throws {ChainIdMismatchError} when the client targets another chain.
|
|
1372
1373
|
* @throws {MidnightInvalidAccountAddressError} when `accountAddress` is malformed or zero.
|
|
1373
|
-
* @throws {
|
|
1374
|
+
* @throws {EmptyMidnightGroupCancellationsError} when no groups are provided.
|
|
1375
|
+
* @throws {InvalidMidnightHexInputError} when a group is not 32-byte hex.
|
|
1374
1376
|
* @throws {DuplicateMidnightGroupCancellationError} when a group appears more than once.
|
|
1375
|
-
* @throws {
|
|
1376
|
-
* @throws {
|
|
1377
|
-
* @throws {ExpiredDeadlineError} when `params.deadline` is at or before the local clock (`Time.timestamp()`), including zero or negative values.
|
|
1377
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
1378
|
+
* @throws {UnknownAddressError} when the chain has no `midnight` deployment.
|
|
1378
1379
|
* @example
|
|
1379
1380
|
* ```ts
|
|
1380
1381
|
* import { morphoViemExtension } from "@morpho-org/morpho-sdk";
|
|
1381
|
-
* import { createPublicClient, http,
|
|
1382
|
+
* import { createPublicClient, http, type Address, type Hex } from "viem";
|
|
1382
1383
|
* import { base } from "viem/chains";
|
|
1383
1384
|
*
|
|
1384
1385
|
* declare const maker: Address;
|
|
@@ -1387,17 +1388,14 @@ export declare class MorphoMidnight {
|
|
|
1387
1388
|
* morphoViemExtension(),
|
|
1388
1389
|
* );
|
|
1389
1390
|
* const midnight = client.morpho.midnight(base.id);
|
|
1390
|
-
* const output = midnight.cancelOffers({
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1393
|
-
* deadline: maxUint256,
|
|
1394
|
-
* });
|
|
1391
|
+
* const output = midnight.cancelOffers({ accountAddress: maker, groups: [group] });
|
|
1392
|
+
* await output.getRequirements(); // => []
|
|
1393
|
+
* const tx = output.buildTx(); // calldata: setConsumed(group, maxUint128, maker)
|
|
1395
1394
|
* ```
|
|
1396
1395
|
*/
|
|
1397
1396
|
cancelOffers(params: {
|
|
1398
1397
|
readonly accountAddress: Address;
|
|
1399
|
-
readonly
|
|
1400
|
-
|
|
1401
|
-
}): MidnightActionOutput<MidnightCancelAndMakeAction>;
|
|
1398
|
+
readonly groups: readonly Hex[];
|
|
1399
|
+
} & ReferenceTimestampParams): MidnightActionOutput<MidnightCancelOffersAction>;
|
|
1402
1400
|
private getBundlesV2AuthorizationRequirements;
|
|
1403
1401
|
}
|