@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
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Migrating from morpho-sdk v9 to v10
|
|
2
|
+
|
|
3
|
+
Version 10 changes how `client.morpho.midnight(chainId).cancelOffers` cancels Midnight offer groups.
|
|
4
|
+
It now calls Midnight directly instead of going through MidnightBundlesV2. Nothing else changes:
|
|
5
|
+
the maker flows (`makeLend`, `makeBorrow`, `makeWithdraw`, `makeRepay`,
|
|
6
|
+
`supplyCollateralMakeBorrow`, `supplyBlueMakeLend`) and the pure `midnightCancelAndMake` builder
|
|
7
|
+
keep their inputs and calldata.
|
|
8
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
A cancellation through MidnightBundlesV2 is a call to `midnightBundlesV2CancelAndMake`, the function
|
|
12
|
+
that also publishes offers, with about 17 arguments, most of them zero. Wallets that approve
|
|
13
|
+
transactions by policy (MPC wallets such as Utila, Fireblocks and Fordefi) need an argument-level
|
|
14
|
+
calldata policy to allow it. `Midnight.setConsumed(group, amount, onBehalf)` has three flat fields
|
|
15
|
+
and can only raise a group's consumed amount, so a policy can allow it by method name.
|
|
16
|
+
|
|
17
|
+
## `cancelOffers` before and after
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// v9
|
|
21
|
+
const output = midnight.cancelOffers({
|
|
22
|
+
accountAddress: maker,
|
|
23
|
+
cancellations: [{ group, maxConsumed: maxUint128 }],
|
|
24
|
+
deadline,
|
|
25
|
+
});
|
|
26
|
+
// Returned the Midnight authorization of MidnightBundlesV2 when it was missing.
|
|
27
|
+
for (const requirement of await output.getRequirements()) {
|
|
28
|
+
await walletClient.sendTransaction(requirement);
|
|
29
|
+
}
|
|
30
|
+
await walletClient.sendTransaction(output.buildTx()); // to: MidnightBundlesV2
|
|
31
|
+
|
|
32
|
+
// v10
|
|
33
|
+
const output = midnight.cancelOffers({
|
|
34
|
+
accountAddress: maker,
|
|
35
|
+
groups: [group],
|
|
36
|
+
});
|
|
37
|
+
await output.getRequirements(); // always []
|
|
38
|
+
await walletClient.sendTransaction(output.buildTx()); // to: Midnight
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
| | v9 | v10 |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| Parameters | `{ accountAddress, cancellations, deadline }` | `{ accountAddress, groups }` |
|
|
44
|
+
| Target | MidnightBundlesV2 | Midnight |
|
|
45
|
+
| Calldata, one group | `midnightBundlesV2CancelAndMake(...)` | `setConsumed(group, maxUint128, accountAddress)` |
|
|
46
|
+
| Calldata, two or more groups | `midnightBundlesV2CancelAndMake(...)` | `multicall([setConsumed(...), ...])`, in list order |
|
|
47
|
+
| Requirements | Midnight authorization of MidnightBundlesV2 when missing | none |
|
|
48
|
+
| Action type | `midnightCancelAndMake` | `midnightCancelOffers`, args `{ groups, onBehalf }` |
|
|
49
|
+
| Chains | the six chains with a pinned MidnightBundlesV2 | every chain with a Midnight deployment |
|
|
50
|
+
|
|
51
|
+
## What is gone
|
|
52
|
+
|
|
53
|
+
- **`cancellations`.** Pass the offer groups as `groups: readonly Hex[]`. Map
|
|
54
|
+
`cancellations.map(({ group }) => group)`.
|
|
55
|
+
- **`maxConsumed`.** There is no consumption guard on a plain cancellation. v9 reverted the
|
|
56
|
+
whole call when a group's consumption was above its ceiling; v10 cancels whatever has been filled
|
|
57
|
+
so far. Reading `Midnight.consumed(maker, group)` before sending is advisory only, because a taker
|
|
58
|
+
can fill the offer after the read and before the cancel is included. For a guard that holds, use
|
|
59
|
+
cancel-only `midnightCancelAndMake` with `maxConsumed` set to the ceiling (for example `0n`); it
|
|
60
|
+
targets MidnightBundlesV2, so the maker must have authorized MidnightBundlesV2 on Midnight.
|
|
61
|
+
- **`deadline`.** The call has no deadline and `cancelOffers` no longer throws
|
|
62
|
+
`ExpiredDeadlineError`. A cancellation can only make an offer less fillable, so a late inclusion
|
|
63
|
+
is harmless.
|
|
64
|
+
- **The MidnightBundlesV2 authorization requirement.** `getRequirements()` always resolves to an
|
|
65
|
+
empty list and performs no RPC read. A maker that only cancels never needs to authorize
|
|
66
|
+
MidnightBundlesV2. The authorization is still required by the maker and taker flows.
|
|
67
|
+
- **`NegativeInputError` and `InputExceedsMaxError`** from `cancelOffers`: there is no ceiling or
|
|
68
|
+
deadline left to validate. `EmptyMidnightGroupCancellationsError`,
|
|
69
|
+
`DuplicateMidnightGroupCancellationError`, `InvalidMidnightHexInputError`,
|
|
70
|
+
`MidnightInvalidAccountAddressError` and `ChainIdMismatchError` are thrown as before.
|
|
71
|
+
|
|
72
|
+
## What changed
|
|
73
|
+
|
|
74
|
+
- **Full cancellation only.** Every group is set to `maxUint128`, which Midnight treats as fully
|
|
75
|
+
consumed. There is no partial amount.
|
|
76
|
+
- **An operator may send.** `accountAddress` is encoded as `onBehalf`. The maker can send the
|
|
77
|
+
transaction, and so can an operator the maker authorized on Midnight.
|
|
78
|
+
- **A wrong sender now reverts.** In v9 the bundle cancelled the groups of whichever account sent
|
|
79
|
+
the transaction, so a send from another account that had authorized MidnightBundlesV2 succeeded
|
|
80
|
+
and left the maker's offers fillable. In v10 a sender that is neither `accountAddress` nor its
|
|
81
|
+
operator reverts with `Unauthorized()` and no group changes.
|
|
82
|
+
- **A retry succeeds.** Cancelling a group that is already cancelled does not revert.
|
|
83
|
+
- **A batch is atomic.** Two or more groups are one `Midnight.multicall`: every group is cancelled
|
|
84
|
+
or none.
|
|
85
|
+
- **The action type changed.** Code that switches on `tx.action.type` for a cancellation must handle
|
|
86
|
+
`"midnightCancelOffers"`; `"midnightCancelAndMake"` now only describes maker bundles built by the
|
|
87
|
+
maker flows or the pure builder.
|
|
88
|
+
- **Simulation.** `toSimulationLimits` from `@morpho-org/evm-simulation` throws
|
|
89
|
+
`UnsupportedLimitActionError` for a `midnightCancelOffers` action, as it did for a cancel-only
|
|
90
|
+
bundle. A cancellation moves no value: simulate it with `limits: "none"`.
|
|
91
|
+
|
|
92
|
+
## MPC wallets: cancel one group per transaction
|
|
93
|
+
|
|
94
|
+
Only the single-group transaction is a bare `setConsumed` call. A policy that allows `setConsumed`
|
|
95
|
+
on the chain's Midnight contract by method name approves it, and an approver reads three fields:
|
|
96
|
+
the group, the amount (`maxUint128`) and the maker.
|
|
97
|
+
|
|
98
|
+
A transaction that cancels two or more groups calls `multicall`, so a `setConsumed` method-name
|
|
99
|
+
policy does not match it, and allowing `multicall` by name would allow any Midnight call. In MPC
|
|
100
|
+
flows, send one `cancelOffers` transaction per group:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
for (const group of groups) {
|
|
104
|
+
const tx = midnight.cancelOffers({ accountAddress: maker, groups: [group] }).buildTx();
|
|
105
|
+
await walletClient.sendTransaction(tx);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Lower-level builders
|
|
110
|
+
|
|
111
|
+
- `midnightCancelOffers({ chainId, groups, onBehalf, metadata? })` is the new pure action behind
|
|
112
|
+
`cancelOffers`, exported with `MidnightCancelOffersParams` and `MidnightCancelOffersAction`.
|
|
113
|
+
- `midnightCancelAndMake` is unchanged, including its cancel-only mode. Keep using it, or a maker
|
|
114
|
+
flow, to cancel and replace offers in one transaction under `maxConsumed` guards.
|
package/README.md
CHANGED
|
@@ -21,13 +21,16 @@ General Vault V1 operations remain supported.
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
|
|
24
|
+
npm install @morpho-org/morpho-sdk
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Read [Dead-share validators](./DEAD-SHARE-PROTECTION.md) for the exported checks. Builders do not
|
|
28
28
|
enforce the dead-deposit rule; integrators should validate their snapshot before building.
|
|
29
29
|
Snapshot-free Blue `supply` remains deprecated.
|
|
30
30
|
|
|
31
|
+
Upgrading from v9? Read the [v9 → v10 migration guide](./MIGRATION-v9-to-v10.md) for the direct
|
|
32
|
+
Midnight `cancelOffers` route.
|
|
33
|
+
|
|
31
34
|
Upgrading from v8? Read the [v8 → v9 migration guide](./MIGRATION-v8-to-v9.md) for the approval
|
|
32
35
|
API removals and the new unlimited-approval behavior.
|
|
33
36
|
|
|
@@ -58,7 +61,8 @@ BlueBundlesV1, and the remaining rows identify their destination.
|
|
|
58
61
|
| **Midnight** | `takeLend`, `takeBorrow`, `supplyCollateralTakeBorrow`, `takeRepayWithdrawCollateral`, `repayWithdrawCollateral`, `takeWithdraw` | MidnightBundlesV2 (Ethereum, Base, Arbitrum, Arc, Robinhood, Tempo) |
|
|
59
62
|
| | `supplyCollateral`, `withdrawCollateral`, `redeem` | Direct call |
|
|
60
63
|
| | `supplyCollateralBatch`, `withdrawCollateralBatch` | Midnight multicall |
|
|
61
|
-
| | `
|
|
64
|
+
| | `cancelOffers` | Direct call for one group (`setConsumed`), Midnight multicall for several; every Midnight chain |
|
|
65
|
+
| | `makeLend`, `makeBorrow`, `makeWithdraw`, `makeRepay`, `supplyCollateralMakeBorrow`, `supplyBlueMakeLend` | MidnightBundlesV2 (Ethereum, Base, Arbitrum, Arc, Robinhood, Tempo) |
|
|
62
66
|
|
|
63
67
|
`makeBorrow` publishes without collateral; `supplyCollateralMakeBorrow` requires collateral and
|
|
64
68
|
supplies it in the same transaction.
|
|
@@ -73,7 +77,9 @@ then call `buildTx()` without a separate root signature.
|
|
|
73
77
|
|
|
74
78
|
`VaultExitBundlesV1`, `VaultBundlesV1`, and `BlueBundlesV1` are registered on Ethereum, Base,
|
|
75
79
|
Arbitrum, Optimism, Polygon, World Chain, Unichain, HyperEVM, Katana, Monad, Stable, Tempo,
|
|
76
|
-
Robinhood Chain, Arc,
|
|
80
|
+
Robinhood Chain, Arc, X Layer, and Alpen. Alpen has no registered Vault V1 factory, wrapped-native
|
|
81
|
+
token, or Permit2; native-token funding is not enabled there. Custom deployments can still be
|
|
82
|
+
configured with `registerCustomAddresses`.
|
|
77
83
|
|
|
78
84
|
## How it works
|
|
79
85
|
|
|
@@ -273,7 +279,38 @@ instant liquidation. Blue writes do not accept `slippageTolerance`, `minSharePri
|
|
|
273
279
|
> **Beta:** TransactionPlan is experimental; breaking changes may ship in minor releases.
|
|
274
280
|
> Existing entity flows remain the recommended stable path during the shadow-mode rollout.
|
|
275
281
|
|
|
276
|
-
|
|
282
|
+
Preparers emit stored format `version: 2`. Version 1 (including SDK 9.7.0 plans) is rejected with
|
|
283
|
+
`UnsupportedTransactionPlanVersionError`; migrate trusted saved plans' fields and version before
|
|
284
|
+
restoring them. There is no legacy parser.
|
|
285
|
+
|
|
286
|
+
Prepare a Vault V2 deposit, withdrawal, force-withdraw or exact-share redemption plan, or a Vault V1 deposit or withdrawal plan with
|
|
287
|
+
`prepareVaultV1Deposit` or `prepareVaultV1Withdraw` and a `fetchAccrualVault` snapshot, then sign its pending requests with your wallet.
|
|
288
|
+
Deposit and withdrawal preparers take `assets`; redemption takes `shares`. Stored operation inputs
|
|
289
|
+
use the same names, except native-funded deposits store `nativeAssets` instead of `assets`.
|
|
290
|
+
Stored ERC-20 approval inputs likewise use `assets` for underlying-token approvals or `shares`
|
|
291
|
+
for vault-share approvals. See the [TransactionPlan format and migration notes](./src/transactionPlan/README.md).
|
|
292
|
+
Pass the caller-fetched `AccrualVault` (V1) or `AccrualVaultV2` (V2) once as `vault` for deposits,
|
|
293
|
+
and the matching snapshot as `vault` for withdrawals;
|
|
294
|
+
the contract address comes from `vault.address`. Only deposit preparation accepts `deployless`.
|
|
295
|
+
|
|
296
|
+
V1 and V2 deposits share preparation and validation; use `assets` for either preparer and
|
|
297
|
+
`nativeAssets` in stored native funding. The snapshot is not retained in the stored plan.
|
|
298
|
+
|
|
299
|
+
V1 and V2 withdrawal plans also share preparation and validation: both prepare and store gross
|
|
300
|
+
`assets`, alongside the stored `requiredShareAllowance` quote. Neither accepts a slippage override.
|
|
301
|
+
|
|
302
|
+
`prepareVaultV1Redeem` prepares a Vault V1 exact-share redemption. Its required `shareToken: Token`
|
|
303
|
+
supplies the vault address and share-permit domain metadata; no accrual snapshot is required.
|
|
304
|
+
|
|
305
|
+
V1 and V2 redemptions both prepare and store exact `shares`. Their shared authorization resolver
|
|
306
|
+
also serves ordinary withdrawals: chain checks, code checks and requirements run concurrently,
|
|
307
|
+
while the requirements helper checks the RPC chain before allowance or nonce reads.
|
|
308
|
+
|
|
309
|
+
Migration plans take exactly one of `assets` or `shares`, store `vault: sourceVault` and derived
|
|
310
|
+
`maxSharePrice`, and translate that bound to the entity/ABI `maxSharePriceVaultV2` argument.
|
|
311
|
+
Pass the caller-fetched source and target snapshots once each, as `sourceVault: AccrualVault` and
|
|
312
|
+
`targetVault: AccrualVaultV2`. Their assets must match and their addresses must differ.
|
|
313
|
+
|
|
277
314
|
`applySignatures(plan, signatures)` synchronously verifies every supplied signature before attaching
|
|
278
315
|
it, without a client or RPC. It validates all requests against their actions, including permit/action
|
|
279
316
|
deadline agreement, rejects unknown or duplicate input IDs, and recovers the permit owner from the
|
|
@@ -292,17 +329,76 @@ clock or RPC and does not check expiry, live state, signature ownership or actio
|
|
|
292
329
|
constraints. It does not prove authenticity or intent: tampered-but-well-formed, internally consistent
|
|
293
330
|
plans pass, so integrators must still protect stored plans.
|
|
294
331
|
|
|
295
|
-
|
|
332
|
+
Supported action types are `erc20Approval`, `vaultV1Deposit`, `vaultV1Withdraw`, `vaultV1Redeem`, `vaultV1InKindRedeem`, `vaultV1MigrateToV2`,
|
|
333
|
+
`vaultV2Deposit`, `vaultV2Withdraw`, `vaultV2Redeem`,
|
|
334
|
+
`vaultV2ForceWithdraw`, `vaultV2ForceRedeem` and `vaultV2InKindRedeem`. Builders return plain `Readonly<Transaction>` objects without step metadata.
|
|
335
|
+
|
|
336
|
+
| Prepare function | Operation |
|
|
337
|
+
| --- | --- |
|
|
338
|
+
| `prepareVaultV2Deposit` | Deposit assets into Vault V2 |
|
|
339
|
+
| `prepareVaultV2Withdraw` | Withdraw assets from Vault V2 |
|
|
340
|
+
| `prepareVaultV2Redeem` | Redeem an exact number of Vault V2 shares |
|
|
341
|
+
| `prepareVaultV2ForceWithdraw` | Force-withdraw a penalty-inclusive asset amount from Vault V2 |
|
|
342
|
+
| `prepareVaultV2ForceRedeem` | Force-deallocate and redeem an exact number of Vault V2 shares |
|
|
343
|
+
| `prepareVaultV2InKindRedeem` | Exit a penalty-inclusive asset amount from Vault V2 in kind (idle assets and Blue supply positions) |
|
|
344
|
+
| `prepareVaultV1Deposit` | Deposit assets into Vault V1 |
|
|
345
|
+
| `prepareVaultV1Withdraw` | Withdraw assets from Vault V1 |
|
|
346
|
+
| `prepareVaultV1Redeem` | Redeem an exact number of Vault V1 shares |
|
|
347
|
+
| `prepareVaultV1InKindRedeem` | Redeem Vault V1 shares in kind |
|
|
348
|
+
| `prepareVaultV1MigrateToV2` | Migrate exclusive `assets` or `shares` from Vault V1 into Vault V2 |
|
|
349
|
+
|
|
350
|
+
`prepareVaultV2ForceRedeem` takes `vaultAddress` and top-level `shares`, with no snapshot.
|
|
351
|
+
Caller-supplied `deallocations[].assets` and `shares` are fixed on one `vaultV2ForceRedeem` step
|
|
352
|
+
with no approvals or signature requests. It accepts neither `supportSignature` nor `deployless`.
|
|
353
|
+
`expiresAt` is plan metadata only, not an onchain deadline.
|
|
354
|
+
|
|
355
|
+
`prepareVaultV2Deposit` and `prepareVaultV2Withdraw` take one `vault: AccrualVaultV2` snapshot.
|
|
356
|
+
`prepareVaultV1MigrateToV2` takes `sourceVault: AccrualVault` and `targetVault: AccrualVaultV2` snapshots.
|
|
357
|
+
|
|
358
|
+
Preparers with token authorization default to `supportSignature: false`. With `true`, ERC-2612 tokens use permits and other
|
|
359
|
+
tokens fall back to direct approval; no Permit2 or fetch requests are generated. Callers fetch
|
|
360
|
+
snapshots before preparation. Builders return plain SDK transactions without step IDs or kinds.
|
|
361
|
+
|
|
362
|
+
When existing allowance is insufficient, withdrawal, redemption and migration plans request an unlimited (`maxUint256`)
|
|
296
363
|
ERC-2612 vault-share permit or direct share approval. The quote's `requiredShareAllowance` remains
|
|
297
|
-
the minimum needed for that
|
|
364
|
+
the minimum needed for that exit; later exits reuse sufficient allowance without a
|
|
298
365
|
new signature. Deposit asset permits must instead sign the exact pull amount, not an unlimited
|
|
299
|
-
value.
|
|
366
|
+
value. Finite format-2 withdrawal permits that cover the quoted minimum allowance remain valid;
|
|
367
|
+
this finite-permit compatibility does not apply to force-withdraw plans.
|
|
300
368
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
internally, but withdrawals have no on-chain share-price or maximum-shares bound. A price drop
|
|
369
|
+
Deposit and migration plans accept `slippageTolerance`, which sets their on-chain maximum share price.
|
|
370
|
+
`vaultV1Withdraw` and `vaultV2Withdraw` plans do not accept it: the share-allowance quote uses `DEFAULT_SLIPPAGE_TOLERANCE`
|
|
371
|
+
internally, but these ordinary withdrawals have no on-chain share-price or maximum-shares bound. A price drop
|
|
304
372
|
before inclusion can burn more shares than quoted.
|
|
305
373
|
|
|
374
|
+
`vaultV1InKindRedeem` and `vaultV2InKindRedeem` are also asset-denominated, with no on-chain share-price or maximum-shares
|
|
375
|
+
bound. A price drop before inclusion can burn more shares than quoted.
|
|
376
|
+
Each preparer takes one caller-fetched `vault` snapshot (`AccrualVault` for V1, `AccrualVaultV2`
|
|
377
|
+
for V2) and no `deployless` option.
|
|
378
|
+
V1 and V2 prepare and stored in-kind quantities use `assets`; builders translate to the stable entity/ABI
|
|
379
|
+
`amount`. Share approvals store `shares`, while ERC-2612 typed data retains `value`.
|
|
380
|
+
|
|
381
|
+
Use `prepareVaultV2ForceWithdraw` with one caller-fetched `vault: AccrualVaultV2` snapshot for a
|
|
382
|
+
penalty-inclusive asset exit; it accepts no `deployless` option. Prepare and stored `assets`
|
|
383
|
+
include the penalty. Optional `slippageTolerance` derives the stored on-chain `minSharePriceE27`
|
|
384
|
+
floor from the snapshot, using the entity default when omitted; plans accept no raw floor override.
|
|
385
|
+
Share allowances and permits target VaultExitBundlesV1, and any permit
|
|
386
|
+
must be unlimited (`maxUint256`).
|
|
387
|
+
|
|
388
|
+
`prepareVaultV2ForceRedeem` takes `vaultAddress`, top-level `shares`, and ordered deallocations
|
|
389
|
+
with `assets`. It creates a native vault multicall with no `supportSignature` or `deployless`
|
|
390
|
+
option. Stored inputs retain `vault` and `redeem.shares`; the entity method is unchanged.
|
|
391
|
+
|
|
392
|
+
Use `prepareVaultV2Redeem(client, { shareToken, chainId, account, shares, supportSignature })`
|
|
393
|
+
to burn exactly `shares`; pass the account's share balance for a full redemption.
|
|
394
|
+
`supportSignature` defaults to `false` (direct approval); `true` uses an ERC-2612 share
|
|
395
|
+
permit when allowance is insufficient. No Permit2 is used. Exact-share redemption needs
|
|
396
|
+
no quote: `shareToken: Token` is required, but an address-only `new Token({ address })` is sufficient.
|
|
397
|
+
An accrual snapshot also satisfies `Token`. Redemption sets no minimum assets received and accepts
|
|
398
|
+
neither `slippageTolerance` nor `deployless`.
|
|
399
|
+
Plans are serializable data; `buildTransaction` and `buildTransactions` return plain
|
|
400
|
+
frozen SDK transactions without step `id` or `kind` fields.
|
|
401
|
+
|
|
306
402
|
```typescript
|
|
307
403
|
import {
|
|
308
404
|
buildTransactions,
|
|
@@ -518,13 +614,13 @@ Link this package to your app for local debugging:
|
|
|
518
614
|
|
|
519
615
|
```bash
|
|
520
616
|
# In this morpho-sdk project
|
|
521
|
-
|
|
522
|
-
|
|
617
|
+
bun run build
|
|
618
|
+
bun link
|
|
523
619
|
```
|
|
524
620
|
|
|
525
621
|
```bash
|
|
526
622
|
# In your other project
|
|
527
|
-
|
|
623
|
+
bun link @morpho-org/morpho-sdk
|
|
528
624
|
```
|
|
529
625
|
|
|
530
626
|
Contribute from the monorepo root. See [CONTRIBUTING.md](../../CONTRIBUTING.md) for setup, checks, and package workflow. Report vulnerabilities through [SECURITY.md](../../SECURITY.md).
|
|
@@ -29,8 +29,9 @@ const validateBlueBundlesV1NativeFunding = (params) => {
|
|
|
29
29
|
if (nativeAmount < 0n) {
|
|
30
30
|
throw new index_js_2.NegativeInputError("nativeAmount", nativeAmount);
|
|
31
31
|
}
|
|
32
|
-
if (nativeAmount === 0n)
|
|
32
|
+
if (nativeAmount === 0n) {
|
|
33
33
|
return 0n;
|
|
34
|
+
}
|
|
34
35
|
(0, index_js_1.validateNativeAsset)(params.chainId, params.token);
|
|
35
36
|
if (nativeAmount !== params.fundedAmount) {
|
|
36
37
|
throw new index_js_2.NativeFundingAmountMismatchError(nativeAmount, params.fundedAmount);
|
|
@@ -55,8 +56,9 @@ exports.getBlueBundlesV1TokenPermit = getBlueBundlesV1TokenPermit;
|
|
|
55
56
|
/** @internal */
|
|
56
57
|
const getBlueBundlesV1SignedAuthorization = (params) => {
|
|
57
58
|
const { authorizationSignature } = params;
|
|
58
|
-
if (authorizationSignature == null)
|
|
59
|
+
if (authorizationSignature == null) {
|
|
59
60
|
return EMPTY_SIGNED_AUTHORIZATION;
|
|
61
|
+
}
|
|
60
62
|
const authorized = (0, morpho_ts_1.getChainAddress)(params.chainId, "bundles.blueBundlesV1");
|
|
61
63
|
if (!(0, viem_1.isAddressEqual)(authorizationSignature.args.owner, params.userAddress)) {
|
|
62
64
|
throw new index_js_2.DepositOwnerMismatchError(params.userAddress, authorizationSignature.args.owner);
|
|
@@ -49,8 +49,9 @@ const blueWithdrawBuyCallback = (params) => {
|
|
|
49
49
|
const { callbackAddress, userAddress, shares } = params.args;
|
|
50
50
|
(0, validate_js_1.validateMarketParamsId)(marketParams);
|
|
51
51
|
(0, validate_js_1.validateUint256Field)("shares", shares);
|
|
52
|
-
if (shares === 0n)
|
|
52
|
+
if (shares === 0n) {
|
|
53
53
|
throw new index_js_2.NonPositiveInputError("shares", shares);
|
|
54
|
+
}
|
|
54
55
|
let tx = {
|
|
55
56
|
to: (0, morpho_ts_1.getChainAddress)(chainId, "blue"),
|
|
56
57
|
value: 0n,
|
|
@@ -66,10 +66,10 @@ const resolveBundlesFunding = (params) => {
|
|
|
66
66
|
}
|
|
67
67
|
const assets = amount ?? nativeAmount ?? 0n;
|
|
68
68
|
if (assets < 0n) {
|
|
69
|
-
throw new index_js_2.NegativeInputError(amount
|
|
69
|
+
throw new index_js_2.NegativeInputError(amount == null ? "nativeAmount" : "amount", assets);
|
|
70
70
|
}
|
|
71
71
|
if (assets === 0n) {
|
|
72
|
-
throw new index_js_2.NonPositiveInputError(amount
|
|
72
|
+
throw new index_js_2.NonPositiveInputError(amount == null ? "nativeAmount" : "amount", assets);
|
|
73
73
|
}
|
|
74
74
|
return { assets, value: nativeAmount ?? 0n };
|
|
75
75
|
};
|
|
@@ -107,11 +107,13 @@ exports.resolveBundlesFunding = resolveBundlesFunding;
|
|
|
107
107
|
*/
|
|
108
108
|
const getBundlesTokenPermit = (params) => {
|
|
109
109
|
const { requirementSignature } = params;
|
|
110
|
-
if (requirementSignature == null)
|
|
110
|
+
if (requirementSignature == null) {
|
|
111
111
|
return { ...EMPTY_TOKEN_PERMIT };
|
|
112
|
+
}
|
|
112
113
|
const { type } = requirementSignature.action;
|
|
113
|
-
if (type !== "permit" && type !== "permit2SignatureTransfer")
|
|
114
|
+
if (type !== "permit" && type !== "permit2SignatureTransfer") {
|
|
114
115
|
throw new index_js_2.UnsupportedRequirementSignatureError(type);
|
|
116
|
+
}
|
|
115
117
|
if (!(0, viem_1.isAddressEqual)(requirementSignature.args.owner, params.userAddress)) {
|
|
116
118
|
throw new index_js_2.DepositOwnerMismatchError(params.userAddress, requirementSignature.args.owner);
|
|
117
119
|
}
|
|
@@ -362,10 +364,12 @@ exports.getBundlesSharesPermit = getBundlesSharesPermit;
|
|
|
362
364
|
* from the operation's, or when a carried action nonce is inconsistent with the signed nonce.
|
|
363
365
|
*/
|
|
364
366
|
const selectBundlesTokenRequirementSignature = (signatures, expected) => {
|
|
365
|
-
if (signatures == null)
|
|
367
|
+
if (signatures == null) {
|
|
366
368
|
return undefined;
|
|
367
|
-
|
|
369
|
+
}
|
|
370
|
+
if (signatures.length === 0) {
|
|
368
371
|
return undefined;
|
|
372
|
+
}
|
|
369
373
|
const selected = signatures.filter((signature) => signature.action.type === "permit" ||
|
|
370
374
|
signature.action.type === "permit2SignatureTransfer");
|
|
371
375
|
if (selected.length !== signatures.length) {
|
|
@@ -377,8 +381,9 @@ const selectBundlesTokenRequirementSignature = (signatures, expected) => {
|
|
|
377
381
|
throw new index_js_2.AmbiguousRequirementSignaturesError("permit", selected.length);
|
|
378
382
|
}
|
|
379
383
|
const selectedSignature = selected[0];
|
|
380
|
-
if (selectedSignature == null)
|
|
384
|
+
if (selectedSignature == null) {
|
|
381
385
|
return undefined;
|
|
386
|
+
}
|
|
382
387
|
const { action } = selectedSignature;
|
|
383
388
|
if (!(0, viem_1.isAddressEqual)(action.args.spender, expected.spender)) {
|
|
384
389
|
throw new index_js_2.BundlesPermitMismatchError({
|
|
@@ -387,9 +392,9 @@ const selectBundlesTokenRequirementSignature = (signatures, expected) => {
|
|
|
387
392
|
actual: action.args.spender,
|
|
388
393
|
});
|
|
389
394
|
}
|
|
390
|
-
const actualAmount = selectedSignature.args.amount
|
|
391
|
-
?
|
|
392
|
-
:
|
|
395
|
+
const actualAmount = selectedSignature.args.amount === expected.amount
|
|
396
|
+
? action.args.amount
|
|
397
|
+
: selectedSignature.args.amount;
|
|
393
398
|
if (actualAmount !== expected.amount) {
|
|
394
399
|
throw new index_js_2.BundlesPermitMismatchError({
|
|
395
400
|
field: "amount",
|
|
@@ -397,9 +402,9 @@ const selectBundlesTokenRequirementSignature = (signatures, expected) => {
|
|
|
397
402
|
actual: String(actualAmount),
|
|
398
403
|
});
|
|
399
404
|
}
|
|
400
|
-
const actualDeadline = selectedSignature.args.deadline
|
|
401
|
-
?
|
|
402
|
-
:
|
|
405
|
+
const actualDeadline = selectedSignature.args.deadline === expected.deadline
|
|
406
|
+
? action.args.deadline
|
|
407
|
+
: selectedSignature.args.deadline;
|
|
403
408
|
if (actualDeadline !== expected.deadline) {
|
|
404
409
|
throw new index_js_2.BundlesPermitMismatchError({
|
|
405
410
|
field: "deadline",
|
|
@@ -436,8 +441,9 @@ exports.selectBundlesTokenRequirementSignature = selectBundlesTokenRequirementSi
|
|
|
436
441
|
*/
|
|
437
442
|
const selectBundlesSharesPermitSignature = (signatures, expected) => {
|
|
438
443
|
const { permit } = (0, index_js_2.selectRequirementSignatures)(signatures, { permit: true });
|
|
439
|
-
if (permit == null)
|
|
444
|
+
if (permit == null) {
|
|
440
445
|
return undefined;
|
|
446
|
+
}
|
|
441
447
|
const { action } = permit;
|
|
442
448
|
if (action.type !== "permit") {
|
|
443
449
|
throw new index_js_2.BundlesPermitMismatchError({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import { type BundlesTokenSignatureRequirement, type ERC20ApprovalAction, type Transaction } from "../../types/index.js";
|
|
2
|
+
import { type BundlesTokenSignatureRequirement, type ERC20ApprovalAction, type ReferenceTimestampParams, type Transaction } from "../../types/index.js";
|
|
3
3
|
/** Plain onchain state used by {@link resolveBundlesTokenRequirements}. */
|
|
4
4
|
export type BundlesTokenRequirementsState = {
|
|
5
5
|
readonly type: "approval";
|
|
@@ -31,7 +31,7 @@ export type BundlesTokenRequirementsState = {
|
|
|
31
31
|
* @param params.amount - Exact pull amount in the token's smallest unit; zero returns no requirements.
|
|
32
32
|
* @param params.deadline - Signature expiration as a Unix timestamp in seconds; in the
|
|
33
33
|
* SignatureTransfer branch it must be positive, within uint256, and in the future.
|
|
34
|
-
* @param params.now -
|
|
34
|
+
* @param params.now - See {@link ReferenceTimestampParams.now}.
|
|
35
35
|
* @param params.state - Prefetched state for either classic approval or Permit2 SignatureTransfer.
|
|
36
36
|
* @param params.state.type - `approval` for a direct allowance or `permit2SignatureTransfer` for a signed pull.
|
|
37
37
|
* @param params.state.allowance - In the approval branch, current token allowance from `owner` to `spender`.
|
|
@@ -74,6 +74,5 @@ export declare const resolveBundlesTokenRequirements: (params: {
|
|
|
74
74
|
readonly chainId: number;
|
|
75
75
|
readonly amount: bigint;
|
|
76
76
|
readonly deadline: bigint;
|
|
77
|
-
readonly now?: bigint;
|
|
78
77
|
readonly state: BundlesTokenRequirementsState;
|
|
79
|
-
}) => readonly (Readonly<Transaction<ERC20ApprovalAction>> | BundlesTokenSignatureRequirement)[];
|
|
78
|
+
} & ReferenceTimestampParams) => readonly (Readonly<Transaction<ERC20ApprovalAction>> | BundlesTokenSignatureRequirement)[];
|
|
@@ -27,7 +27,7 @@ const getRequirementsApproval_js_1 = require("../requirements/getRequirementsApp
|
|
|
27
27
|
* @param params.amount - Exact pull amount in the token's smallest unit; zero returns no requirements.
|
|
28
28
|
* @param params.deadline - Signature expiration as a Unix timestamp in seconds; in the
|
|
29
29
|
* SignatureTransfer branch it must be positive, within uint256, and in the future.
|
|
30
|
-
* @param params.now -
|
|
30
|
+
* @param params.now - See {@link ReferenceTimestampParams.now}.
|
|
31
31
|
* @param params.state - Prefetched state for either classic approval or Permit2 SignatureTransfer.
|
|
32
32
|
* @param params.state.type - `approval` for a direct allowance or `permit2SignatureTransfer` for a signed pull.
|
|
33
33
|
* @param params.state.allowance - In the approval branch, current token allowance from `owner` to `spender`.
|
|
@@ -71,8 +71,9 @@ const resolveBundlesTokenRequirements = (params) => {
|
|
|
71
71
|
});
|
|
72
72
|
// Reject invalid pulls before an approval encoder can cap the requested amount.
|
|
73
73
|
(0, validate_js_1.validateUint256Field)("amount", params.amount);
|
|
74
|
-
if (params.amount === 0n)
|
|
74
|
+
if (params.amount === 0n) {
|
|
75
75
|
return [];
|
|
76
|
+
}
|
|
76
77
|
if (params.state.type === "approval") {
|
|
77
78
|
return (0, getRequirementsApproval_js_1.getRequirementsApproval)({
|
|
78
79
|
address: params.token,
|
|
@@ -5,7 +5,8 @@ export type { MidnightCancelAndMakeParams, MidnightMakeBorrowCollateral, Midnigh
|
|
|
5
5
|
* Encodes `MidnightBundlesV2.midnightBundlesV2CancelAndMake` for `msg.sender`: cancel previous
|
|
6
6
|
* groups under consumption guards, optionally park loan assets on Morpho Blue for the maker's
|
|
7
7
|
* `BlueBuyCallback` or supply collateral, activate `root`, and publish `payload`.
|
|
8
|
-
* Without `publication`, it only cancels groups (
|
|
8
|
+
* Without `publication`, it only cancels groups; `client.morpho.midnight(chainId).cancelOffers(...)`
|
|
9
|
+
* does not use this builder and calls Midnight directly through `midnightCancelOffers`.
|
|
9
10
|
* Execution reverts as a whole if any group's consumption exceeds its `maxConsumed` ceiling.
|
|
10
11
|
* The builder snapshots every input field once before validation and encoding. It checks root,
|
|
11
12
|
* groups, cancellation groups, Blue callback salt, and root-signature `r`/`s` as 32-byte hex and
|
|
@@ -26,7 +26,8 @@ const emptyMidnightMarket = {
|
|
|
26
26
|
* Encodes `MidnightBundlesV2.midnightBundlesV2CancelAndMake` for `msg.sender`: cancel previous
|
|
27
27
|
* groups under consumption guards, optionally park loan assets on Morpho Blue for the maker's
|
|
28
28
|
* `BlueBuyCallback` or supply collateral, activate `root`, and publish `payload`.
|
|
29
|
-
* Without `publication`, it only cancels groups (
|
|
29
|
+
* Without `publication`, it only cancels groups; `client.morpho.midnight(chainId).cancelOffers(...)`
|
|
30
|
+
* does not use this builder and calls Midnight directly through `midnightCancelOffers`.
|
|
30
31
|
* Execution reverts as a whole if any group's consumption exceeds its `maxConsumed` ceiling.
|
|
31
32
|
* The builder snapshots every input field once before validation and encoding. It checks root,
|
|
32
33
|
* groups, cancellation groups, Blue callback salt, and root-signature `r`/`s` as 32-byte hex and
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type Metadata, type MidnightCancelOffersAction, type Transaction } from "../../types/index.js";
|
|
3
|
+
/** Parameters for a direct Midnight cancellation of one or more offer groups. */
|
|
4
|
+
export interface MidnightCancelOffersParams {
|
|
5
|
+
readonly chainId: number;
|
|
6
|
+
readonly groups: readonly Hex[];
|
|
7
|
+
readonly onBehalf: Address;
|
|
8
|
+
readonly metadata?: Metadata;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Encodes a full cancellation of one or more offer groups as a direct call to Midnight.
|
|
12
|
+
*
|
|
13
|
+
* One group encodes a bare `setConsumed(group, maxUint128, onBehalf)`. Two or more groups encode
|
|
14
|
+
* one Midnight `multicall` holding one such `setConsumed` call per group, in list order; the batch
|
|
15
|
+
* cancels every group or none. Only the single-group encoding is matchable by a wallet policy that
|
|
16
|
+
* allows `setConsumed` by method name: a batch is a `multicall` call, so cancel one group per
|
|
17
|
+
* transaction when the signer's policy names `setConsumed`.
|
|
18
|
+
*
|
|
19
|
+
* The amount is always `maxUint128`, which Midnight never rejects, so cancelling a group again
|
|
20
|
+
* succeeds. Cancellation is per group: it does not unratify roots or revoke authorizations. The
|
|
21
|
+
* transaction never targets `MidnightBundlesV2` and needs no prior authorization or approval.
|
|
22
|
+
*
|
|
23
|
+
* @param params.chainId - Chain id used to resolve `Midnight`.
|
|
24
|
+
* @param params.groups - Nonempty list of distinct 32-byte offer groups to cancel.
|
|
25
|
+
* @param params.onBehalf - Maker whose groups are cancelled. `onBehalf`, or an operator it
|
|
26
|
+
* authorized on Midnight, must send the transaction; otherwise Midnight reverts
|
|
27
|
+
* `Unauthorized()` and no group changes.
|
|
28
|
+
* @param params.metadata - Optional analytics metadata appended to calldata.
|
|
29
|
+
* @returns A deep-frozen `Transaction<MidnightCancelOffersAction>` targeting `Midnight`.
|
|
30
|
+
* @throws {MidnightCalldataEncodingError} when `onBehalf` is not a valid address.
|
|
31
|
+
* @throws {MidnightZeroOnBehalfError} when `onBehalf` is the zero address.
|
|
32
|
+
* @throws {EmptyMidnightGroupCancellationsError} when `groups` is empty.
|
|
33
|
+
* @throws {InvalidMidnightHexInputError} when a group is not 32-byte hex.
|
|
34
|
+
* @throws {DuplicateMidnightGroupCancellationError} when a group appears more than once.
|
|
35
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
36
|
+
* @throws {UnknownAddressError} when the chain has no `midnight` deployment.
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { midnightCancelOffers } from "@morpho-org/morpho-sdk";
|
|
40
|
+
* import type { Address, Hex } from "viem";
|
|
41
|
+
*
|
|
42
|
+
* declare const maker: Address;
|
|
43
|
+
* declare const group: Hex;
|
|
44
|
+
*
|
|
45
|
+
* // One group: calldata is `setConsumed(group, maxUint128, maker)`.
|
|
46
|
+
* const tx = midnightCancelOffers({
|
|
47
|
+
* chainId: 8453,
|
|
48
|
+
* groups: [group],
|
|
49
|
+
* onBehalf: maker,
|
|
50
|
+
* });
|
|
51
|
+
* // tx.action => { type: "midnightCancelOffers", args: { groups: [group], onBehalf: maker } }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare const midnightCancelOffers: (params: MidnightCancelOffersParams) => Readonly<Transaction<MidnightCancelOffersAction>>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.midnightCancelOffers = void 0;
|
|
4
|
+
const midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
5
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
|
+
const viem_1 = require("viem");
|
|
7
|
+
const encodeMidnightCalldata_js_1 = require("../../helpers/encodeMidnightCalldata.js");
|
|
8
|
+
const index_js_1 = require("../../helpers/index.js");
|
|
9
|
+
const validateMidnightAccount_js_1 = require("../../helpers/validateMidnightAccount.js");
|
|
10
|
+
const validateMidnightPublication_js_1 = require("../../helpers/validateMidnightPublication.js");
|
|
11
|
+
const index_js_2 = require("../../types/index.js");
|
|
12
|
+
/**
|
|
13
|
+
* Encodes a full cancellation of one or more offer groups as a direct call to Midnight.
|
|
14
|
+
*
|
|
15
|
+
* One group encodes a bare `setConsumed(group, maxUint128, onBehalf)`. Two or more groups encode
|
|
16
|
+
* one Midnight `multicall` holding one such `setConsumed` call per group, in list order; the batch
|
|
17
|
+
* cancels every group or none. Only the single-group encoding is matchable by a wallet policy that
|
|
18
|
+
* allows `setConsumed` by method name: a batch is a `multicall` call, so cancel one group per
|
|
19
|
+
* transaction when the signer's policy names `setConsumed`.
|
|
20
|
+
*
|
|
21
|
+
* The amount is always `maxUint128`, which Midnight never rejects, so cancelling a group again
|
|
22
|
+
* succeeds. Cancellation is per group: it does not unratify roots or revoke authorizations. The
|
|
23
|
+
* transaction never targets `MidnightBundlesV2` and needs no prior authorization or approval.
|
|
24
|
+
*
|
|
25
|
+
* @param params.chainId - Chain id used to resolve `Midnight`.
|
|
26
|
+
* @param params.groups - Nonempty list of distinct 32-byte offer groups to cancel.
|
|
27
|
+
* @param params.onBehalf - Maker whose groups are cancelled. `onBehalf`, or an operator it
|
|
28
|
+
* authorized on Midnight, must send the transaction; otherwise Midnight reverts
|
|
29
|
+
* `Unauthorized()` and no group changes.
|
|
30
|
+
* @param params.metadata - Optional analytics metadata appended to calldata.
|
|
31
|
+
* @returns A deep-frozen `Transaction<MidnightCancelOffersAction>` targeting `Midnight`.
|
|
32
|
+
* @throws {MidnightCalldataEncodingError} when `onBehalf` is not a valid address.
|
|
33
|
+
* @throws {MidnightZeroOnBehalfError} when `onBehalf` is the zero address.
|
|
34
|
+
* @throws {EmptyMidnightGroupCancellationsError} when `groups` is empty.
|
|
35
|
+
* @throws {InvalidMidnightHexInputError} when a group is not 32-byte hex.
|
|
36
|
+
* @throws {DuplicateMidnightGroupCancellationError} when a group appears more than once.
|
|
37
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
38
|
+
* @throws {UnknownAddressError} when the chain has no `midnight` deployment.
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { midnightCancelOffers } from "@morpho-org/morpho-sdk";
|
|
42
|
+
* import type { Address, Hex } from "viem";
|
|
43
|
+
*
|
|
44
|
+
* declare const maker: Address;
|
|
45
|
+
* declare const group: Hex;
|
|
46
|
+
*
|
|
47
|
+
* // One group: calldata is `setConsumed(group, maxUint128, maker)`.
|
|
48
|
+
* const tx = midnightCancelOffers({
|
|
49
|
+
* chainId: 8453,
|
|
50
|
+
* groups: [group],
|
|
51
|
+
* onBehalf: maker,
|
|
52
|
+
* });
|
|
53
|
+
* // tx.action => { type: "midnightCancelOffers", args: { groups: [group], onBehalf: maker } }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
const midnightCancelOffers = (params) => {
|
|
57
|
+
const { chainId, onBehalf, metadata } = params;
|
|
58
|
+
// Copy the list so validation and encoding read one snapshot and the caller's array stays unfrozen.
|
|
59
|
+
const groups = [...params.groups];
|
|
60
|
+
// Reject a malformed account before comparing it with the zero address.
|
|
61
|
+
(0, validateMidnightAccount_js_1.validateMidnightAddress)("onBehalf", onBehalf);
|
|
62
|
+
if ((0, viem_1.isAddressEqual)(onBehalf, viem_1.zeroAddress)) {
|
|
63
|
+
throw new index_js_2.MidnightZeroOnBehalfError("onBehalf");
|
|
64
|
+
}
|
|
65
|
+
if (groups.length === 0) {
|
|
66
|
+
throw new index_js_2.EmptyMidnightGroupCancellationsError();
|
|
67
|
+
}
|
|
68
|
+
const seen = new Set();
|
|
69
|
+
for (const [index, group] of groups.entries()) {
|
|
70
|
+
// Validation only; rejects groups that are not 32-byte hex.
|
|
71
|
+
(0, validateMidnightPublication_js_1.validateMidnightBytes32)(`groups[${index}]`, group);
|
|
72
|
+
const key = group.toLowerCase();
|
|
73
|
+
if (seen.has(key)) {
|
|
74
|
+
throw new index_js_2.DuplicateMidnightGroupCancellationError({ index, group });
|
|
75
|
+
}
|
|
76
|
+
seen.add(key);
|
|
77
|
+
}
|
|
78
|
+
const midnight = (0, morpho_ts_1.getChainAddress)(chainId, "midnight");
|
|
79
|
+
const calls = groups.map((group) => (0, encodeMidnightCalldata_js_1.encodeMidnightCalldata)({
|
|
80
|
+
abi: midnight_sdk_1.midnightAbi,
|
|
81
|
+
functionName: "setConsumed",
|
|
82
|
+
args: [group, viem_1.maxUint128, onBehalf],
|
|
83
|
+
}));
|
|
84
|
+
const [single] = calls;
|
|
85
|
+
let tx = {
|
|
86
|
+
to: midnight,
|
|
87
|
+
value: 0n,
|
|
88
|
+
// A single cancellation stays a bare `setConsumed` so a method-name policy can match it.
|
|
89
|
+
data: calls.length === 1 && single !== undefined
|
|
90
|
+
? single
|
|
91
|
+
: (0, encodeMidnightCalldata_js_1.encodeMidnightCalldata)({
|
|
92
|
+
abi: midnight_sdk_1.midnightAbi,
|
|
93
|
+
functionName: "multicall",
|
|
94
|
+
args: [calls],
|
|
95
|
+
}),
|
|
96
|
+
};
|
|
97
|
+
if (metadata) {
|
|
98
|
+
tx = (0, index_js_1.addTransactionMetadata)(tx, metadata);
|
|
99
|
+
}
|
|
100
|
+
return (0, morpho_ts_1.deepFreeze)({
|
|
101
|
+
...tx,
|
|
102
|
+
action: {
|
|
103
|
+
type: "midnightCancelOffers",
|
|
104
|
+
args: { groups, onBehalf },
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
exports.midnightCancelOffers = midnightCancelOffers;
|