@morpho-org/morpho-sdk 5.9.0 → 6.0.0-next.1
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 +404 -0
- package/README.md +127 -69
- package/lib/cjs/abis.d.ts +210 -0
- package/lib/cjs/abis.js +142 -2
- package/lib/cjs/actions/blue/borrow.d.ts +62 -61
- package/lib/cjs/actions/blue/borrow.js +48 -80
- package/lib/cjs/actions/blue/common.d.ts +86 -0
- package/lib/cjs/actions/blue/common.js +205 -0
- package/lib/cjs/actions/blue/refinance.d.ts +72 -112
- package/lib/cjs/actions/blue/refinance.js +97 -199
- package/lib/cjs/actions/blue/repay.d.ts +72 -68
- package/lib/cjs/actions/blue/repay.js +56 -118
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +85 -90
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +148 -137
- package/lib/cjs/actions/blue/supply.d.ts +62 -45
- package/lib/cjs/actions/blue/supply.js +94 -70
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +63 -40
- package/lib/cjs/actions/blue/supplyCollateral.js +52 -69
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +82 -90
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +133 -120
- package/lib/cjs/actions/blue/withdraw.d.ts +68 -79
- package/lib/cjs/actions/blue/withdraw.js +101 -97
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +56 -28
- package/lib/cjs/actions/blue/withdrawCollateral.js +45 -50
- package/lib/cjs/actions/bundles/common.d.ts +200 -0
- package/lib/cjs/actions/bundles/common.js +469 -0
- package/lib/cjs/actions/bundles/index.d.ts +3 -0
- package/lib/cjs/actions/bundles/index.js +23 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +125 -0
- package/lib/cjs/actions/index.d.ts +2 -1
- package/lib/cjs/actions/index.js +1 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +2 -2
- package/lib/cjs/actions/midnight/takeBorrow.js +2 -2
- package/lib/cjs/actions/midnight/takeLend.d.ts +2 -2
- package/lib/cjs/actions/midnight/takeLend.js +2 -2
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +29 -17
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +60 -19
- package/lib/cjs/actions/requirements/blue/getUnusedPermit2Nonce.d.ts +48 -0
- package/lib/cjs/actions/requirements/blue/getUnusedPermit2Nonce.js +72 -0
- package/lib/cjs/actions/requirements/blue/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/blue/index.js +1 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -7
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +30 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +8 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -6
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +61 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +123 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +6 -5
- package/lib/cjs/actions/requirements/encode/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/index.js +1 -0
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +1 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +6 -4
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +6 -4
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +1 -0
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +4 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +22 -30
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +18 -66
- package/lib/cjs/actions/vaultV1/deposit.d.ts +73 -57
- package/lib/cjs/actions/vaultV1/deposit.js +110 -109
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +43 -66
- package/lib/cjs/actions/vaultV1/migrateToV2.js +91 -104
- package/lib/cjs/actions/vaultV1/redeem.d.ts +30 -23
- package/lib/cjs/actions/vaultV1/redeem.js +56 -33
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +58 -24
- package/lib/cjs/actions/vaultV1/withdraw.js +86 -34
- package/lib/cjs/actions/vaultV2/deposit.d.ts +74 -57
- package/lib/cjs/actions/vaultV2/deposit.js +111 -109
- package/lib/cjs/actions/vaultV2/redeem.d.ts +30 -24
- package/lib/cjs/actions/vaultV2/redeem.js +56 -34
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +58 -25
- package/lib/cjs/actions/vaultV2/withdraw.js +86 -35
- package/lib/cjs/bundler/actions.d.ts +4 -4
- package/lib/cjs/bundler/actions.js +4 -4
- package/lib/cjs/client/morphoViemExtension.d.ts +2 -1
- package/lib/cjs/client/morphoViemExtension.js +2 -1
- package/lib/cjs/entities/blue/blue.d.ts +806 -374
- package/lib/cjs/entities/blue/blue.js +449 -696
- package/lib/cjs/entities/index.d.ts +2 -0
- package/lib/cjs/entities/index.js +15 -0
- package/lib/cjs/entities/midnight/midnight.d.ts +2 -2
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +87 -0
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +203 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +74 -0
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +17 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +348 -98
- package/lib/cjs/entities/vaultV1/vaultV1.js +322 -120
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +221 -68
- package/lib/cjs/entities/vaultV2/vaultV2.js +219 -77
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +3 -9
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +3 -9
- package/lib/cjs/helpers/index.d.ts +2 -1
- package/lib/cjs/helpers/index.js +5 -1
- package/lib/cjs/helpers/referralFee.d.ts +21 -0
- package/lib/cjs/helpers/referralFee.js +35 -0
- package/lib/cjs/helpers/slippage.d.ts +90 -1
- package/lib/cjs/helpers/slippage.js +123 -0
- package/lib/cjs/helpers/validate.d.ts +16 -23
- package/lib/cjs/helpers/validate.js +41 -48
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +2 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +3 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/types/action.d.ts +303 -210
- package/lib/cjs/types/action.js +29 -2
- package/lib/cjs/types/client.d.ts +9 -0
- package/lib/cjs/types/error.d.ts +193 -18
- package/lib/cjs/types/error.js +267 -24
- package/lib/cjs/types/sharedLiquidity.d.ts +0 -7
- package/lib/esm/abis.d.ts +210 -0
- package/lib/esm/abis.js +140 -0
- package/lib/esm/actions/blue/borrow.d.ts +62 -61
- package/lib/esm/actions/blue/borrow.js +48 -80
- package/lib/esm/actions/blue/common.d.ts +86 -0
- package/lib/esm/actions/blue/common.js +193 -0
- package/lib/esm/actions/blue/refinance.d.ts +72 -112
- package/lib/esm/actions/blue/refinance.js +98 -200
- package/lib/esm/actions/blue/repay.d.ts +72 -68
- package/lib/esm/actions/blue/repay.js +56 -118
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +85 -90
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +149 -138
- package/lib/esm/actions/blue/supply.d.ts +62 -45
- package/lib/esm/actions/blue/supply.js +94 -70
- package/lib/esm/actions/blue/supplyCollateral.d.ts +63 -40
- package/lib/esm/actions/blue/supplyCollateral.js +52 -69
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +82 -90
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +134 -121
- package/lib/esm/actions/blue/withdraw.d.ts +68 -79
- package/lib/esm/actions/blue/withdraw.js +100 -96
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +56 -28
- package/lib/esm/actions/blue/withdrawCollateral.js +45 -50
- package/lib/esm/actions/bundles/common.d.ts +200 -0
- package/lib/esm/actions/bundles/common.js +457 -0
- package/lib/esm/actions/bundles/index.d.ts +3 -0
- package/lib/esm/actions/bundles/index.js +2 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +121 -0
- package/lib/esm/actions/index.d.ts +2 -1
- package/lib/esm/actions/index.js +1 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
- package/lib/esm/actions/midnight/takeBorrow.d.ts +2 -2
- package/lib/esm/actions/midnight/takeBorrow.js +2 -2
- package/lib/esm/actions/midnight/takeLend.d.ts +2 -2
- package/lib/esm/actions/midnight/takeLend.js +2 -2
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +29 -17
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +63 -22
- package/lib/esm/actions/requirements/blue/getUnusedPermit2Nonce.d.ts +48 -0
- package/lib/esm/actions/requirements/blue/getUnusedPermit2Nonce.js +68 -0
- package/lib/esm/actions/requirements/blue/index.d.ts +1 -0
- package/lib/esm/actions/requirements/blue/index.js +1 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -7
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +31 -6
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +9 -3
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +61 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +119 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +6 -5
- package/lib/esm/actions/requirements/encode/index.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/index.js +1 -0
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +1 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +6 -4
- package/lib/esm/actions/requirements/getRequirementsApproval.js +6 -4
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +1 -0
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +5 -1
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +22 -30
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +19 -67
- package/lib/esm/actions/vaultV1/deposit.d.ts +73 -57
- package/lib/esm/actions/vaultV1/deposit.js +112 -111
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +43 -66
- package/lib/esm/actions/vaultV1/migrateToV2.js +93 -106
- package/lib/esm/actions/vaultV1/redeem.d.ts +30 -23
- package/lib/esm/actions/vaultV1/redeem.js +56 -33
- package/lib/esm/actions/vaultV1/withdraw.d.ts +58 -24
- package/lib/esm/actions/vaultV1/withdraw.js +86 -34
- package/lib/esm/actions/vaultV2/deposit.d.ts +74 -57
- package/lib/esm/actions/vaultV2/deposit.js +113 -111
- package/lib/esm/actions/vaultV2/redeem.d.ts +30 -24
- package/lib/esm/actions/vaultV2/redeem.js +56 -34
- package/lib/esm/actions/vaultV2/withdraw.d.ts +58 -25
- package/lib/esm/actions/vaultV2/withdraw.js +86 -35
- package/lib/esm/bundler/actions.d.ts +4 -4
- package/lib/esm/bundler/actions.js +4 -4
- package/lib/esm/client/morphoViemExtension.d.ts +2 -1
- package/lib/esm/client/morphoViemExtension.js +2 -1
- package/lib/esm/entities/blue/blue.d.ts +806 -374
- package/lib/esm/entities/blue/blue.js +455 -702
- package/lib/esm/entities/index.d.ts +2 -0
- package/lib/esm/entities/index.js +1 -0
- package/lib/esm/entities/midnight/midnight.d.ts +2 -2
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +87 -0
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +199 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +70 -0
- 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 +348 -98
- package/lib/esm/entities/vaultV1/vaultV1.js +326 -124
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +221 -68
- package/lib/esm/entities/vaultV2/vaultV2.js +222 -80
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +3 -9
- package/lib/esm/helpers/computeVaultV1Reallocations.js +3 -9
- package/lib/esm/helpers/index.d.ts +2 -1
- package/lib/esm/helpers/index.js +2 -1
- package/lib/esm/helpers/referralFee.d.ts +21 -0
- package/lib/esm/helpers/referralFee.js +31 -0
- package/lib/esm/helpers/slippage.d.ts +90 -1
- package/lib/esm/helpers/slippage.js +122 -2
- package/lib/esm/helpers/validate.d.ts +16 -23
- package/lib/esm/helpers/validate.js +40 -48
- package/lib/esm/helpers/validateRequirementSpender.d.ts +2 -1
- package/lib/esm/helpers/validateRequirementSpender.js +3 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/types/action.d.ts +303 -210
- package/lib/esm/types/action.js +28 -2
- package/lib/esm/types/client.d.ts +9 -0
- package/lib/esm/types/error.d.ts +193 -18
- package/lib/esm/types/error.js +252 -21
- package/lib/esm/types/sharedLiquidity.d.ts +0 -7
- package/package.json +6 -5
- package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +0 -47
- package/lib/cjs/actions/blue/buildAssetFundingActions.js +0 -63
- package/lib/cjs/actions/blue/buildReallocationActions.d.ts +0 -69
- package/lib/cjs/actions/blue/buildReallocationActions.js +0 -141
- package/lib/cjs/actions/blue/resolveRepayFunding.d.ts +0 -66
- package/lib/cjs/actions/blue/resolveRepayFunding.js +0 -85
- package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +0 -47
- package/lib/esm/actions/blue/buildAssetFundingActions.js +0 -59
- package/lib/esm/actions/blue/buildReallocationActions.d.ts +0 -69
- package/lib/esm/actions/blue/buildReallocationActions.js +0 -135
- package/lib/esm/actions/blue/resolveRepayFunding.d.ts +0 -66
- package/lib/esm/actions/blue/resolveRepayFunding.js +0 -81
|
@@ -2,7 +2,7 @@ import { type AccrualVault, type AccrualVaultV2, type MarketParams } from "@morp
|
|
|
2
2
|
import { fetchAccrualVault } from "@morpho-org/blue-sdk-viem";
|
|
3
3
|
import { type Address } from "viem";
|
|
4
4
|
import type { FetchParameters } from "../../types/data.js";
|
|
5
|
-
import { type ActionOutput, type
|
|
5
|
+
import { type ActionOutput, type ActionRequirement, type BundlesFundingArgs, type BundlesTokenRequirementsOptions, type MorphoClientType, type RequirementSignature, type VaultV1DepositAction, type VaultV1InKindRedeemAction, type VaultV1MigrateToV2Action, type VaultV1MigrateToV2AmountArgs, type VaultV1RedeemAction, type VaultV1WithdrawAction } from "../../types/index.js";
|
|
6
6
|
export interface VaultV1Actions {
|
|
7
7
|
/**
|
|
8
8
|
* Fetches the latest vault data with accrued interest.
|
|
@@ -12,66 +12,230 @@ export interface VaultV1Actions {
|
|
|
12
12
|
*/
|
|
13
13
|
getData: (parameters?: FetchParameters) => Promise<Awaited<ReturnType<typeof fetchAccrualVault>>>;
|
|
14
14
|
/**
|
|
15
|
-
* Prepares a deposit
|
|
16
|
-
*
|
|
17
|
-
* Uses
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @
|
|
15
|
+
* Prepares a Vault V1 deposit through the registered VaultBundlesV1 contract.
|
|
16
|
+
*
|
|
17
|
+
* Uses the supplied vault snapshot to compute the deadline-accrued `maxSharePrice`.
|
|
18
|
+
* `getRequirements()` reads the asset allowance and, when enabled, the selected ERC-2612 or
|
|
19
|
+
* Permit2 nonce state. Native funding is exclusive and skips token requirements. Shares are
|
|
20
|
+
* always minted to the transaction sender, which must be `userAddress`.
|
|
21
|
+
* Concurrent requirement reads share the first caller's options; later calls refresh on-chain
|
|
22
|
+
* state using their own options. `buildTx()` accepts signatures from the latest completed read.
|
|
23
|
+
*
|
|
24
|
+
* @param params.userAddress - Account that funds, signs, submits, and receives the vault shares.
|
|
25
|
+
* @param params.vaultData - Pre-fetched Vault V1 snapshot used for asset and share conversion.
|
|
26
|
+
* @param params.amount - Optional gross ERC-20 assets; exclusive with `nativeAmount`.
|
|
27
|
+
* @param params.nativeAmount - Optional gross native assets; exclusive with `amount` and valid
|
|
28
|
+
* only for a wNative vault.
|
|
29
|
+
* @param params.slippageTolerance - Optional WAD-scaled tolerance; defaults to 0.03% and cannot
|
|
30
|
+
* exceed 10%.
|
|
31
|
+
* @param params.referralFeePct - Optional WAD-scaled referral fee below 100%, deducted before
|
|
32
|
+
* the vault deposit.
|
|
33
|
+
* @param params.referralFeeRecipient - Non-zero recipient required for a positive referral fee.
|
|
34
|
+
* @param params.deadline - Optional execution and permit deadline in Unix seconds; defaults to
|
|
35
|
+
* two hours from handle creation.
|
|
36
|
+
* @returns Lazy token prerequisite resolution and a synchronous deep-frozen VaultBundlesV1
|
|
37
|
+
* transaction builder.
|
|
38
|
+
* @throws {ChainIdMismatchError} when the connected client targets another chain.
|
|
39
|
+
* @throws {VaultAddressMismatchError} when `vaultData` belongs to another vault.
|
|
40
|
+
* @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
|
|
41
|
+
* @throws {MixedBundlesFundingError} when ERC-20 and native funding are both supplied.
|
|
42
|
+
* @throws {NegativeInputError} when funding, slippage, the referral fee, or a Permit2 nonce is negative.
|
|
43
|
+
* @throws {NonPositiveInputError} when funding or the previewed vault shares are not positive.
|
|
44
|
+
* @throws {ExcessiveSlippageToleranceError} when slippage tolerance exceeds the SDK maximum.
|
|
45
|
+
* @throws {ReferralFeePctExceededError} when the referral fee is at least WAD.
|
|
46
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no recipient.
|
|
47
|
+
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
48
|
+
* @throws {NativeAmountOnNonWNativeVaultError} when native funding targets a non-wNative vault.
|
|
49
|
+
* @throws {MissingPermit2SignatureTransferNonceError} from `getRequirements()` when Permit2 is
|
|
50
|
+
* selected without an explicit nonce.
|
|
51
|
+
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the
|
|
52
|
+
* explicit Permit2 nonce is consumed.
|
|
53
|
+
* @throws {InputExceedsMaxError} when funding or the deadline exceeds uint256, or from
|
|
54
|
+
* `getRequirements()` when the Permit2 nonce exceeds uint256.
|
|
55
|
+
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
56
|
+
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
|
|
57
|
+
* @throws {BundlesPermitMismatchError} from `buildTx()` when the signature was not produced for
|
|
58
|
+
* this prepared handle.
|
|
59
|
+
* @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
|
|
60
|
+
* @throws {DepositAssetMismatchError} from `buildTx()` when the signed asset differs from the vault asset.
|
|
61
|
+
* @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when signature metadata is malformed.
|
|
62
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
63
|
+
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered.
|
|
64
|
+
* @throws {viem.BaseError} from `getRequirements()` when an allowance, nonce, or token metadata read fails.
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { vaults } from "@morpho-org/morpho-test";
|
|
68
|
+
* import { morphoViemExtension } from "@morpho-org/morpho-sdk";
|
|
69
|
+
* import { createPublicClient, http, zeroAddress } from "viem";
|
|
70
|
+
* import { mainnet } from "viem/chains";
|
|
71
|
+
*
|
|
72
|
+
* const client = createPublicClient({ chain: mainnet, transport: http() })
|
|
73
|
+
* .extend(morphoViemExtension());
|
|
74
|
+
* const vault = client.morpho.vaultV1(vaults[mainnet.id].steakUsdc.address, mainnet.id);
|
|
75
|
+
* const vaultData = await vault.getData();
|
|
76
|
+
* const action = vault.deposit({
|
|
77
|
+
* amount: 1_000_000n,
|
|
78
|
+
* userAddress: zeroAddress,
|
|
79
|
+
* vaultData,
|
|
80
|
+
* });
|
|
81
|
+
* const requirements = await action.getRequirements(); // Satisfy these first.
|
|
82
|
+
* const tx = action.buildTx(); // For a client configured with supportSignature: false.
|
|
83
|
+
* // tx satisfies Readonly<Transaction<VaultV1DepositAction>>
|
|
84
|
+
* ```
|
|
27
85
|
*/
|
|
28
86
|
deposit: (params: {
|
|
29
|
-
userAddress: Address;
|
|
30
|
-
vaultData: AccrualVault;
|
|
31
|
-
slippageTolerance?: bigint;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Requirement<PermitRequirementSignature>)[]>;
|
|
37
|
-
};
|
|
87
|
+
readonly userAddress: Address;
|
|
88
|
+
readonly vaultData: AccrualVault;
|
|
89
|
+
readonly slippageTolerance?: bigint;
|
|
90
|
+
readonly referralFeePct?: bigint;
|
|
91
|
+
readonly referralFeeRecipient?: Address;
|
|
92
|
+
readonly deadline?: bigint;
|
|
93
|
+
} & BundlesFundingArgs) => ActionOutput<VaultV1DepositAction, readonly RequirementSignature[], BundlesTokenRequirementsOptions>;
|
|
38
94
|
/**
|
|
39
|
-
* Prepares
|
|
95
|
+
* Prepares an exact-assets Vault V1 withdrawal through VaultBundlesV1.
|
|
96
|
+
*
|
|
97
|
+
* Reads the vault accrual state on the first `getRequirements()` call, then reads the live
|
|
98
|
+
* vault-share allowance and, when a signature is needed, the permit nonce on each call.
|
|
99
|
+
* Captures the requested amount and owner at creation, so later changes to `params` do not
|
|
100
|
+
* change this handle's requirements or transaction.
|
|
101
|
+
*
|
|
102
|
+
* @param params.amount - Positive gross withdrawal in underlying asset base units, before fees.
|
|
103
|
+
* @param params.userAddress - Share owner that must sign and submit; receives the net assets.
|
|
104
|
+
* @param params.slippageTolerance - Optional WAD-scaled share-price loss tolerance applied to
|
|
105
|
+
* the share cap for MetaMorpho 1.0; MetaMorpho 1.1 retains its lost-assets clamp.
|
|
106
|
+
* Defaults to 0.03% and cannot exceed 10%.
|
|
107
|
+
* @param params.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero;
|
|
108
|
+
* rounded down and deducted from the gross withdrawn assets.
|
|
109
|
+
* @param params.referralFeeRecipient - Optional nonzero recipient required for a positive fee.
|
|
110
|
+
* @param params.deadline - Optional execution and share-permit deadline in Unix seconds;
|
|
111
|
+
* defaults to two hours from handle creation.
|
|
112
|
+
* @returns A frozen handle with lazy `getRequirements()` and synchronous `buildTx(signatures?)`,
|
|
113
|
+
* which returns a deep-frozen `Transaction<VaultV1WithdrawAction>`. Requirements are empty
|
|
114
|
+
* when the allowance equals the cap; otherwise they contain an exact approval or, with
|
|
115
|
+
* signature support, an ERC-2612 request. The cap stays pinned to the first resolution while
|
|
116
|
+
* each call re-reads the allowance. Confirm the approval or pass its signed permit to `buildTx`.
|
|
117
|
+
* @throws {ChainIdMismatchError} when the connected client targets another chain.
|
|
118
|
+
* @throws {NonPositiveInputError} when `amount` or the computed share cap is not positive.
|
|
119
|
+
* @throws {ExpiredDeadlineError} when `deadline` is not in the future at handle creation or
|
|
120
|
+
* at any `getRequirements()` call.
|
|
121
|
+
* @throws {InputExceedsMaxError} when `amount` or `deadline` exceeds uint256 at handle creation.
|
|
122
|
+
* @throws {NegativeInputError} when `referralFeePct` or `slippageTolerance` is negative.
|
|
123
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
124
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no nonzero recipient.
|
|
125
|
+
* @throws {ExcessiveSlippageToleranceError} when `slippageTolerance` exceeds 10%.
|
|
126
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
127
|
+
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
|
|
128
|
+
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
|
|
129
|
+
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permits are supplied.
|
|
130
|
+
* @throws {BundlesPermitMismatchError} from `buildTx()` when the share permit is malformed,
|
|
131
|
+
* was not resolved for this handle, or has incompatible vault, owner, spender, amount,
|
|
132
|
+
* deadline, or nonce values.
|
|
133
|
+
* @throws {viem.BaseError} when a vault, allowance, or nonce read or transaction encoding fails.
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* import { morphoViemExtension } from "@morpho-org/morpho-sdk";
|
|
137
|
+
* import { createPublicClient, http, type Address } from "viem";
|
|
138
|
+
* import { mainnet } from "viem/chains";
|
|
40
139
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
140
|
+
* export async function prepareUsdcWithdrawal(userAddress: Address) {
|
|
141
|
+
* const vaultAddress = "0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB";
|
|
142
|
+
* const client = createPublicClient({ chain: mainnet, transport: http() })
|
|
143
|
+
* .extend(morphoViemExtension({ supportSignature: false }));
|
|
144
|
+
* const vault = client.morpho.vaultV1(vaultAddress, mainnet.id);
|
|
145
|
+
* const action = vault.withdraw({ amount: 1_000_000n, userAddress });
|
|
146
|
+
* const requirements = await action.getRequirements();
|
|
147
|
+
* // Send and confirm each approval before calling action.buildTx().
|
|
148
|
+
* // action.buildTx() returns Readonly<Transaction<VaultV1WithdrawAction>>.
|
|
149
|
+
* return { action, requirements }; // Prepared handle and its outstanding share approvals.
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
45
152
|
*/
|
|
46
153
|
withdraw: (params: {
|
|
47
|
-
amount: bigint;
|
|
48
|
-
userAddress: Address;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
154
|
+
readonly amount: bigint;
|
|
155
|
+
readonly userAddress: Address;
|
|
156
|
+
readonly slippageTolerance?: bigint;
|
|
157
|
+
readonly referralFeePct?: bigint;
|
|
158
|
+
readonly referralFeeRecipient?: Address;
|
|
159
|
+
readonly deadline?: bigint;
|
|
160
|
+
}) => ActionOutput<VaultV1WithdrawAction, readonly RequirementSignature[], undefined>;
|
|
52
161
|
/**
|
|
53
|
-
* Prepares
|
|
162
|
+
* Prepares an exact-shares Vault V1 redemption through VaultBundlesV1.
|
|
54
163
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
164
|
+
* Captures `shares` and `userAddress` at handle creation for both requirements and `buildTx()`.
|
|
165
|
+
* The caller must satisfy the exact vault-share allowance returned by `getRequirements()` before
|
|
166
|
+
* `buildTx()`; every requirement resolution re-reads the live allowance and checks the deadline.
|
|
167
|
+
* `buildTx()` accepts permits from the latest completed requirement resolution.
|
|
168
|
+
*
|
|
169
|
+
* @param params.shares - Exact vault shares to burn.
|
|
170
|
+
* @param params.userAddress - Account that signs and submits the transaction; VaultBundlesV1
|
|
171
|
+
* burns and pays `msg.sender`.
|
|
172
|
+
* @param params.referralFeePct - Optional WAD-scaled referral fee below 100%, deducted from the
|
|
173
|
+
* redeemed assets.
|
|
174
|
+
* @param params.referralFeeRecipient - Optional non-zero recipient required for a positive fee.
|
|
175
|
+
* @param params.deadline - Optional execution and share-permit deadline in Unix seconds; defaults
|
|
176
|
+
* to two hours from handle creation.
|
|
177
|
+
* @returns Lazy exact share-allowance requirements and a synchronous transaction builder.
|
|
178
|
+
* @throws {ChainIdMismatchError} when the connected client targets another chain.
|
|
179
|
+
* @throws {NonPositiveInputError} when `shares` is not positive.
|
|
180
|
+
* @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
|
|
181
|
+
* @throws {NegativeInputError} when `referralFeePct` is negative.
|
|
182
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
183
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
|
|
184
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
185
|
+
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered.
|
|
186
|
+
* @throws {viem.BaseError} from `getRequirements()` when an allowance or permit-nonce read fails.
|
|
187
|
+
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permit signatures are supplied.
|
|
188
|
+
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when a non-permit signature is supplied.
|
|
189
|
+
* @throws {BundlesPermitMismatchError} from `buildTx()` when the supplied permit does not match
|
|
190
|
+
* the resolved share amount, spender, owner, nonce, or deadline.
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* import { vaults } from "@morpho-org/morpho-test";
|
|
194
|
+
* import { isRequirementSignature, morphoViemExtension } from "@morpho-org/morpho-sdk";
|
|
195
|
+
* import { createWalletClient, http, publicActions, zeroAddress } from "viem";
|
|
196
|
+
* import { mainnet } from "viem/chains";
|
|
197
|
+
*
|
|
198
|
+
* const client = createWalletClient({
|
|
199
|
+
* account: zeroAddress,
|
|
200
|
+
* chain: mainnet,
|
|
201
|
+
* transport: http(),
|
|
202
|
+
* })
|
|
203
|
+
* .extend(publicActions)
|
|
204
|
+
* .extend(morphoViemExtension({ supportSignature: true }));
|
|
205
|
+
* const vault = client.morpho.vaultV1(
|
|
206
|
+
* vaults[mainnet.id].steakUsdc.address,
|
|
207
|
+
* mainnet.id,
|
|
208
|
+
* );
|
|
209
|
+
* const redemption = vault.redeem({ shares: 1_000_000n, userAddress: zeroAddress });
|
|
210
|
+
* const signatures = [];
|
|
211
|
+
* for (const requirement of await redemption.getRequirements()) {
|
|
212
|
+
* if (isRequirementSignature(requirement)) {
|
|
213
|
+
* signatures.push(await requirement.sign(client, zeroAddress));
|
|
214
|
+
* } else {
|
|
215
|
+
* const hash = await client.sendTransaction(requirement);
|
|
216
|
+
* await client.waitForTransactionReceipt({ hash });
|
|
217
|
+
* }
|
|
218
|
+
* }
|
|
219
|
+
* const tx = redemption.buildTx(signatures);
|
|
220
|
+
* // tx satisfies Readonly<Transaction<VaultV1RedeemAction>>
|
|
221
|
+
* ```
|
|
59
222
|
*/
|
|
60
223
|
redeem: (params: {
|
|
61
|
-
shares: bigint;
|
|
62
|
-
userAddress: Address;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
224
|
+
readonly shares: bigint;
|
|
225
|
+
readonly userAddress: Address;
|
|
226
|
+
readonly referralFeePct?: bigint;
|
|
227
|
+
readonly referralFeeRecipient?: Address;
|
|
228
|
+
readonly deadline?: bigint;
|
|
229
|
+
}) => ActionOutput<VaultV1RedeemAction, readonly RequirementSignature[], undefined>;
|
|
66
230
|
/**
|
|
67
231
|
* Prepares an illiquid Vault V1 exit into the vault's Morpho Blue supply positions.
|
|
68
232
|
*
|
|
69
233
|
* The caller controls market order and must call `getRequirements()` before `buildTx()` so the
|
|
70
234
|
* RPC-backed Blue-balance and Morpho-deployment checks run. The SDK validates market coverage but
|
|
71
235
|
* intentionally does not validate the user's share balance; size `amount` in asset terms against
|
|
72
|
-
* `previewRedeem(sharesHeld)`. The share allowance
|
|
73
|
-
*
|
|
74
|
-
*
|
|
236
|
+
* `previewRedeem(sharesHeld)`. The share allowance uses the greater rounded-up share preview
|
|
237
|
+
* before and after accruing pending performance-fee shares. MetaMorpho 1.0 adds the default
|
|
238
|
+
* 0.03% loss buffer; MetaMorpho 1.1 retains its lost-assets clamp without that buffer.
|
|
75
239
|
*
|
|
76
240
|
* Snapshot state can drift before inclusion, so a later reallocation may still make the on-chain
|
|
77
241
|
* loop under-cover even after pre-flight succeeds.
|
|
@@ -134,29 +298,101 @@ export interface VaultV1Actions {
|
|
|
134
298
|
readonly deadline?: bigint;
|
|
135
299
|
}) => ActionOutput<VaultV1InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
136
300
|
/**
|
|
137
|
-
* Prepares a
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* @param
|
|
146
|
-
*
|
|
147
|
-
* @param
|
|
148
|
-
*
|
|
301
|
+
* Prepares a Vault V1-to-Vault V2 migration through VaultBundlesV1.
|
|
302
|
+
*
|
|
303
|
+
* Exits V1 by assets or shares and atomically deposits the resulting assets into V2 through
|
|
304
|
+
* VaultBundlesV1. Only the destination deposit has an onchain share-price bound. The caller must
|
|
305
|
+
* satisfy the exact source-vault share requirement before building the transaction.
|
|
306
|
+
* Captures vault identities, permit-domain metadata, and the owner at handle creation.
|
|
307
|
+
* `buildTx()` accepts permits from the latest completed requirement resolution.
|
|
308
|
+
*
|
|
309
|
+
* @param params.userAddress - Account that signs and submits the transaction; VaultBundlesV1
|
|
310
|
+
* burns and mints shares for `msg.sender`.
|
|
311
|
+
* @param params.sourceVault - Pre-fetched Vault V1 snapshot used for source conversion and the
|
|
312
|
+
* share-authorization cap.
|
|
313
|
+
* @param params.targetVault - Pre-fetched Vault V2 snapshot used for the destination share-price
|
|
314
|
+
* bound.
|
|
315
|
+
* @param params.shares - Optional exact Vault V1 shares to migrate; exclusive with `assets`.
|
|
316
|
+
* @param params.assets - Optional exact Vault V1 assets to withdraw and migrate; exclusive with
|
|
317
|
+
* `shares`.
|
|
318
|
+
* @param params.slippageTolerance - Optional WAD-scaled tolerance applied to an assets-mode share
|
|
319
|
+
* cap and the destination bound; defaults to 0.03% and cannot exceed 10%.
|
|
320
|
+
* @param params.referralFeePct - Optional WAD-scaled referral fee below 100%, deducted from the
|
|
321
|
+
* source-vault proceeds.
|
|
322
|
+
* @param params.referralFeeRecipient - Optional non-zero recipient required for a positive fee.
|
|
323
|
+
* @param params.deadline - Optional execution and share-permit deadline in Unix seconds; defaults
|
|
324
|
+
* to two hours from handle creation.
|
|
325
|
+
* @returns Lazy exact source-share requirements and a synchronous transaction builder.
|
|
326
|
+
* `getRequirements()` re-reads the live share allowance on every call, so a requirement
|
|
327
|
+
* satisfied between calls stops being reported, while the derived source share cap stays
|
|
328
|
+
* pinned to the supplied snapshot.
|
|
329
|
+
* @throws {ChainIdMismatchError} when the connected client targets another chain.
|
|
330
|
+
* @throws {VaultAddressMismatchError} when `sourceVault` belongs to another vault.
|
|
331
|
+
* @throws {VaultAssetMismatchError} when the source and destination vault assets differ.
|
|
332
|
+
* @throws {SameVaultMigrationError} when the source and destination vault addresses are equal.
|
|
333
|
+
* @throws {AmountAndSharesExclusiveError} when both amount modes or neither are supplied.
|
|
334
|
+
* @throws {NonPositiveInputError} when the selected amount or a computed share value is not positive.
|
|
335
|
+
* @throws {NegativeInputError} when slippage tolerance or `referralFeePct` is negative.
|
|
336
|
+
* @throws {ExcessiveSlippageToleranceError} when slippage tolerance exceeds the SDK maximum.
|
|
337
|
+
* @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
|
|
338
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
339
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
|
|
340
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
341
|
+
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered.
|
|
342
|
+
* @throws {viem.BaseError} from `getRequirements()` when an allowance or permit-nonce read fails.
|
|
343
|
+
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permit signatures are supplied.
|
|
344
|
+
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when a non-permit signature is supplied.
|
|
345
|
+
* @throws {BundlesPermitMismatchError} from `buildTx()` when the supplied permit does not match
|
|
346
|
+
* the prepared source share cap, spender, owner, nonce, or deadline.
|
|
347
|
+
* @example
|
|
348
|
+
* ```ts
|
|
349
|
+
* import { vaults } from "@morpho-org/morpho-test";
|
|
350
|
+
* import { isRequirementSignature, morphoViemExtension } from "@morpho-org/morpho-sdk";
|
|
351
|
+
* import { createWalletClient, http, publicActions, type Address, zeroAddress } from "viem";
|
|
352
|
+
* import { mainnet } from "viem/chains";
|
|
353
|
+
*
|
|
354
|
+
* const keyrockUsdcVaultV2 =
|
|
355
|
+
* "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145" satisfies Address;
|
|
356
|
+
* const client = createWalletClient({
|
|
357
|
+
* account: zeroAddress,
|
|
358
|
+
* chain: mainnet,
|
|
359
|
+
* transport: http(),
|
|
360
|
+
* })
|
|
361
|
+
* .extend(publicActions)
|
|
362
|
+
* .extend(morphoViemExtension({ supportSignature: true }));
|
|
363
|
+
* const source = client.morpho.vaultV1(
|
|
364
|
+
* vaults[mainnet.id].steakUsdc.address,
|
|
365
|
+
* mainnet.id,
|
|
366
|
+
* );
|
|
367
|
+
* const target = client.morpho.vaultV2(keyrockUsdcVaultV2, mainnet.id);
|
|
368
|
+
* const migration = source.migrateToV2({
|
|
369
|
+
* assets: 1_000_000n,
|
|
370
|
+
* userAddress: zeroAddress,
|
|
371
|
+
* sourceVault: await source.getData(),
|
|
372
|
+
* targetVault: await target.getData(),
|
|
373
|
+
* });
|
|
374
|
+
* const signatures = [];
|
|
375
|
+
* for (const requirement of await migration.getRequirements()) {
|
|
376
|
+
* if (isRequirementSignature(requirement)) {
|
|
377
|
+
* signatures.push(await requirement.sign(client, zeroAddress));
|
|
378
|
+
* } else {
|
|
379
|
+
* const hash = await client.sendTransaction(requirement);
|
|
380
|
+
* await client.waitForTransactionReceipt({ hash });
|
|
381
|
+
* }
|
|
382
|
+
* }
|
|
383
|
+
* const tx = migration.buildTx(signatures);
|
|
384
|
+
* // tx satisfies Readonly<Transaction<VaultV1MigrateToV2Action>>
|
|
385
|
+
* ```
|
|
149
386
|
*/
|
|
150
387
|
migrateToV2: (params: {
|
|
151
|
-
userAddress: Address;
|
|
152
|
-
sourceVault: AccrualVault;
|
|
153
|
-
targetVault: AccrualVaultV2;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
};
|
|
388
|
+
readonly userAddress: Address;
|
|
389
|
+
readonly sourceVault: AccrualVault;
|
|
390
|
+
readonly targetVault: AccrualVaultV2;
|
|
391
|
+
readonly slippageTolerance?: bigint;
|
|
392
|
+
readonly referralFeePct?: bigint;
|
|
393
|
+
readonly referralFeeRecipient?: Address;
|
|
394
|
+
readonly deadline?: bigint;
|
|
395
|
+
} & VaultV1MigrateToV2AmountArgs) => ActionOutput<VaultV1MigrateToV2Action, readonly RequirementSignature[], undefined>;
|
|
160
396
|
}
|
|
161
397
|
export declare class MorphoVaultV1 implements VaultV1Actions {
|
|
162
398
|
private readonly client;
|
|
@@ -164,28 +400,40 @@ export declare class MorphoVaultV1 implements VaultV1Actions {
|
|
|
164
400
|
private readonly chainId;
|
|
165
401
|
constructor(client: MorphoClientType, vault: Address, chainId: number);
|
|
166
402
|
getData(parameters?: FetchParameters): Promise<AccrualVault>;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}): {
|
|
187
|
-
|
|
188
|
-
|
|
403
|
+
/** {@inheritDoc VaultV1Actions.deposit} */
|
|
404
|
+
deposit(params: {
|
|
405
|
+
readonly userAddress: Address;
|
|
406
|
+
readonly vaultData: AccrualVault;
|
|
407
|
+
readonly slippageTolerance?: bigint;
|
|
408
|
+
readonly referralFeePct?: bigint;
|
|
409
|
+
readonly referralFeeRecipient?: Address;
|
|
410
|
+
readonly deadline?: bigint;
|
|
411
|
+
} & BundlesFundingArgs): Readonly<{
|
|
412
|
+
getRequirements: (requirementOptions?: BundlesTokenRequirementsOptions) => Promise<readonly ActionRequirement[]>;
|
|
413
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<import("../../types/action.js").Transaction<VaultV1DepositAction>>;
|
|
414
|
+
}>;
|
|
415
|
+
withdraw(params: {
|
|
416
|
+
readonly amount: bigint;
|
|
417
|
+
readonly userAddress: Address;
|
|
418
|
+
readonly slippageTolerance?: bigint;
|
|
419
|
+
readonly referralFeePct?: bigint;
|
|
420
|
+
readonly referralFeeRecipient?: Address;
|
|
421
|
+
readonly deadline?: bigint;
|
|
422
|
+
}): Readonly<{
|
|
423
|
+
getRequirements: () => Promise<readonly ActionRequirement[]>;
|
|
424
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<import("../../types/action.js").Transaction<VaultV1WithdrawAction>>;
|
|
425
|
+
}>;
|
|
426
|
+
/** {@inheritDoc VaultV1Actions.redeem} */
|
|
427
|
+
redeem(params: {
|
|
428
|
+
readonly shares: bigint;
|
|
429
|
+
readonly userAddress: Address;
|
|
430
|
+
readonly referralFeePct?: bigint;
|
|
431
|
+
readonly referralFeeRecipient?: Address;
|
|
432
|
+
readonly deadline?: bigint;
|
|
433
|
+
}): Readonly<{
|
|
434
|
+
getRequirements: () => Promise<readonly ActionRequirement[]>;
|
|
435
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<import("../../types/action.js").Transaction<VaultV1RedeemAction>>;
|
|
436
|
+
}>;
|
|
189
437
|
/** {@inheritDoc VaultV1Actions.inKindRedeem} */
|
|
190
438
|
inKindRedeem({ amount, marketParamsList, vaultData, userAddress, deadline: deadlineOverride, }: {
|
|
191
439
|
readonly amount: bigint;
|
|
@@ -194,14 +442,16 @@ export declare class MorphoVaultV1 implements VaultV1Actions {
|
|
|
194
442
|
readonly userAddress: Address;
|
|
195
443
|
readonly deadline?: bigint;
|
|
196
444
|
}): ActionOutput<VaultV1InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
197
|
-
migrateToV2(
|
|
198
|
-
userAddress: Address;
|
|
199
|
-
sourceVault: AccrualVault;
|
|
200
|
-
targetVault: AccrualVaultV2;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
445
|
+
migrateToV2(params: {
|
|
446
|
+
readonly userAddress: Address;
|
|
447
|
+
readonly sourceVault: AccrualVault;
|
|
448
|
+
readonly targetVault: AccrualVaultV2;
|
|
449
|
+
readonly slippageTolerance?: bigint;
|
|
450
|
+
readonly referralFeePct?: bigint;
|
|
451
|
+
readonly referralFeeRecipient?: Address;
|
|
452
|
+
readonly deadline?: bigint;
|
|
453
|
+
} & VaultV1MigrateToV2AmountArgs): Readonly<{
|
|
454
|
+
getRequirements: () => Promise<readonly ActionRequirement[]>;
|
|
455
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<import("../../types/action.js").Transaction<VaultV1MigrateToV2Action>>;
|
|
456
|
+
}>;
|
|
207
457
|
}
|