@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.3
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-v5-to-v6.md +199 -34
- package/README.md +23 -15
- package/lib/cjs/abis.d.ts +3 -2829
- package/lib/cjs/abis.js +1 -1938
- package/lib/cjs/actions/blue/borrow.d.ts +3 -2
- package/lib/cjs/actions/blue/borrow.js +3 -2
- package/lib/cjs/actions/blue/common.js +6 -35
- package/lib/cjs/actions/blue/refinance.d.ts +2 -2
- package/lib/cjs/actions/blue/refinance.js +2 -2
- package/lib/cjs/actions/blue/repay.d.ts +1 -1
- package/lib/cjs/actions/blue/repay.js +1 -1
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/cjs/actions/blue/supply.d.ts +2 -2
- package/lib/cjs/actions/blue/supply.js +4 -9
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
- package/lib/cjs/actions/blue/withdraw.js +3 -3
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
- package/lib/cjs/actions/bundles/common.d.ts +38 -4
- package/lib/cjs/actions/bundles/common.js +91 -35
- package/lib/cjs/actions/index.d.ts +0 -1
- package/lib/cjs/actions/index.js +0 -1
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +17 -26
- package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/blue/index.js +0 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +24 -25
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -38
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/encode/index.js +0 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/cjs/actions/requirements/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/index.js +0 -1
- package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV1/deposit.js +1 -2
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV2/deposit.js +1 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/cjs/augment.d.ts +0 -1
- package/lib/cjs/augment.js +0 -1
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +1 -5
- package/lib/cjs/blue/entities.d.ts +2 -2
- package/lib/cjs/blue/entities.js +1 -2
- package/lib/cjs/blue/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +2 -1
- package/lib/cjs/blue/fetch.d.ts +1 -1
- package/lib/cjs/blue/fetch.js +1 -2
- package/lib/cjs/blue/types.d.ts +2 -4
- package/lib/cjs/blue/utils.d.ts +1 -3
- package/lib/cjs/blue/utils.js +1 -3
- package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
- package/lib/cjs/client/morphoViemExtension.js +1 -1
- package/lib/cjs/constants.d.ts +3 -37
- package/lib/cjs/constants.js +1 -39
- package/lib/cjs/entities/blue/blue.d.ts +38 -264
- package/lib/cjs/entities/blue/blue.js +2 -203
- package/lib/cjs/entities/index.d.ts +3 -60
- package/lib/cjs/entities/index.js +1 -20
- package/lib/cjs/entities/midnight/midnight.js +20 -24
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +19 -14
- package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +1 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +18 -6
- package/lib/cjs/entities/vaultV1/vaultV1.js +25 -8
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/cjs/entities/vaultV2/vaultV2.js +249 -23
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +50 -34
- package/lib/cjs/errors.d.ts +2 -46
- package/lib/cjs/errors.js +2 -46
- package/lib/cjs/fetch.d.ts +1 -15
- package/lib/cjs/fetch.js +1 -16
- package/lib/cjs/helpers/constant.d.ts +0 -2
- package/lib/cjs/helpers/constant.js +0 -2
- package/lib/cjs/helpers/index.d.ts +4 -3
- package/lib/cjs/helpers/index.js +10 -9
- package/lib/cjs/helpers/metadata.d.ts +3 -5
- package/lib/cjs/helpers/metadata.js +4 -6
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/cjs/helpers/slippage.d.ts +34 -90
- package/lib/cjs/helpers/slippage.js +52 -137
- package/lib/cjs/helpers/utilization.d.ts +12 -10
- package/lib/cjs/helpers/utilization.js +27 -12
- package/lib/cjs/helpers/validate.d.ts +66 -32
- package/lib/cjs/helpers/validate.js +84 -57
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
- package/lib/cjs/types/action.d.ts +102 -68
- package/lib/cjs/types/action.js +11 -4
- package/lib/cjs/types/error.d.ts +332 -385
- package/lib/cjs/types/error.js +369 -412
- package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
- package/lib/cjs/types.d.ts +2 -18
- package/lib/cjs/utils.d.ts +8 -35
- package/lib/cjs/utils.js +11 -36
- package/lib/esm/abis.d.ts +3 -2829
- package/lib/esm/abis.js +3 -1935
- package/lib/esm/actions/blue/borrow.d.ts +3 -2
- package/lib/esm/actions/blue/borrow.js +3 -2
- package/lib/esm/actions/blue/common.js +8 -37
- package/lib/esm/actions/blue/refinance.d.ts +2 -2
- package/lib/esm/actions/blue/refinance.js +2 -2
- package/lib/esm/actions/blue/repay.d.ts +1 -1
- package/lib/esm/actions/blue/repay.js +1 -1
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/esm/actions/blue/supply.d.ts +2 -2
- package/lib/esm/actions/blue/supply.js +6 -11
- package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/supplyCollateral.js +2 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/esm/actions/blue/withdraw.d.ts +3 -3
- package/lib/esm/actions/blue/withdraw.js +3 -3
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
- package/lib/esm/actions/bundles/common.d.ts +38 -4
- package/lib/esm/actions/bundles/common.js +91 -36
- package/lib/esm/actions/index.d.ts +0 -1
- package/lib/esm/actions/index.js +0 -1
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +20 -29
- package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
- package/lib/esm/actions/requirements/blue/index.js +0 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +25 -26
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -39
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
- package/lib/esm/actions/requirements/encode/index.js +0 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/esm/actions/requirements/index.d.ts +0 -1
- package/lib/esm/actions/requirements/index.js +0 -1
- package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV1/deposit.js +1 -2
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV2/deposit.js +1 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/esm/augment.d.ts +0 -1
- package/lib/esm/augment.js +0 -1
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/entities.d.ts +2 -2
- package/lib/esm/blue/entities.js +1 -1
- package/lib/esm/blue/errors.d.ts +1 -1
- package/lib/esm/blue/errors.js +1 -1
- package/lib/esm/blue/fetch.d.ts +1 -1
- package/lib/esm/blue/fetch.js +1 -1
- package/lib/esm/blue/types.d.ts +2 -4
- package/lib/esm/blue/utils.d.ts +1 -3
- package/lib/esm/blue/utils.js +1 -3
- package/lib/esm/client/morphoViemExtension.d.ts +1 -1
- package/lib/esm/client/morphoViemExtension.js +1 -1
- package/lib/esm/constants.d.ts +3 -37
- package/lib/esm/constants.js +3 -37
- package/lib/esm/entities/blue/blue.d.ts +38 -264
- package/lib/esm/entities/blue/blue.js +5 -206
- package/lib/esm/entities/index.d.ts +3 -60
- package/lib/esm/entities/index.js +1 -16
- package/lib/esm/entities/midnight/midnight.js +20 -24
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +20 -15
- package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/esm/entities/requirements/index.d.ts +1 -0
- package/lib/esm/entities/requirements/index.js +1 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +18 -6
- package/lib/esm/entities/vaultV1/vaultV1.js +29 -12
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/esm/entities/vaultV2/vaultV2.js +256 -30
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.js +48 -32
- package/lib/esm/errors.d.ts +2 -46
- package/lib/esm/errors.js +2 -46
- package/lib/esm/fetch.d.ts +1 -15
- package/lib/esm/fetch.js +1 -15
- package/lib/esm/helpers/constant.d.ts +0 -2
- package/lib/esm/helpers/constant.js +0 -2
- package/lib/esm/helpers/index.d.ts +4 -3
- package/lib/esm/helpers/index.js +4 -3
- package/lib/esm/helpers/metadata.d.ts +3 -5
- package/lib/esm/helpers/metadata.js +4 -6
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/esm/helpers/slippage.d.ts +34 -90
- package/lib/esm/helpers/slippage.js +52 -134
- package/lib/esm/helpers/utilization.d.ts +12 -10
- package/lib/esm/helpers/utilization.js +26 -11
- package/lib/esm/helpers/validate.d.ts +66 -32
- package/lib/esm/helpers/validate.js +83 -57
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +1 -3
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
- package/lib/esm/types/action.d.ts +102 -68
- package/lib/esm/types/action.js +12 -5
- package/lib/esm/types/error.d.ts +332 -385
- package/lib/esm/types/error.js +355 -392
- package/lib/esm/types/sharedLiquidity.d.ts +1 -117
- package/lib/esm/types.d.ts +2 -18
- package/lib/esm/utils.d.ts +8 -35
- package/lib/esm/utils.js +7 -34
- package/package.json +7 -15
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -83
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -151
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -50
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
- package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -43
- package/lib/cjs/actions/signatures/index.d.ts +0 -3
- package/lib/cjs/actions/signatures/index.js +0 -19
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
- package/lib/cjs/bundler/actions.d.ts +0 -797
- package/lib/cjs/bundler/actions.js +0 -1371
- package/lib/cjs/bundler/index.d.ts +0 -2
- package/lib/cjs/bundler/index.js +0 -18
- package/lib/cjs/bundler/types.d.ts +0 -235
- package/lib/cjs/bundler/types.js +0 -2
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/cjs/entities/vaultV1ReallocationData.js +0 -542
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -243
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -79
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -147
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -46
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
- package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -39
- package/lib/esm/actions/signatures/index.d.ts +0 -3
- package/lib/esm/actions/signatures/index.js +0 -3
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -5
- package/lib/esm/bundler/actions.d.ts +0 -797
- package/lib/esm/bundler/actions.js +0 -1368
- package/lib/esm/bundler/index.d.ts +0 -2
- package/lib/esm/bundler/index.js +0 -2
- package/lib/esm/bundler/types.d.ts +0 -235
- package/lib/esm/bundler/types.js +0 -1
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/esm/entities/vaultV1ReallocationData.js +0 -544
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -239
- /package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
- /package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
|
@@ -1,41 +1,5 @@
|
|
|
1
|
-
import type { BigIntish,
|
|
1
|
+
import type { BigIntish, MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
|
-
/**
|
|
4
|
-
* Options controlling public allocator withdrawal discovery.
|
|
5
|
-
*
|
|
6
|
-
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
7
|
-
* {@link VaultV2BluePublicAllocatorOptions}.
|
|
8
|
-
*/
|
|
9
|
-
export interface PublicAllocatorOptions {
|
|
10
|
-
/** Whether public allocator reallocation discovery is enabled. */
|
|
11
|
-
readonly enabled?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Timestamp at which market interest and public allocator pending caps are evaluated.
|
|
14
|
-
* Defaults to the target market's last update timestamp.
|
|
15
|
-
*/
|
|
16
|
-
readonly timestamp?: BigIntish;
|
|
17
|
-
/**
|
|
18
|
-
* Vaults to consider for reallocation. They must have enabled the PublicAllocator.
|
|
19
|
-
* Arrays, readonly arrays, sets, and other iterables are accepted.
|
|
20
|
-
* Defaults to all vaults present in the reallocation data.
|
|
21
|
-
*/
|
|
22
|
-
readonly reallocatableVaults?: Iterable<Address>;
|
|
23
|
-
/**
|
|
24
|
-
* The maximum utilization each source market may reach when withdrawing
|
|
25
|
-
* shared liquidity, scaled by WAD.
|
|
26
|
-
*
|
|
27
|
-
* @deprecated Per-market source ceilings will be removed in the next major.
|
|
28
|
-
* Use `defaultMaxWithdrawalUtilization` to configure one ceiling for every source.
|
|
29
|
-
*/
|
|
30
|
-
readonly maxWithdrawalUtilization?: Readonly<Record<MarketId, bigint | undefined>>;
|
|
31
|
-
/**
|
|
32
|
-
* The default maximum utilization source markets may reach when withdrawing
|
|
33
|
-
* shared liquidity, scaled by WAD.
|
|
34
|
-
*
|
|
35
|
-
* @default 90% (900000000000000000n)
|
|
36
|
-
*/
|
|
37
|
-
readonly defaultMaxWithdrawalUtilization?: bigint;
|
|
38
|
-
}
|
|
39
3
|
/** Options controlling Vault V2 BluePublicAllocator reallocation discovery. */
|
|
40
4
|
export interface VaultV2BluePublicAllocatorOptions {
|
|
41
5
|
/** Whether Vault V2 public allocator discovery is enabled. */
|
|
@@ -64,48 +28,6 @@ export interface VaultV2BluePublicAllocatorOptions {
|
|
|
64
28
|
*/
|
|
65
29
|
readonly maxPenalty?: bigint;
|
|
66
30
|
}
|
|
67
|
-
/**
|
|
68
|
-
* A computed source-market withdrawal before it is grouped by vault.
|
|
69
|
-
*
|
|
70
|
-
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
71
|
-
* {@link VaultV2BlueReallocation}.
|
|
72
|
-
*/
|
|
73
|
-
export interface PublicReallocation {
|
|
74
|
-
/** Source market id to withdraw from. */
|
|
75
|
-
readonly id: MarketId;
|
|
76
|
-
/** Vault that can perform the public allocator reallocation. */
|
|
77
|
-
readonly vault: Address;
|
|
78
|
-
/** Assets to withdraw from the source market. */
|
|
79
|
-
readonly assets: bigint;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A single withdrawal from a source market within a vault reallocation.
|
|
83
|
-
*
|
|
84
|
-
* @deprecated Vault V1 shared-liquidity support will be removed in the next major. Use
|
|
85
|
-
* {@link VaultV2BlueReallocation}.
|
|
86
|
-
*/
|
|
87
|
-
export interface ReallocationWithdrawal {
|
|
88
|
-
/** Source market parameters to pass to the public allocator. */
|
|
89
|
-
readonly marketParams: MarketParams;
|
|
90
|
-
/** Asset amount to withdraw from the source market. */
|
|
91
|
-
readonly amount: bigint;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* A computed reallocation for a single vault.
|
|
95
|
-
*
|
|
96
|
-
* Maps 1:1 to a `PublicAllocator.reallocateTo()` call.
|
|
97
|
-
* Withdraws from source markets and supplies to the target market.
|
|
98
|
-
*
|
|
99
|
-
* @deprecated Vault V1 shared-liquidity support will be removed in the next major. Use
|
|
100
|
-
* {@link VaultV2BlueReallocation}.
|
|
101
|
-
*/
|
|
102
|
-
export interface VaultV1Reallocation {
|
|
103
|
-
readonly vault: Address;
|
|
104
|
-
/** Fee in native token (ETH) paid to the PublicAllocator for this vault. */
|
|
105
|
-
readonly fee: bigint;
|
|
106
|
-
/** Source markets to withdraw from before supplying to the target market. */
|
|
107
|
-
readonly withdrawals: readonly ReallocationWithdrawal[];
|
|
108
|
-
}
|
|
109
31
|
/** Source of a Vault V2 BluePublicAllocator reallocation. */
|
|
110
32
|
export type VaultV2BlueReallocationSource = {
|
|
111
33
|
/** Reallocate from a Morpho Blue market. */
|
|
@@ -137,41 +59,3 @@ export interface VaultV2BlueReallocation {
|
|
|
137
59
|
/** Vault-configured WAD-scaled penalty rate passed to the allocator. */
|
|
138
60
|
readonly penalty: bigint;
|
|
139
61
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Deprecated name for a Vault V1 reallocation.
|
|
142
|
-
*
|
|
143
|
-
* @deprecated Vault V1 shared-liquidity support will be removed in the next major. Use
|
|
144
|
-
* {@link VaultV2BlueReallocation}.
|
|
145
|
-
*/
|
|
146
|
-
export type VaultReallocation = VaultV1Reallocation;
|
|
147
|
-
/**
|
|
148
|
-
* Options for computing vault reallocations via the public allocator.
|
|
149
|
-
*
|
|
150
|
-
* Extends {@link PublicAllocatorOptions} with supply-side utilization targets
|
|
151
|
-
* that determine when reallocation is triggered.
|
|
152
|
-
*
|
|
153
|
-
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
154
|
-
* {@link VaultV2BluePublicAllocatorOptions}.
|
|
155
|
-
*/
|
|
156
|
-
export interface ReallocationComputeOptions extends PublicAllocatorOptions {
|
|
157
|
-
/**
|
|
158
|
-
* Per-market target utilization above which the shared liquidity algorithm
|
|
159
|
-
* is triggered (scaled by WAD). Overrides `defaultSupplyTargetUtilization`
|
|
160
|
-
* for the specified market.
|
|
161
|
-
*
|
|
162
|
-
* @deprecated The supply-target trigger is fixed at 90%
|
|
163
|
-
* ({@link DEFAULT_SUPPLY_TARGET_UTILIZATION}) and will stop being configurable
|
|
164
|
-
* in the next major. Per-market overrides are still honored for now.
|
|
165
|
-
*/
|
|
166
|
-
readonly supplyTargetUtilization?: Readonly<Record<MarketId, bigint | undefined>>;
|
|
167
|
-
/**
|
|
168
|
-
* The default target utilization above which the shared liquidity algorithm
|
|
169
|
-
* is triggered (scaled by WAD).
|
|
170
|
-
*
|
|
171
|
-
* @default 90% (900000000000000000n)
|
|
172
|
-
* @deprecated The supply-target trigger is fixed at 90%
|
|
173
|
-
* ({@link DEFAULT_SUPPLY_TARGET_UTILIZATION}) and will stop being configurable
|
|
174
|
-
* in the next major. Overrides are still honored for now.
|
|
175
|
-
*/
|
|
176
|
-
readonly defaultSupplyTargetUtilization?: bigint;
|
|
177
|
-
}
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams as BlueInputMarketParams,
|
|
2
|
-
|
|
3
|
-
InputMarketParams, IPermit2Allowance, Loadable, MarketId as BlueMarketId,
|
|
4
|
-
/** @deprecated Use `BlueMarketId` or the raw `/blue/types` subpath. */
|
|
5
|
-
MarketId, MaxBorrowOptions as BlueMaxBorrowOptions,
|
|
6
|
-
/** @deprecated Use `BlueMaxBorrowOptions` or the raw `/blue/types` subpath. */
|
|
7
|
-
MaxBorrowOptions, MaxPositionCapacities as BlueMaxPositionCapacities,
|
|
8
|
-
/** @deprecated Use `BlueMaxPositionCapacities` or the raw `/blue/types` subpath. */
|
|
9
|
-
MaxPositionCapacities, MaxWithdrawCollateralOptions as BlueMaxWithdrawCollateralOptions,
|
|
10
|
-
/** @deprecated Use `BlueMaxWithdrawCollateralOptions` or the raw `/blue/types` subpath. */
|
|
11
|
-
MaxWithdrawCollateralOptions, Pending, Permit2Allowance, } from "@morpho-org/blue-sdk";
|
|
12
|
-
export type { AuthorizationArgs as BlueAuthorizationTypedDataArgs,
|
|
13
|
-
/** @deprecated Args for the deprecated getDaiPermitTypedData; scheduled for removal in the next major. */
|
|
14
|
-
DaiPermitArgs, DeploylessFetchParameters as BlueDeploylessFetchParameters,
|
|
15
|
-
/** @deprecated Use `BlueDeploylessFetchParameters` or the raw `/blue/types` subpath. */
|
|
16
|
-
DeploylessFetchParameters, FetchParameters as BlueFetchParameters,
|
|
17
|
-
/** @deprecated Use `BlueFetchParameters` or the raw `/blue/types` subpath. */
|
|
18
|
-
FetchParameters, InputAllocation as BlueInputAllocation, MetaMorphoCall as BlueMetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs as PermitTypedDataArgs, } from "@morpho-org/blue-sdk-viem";
|
|
1
|
+
export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams as BlueInputMarketParams, Loadable, MarketId as BlueMarketId, MaxBorrowOptions as BlueMaxBorrowOptions, MaxPositionCapacities as BlueMaxPositionCapacities, MaxWithdrawCollateralOptions as BlueMaxWithdrawCollateralOptions, Pending, } from "@morpho-org/blue-sdk";
|
|
2
|
+
export type { AuthorizationArgs as BlueAuthorizationTypedDataArgs, DeploylessFetchParameters as BlueDeploylessFetchParameters, FetchParameters as BlueFetchParameters, InputAllocation as BlueInputAllocation, MetaMorphoCall as BlueMetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs as PermitTypedDataArgs, } from "@morpho-org/blue-sdk-viem";
|
|
19
3
|
export type { BuildFixedRateOfferChainParams as MidnightBuildFixedRateOfferChainParams, DecodedEcrecoverRatifierData as MidnightDecodedEcrecoverRatifierData, DecodedSetterRatifierData as MidnightDecodedSetterRatifierData, DeploylessFetchParameters as MidnightDeploylessFetchParameters, EcrecoverRatificationTypedData as MidnightEcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams as MidnightEcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams as MidnightEcrecoverRatifierDataParams, EcrecoverRatifierDataVerificationParams as MidnightEcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams as MidnightEcrecoverRatifierRatifyParams, EcrecoverRatifierRootDigestParams as MidnightEcrecoverRatifierRootDigestParams, EcrecoverRatifierTypedDataParams as MidnightEcrecoverRatifierTypedDataParams, EcrecoverSignatureInput as MidnightEcrecoverSignatureInput, FixedRateOfferChainLeg as MidnightFixedRateOfferChainLeg, GetRatifierInfoParams as MidnightGetRatifierInfoParams, MidnightCallParameters, MidnightFetchParams, RatifierInfo as MidnightRatifierInfo, SetterRatifierDataParams as MidnightSetterRatifierDataParams, SetterRatifierDataVerificationParams as MidnightSetterRatifierDataVerificationParams, VerifiedEcrecoverRatifierData as MidnightVerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
|
|
20
4
|
export type { ChainMetadata } from "@morpho-org/morpho-ts";
|
|
21
5
|
export * from "./types/index.js";
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -1,39 +1,12 @@
|
|
|
1
1
|
export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
MarketUtils, MathLib, SharesMath as BlueSharesMath,
|
|
7
|
-
/** @deprecated Use BlueSharesMath or the raw protocol subpath. */
|
|
8
|
-
SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
9
|
-
export { decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData,
|
|
10
|
-
/** @deprecated Use getBlueAuthorizationTypedData or the raw protocol subpath. */
|
|
11
|
-
getAuthorizationTypedData,
|
|
12
|
-
/** @deprecated DAI is routed through Permit2 internally; scheduled for removal in the next major. */
|
|
13
|
-
getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
14
|
-
export { EcrecoverRatifierUtils as MidnightEcrecoverRatifierUtils,
|
|
15
|
-
/** @deprecated Use MidnightEcrecoverRatifierUtils or the raw protocol subpath. */
|
|
16
|
-
EcrecoverRatifierUtils, eip712Digest, GroupUtils as MidnightGroupUtils,
|
|
17
|
-
/** @deprecated Use MidnightGroupUtils or the raw protocol subpath. */
|
|
18
|
-
GroupUtils, MarketUtils as MidnightMarketUtils, OfferChainUtils as MidnightOfferChainUtils, OfferUtils as MidnightOfferUtils,
|
|
19
|
-
/** @deprecated Use MidnightOfferUtils or the raw protocol subpath. */
|
|
20
|
-
OfferUtils, Payload as MidnightPayload,
|
|
21
|
-
/** @deprecated Use MidnightPayload or the raw protocol subpath. */
|
|
22
|
-
Payload, PositionUtils as MidnightPositionUtils, RatifierUtils as MidnightRatifierUtils,
|
|
23
|
-
/** @deprecated Use MidnightRatifierUtils or the raw protocol subpath. */
|
|
24
|
-
RatifierUtils, SetterRatifierUtils as MidnightSetterRatifierUtils,
|
|
25
|
-
/** @deprecated Use MidnightSetterRatifierUtils or the raw protocol subpath. */
|
|
26
|
-
SetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib,
|
|
27
|
-
/** @deprecated Use MidnightTakeAmountsLib or the raw protocol subpath. */
|
|
28
|
-
TakeAmountsLib, TickLib as MidnightTickLib,
|
|
29
|
-
/** @deprecated Use MidnightTickLib or the raw protocol subpath. */
|
|
30
|
-
TickLib, TreeUtils as MidnightTreeUtils,
|
|
31
|
-
/** @deprecated Use MidnightTreeUtils or the raw protocol subpath. */
|
|
32
|
-
TreeUtils, } from "@morpho-org/midnight-sdk";
|
|
33
|
-
export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDottedKeys, WithId, WithIndex, } from "@morpho-org/morpho-ts";
|
|
2
|
+
export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry as blueDefaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
3
|
+
export { decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
4
|
+
export { EcrecoverRatifierUtils as MidnightEcrecoverRatifierUtils, eip712Digest, GroupUtils as MidnightGroupUtils, MarketUtils as MidnightMarketUtils, OfferChainUtils as MidnightOfferChainUtils, OfferUtils as MidnightOfferUtils, Payload as MidnightPayload, PositionUtils as MidnightPositionUtils, RatifierUtils as MidnightRatifierUtils, SetterRatifierUtils as MidnightSetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib, TickLib as MidnightTickLib, TreeUtils as MidnightTreeUtils, } from "@morpho-org/midnight-sdk";
|
|
5
|
+
export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDottedKeys, } from "@morpho-org/morpho-ts";
|
|
34
6
|
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
|
|
35
|
-
export { computeReallocations, computeVaultV1Reallocations, } from "./helpers/computeVaultV1Reallocations.js";
|
|
36
7
|
export { addTransactionMetadata } from "./helpers/metadata.js";
|
|
8
|
+
export { type PreviewVaultV2ForceWithdrawParams, previewVaultV2ForceWithdraw, type VaultV2ForceWithdrawPreview, } from "./helpers/previewVaultV2ForceWithdraw.js";
|
|
37
9
|
export { type PreviewVaultV2InKindRedeemParams, previewVaultV2InKindRedeem, type VaultV2InKindRedeemMarketPreview, } from "./helpers/previewVaultV2InKindRedeem.js";
|
|
38
|
-
export {
|
|
39
|
-
export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw,
|
|
10
|
+
export { computeMinForceWithdrawSharePrice } from "./helpers/slippage.js";
|
|
11
|
+
export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateRepayAmount, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
|
|
12
|
+
export { computeVaultV2ForceWithdrawFeeSharesMinted, computeVaultV2ForceWithdrawMinSharesBurnt, computeVaultV2ForceWithdrawPlan, computeVaultV2ForceWithdrawSharesBurnt, resolveVaultV2ForceWithdrawEligibility, type VaultV2ForceWithdrawEligibility, type VaultV2ForceWithdrawPlan, } from "./helpers/vaultV2ForceWithdrawPlan.js";
|
package/lib/esm/utils.js
CHANGED
|
@@ -1,37 +1,10 @@
|
|
|
1
|
-
export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/** @deprecated Use BlueMarketUtils or the raw protocol subpath. */
|
|
5
|
-
MarketUtils, MathLib, SharesMath as BlueSharesMath,
|
|
6
|
-
/** @deprecated Use BlueSharesMath or the raw protocol subpath. */
|
|
7
|
-
SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
8
|
-
export { decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData,
|
|
9
|
-
/** @deprecated Use getBlueAuthorizationTypedData or the raw protocol subpath. */
|
|
10
|
-
getAuthorizationTypedData,
|
|
11
|
-
/** @deprecated DAI is routed through Permit2 internally; scheduled for removal in the next major. */
|
|
12
|
-
getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
13
|
-
export { EcrecoverRatifierUtils as MidnightEcrecoverRatifierUtils,
|
|
14
|
-
/** @deprecated Use MidnightEcrecoverRatifierUtils or the raw protocol subpath. */
|
|
15
|
-
EcrecoverRatifierUtils, eip712Digest, GroupUtils as MidnightGroupUtils,
|
|
16
|
-
/** @deprecated Use MidnightGroupUtils or the raw protocol subpath. */
|
|
17
|
-
GroupUtils, MarketUtils as MidnightMarketUtils, OfferChainUtils as MidnightOfferChainUtils, OfferUtils as MidnightOfferUtils,
|
|
18
|
-
/** @deprecated Use MidnightOfferUtils or the raw protocol subpath. */
|
|
19
|
-
OfferUtils, Payload as MidnightPayload,
|
|
20
|
-
/** @deprecated Use MidnightPayload or the raw protocol subpath. */
|
|
21
|
-
Payload, PositionUtils as MidnightPositionUtils, RatifierUtils as MidnightRatifierUtils,
|
|
22
|
-
/** @deprecated Use MidnightRatifierUtils or the raw protocol subpath. */
|
|
23
|
-
RatifierUtils, SetterRatifierUtils as MidnightSetterRatifierUtils,
|
|
24
|
-
/** @deprecated Use MidnightSetterRatifierUtils or the raw protocol subpath. */
|
|
25
|
-
SetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib,
|
|
26
|
-
/** @deprecated Use MidnightTakeAmountsLib or the raw protocol subpath. */
|
|
27
|
-
TakeAmountsLib, TickLib as MidnightTickLib,
|
|
28
|
-
/** @deprecated Use MidnightTickLib or the raw protocol subpath. */
|
|
29
|
-
TickLib, TreeUtils as MidnightTreeUtils,
|
|
30
|
-
/** @deprecated Use MidnightTreeUtils or the raw protocol subpath. */
|
|
31
|
-
TreeUtils, } from "@morpho-org/midnight-sdk";
|
|
1
|
+
export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry as blueDefaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
2
|
+
export { decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
export { EcrecoverRatifierUtils as MidnightEcrecoverRatifierUtils, eip712Digest, GroupUtils as MidnightGroupUtils, MarketUtils as MidnightMarketUtils, OfferChainUtils as MidnightOfferChainUtils, OfferUtils as MidnightOfferUtils, Payload as MidnightPayload, PositionUtils as MidnightPositionUtils, RatifierUtils as MidnightRatifierUtils, SetterRatifierUtils as MidnightSetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib, TickLib as MidnightTickLib, TreeUtils as MidnightTreeUtils, } from "@morpho-org/midnight-sdk";
|
|
32
4
|
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
|
|
33
|
-
export { computeReallocations, computeVaultV1Reallocations, } from "./helpers/computeVaultV1Reallocations.js";
|
|
34
5
|
export { addTransactionMetadata } from "./helpers/metadata.js";
|
|
6
|
+
export { previewVaultV2ForceWithdraw, } from "./helpers/previewVaultV2ForceWithdraw.js";
|
|
35
7
|
export { previewVaultV2InKindRedeem, } from "./helpers/previewVaultV2InKindRedeem.js";
|
|
36
|
-
export {
|
|
37
|
-
export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw,
|
|
8
|
+
export { computeMinForceWithdrawSharePrice } from "./helpers/slippage.js";
|
|
9
|
+
export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateRepayAmount, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
|
|
10
|
+
export { computeVaultV2ForceWithdrawFeeSharesMinted, computeVaultV2ForceWithdrawMinSharesBurnt, computeVaultV2ForceWithdrawPlan, computeVaultV2ForceWithdrawSharesBurnt, resolveVaultV2ForceWithdrawEligibility, } from "./helpers/vaultV2ForceWithdrawPlan.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/morpho-sdk",
|
|
3
3
|
"description": "Abstraction layer for Morpho's complexity.",
|
|
4
|
-
"version": "6.0.0-next.
|
|
4
|
+
"version": "6.0.0-next.3",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Foulks-Plb <https://x.com/FoulkPlb>"
|
|
@@ -50,11 +50,6 @@
|
|
|
50
50
|
"import": "./lib/esm/blue/*.js",
|
|
51
51
|
"require": "./lib/cjs/blue/*.js"
|
|
52
52
|
},
|
|
53
|
-
"./bundler": {
|
|
54
|
-
"types": "./lib/esm/bundler/index.d.ts",
|
|
55
|
-
"import": "./lib/esm/bundler/index.js",
|
|
56
|
-
"require": "./lib/cjs/bundler/index.js"
|
|
57
|
-
},
|
|
58
53
|
"./constants": {
|
|
59
54
|
"types": "./lib/esm/constants.d.ts",
|
|
60
55
|
"import": "./lib/esm/constants.js",
|
|
@@ -118,9 +113,6 @@
|
|
|
118
113
|
"blue/*": [
|
|
119
114
|
"lib/esm/blue/*.d.ts"
|
|
120
115
|
],
|
|
121
|
-
"bundler": [
|
|
122
|
-
"lib/esm/bundler/index.d.ts"
|
|
123
|
-
],
|
|
124
116
|
"constants": [
|
|
125
117
|
"lib/esm/constants.d.ts"
|
|
126
118
|
],
|
|
@@ -162,10 +154,10 @@
|
|
|
162
154
|
],
|
|
163
155
|
"dependencies": {
|
|
164
156
|
"zod": "^4.4.3",
|
|
165
|
-
"@morpho-org/blue-sdk": "^
|
|
166
|
-
"@morpho-org/blue-sdk-viem": "^
|
|
167
|
-
"@morpho-org/midnight-sdk": "^1.
|
|
168
|
-
"@morpho-org/morpho-ts": "^
|
|
157
|
+
"@morpho-org/blue-sdk": "^7.0.0-next.1",
|
|
158
|
+
"@morpho-org/blue-sdk-viem": "^6.0.0-next.0",
|
|
159
|
+
"@morpho-org/midnight-sdk": "^1.5.1-next.0",
|
|
160
|
+
"@morpho-org/morpho-ts": "^3.0.0-next.0"
|
|
169
161
|
},
|
|
170
162
|
"peerDependencies": {
|
|
171
163
|
"viem": "^2.0.0"
|
|
@@ -179,8 +171,8 @@
|
|
|
179
171
|
"@morpho-org/test": "^2.10.0"
|
|
180
172
|
},
|
|
181
173
|
"scripts": {
|
|
182
|
-
"prepublish": "
|
|
183
|
-
"build": "tsc --noEmit &&
|
|
174
|
+
"prepublish": "pnpm build",
|
|
175
|
+
"build": "tsc --noEmit && pnpm build:cjs && pnpm build:esm",
|
|
184
176
|
"build:cjs": "tsc --build tsconfig.build.cjs.json && echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json",
|
|
185
177
|
"build:esm": "tsc --build tsconfig.build.esm.json && echo '{\"type\":\"module\"}' > lib/esm/package.json",
|
|
186
178
|
"test": "vitest --root ../.. --project morpho-sdk --project morpho-sdk-fork"
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type Address } from "@morpho-org/blue-sdk";
|
|
2
|
-
import type { PermitRequirementSignature, Requirement } from "../../../types/index.js";
|
|
3
|
-
/** Parameters for {@link encodeErc20Permit2Approve}. */
|
|
4
|
-
interface EncodeErc20Permit2ApproveParams {
|
|
5
|
-
token: Address;
|
|
6
|
-
amount: bigint;
|
|
7
|
-
chainId: number;
|
|
8
|
-
nonce: bigint;
|
|
9
|
-
expiration?: bigint;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Builds a Permit2 `Requirement` that, once signed, lets GeneralAdapter1 pull `amount` of `token`
|
|
13
|
-
* via the Permit2 contract.
|
|
14
|
-
*
|
|
15
|
-
* Deadline defaults to two hours from `Time.timestamp()`.
|
|
16
|
-
*
|
|
17
|
-
* @param params - Permit2 encoding parameters.
|
|
18
|
-
* @param params.token - ERC-20 token address.
|
|
19
|
-
* @param params.amount - Permit2 allowance amount (per-call).
|
|
20
|
-
* @param params.chainId - Target chain id.
|
|
21
|
-
* @param params.nonce - The user's current Permit2 nonce for `(token, GeneralAdapter1)`.
|
|
22
|
-
* @param params.expiration - Permit2-managed allowance expiration timestamp.
|
|
23
|
-
* @returns A `Requirement` whose `sign(client, userAddress)` produces the deep-frozen signature.
|
|
24
|
-
* @throws {MissingClientPropertyError} from `sign()` when the client has no `account.address`.
|
|
25
|
-
* @throws {AddressMismatchError} from `sign()` when the client account differs from `userAddress`.
|
|
26
|
-
* @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { encodeErc20Permit2Approve } from "@morpho-org/morpho-sdk";
|
|
30
|
-
*
|
|
31
|
-
* const requirement = encodeErc20Permit2Approve({
|
|
32
|
-
* token: USDC,
|
|
33
|
-
* amount: 1_000_000n,
|
|
34
|
-
* chainId: 1,
|
|
35
|
-
* nonce: 0n,
|
|
36
|
-
* expiration: 281_474_976_710_655n, // MAX_UINT_48 (2^48 - 1, effectively indefinite)
|
|
37
|
-
* });
|
|
38
|
-
* // requirement satisfies Requirement
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare const encodeErc20Permit2Approve: (params: EncodeErc20Permit2ApproveParams) => Requirement<PermitRequirementSignature>;
|
|
42
|
-
export {};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeErc20Permit2Approve = void 0;
|
|
4
|
-
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
-
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
6
|
-
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
7
|
-
const signAndVerifyTypedData_js_1 = require("../../../helpers/signAndVerifyTypedData.js");
|
|
8
|
-
/**
|
|
9
|
-
* Builds a Permit2 `Requirement` that, once signed, lets GeneralAdapter1 pull `amount` of `token`
|
|
10
|
-
* via the Permit2 contract.
|
|
11
|
-
*
|
|
12
|
-
* Deadline defaults to two hours from `Time.timestamp()`.
|
|
13
|
-
*
|
|
14
|
-
* @param params - Permit2 encoding parameters.
|
|
15
|
-
* @param params.token - ERC-20 token address.
|
|
16
|
-
* @param params.amount - Permit2 allowance amount (per-call).
|
|
17
|
-
* @param params.chainId - Target chain id.
|
|
18
|
-
* @param params.nonce - The user's current Permit2 nonce for `(token, GeneralAdapter1)`.
|
|
19
|
-
* @param params.expiration - Permit2-managed allowance expiration timestamp.
|
|
20
|
-
* @returns A `Requirement` whose `sign(client, userAddress)` produces the deep-frozen signature.
|
|
21
|
-
* @throws {MissingClientPropertyError} from `sign()` when the client has no `account.address`.
|
|
22
|
-
* @throws {AddressMismatchError} from `sign()` when the client account differs from `userAddress`.
|
|
23
|
-
* @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* import { encodeErc20Permit2Approve } from "@morpho-org/morpho-sdk";
|
|
27
|
-
*
|
|
28
|
-
* const requirement = encodeErc20Permit2Approve({
|
|
29
|
-
* token: USDC,
|
|
30
|
-
* amount: 1_000_000n,
|
|
31
|
-
* chainId: 1,
|
|
32
|
-
* nonce: 0n,
|
|
33
|
-
* expiration: 281_474_976_710_655n, // MAX_UINT_48 (2^48 - 1, effectively indefinite)
|
|
34
|
-
* });
|
|
35
|
-
* // requirement satisfies Requirement
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
const encodeErc20Permit2Approve = (params) => {
|
|
39
|
-
const { token, amount, chainId, nonce, expiration = blue_sdk_1.MathLib.MAX_UINT_48, } = params;
|
|
40
|
-
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
41
|
-
const now = morpho_ts_1.Time.timestamp();
|
|
42
|
-
const deadline = now + morpho_ts_1.Time.s.from.h(2n);
|
|
43
|
-
const action = {
|
|
44
|
-
type: "permit2",
|
|
45
|
-
args: {
|
|
46
|
-
spender: generalAdapter1,
|
|
47
|
-
amount,
|
|
48
|
-
deadline,
|
|
49
|
-
expiration,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
action,
|
|
54
|
-
async sign(client, userAddress) {
|
|
55
|
-
const typedData = (0, blue_sdk_viem_1.getPermit2PermitTypedData)({
|
|
56
|
-
spender: generalAdapter1,
|
|
57
|
-
allowance: amount,
|
|
58
|
-
erc20: token,
|
|
59
|
-
nonce: Number(nonce),
|
|
60
|
-
deadline,
|
|
61
|
-
expiration: Number(expiration),
|
|
62
|
-
}, chainId);
|
|
63
|
-
const signature = await (0, signAndVerifyTypedData_js_1.signAndVerifyTypedData)({
|
|
64
|
-
client,
|
|
65
|
-
userAddress,
|
|
66
|
-
typedData,
|
|
67
|
-
});
|
|
68
|
-
return (0, morpho_ts_1.deepFreeze)({
|
|
69
|
-
args: {
|
|
70
|
-
owner: userAddress,
|
|
71
|
-
signature,
|
|
72
|
-
deadline,
|
|
73
|
-
amount,
|
|
74
|
-
asset: token,
|
|
75
|
-
expiration,
|
|
76
|
-
nonce,
|
|
77
|
-
},
|
|
78
|
-
action,
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
exports.encodeErc20Permit2Approve = encodeErc20Permit2Approve;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { type Address } from "@morpho-org/blue-sdk";
|
|
2
|
-
import { type Client } from "viem";
|
|
3
|
-
import type { Bundler3TokenSignatureRequirement, ERC20ApprovalAction, Transaction } from "../../../types/index.js";
|
|
4
|
-
/** Shared parameters for GeneralAdapter1 token requirement resolution. */
|
|
5
|
-
export type GetGeneralAdapterRequirementsBaseParams = {
|
|
6
|
-
address: Address;
|
|
7
|
-
chainId: number;
|
|
8
|
-
supportDeployless?: boolean;
|
|
9
|
-
args: {
|
|
10
|
-
amount: bigint;
|
|
11
|
-
from: Address;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
/** Parameters for {@link getGeneralAdapterRequirements}. */
|
|
15
|
-
export type GetGeneralAdapterRequirementsParams = (GetGeneralAdapterRequirementsBaseParams & {
|
|
16
|
-
/** Signature-based approvals are not supported. Classic approval (transaction) will be used. */
|
|
17
|
-
supportSignature: false;
|
|
18
|
-
}) | (GetGeneralAdapterRequirementsBaseParams & {
|
|
19
|
-
/** Signature-based approvals are supported. Will try permit (EIP-2612), else fallback to permit2. */
|
|
20
|
-
supportSignature: true;
|
|
21
|
-
/**
|
|
22
|
-
* Prefer the ERC-2612 simple-permit path when the SDK detects support.
|
|
23
|
-
* Leave unset or set to `false` to force the Permit2 fallback when a token is known to be
|
|
24
|
-
* incompatible despite passing the SDK's shallow nonce probe.
|
|
25
|
-
*/
|
|
26
|
-
useSimplePermit?: boolean;
|
|
27
|
-
});
|
|
28
|
-
/**
|
|
29
|
-
* Resolves the approval requirements an integrator must satisfy before a bundled action pulls
|
|
30
|
-
* tokens through `GeneralAdapter1`.
|
|
31
|
-
*
|
|
32
|
-
* Reads the minimum token allowance / nonce state needed from the chain, then picks one of three
|
|
33
|
-
* flows:
|
|
34
|
-
*
|
|
35
|
-
* 1. **`supportSignature: false`** — classic ERC-20 `approve` transaction (or no-op when the
|
|
36
|
-
* direct allowance is already large enough).
|
|
37
|
-
* 2. **`supportSignature: true` + EIP-2612 nonce detected + `useSimplePermit`** — single permit
|
|
38
|
-
* signature against the token itself. DAI is excluded from this branch (its non-standard
|
|
39
|
-
* permit signature is incompatible) and falls through to Permit2 even with
|
|
40
|
-
* `useSimplePermit: true`.
|
|
41
|
-
* 3. **`supportSignature: true`, default** — Permit2 flow: classic approval to the Permit2
|
|
42
|
-
* contract (if needed), followed by a Permit2 signature against `GeneralAdapter1`.
|
|
43
|
-
*
|
|
44
|
-
* The simple-permit compatibility check is intentionally shallow: when requested, it probes
|
|
45
|
-
* whether the token exposes a readable ERC-2612 `nonces(owner)` value.
|
|
46
|
-
* Leaving `useSimplePermit` unset, or passing `false`, is the caller escape hatch for tokens
|
|
47
|
-
* that expose `nonces` but are still incompatible with the SDK's ERC-2612 encoder. This opt-out
|
|
48
|
-
* has proven useful in the past, but the SDK does not encode a token-specific example here.
|
|
49
|
-
* DAI is handled as a built-in version of that incompatibility: it exposes `nonces(owner)` but is
|
|
50
|
-
* always routed to Permit2/classic approval instead of DAI-specific permit signing.
|
|
51
|
-
*
|
|
52
|
-
* @param viemClient - Connected viem `Client` whose `chain.id` matches `params.chainId`.
|
|
53
|
-
* @param params - Requirement resolution parameters.
|
|
54
|
-
* @param params.address - ERC-20 token address.
|
|
55
|
-
* @param params.chainId - Chain id; must match `viemClient.chain.id`.
|
|
56
|
-
* @param params.args.amount - Required token amount. Returns `[]` when zero.
|
|
57
|
-
* @param params.args.from - Account that will grant the approval.
|
|
58
|
-
* @param params.supportSignature - Whether the integrator can collect a signature; controls
|
|
59
|
-
* permit / permit2 vs. classic approval.
|
|
60
|
-
* @param params.supportDeployless - Whether ERC-2612 permit metadata reads may use deployless multicall.
|
|
61
|
-
* @param params.useSimplePermit - When `supportSignature` is `true`, prefer EIP-2612 permit if
|
|
62
|
-
* the nonce probe detects support. Leave unset or pass `false` to force the Permit2 fallback
|
|
63
|
-
* for tokens known to be incompatible despite passing that probe.
|
|
64
|
-
* @returns Promise resolving to an array of either deep-frozen approval transactions or
|
|
65
|
-
* `Requirement` objects (signature requirements with a `sign()` method). Empty when `amount`
|
|
66
|
-
* is zero or when the classic-approval path can reuse sufficient direct allowance.
|
|
67
|
-
* @throws {ChainIdMismatchError} when `viemClient.chain?.id !== params.chainId`. No other typed
|
|
68
|
-
* error is reachable through this entry point: the values passed into
|
|
69
|
-
* `getRequirementsApproval` always satisfy `approvalAmount >= spendAmount` (direct path uses
|
|
70
|
-
* `approvalAmount === spendAmount === amount`; Permit2 path uses `MAX_UINT_160`), so
|
|
71
|
-
* `ApprovalAmountLessThanSpendAmountError` cannot fire from here.
|
|
72
|
-
* @example
|
|
73
|
-
* ```ts
|
|
74
|
-
* import { createPublicClient, http } from "viem";
|
|
75
|
-
* import { mainnet } from "viem/chains";
|
|
76
|
-
* import { getGeneralAdapterRequirements } from "@morpho-org/morpho-sdk";
|
|
77
|
-
*
|
|
78
|
-
* const client = createPublicClient({ chain: mainnet, transport: http() });
|
|
79
|
-
* const requirements = await getGeneralAdapterRequirements(client, {
|
|
80
|
-
* address: USDC,
|
|
81
|
-
* chainId: 1,
|
|
82
|
-
* supportSignature: true,
|
|
83
|
-
* args: { amount: 1_000_000n, from: user },
|
|
84
|
-
* });
|
|
85
|
-
* // requirements satisfies (Readonly<Transaction<ERC20ApprovalAction>> | Bundler3TokenSignatureRequirement)[]
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
export declare const getGeneralAdapterRequirements: (viemClient: Client, params: GetGeneralAdapterRequirementsParams) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Bundler3TokenSignatureRequirement)[]>;
|