@morpho-org/morpho-sdk 6.0.0-next.2 → 6.0.0-next.4
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 +88 -32
- package/README.md +9 -7
- package/lib/cjs/abis.d.ts +7 -2844
- package/lib/cjs/abis.js +3 -1951
- 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 +1 -9
- 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 +2 -2
- 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 +6 -2
- package/lib/cjs/actions/bundles/common.js +31 -5
- 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 +6 -8
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +11 -16
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
- 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 +5 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +6 -11
- 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 +7 -5
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +11 -7
- 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 +1 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +3 -3
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +7 -5
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +11 -7
- package/lib/cjs/augment/AccrualPosition.d.ts +1 -0
- package/lib/cjs/augment.d.ts +0 -1
- package/lib/cjs/augment.js +0 -1
- package/lib/cjs/blue/abis.d.ts +5 -5
- package/lib/cjs/blue/abis.js +3 -7
- package/lib/cjs/blue/entities.d.ts +10 -8
- package/lib/cjs/blue/entities.js +3 -3
- package/lib/cjs/blue/errors.d.ts +4 -2
- package/lib/cjs/blue/errors.js +3 -1
- package/lib/cjs/blue/fetch.d.ts +5 -3
- package/lib/cjs/blue/fetch.js +3 -3
- package/lib/cjs/blue/types.d.ts +2 -4
- package/lib/cjs/blue/utils.d.ts +6 -4
- package/lib/cjs/blue/utils.js +3 -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 +30 -265
- package/lib/cjs/entities/blue/blue.js +1 -205
- package/lib/cjs/entities/index.d.ts +11 -66
- package/lib/cjs/entities/index.js +3 -21
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -2
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -3
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +13 -5
- package/lib/cjs/entities/vaultV1/vaultV1.js +16 -10
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +40 -19
- package/lib/cjs/entities/vaultV2/vaultV2.js +57 -26
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +4 -21
- package/lib/cjs/errors.d.ts +5 -47
- package/lib/cjs/errors.js +4 -46
- package/lib/cjs/fetch.d.ts +5 -17
- package/lib/cjs/fetch.js +3 -17
- package/lib/cjs/helpers/constant.d.ts +0 -2
- package/lib/cjs/helpers/constant.js +0 -2
- package/lib/cjs/helpers/index.d.ts +2 -3
- package/lib/cjs/helpers/index.js +1 -9
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +11 -5
- package/lib/cjs/helpers/slippage.d.ts +1 -103
- package/lib/cjs/helpers/slippage.js +0 -150
- package/lib/cjs/helpers/utilization.d.ts +12 -10
- package/lib/cjs/helpers/utilization.js +27 -12
- package/lib/cjs/helpers/validate.d.ts +1 -24
- package/lib/cjs/helpers/validate.js +2 -49
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +48 -15
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +48 -15
- package/lib/cjs/midnight/errors.d.ts +1 -1
- package/lib/cjs/midnight/errors.js +2 -1
- package/lib/cjs/types/action.d.ts +17 -65
- package/lib/cjs/types/action.js +11 -4
- package/lib/cjs/types/error.d.ts +50 -381
- package/lib/cjs/types/error.js +64 -395
- package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
- package/lib/cjs/types.d.ts +2 -18
- package/lib/cjs/utils.d.ts +10 -35
- package/lib/cjs/utils.js +4 -36
- package/lib/esm/abis.d.ts +7 -2844
- package/lib/esm/abis.js +7 -1950
- 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 +1 -9
- 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 +2 -2
- 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 +6 -2
- package/lib/esm/actions/bundles/common.js +32 -6
- 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 +6 -8
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +12 -17
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
- 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 +5 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +6 -11
- 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 +7 -5
- package/lib/esm/actions/vaultV1/inKindRedeem.js +11 -7
- 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 +1 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +3 -3
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +7 -5
- package/lib/esm/actions/vaultV2/inKindRedeem.js +11 -7
- package/lib/esm/augment/AccrualPosition.d.ts +1 -0
- package/lib/esm/augment.d.ts +0 -1
- package/lib/esm/augment.js +0 -1
- package/lib/esm/blue/abis.d.ts +5 -5
- package/lib/esm/blue/abis.js +5 -5
- package/lib/esm/blue/entities.d.ts +10 -8
- package/lib/esm/blue/entities.js +5 -3
- package/lib/esm/blue/errors.d.ts +4 -2
- package/lib/esm/blue/errors.js +4 -2
- package/lib/esm/blue/fetch.d.ts +5 -3
- package/lib/esm/blue/fetch.js +5 -3
- package/lib/esm/blue/types.d.ts +2 -4
- package/lib/esm/blue/utils.d.ts +6 -4
- package/lib/esm/blue/utils.js +6 -4
- 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 +30 -265
- package/lib/esm/entities/blue/blue.js +4 -208
- package/lib/esm/entities/index.d.ts +11 -66
- package/lib/esm/entities/index.js +5 -18
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -2
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +8 -3
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +13 -5
- package/lib/esm/entities/vaultV1/vaultV1.js +19 -13
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +40 -19
- package/lib/esm/entities/vaultV2/vaultV2.js +61 -30
- package/lib/esm/entities/vaultV2BlueReallocationData.js +2 -19
- package/lib/esm/errors.d.ts +5 -47
- package/lib/esm/errors.js +5 -47
- package/lib/esm/fetch.d.ts +5 -17
- package/lib/esm/fetch.js +5 -17
- package/lib/esm/helpers/constant.d.ts +0 -2
- package/lib/esm/helpers/constant.js +0 -2
- package/lib/esm/helpers/index.d.ts +2 -3
- package/lib/esm/helpers/index.js +2 -3
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +11 -5
- package/lib/esm/helpers/slippage.d.ts +1 -103
- package/lib/esm/helpers/slippage.js +1 -147
- package/lib/esm/helpers/utilization.d.ts +12 -10
- package/lib/esm/helpers/utilization.js +26 -11
- package/lib/esm/helpers/validate.d.ts +1 -24
- package/lib/esm/helpers/validate.js +2 -48
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +1 -3
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +48 -15
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +48 -15
- package/lib/esm/midnight/errors.d.ts +1 -1
- package/lib/esm/midnight/errors.js +1 -1
- package/lib/esm/types/action.d.ts +17 -65
- package/lib/esm/types/action.js +12 -5
- package/lib/esm/types/error.d.ts +50 -381
- package/lib/esm/types/error.js +58 -377
- package/lib/esm/types/sharedLiquidity.d.ts +1 -117
- package/lib/esm/types.d.ts +2 -18
- package/lib/esm/utils.d.ts +10 -35
- package/lib/esm/utils.js +9 -34
- package/package.json +6 -17
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -152
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -53
- 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 -50
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -45
- 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 -11
- 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 -332
- package/lib/cjs/entities/vaultV1ReallocationData.js +0 -557
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -80
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -245
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -84
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -148
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -49
- 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 -50
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -41
- 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 -11
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -7
- 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 -332
- package/lib/esm/entities/vaultV1ReallocationData.js +0 -559
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -80
- package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -241
|
@@ -7,9 +7,8 @@ const signAndVerifyTypedData_js_1 = require("../../../helpers/signAndVerifyTyped
|
|
|
7
7
|
const validate_js_1 = require("../../../helpers/validate.js");
|
|
8
8
|
const index_js_1 = require("../../../types/index.js");
|
|
9
9
|
/**
|
|
10
|
-
* Builds a Morpho authorization `Requirement` that, once signed, lets
|
|
11
|
-
* Morpho on the signer's behalf.
|
|
12
|
-
* BlueBundlesV1 embeds the same signed authorization in its direct-call struct.
|
|
10
|
+
* Builds a Morpho authorization `Requirement` that, once signed, lets BlueBundlesV1 operate on
|
|
11
|
+
* Morpho on the signer's behalf.
|
|
13
12
|
*
|
|
14
13
|
* The returned `Requirement.sign()` produces the EIP-712 signature over Morpho's `Authorization`
|
|
15
14
|
* typed data, verifies it against the connected account, and returns a deep-frozen
|
|
@@ -20,7 +19,7 @@ const index_js_1 = require("../../../types/index.js");
|
|
|
20
19
|
* @param viemClient - Connected viem `Client` whose `chain.id` matches `params.chainId`.
|
|
21
20
|
* @param params - Authorization encoding parameters.
|
|
22
21
|
* @param params.owner - Account granting the authorization and signing it (the Morpho `authorizer`).
|
|
23
|
-
* @param params.authorized -
|
|
22
|
+
* @param params.authorized - BlueBundlesV1 operator to authorize.
|
|
24
23
|
* @param params.chainId - Target chain id.
|
|
25
24
|
* @param params.nonce - The owner's current Morpho authorization nonce.
|
|
26
25
|
* @param params.isAuthorized - Grant (`true`, default) or revoke (`false`).
|
|
@@ -44,7 +43,7 @@ const index_js_1 = require("../../../types/index.js");
|
|
|
44
43
|
* const client = createWalletClient({ chain: mainnet, transport: http() });
|
|
45
44
|
* const requirement = await encodeBlueSignatureAuthorization(client, {
|
|
46
45
|
* owner,
|
|
47
|
-
* authorized:
|
|
46
|
+
* authorized: blueBundlesV1,
|
|
48
47
|
* chainId: 1,
|
|
49
48
|
* nonce: 0n,
|
|
50
49
|
* });
|
|
@@ -11,12 +11,12 @@ interface EncodeErc20ApprovalParams {
|
|
|
11
11
|
* Encodes a deep-frozen ERC-20 approval transaction for a supported SDK spender.
|
|
12
12
|
*
|
|
13
13
|
* Caps `amount` at the per-chain, per-token maximum from `MAX_TOKEN_APPROVALS` (defaults to
|
|
14
|
-
* `maxUint256`). Used by {@link getRequirementsApproval}
|
|
14
|
+
* `maxUint256`). Used by {@link getRequirementsApproval}.
|
|
15
15
|
*
|
|
16
16
|
* @param params - Encoding parameters.
|
|
17
17
|
* @param params.token - ERC-20 token address to approve.
|
|
18
|
-
* @param params.spender - Address granted the allowance. Must be
|
|
19
|
-
*
|
|
18
|
+
* @param params.spender - Address granted the allowance. Must be Permit2, Midnight,
|
|
19
|
+
* MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for the chain.
|
|
20
20
|
* @param params.amount - Allowance amount before per-token cap.
|
|
21
21
|
* @param params.chainId - The chain the transaction targets (used to resolve supported spenders and the per-token cap).
|
|
22
22
|
* @returns A deep-frozen `Transaction<ERC20ApprovalAction>` with the capped approval amount.
|
|
@@ -28,7 +28,7 @@ interface EncodeErc20ApprovalParams {
|
|
|
28
28
|
*
|
|
29
29
|
* const tx = encodeErc20Approval({
|
|
30
30
|
* token: USDC,
|
|
31
|
-
* spender:
|
|
31
|
+
* spender: blueBundlesV1,
|
|
32
32
|
* amount: 1_000_000n,
|
|
33
33
|
* chainId: 1,
|
|
34
34
|
* });
|
|
@@ -10,12 +10,12 @@ const validateRequirementSpender_js_1 = require("../../../helpers/validateRequir
|
|
|
10
10
|
* Encodes a deep-frozen ERC-20 approval transaction for a supported SDK spender.
|
|
11
11
|
*
|
|
12
12
|
* Caps `amount` at the per-chain, per-token maximum from `MAX_TOKEN_APPROVALS` (defaults to
|
|
13
|
-
* `maxUint256`). Used by {@link getRequirementsApproval}
|
|
13
|
+
* `maxUint256`). Used by {@link getRequirementsApproval}.
|
|
14
14
|
*
|
|
15
15
|
* @param params - Encoding parameters.
|
|
16
16
|
* @param params.token - ERC-20 token address to approve.
|
|
17
|
-
* @param params.spender - Address granted the allowance. Must be
|
|
18
|
-
*
|
|
17
|
+
* @param params.spender - Address granted the allowance. Must be Permit2, Midnight,
|
|
18
|
+
* MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for the chain.
|
|
19
19
|
* @param params.amount - Allowance amount before per-token cap.
|
|
20
20
|
* @param params.chainId - The chain the transaction targets (used to resolve supported spenders and the per-token cap).
|
|
21
21
|
* @returns A deep-frozen `Transaction<ERC20ApprovalAction>` with the capped approval amount.
|
|
@@ -27,7 +27,7 @@ const validateRequirementSpender_js_1 = require("../../../helpers/validateRequir
|
|
|
27
27
|
*
|
|
28
28
|
* const tx = encodeErc20Approval({
|
|
29
29
|
* token: USDC,
|
|
30
|
-
* spender:
|
|
30
|
+
* spender: blueBundlesV1,
|
|
31
31
|
* amount: 1_000_000n,
|
|
32
32
|
* chainId: 1,
|
|
33
33
|
* });
|
|
@@ -41,7 +41,6 @@ const encodeErc20Approval = (params) => {
|
|
|
41
41
|
chainId,
|
|
42
42
|
spender,
|
|
43
43
|
allowed: [
|
|
44
|
-
"generalAdapter1",
|
|
45
44
|
"permit2",
|
|
46
45
|
"midnight",
|
|
47
46
|
"midnightBundles",
|
|
@@ -27,8 +27,8 @@ interface EncodeErc20PermitParams {
|
|
|
27
27
|
* @param params - Permit encoding parameters.
|
|
28
28
|
* @param params.token - ERC-20 token address (must support EIP-2612).
|
|
29
29
|
* @param params.owner - Account that owns the tokens and signs the permit.
|
|
30
|
-
* @param params.spender - Permit spender. Must be
|
|
31
|
-
*
|
|
30
|
+
* @param params.spender - Permit spender. Must be MidnightBundles, VaultBundlesV1, or
|
|
31
|
+
* BlueBundlesV1 for the chain.
|
|
32
32
|
* @param params.amount - Permit allowance amount.
|
|
33
33
|
* @param params.chainId - Target chain id.
|
|
34
34
|
* @param params.nonce - The owner's current EIP-2612 nonce on `token`.
|
|
@@ -38,8 +38,8 @@ interface EncodeErc20PermitParams {
|
|
|
38
38
|
* `sign(client, userAddress)` produces the deep-frozen signature.
|
|
39
39
|
* @throws {ChainIdMismatchError} when `viemClient.chain?.id !== params.chainId`.
|
|
40
40
|
* @throws {UnsupportedChainIdError} when `chainId` is absent from the address registry.
|
|
41
|
-
* @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not
|
|
42
|
-
*
|
|
41
|
+
* @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not MidnightBundles,
|
|
42
|
+
* VaultBundlesV1, or BlueBundlesV1 for `chainId`.
|
|
43
43
|
* @throws {NonPositiveInputError} when an explicit `deadline` is not positive.
|
|
44
44
|
* @throws {InputExceedsMaxError} when an explicit `deadline` exceeds `uint256`.
|
|
45
45
|
* @throws {ExpiredDeadlineError} when an explicit `deadline` is positive but not in the future.
|
|
@@ -58,7 +58,7 @@ interface EncodeErc20PermitParams {
|
|
|
58
58
|
* const requirement = await encodeErc20Permit(client, {
|
|
59
59
|
* token: USDC, // Must implement standard ERC-2612. DAI is routed through Permit2 by requirement helpers.
|
|
60
60
|
* owner,
|
|
61
|
-
* spender:
|
|
61
|
+
* spender: blueBundlesV1,
|
|
62
62
|
* amount: 1_000_000n,
|
|
63
63
|
* chainId: 1,
|
|
64
64
|
* nonce: 0n,
|
|
@@ -21,8 +21,8 @@ const index_js_1 = require("../../../types/index.js");
|
|
|
21
21
|
* @param params - Permit encoding parameters.
|
|
22
22
|
* @param params.token - ERC-20 token address (must support EIP-2612).
|
|
23
23
|
* @param params.owner - Account that owns the tokens and signs the permit.
|
|
24
|
-
* @param params.spender - Permit spender. Must be
|
|
25
|
-
*
|
|
24
|
+
* @param params.spender - Permit spender. Must be MidnightBundles, VaultBundlesV1, or
|
|
25
|
+
* BlueBundlesV1 for the chain.
|
|
26
26
|
* @param params.amount - Permit allowance amount.
|
|
27
27
|
* @param params.chainId - Target chain id.
|
|
28
28
|
* @param params.nonce - The owner's current EIP-2612 nonce on `token`.
|
|
@@ -32,8 +32,8 @@ const index_js_1 = require("../../../types/index.js");
|
|
|
32
32
|
* `sign(client, userAddress)` produces the deep-frozen signature.
|
|
33
33
|
* @throws {ChainIdMismatchError} when `viemClient.chain?.id !== params.chainId`.
|
|
34
34
|
* @throws {UnsupportedChainIdError} when `chainId` is absent from the address registry.
|
|
35
|
-
* @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not
|
|
36
|
-
*
|
|
35
|
+
* @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not MidnightBundles,
|
|
36
|
+
* VaultBundlesV1, or BlueBundlesV1 for `chainId`.
|
|
37
37
|
* @throws {NonPositiveInputError} when an explicit `deadline` is not positive.
|
|
38
38
|
* @throws {InputExceedsMaxError} when an explicit `deadline` exceeds `uint256`.
|
|
39
39
|
* @throws {ExpiredDeadlineError} when an explicit `deadline` is positive but not in the future.
|
|
@@ -52,7 +52,7 @@ const index_js_1 = require("../../../types/index.js");
|
|
|
52
52
|
* const requirement = await encodeErc20Permit(client, {
|
|
53
53
|
* token: USDC, // Must implement standard ERC-2612. DAI is routed through Permit2 by requirement helpers.
|
|
54
54
|
* owner,
|
|
55
|
-
* spender:
|
|
55
|
+
* spender: blueBundlesV1,
|
|
56
56
|
* amount: 1_000_000n,
|
|
57
57
|
* chainId: 1,
|
|
58
58
|
* nonce: 0n,
|
|
@@ -70,12 +70,7 @@ const encodeErc20Permit = async (viemClient, params) => {
|
|
|
70
70
|
(0, validateRequirementSpender_js_1.validateRequirementSpender)({
|
|
71
71
|
chainId,
|
|
72
72
|
spender,
|
|
73
|
-
allowed: [
|
|
74
|
-
"generalAdapter1",
|
|
75
|
-
"midnightBundles",
|
|
76
|
-
"vaultBundlesV1",
|
|
77
|
-
"blueBundlesV1",
|
|
78
|
-
],
|
|
73
|
+
allowed: ["midnightBundles", "vaultBundlesV1", "blueBundlesV1"],
|
|
79
74
|
});
|
|
80
75
|
const now = morpho_ts_1.Time.timestamp();
|
|
81
76
|
// Validate an explicit deadline before the token-metadata read: this exported encoder can be
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./encodeBlueSignatureAuthorization.js";
|
|
2
2
|
export * from "./encodeErc20Approval.js";
|
|
3
3
|
export * from "./encodeErc20Permit.js";
|
|
4
|
-
export * from "./encodeErc20Permit2Approve.js";
|
|
5
4
|
export * from "./encodeErc20Permit2SignatureTransfer.js";
|
|
6
5
|
export * from "./encodeVaultSharesPermit.js";
|
|
@@ -17,6 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./encodeBlueSignatureAuthorization.js"), exports);
|
|
18
18
|
__exportStar(require("./encodeErc20Approval.js"), exports);
|
|
19
19
|
__exportStar(require("./encodeErc20Permit.js"), exports);
|
|
20
|
-
__exportStar(require("./encodeErc20Permit2Approve.js"), exports);
|
|
21
20
|
__exportStar(require("./encodeErc20Permit2SignatureTransfer.js"), exports);
|
|
22
21
|
__exportStar(require("./encodeVaultSharesPermit.js"), exports);
|
|
@@ -5,8 +5,8 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
|
|
|
5
5
|
* allowance.
|
|
6
6
|
*
|
|
7
7
|
* The spender is validated by {@link encodeErc20Approval}. Supported spenders are the chain's
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, and BlueBundlesV1
|
|
9
|
+
* addresses when configured.
|
|
10
10
|
*
|
|
11
11
|
* Returns an empty array when the allowance already covers `spendAmount`. When the token is in
|
|
12
12
|
* `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
|
|
@@ -19,9 +19,8 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
|
|
|
19
19
|
* @param params.args.spendAmount - The amount the bundle will actually pull.
|
|
20
20
|
* @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
|
|
21
21
|
* may be `maxUint256` for reusable Permit2 or saturated-share-repay approvals).
|
|
22
|
-
* @param params.args.spender - Address that will be granted the approval. Must be
|
|
23
|
-
*
|
|
24
|
-
* `chainId`.
|
|
22
|
+
* @param params.args.spender - Address that will be granted the approval. Must be Permit2,
|
|
23
|
+
* Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for `chainId`.
|
|
25
24
|
* @param params.allowances - The user's current allowance of `address` for `spender`.
|
|
26
25
|
* @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
|
|
27
26
|
* followed by the new approval. Empty when no approval is needed.
|
|
@@ -35,7 +34,7 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
|
|
|
35
34
|
* const txs = getRequirementsApproval({
|
|
36
35
|
* address: USDC,
|
|
37
36
|
* chainId: 1,
|
|
38
|
-
* args: { approvalAmount: 1_000_000n, spendAmount: 1_000_000n, spender:
|
|
37
|
+
* args: { approvalAmount: 1_000_000n, spendAmount: 1_000_000n, spender: blueBundlesV1 },
|
|
39
38
|
* allowances: 0n,
|
|
40
39
|
* });
|
|
41
40
|
* // txs satisfies Readonly<Transaction<ERC20ApprovalAction>>[]
|
|
@@ -10,8 +10,8 @@ const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
|
|
|
10
10
|
* allowance.
|
|
11
11
|
*
|
|
12
12
|
* The spender is validated by {@link encodeErc20Approval}. Supported spenders are the chain's
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, and BlueBundlesV1
|
|
14
|
+
* addresses when configured.
|
|
15
15
|
*
|
|
16
16
|
* Returns an empty array when the allowance already covers `spendAmount`. When the token is in
|
|
17
17
|
* `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
|
|
@@ -24,9 +24,8 @@ const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
|
|
|
24
24
|
* @param params.args.spendAmount - The amount the bundle will actually pull.
|
|
25
25
|
* @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
|
|
26
26
|
* may be `maxUint256` for reusable Permit2 or saturated-share-repay approvals).
|
|
27
|
-
* @param params.args.spender - Address that will be granted the approval. Must be
|
|
28
|
-
*
|
|
29
|
-
* `chainId`.
|
|
27
|
+
* @param params.args.spender - Address that will be granted the approval. Must be Permit2,
|
|
28
|
+
* Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for `chainId`.
|
|
30
29
|
* @param params.allowances - The user's current allowance of `address` for `spender`.
|
|
31
30
|
* @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
|
|
32
31
|
* followed by the new approval. Empty when no approval is needed.
|
|
@@ -40,7 +39,7 @@ const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
|
|
|
40
39
|
* const txs = getRequirementsApproval({
|
|
41
40
|
* address: USDC,
|
|
42
41
|
* chainId: 1,
|
|
43
|
-
* args: { approvalAmount: 1_000_000n, spendAmount: 1_000_000n, spender:
|
|
42
|
+
* args: { approvalAmount: 1_000_000n, spendAmount: 1_000_000n, spender: blueBundlesV1 },
|
|
44
43
|
* allowances: 0n,
|
|
45
44
|
* });
|
|
46
45
|
* // txs satisfies Readonly<Transaction<ERC20ApprovalAction>>[]
|
|
@@ -16,6 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./blue/index.js"), exports);
|
|
18
18
|
__exportStar(require("./encode/index.js"), exports);
|
|
19
|
-
__exportStar(require("./generalAdapter/index.js"), exports);
|
|
20
19
|
__exportStar(require("./getRequirementsApproval.js"), exports);
|
|
21
20
|
__exportStar(require("./midnight/index.js"), exports);
|
|
@@ -52,8 +52,7 @@ export interface VaultV1DepositParams {
|
|
|
52
52
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
|
|
53
53
|
* {@link InputExceedsMaxError}, so either class catches it.
|
|
54
54
|
* @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
|
|
55
|
-
* @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit
|
|
56
|
-
* Permit2 AllowanceTransfer signature is supplied.
|
|
55
|
+
* @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit.
|
|
57
56
|
* @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
|
|
58
57
|
* @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
|
|
59
58
|
* @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
|
|
@@ -41,8 +41,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
41
41
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
|
|
42
42
|
* {@link InputExceedsMaxError}, so either class catches it.
|
|
43
43
|
* @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
|
|
44
|
-
* @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit
|
|
45
|
-
* Permit2 AllowanceTransfer signature is supplied.
|
|
44
|
+
* @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit.
|
|
46
45
|
* @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
|
|
47
46
|
* @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
|
|
48
47
|
* @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
|
|
@@ -27,20 +27,22 @@ export interface VaultV1InKindRedeemParams {
|
|
|
27
27
|
* @param params.vault.address - Target Vault V1 address.
|
|
28
28
|
* @param params.args.amount - Asset-denominated amount to exit.
|
|
29
29
|
* @param params.args.marketParamsList - Ordered markets consumed greedily by the contract.
|
|
30
|
-
* @param params.args.userAddress -
|
|
31
|
-
*
|
|
32
|
-
* address.
|
|
30
|
+
* @param params.args.userAddress - Redeeming account, recorded in action metadata and validated as
|
|
31
|
+
* the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
|
|
32
|
+
* `msg.sender`'s vault shares, so the submitting account must equal this address.
|
|
33
33
|
* @param params.args.deadline - Permit and bundle deadline.
|
|
34
34
|
* @param params.args.requirementSignature - Optional bounded Vault V1 shares permit.
|
|
35
35
|
* @param params.metadata - Optional analytics metadata.
|
|
36
36
|
* @returns A deep-frozen `Readonly<Transaction<VaultV1InKindRedeemAction>>` with `to`, `value`,
|
|
37
37
|
* `data`, and the typed action discriminator.
|
|
38
38
|
* @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
|
|
39
|
-
* @throws {InputExceedsMaxError} when
|
|
39
|
+
* @throws {InputExceedsMaxError} when the bundle or permit deadline exceeds `uint256`.
|
|
40
40
|
* @throws {EmptyMarketParamsListError} when no markets are supplied.
|
|
41
41
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
42
42
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
43
|
-
* @throws {
|
|
43
|
+
* @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind, asset, owner,
|
|
44
|
+
* spender, or signature encoding, or when its signed and action amounts, deadlines, or a supplied
|
|
45
|
+
* action nonce disagree.
|
|
44
46
|
* @example
|
|
45
47
|
* ```ts
|
|
46
48
|
* import { vaultV1InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
@@ -7,7 +7,7 @@ const abis_js_1 = require("../../abis.js");
|
|
|
7
7
|
const index_js_1 = require("../../helpers/index.js");
|
|
8
8
|
const validate_js_1 = require("../../helpers/validate.js");
|
|
9
9
|
const index_js_2 = require("../../types/index.js");
|
|
10
|
-
const
|
|
10
|
+
const common_js_1 = require("../bundles/common.js");
|
|
11
11
|
/**
|
|
12
12
|
* Prepares a Vault V1 in-kind redemption into Morpho Blue supply positions.
|
|
13
13
|
*
|
|
@@ -19,20 +19,22 @@ const getVaultExitBundlesV1PermitStruct_js_1 = require("../signatures/getVaultEx
|
|
|
19
19
|
* @param params.vault.address - Target Vault V1 address.
|
|
20
20
|
* @param params.args.amount - Asset-denominated amount to exit.
|
|
21
21
|
* @param params.args.marketParamsList - Ordered markets consumed greedily by the contract.
|
|
22
|
-
* @param params.args.userAddress -
|
|
23
|
-
*
|
|
24
|
-
* address.
|
|
22
|
+
* @param params.args.userAddress - Redeeming account, recorded in action metadata and validated as
|
|
23
|
+
* the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
|
|
24
|
+
* `msg.sender`'s vault shares, so the submitting account must equal this address.
|
|
25
25
|
* @param params.args.deadline - Permit and bundle deadline.
|
|
26
26
|
* @param params.args.requirementSignature - Optional bounded Vault V1 shares permit.
|
|
27
27
|
* @param params.metadata - Optional analytics metadata.
|
|
28
28
|
* @returns A deep-frozen `Readonly<Transaction<VaultV1InKindRedeemAction>>` with `to`, `value`,
|
|
29
29
|
* `data`, and the typed action discriminator.
|
|
30
30
|
* @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
|
|
31
|
-
* @throws {InputExceedsMaxError} when
|
|
31
|
+
* @throws {InputExceedsMaxError} when the bundle or permit deadline exceeds `uint256`.
|
|
32
32
|
* @throws {EmptyMarketParamsListError} when no markets are supplied.
|
|
33
33
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
34
34
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
35
|
-
* @throws {
|
|
35
|
+
* @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind, asset, owner,
|
|
36
|
+
* spender, or signature encoding, or when its signed and action amounts, deadlines, or a supplied
|
|
37
|
+
* action nonce disagree.
|
|
36
38
|
* @example
|
|
37
39
|
* ```ts
|
|
38
40
|
* import { vaultV1InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
@@ -58,9 +60,11 @@ const vaultV1InKindRedeem = ({ vault, args, metadata, }) => {
|
|
|
58
60
|
irm: marketParams.irm,
|
|
59
61
|
lltv: marketParams.lltv,
|
|
60
62
|
}));
|
|
61
|
-
const sharesPermit = (0,
|
|
63
|
+
const sharesPermit = (0, common_js_1.getBundlesSharesPermit)({
|
|
62
64
|
vault: vault.address,
|
|
63
65
|
deadline: args.deadline,
|
|
66
|
+
owner: args.userAddress,
|
|
67
|
+
spender: to,
|
|
64
68
|
requirementSignature: args.requirementSignature,
|
|
65
69
|
});
|
|
66
70
|
let tx = {
|
|
@@ -52,8 +52,7 @@ export interface VaultV2DepositParams {
|
|
|
52
52
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
|
|
53
53
|
* {@link InputExceedsMaxError}, so either class catches it.
|
|
54
54
|
* @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
|
|
55
|
-
* @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit
|
|
56
|
-
* Permit2 AllowanceTransfer signature is supplied.
|
|
55
|
+
* @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit.
|
|
57
56
|
* @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
|
|
58
57
|
* @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
|
|
59
58
|
* @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
|
|
@@ -41,8 +41,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
41
41
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
|
|
42
42
|
* {@link InputExceedsMaxError}, so either class catches it.
|
|
43
43
|
* @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
|
|
44
|
-
* @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit
|
|
45
|
-
* Permit2 AllowanceTransfer signature is supplied.
|
|
44
|
+
* @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit.
|
|
46
45
|
* @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
|
|
47
46
|
* @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
|
|
48
47
|
* @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
|
|
@@ -61,7 +61,7 @@ export interface VaultV2ForceWithdrawParams {
|
|
|
61
61
|
* @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
|
|
62
62
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
63
63
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
64
|
-
* @throws {
|
|
64
|
+
* @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind,
|
|
65
65
|
* asset, owner, spender, or signature encoding.
|
|
66
66
|
* @example
|
|
67
67
|
* ```ts
|
|
@@ -7,7 +7,7 @@ const abis_js_1 = require("../../abis.js");
|
|
|
7
7
|
const index_js_1 = require("../../helpers/index.js");
|
|
8
8
|
const validate_js_1 = require("../../helpers/validate.js");
|
|
9
9
|
const index_js_2 = require("../../types/index.js");
|
|
10
|
-
const
|
|
10
|
+
const common_js_1 = require("../bundles/common.js");
|
|
11
11
|
/**
|
|
12
12
|
* Prepares a Vault V2 force withdrawal through VaultExitBundlesV1.
|
|
13
13
|
*
|
|
@@ -51,7 +51,7 @@ const getVaultExitBundlesV1PermitStruct_js_1 = require("../signatures/getVaultEx
|
|
|
51
51
|
* @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
|
|
52
52
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
53
53
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
54
|
-
* @throws {
|
|
54
|
+
* @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind,
|
|
55
55
|
* asset, owner, spender, or signature encoding.
|
|
56
56
|
* @example
|
|
57
57
|
* ```ts
|
|
@@ -75,7 +75,7 @@ const vaultV2ForceWithdraw = ({ vault, args, metadata, }) => {
|
|
|
75
75
|
(0, validate_js_1.validateUint256Field)("minSharePriceE27", args.minSharePriceE27);
|
|
76
76
|
const { referralFeePct, referralFeeRecipient } = (0, validate_js_1.validateReferralFee)(args);
|
|
77
77
|
const to = (0, morpho_ts_1.getChainAddress)(vault.chainId, "bundles.vaultExitBundlesV1");
|
|
78
|
-
const sharesPermit = (0,
|
|
78
|
+
const sharesPermit = (0, common_js_1.getBundlesSharesPermit)({
|
|
79
79
|
vault: vault.address,
|
|
80
80
|
deadline: args.deadline,
|
|
81
81
|
owner: args.userAddress,
|
|
@@ -30,19 +30,21 @@ export interface VaultV2InKindRedeemParams {
|
|
|
30
30
|
* @param params.args.amount - Penalty-inclusive, asset-denominated amount to exit.
|
|
31
31
|
* @param params.args.marketParamsList - Ordered markets consumed greedily after idle assets. May be
|
|
32
32
|
* empty when the vault's idle balance covers `amount`.
|
|
33
|
-
* @param params.args.userAddress -
|
|
34
|
-
*
|
|
35
|
-
* address.
|
|
33
|
+
* @param params.args.userAddress - Redeeming account, recorded in action metadata and validated as
|
|
34
|
+
* the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
|
|
35
|
+
* `msg.sender`'s vault shares, so the submitting account must equal this address.
|
|
36
36
|
* @param params.args.deadline - Permit and bundle deadline.
|
|
37
37
|
* @param params.args.requirementSignature - Optional bounded Vault V2 shares permit.
|
|
38
38
|
* @param params.metadata - Optional analytics metadata.
|
|
39
39
|
* @returns A deep-frozen `Readonly<Transaction<VaultV2InKindRedeemAction>>` with `to`, `value`,
|
|
40
40
|
* `data`, and the typed action discriminator.
|
|
41
41
|
* @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
|
|
42
|
-
* @throws {InputExceedsMaxError} when
|
|
42
|
+
* @throws {InputExceedsMaxError} when the bundle or permit deadline exceeds `uint256`.
|
|
43
43
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
44
44
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
45
|
-
* @throws {
|
|
45
|
+
* @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind, asset, owner,
|
|
46
|
+
* spender, or signature encoding, or when its signed and action amounts, deadlines, or a supplied
|
|
47
|
+
* action nonce disagree.
|
|
46
48
|
* @example
|
|
47
49
|
* ```ts
|
|
48
50
|
* import { vaultV2InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
@@ -7,7 +7,7 @@ const abis_js_1 = require("../../abis.js");
|
|
|
7
7
|
const index_js_1 = require("../../helpers/index.js");
|
|
8
8
|
const validate_js_1 = require("../../helpers/validate.js");
|
|
9
9
|
const index_js_2 = require("../../types/index.js");
|
|
10
|
-
const
|
|
10
|
+
const common_js_1 = require("../bundles/common.js");
|
|
11
11
|
/**
|
|
12
12
|
* Prepares a Vault V2 in-kind redemption into idle assets and Morpho Blue supply positions.
|
|
13
13
|
*
|
|
@@ -21,19 +21,21 @@ const getVaultExitBundlesV1PermitStruct_js_1 = require("../signatures/getVaultEx
|
|
|
21
21
|
* @param params.args.amount - Penalty-inclusive, asset-denominated amount to exit.
|
|
22
22
|
* @param params.args.marketParamsList - Ordered markets consumed greedily after idle assets. May be
|
|
23
23
|
* empty when the vault's idle balance covers `amount`.
|
|
24
|
-
* @param params.args.userAddress -
|
|
25
|
-
*
|
|
26
|
-
* address.
|
|
24
|
+
* @param params.args.userAddress - Redeeming account, recorded in action metadata and validated as
|
|
25
|
+
* the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
|
|
26
|
+
* `msg.sender`'s vault shares, so the submitting account must equal this address.
|
|
27
27
|
* @param params.args.deadline - Permit and bundle deadline.
|
|
28
28
|
* @param params.args.requirementSignature - Optional bounded Vault V2 shares permit.
|
|
29
29
|
* @param params.metadata - Optional analytics metadata.
|
|
30
30
|
* @returns A deep-frozen `Readonly<Transaction<VaultV2InKindRedeemAction>>` with `to`, `value`,
|
|
31
31
|
* `data`, and the typed action discriminator.
|
|
32
32
|
* @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
|
|
33
|
-
* @throws {InputExceedsMaxError} when
|
|
33
|
+
* @throws {InputExceedsMaxError} when the bundle or permit deadline exceeds `uint256`.
|
|
34
34
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
35
35
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
36
|
-
* @throws {
|
|
36
|
+
* @throws {BundlesPermitMismatchError} when the requirement has the wrong permit kind, asset, owner,
|
|
37
|
+
* spender, or signature encoding, or when its signed and action amounts, deadlines, or a supplied
|
|
38
|
+
* action nonce disagree.
|
|
37
39
|
* @example
|
|
38
40
|
* ```ts
|
|
39
41
|
* import { vaultV2InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
@@ -57,9 +59,11 @@ const vaultV2InKindRedeem = ({ vault, args, metadata, }) => {
|
|
|
57
59
|
irm: marketParams.irm,
|
|
58
60
|
lltv: marketParams.lltv,
|
|
59
61
|
}));
|
|
60
|
-
const sharesPermit = (0,
|
|
62
|
+
const sharesPermit = (0, common_js_1.getBundlesSharesPermit)({
|
|
61
63
|
vault: vault.address,
|
|
62
64
|
deadline: args.deadline,
|
|
65
|
+
owner: args.userAddress,
|
|
66
|
+
spender: to,
|
|
63
67
|
requirementSignature: args.requirementSignature,
|
|
64
68
|
});
|
|
65
69
|
let tx = {
|
|
@@ -3,6 +3,7 @@ import { fetchAccrualPosition, fetchPreLiquidationPosition } from "@morpho-org/b
|
|
|
3
3
|
declare module "@morpho-org/blue-sdk" {
|
|
4
4
|
namespace AccrualPosition {
|
|
5
5
|
let fetch: typeof fetchAccrualPosition;
|
|
6
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
6
7
|
let fetchPreLiquidation: typeof fetchPreLiquidationPosition;
|
|
7
8
|
}
|
|
8
9
|
}
|
package/lib/cjs/augment.d.ts
CHANGED
package/lib/cjs/augment.js
CHANGED
package/lib/cjs/blue/abis.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { marketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
|
|
3
|
-
/** @deprecated
|
|
4
|
-
|
|
5
|
-
/** @deprecated
|
|
6
|
-
|
|
2
|
+
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
|
|
3
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
4
|
+
preLiquidationAbi,
|
|
5
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
6
|
+
preLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
|
package/lib/cjs/blue/abis.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.
|
|
3
|
+
exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.preLiquidationFactoryAbi = exports.preLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.adaptiveCurveIrmAbi = exports.marketParamsAbi = void 0;
|
|
4
4
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
Object.defineProperty(exports, "marketParamsAbi", { enumerable: true, get: function () { return blue_sdk_1.marketParamsAbi; } });
|
|
6
6
|
var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
@@ -19,14 +19,10 @@ Object.defineProperty(exports, "morphoVaultV1AdapterAbi", { enumerable: true, ge
|
|
|
19
19
|
Object.defineProperty(exports, "morphoVaultV1AdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.morphoVaultV1AdapterFactoryAbi; } });
|
|
20
20
|
Object.defineProperty(exports, "permissionedErc20WrapperAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.permissionedErc20WrapperAbi; } });
|
|
21
21
|
Object.defineProperty(exports, "permit2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.permit2Abi; } });
|
|
22
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
22
23
|
Object.defineProperty(exports, "preLiquidationAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.preLiquidationAbi; } });
|
|
24
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
23
25
|
Object.defineProperty(exports, "preLiquidationFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.preLiquidationFactoryAbi; } });
|
|
24
|
-
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
25
|
-
Object.defineProperty(exports, "publicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.publicAllocatorAbi; } });
|
|
26
|
-
Object.defineProperty(exports, "vaultV1AdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterAbi; } });
|
|
27
|
-
Object.defineProperty(exports, "vaultV1AdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterFactoryAbi; } });
|
|
28
|
-
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
29
|
-
Object.defineProperty(exports, "vaultV1PublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1PublicAllocatorAbi; } });
|
|
30
26
|
Object.defineProperty(exports, "vaultV2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2Abi; } });
|
|
31
27
|
Object.defineProperty(exports, "vaultV2BluePublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2BluePublicAllocatorAbi; } });
|
|
32
28
|
Object.defineProperty(exports, "vaultV2FactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2FactoryAbi; } });
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
|
|
2
|
-
/** @deprecated
|
|
3
|
-
|
|
4
|
-
/** @deprecated
|
|
5
|
-
|
|
6
|
-
export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
|
|
7
|
-
/** @deprecated
|
|
8
|
-
|
|
1
|
+
export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
|
|
2
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
|
+
IPreLiquidationParams,
|
|
4
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
5
|
+
IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
|
|
6
|
+
export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
|
|
7
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
8
|
+
PreLiquidationParams,
|
|
9
|
+
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
10
|
+
PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
|