@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.2
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 +127 -16
- package/README.md +17 -11
- package/lib/cjs/abis.d.ts +17 -2
- package/lib/cjs/abis.js +14 -1
- package/lib/cjs/actions/blue/common.js +5 -26
- package/lib/cjs/actions/blue/supply.js +2 -7
- package/lib/cjs/actions/bundles/common.d.ts +32 -2
- package/lib/cjs/actions/bundles/common.js +68 -30
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +6 -10
- package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/blue/index.js +0 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +15 -8
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +20 -20
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +33 -27
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +15 -10
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +1 -0
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +4 -1
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +5 -2
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +6 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +2 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +1 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +3 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +1 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +3 -2
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
- package/lib/cjs/blue/abis.d.ts +5 -1
- package/lib/cjs/blue/abis.js +2 -0
- package/lib/cjs/blue/entities.d.ts +8 -2
- package/lib/cjs/blue/entities.js +1 -0
- package/lib/cjs/blue/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +2 -1
- package/lib/cjs/blue/fetch.d.ts +3 -1
- package/lib/cjs/blue/fetch.js +1 -0
- package/lib/cjs/entities/blue/blue.d.ts +15 -6
- package/lib/cjs/entities/blue/blue.js +3 -0
- package/lib/cjs/entities/index.d.ts +8 -2
- package/lib/cjs/entities/index.js +1 -0
- package/lib/cjs/entities/midnight/midnight.js +20 -24
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +19 -14
- package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +1 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +10 -5
- package/lib/cjs/entities/vaultV1/vaultV1.js +13 -1
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +6 -0
- package/lib/cjs/entities/vaultV1ReallocationData.js +20 -5
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +140 -34
- package/lib/cjs/entities/vaultV2/vaultV2.js +229 -16
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +46 -13
- package/lib/cjs/errors.d.ts +1 -1
- package/lib/cjs/errors.js +3 -2
- package/lib/cjs/fetch.d.ts +3 -1
- package/lib/cjs/fetch.js +1 -0
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +2 -0
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +2 -0
- package/lib/cjs/helpers/index.d.ts +3 -1
- package/lib/cjs/helpers/index.js +10 -1
- package/lib/cjs/helpers/metadata.d.ts +3 -5
- package/lib/cjs/helpers/metadata.js +4 -6
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/cjs/helpers/slippage.d.ts +46 -0
- package/lib/cjs/helpers/slippage.js +65 -0
- package/lib/cjs/helpers/validate.d.ts +65 -8
- package/lib/cjs/helpers/validate.js +83 -9
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
- package/lib/cjs/types/action.d.ts +95 -13
- package/lib/cjs/types/error.d.ts +290 -12
- package/lib/cjs/types/error.js +312 -24
- package/lib/cjs/types/sharedLiquidity.d.ts +2 -2
- package/lib/cjs/utils.d.ts +3 -1
- package/lib/cjs/utils.js +10 -1
- package/lib/esm/abis.d.ts +17 -2
- package/lib/esm/abis.js +17 -2
- package/lib/esm/actions/blue/common.js +7 -28
- package/lib/esm/actions/blue/supply.js +4 -9
- package/lib/esm/actions/bundles/common.d.ts +32 -2
- package/lib/esm/actions/bundles/common.js +68 -31
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +8 -12
- package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
- package/lib/esm/actions/requirements/blue/index.js +0 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +15 -8
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +21 -21
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +34 -28
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +15 -10
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +1 -0
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +4 -1
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +5 -2
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +6 -0
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +2 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +1 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.js +3 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +1 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.js +3 -2
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +3 -1
- package/lib/esm/blue/abis.d.ts +5 -1
- package/lib/esm/blue/abis.js +5 -1
- package/lib/esm/blue/entities.d.ts +8 -2
- package/lib/esm/blue/entities.js +3 -1
- package/lib/esm/blue/errors.d.ts +1 -1
- package/lib/esm/blue/errors.js +1 -1
- package/lib/esm/blue/fetch.d.ts +3 -1
- package/lib/esm/blue/fetch.js +3 -1
- package/lib/esm/entities/blue/blue.d.ts +15 -6
- package/lib/esm/entities/blue/blue.js +3 -0
- package/lib/esm/entities/index.d.ts +8 -2
- package/lib/esm/entities/index.js +3 -1
- package/lib/esm/entities/midnight/midnight.js +20 -24
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +20 -15
- package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/esm/entities/requirements/index.d.ts +1 -0
- package/lib/esm/entities/requirements/index.js +1 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +10 -5
- package/lib/esm/entities/vaultV1/vaultV1.js +14 -2
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +6 -0
- package/lib/esm/entities/vaultV1ReallocationData.js +20 -5
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +140 -34
- package/lib/esm/entities/vaultV2/vaultV2.js +234 -21
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.js +46 -13
- package/lib/esm/errors.d.ts +1 -1
- package/lib/esm/errors.js +1 -1
- package/lib/esm/fetch.d.ts +3 -1
- package/lib/esm/fetch.js +3 -1
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +2 -0
- package/lib/esm/helpers/computeVaultV1Reallocations.js +2 -0
- package/lib/esm/helpers/index.d.ts +3 -1
- package/lib/esm/helpers/index.js +3 -1
- package/lib/esm/helpers/metadata.d.ts +3 -5
- package/lib/esm/helpers/metadata.js +4 -6
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/esm/helpers/slippage.d.ts +46 -0
- package/lib/esm/helpers/slippage.js +65 -1
- package/lib/esm/helpers/validate.d.ts +65 -8
- package/lib/esm/helpers/validate.js +82 -10
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
- package/lib/esm/types/action.d.ts +95 -13
- package/lib/esm/types/error.d.ts +290 -12
- package/lib/esm/types/error.js +301 -19
- package/lib/esm/types/sharedLiquidity.d.ts +2 -2
- package/lib/esm/utils.d.ts +3 -1
- package/lib/esm/utils.js +3 -1
- package/package.json +7 -7
- /package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
- /package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
package/lib/cjs/types/error.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MarketId, UnknownDataError } from "@morpho-org/blue-sdk";
|
|
2
|
-
import type { Address, Hash } from "viem";
|
|
2
|
+
import type { Address, Hash, Hex } from "viem";
|
|
3
3
|
/**
|
|
4
4
|
* Thrown when a morpho-sdk input that must be non-negative is negative.
|
|
5
5
|
*
|
|
@@ -78,8 +78,23 @@ export declare class ExpiredDeadlineError extends Error {
|
|
|
78
78
|
*/
|
|
79
79
|
constructor(deadline: bigint, timestamp: bigint);
|
|
80
80
|
}
|
|
81
|
-
/**
|
|
82
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Thrown when a VaultExitBundlesV1 Vault V2 exit targets a vault without exactly one adapter.
|
|
83
|
+
*
|
|
84
|
+
* Both `vaultExitBundlesV1InKindRedemptionVaultV2` and
|
|
85
|
+
* `vaultExitBundlesV1ForceWithdrawVaultV2` require `adaptersLength() == 1`.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* import { VaultV2SingleAdapterRequiredError } from "@morpho-org/morpho-sdk";
|
|
90
|
+
*
|
|
91
|
+
* const error = new VaultV2SingleAdapterRequiredError(vault, 2);
|
|
92
|
+
* if (error instanceof VaultV2SingleAdapterRequiredError) {
|
|
93
|
+
* console.error(error.vault, error.adapters);
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare class VaultV2SingleAdapterRequiredError extends Error {
|
|
83
98
|
readonly vault: Address;
|
|
84
99
|
readonly adapters: number;
|
|
85
100
|
/**
|
|
@@ -88,6 +103,10 @@ export declare class InKindRedeemRequiresSingleAdapterError extends Error {
|
|
|
88
103
|
*/
|
|
89
104
|
constructor(vault: Address, adapters: number);
|
|
90
105
|
}
|
|
106
|
+
/** @deprecated Use {@link VaultV2SingleAdapterRequiredError}. */
|
|
107
|
+
export declare const InKindRedeemRequiresSingleAdapterError: typeof VaultV2SingleAdapterRequiredError;
|
|
108
|
+
/** @deprecated Use {@link VaultV2SingleAdapterRequiredError}. */
|
|
109
|
+
export type InKindRedeemRequiresSingleAdapterError = VaultV2SingleAdapterRequiredError;
|
|
91
110
|
/** Thrown when a requested in-kind redemption adapter is not part of the Vault V2 snapshot. */
|
|
92
111
|
export declare class AdapterNotPartOfVaultError extends Error {
|
|
93
112
|
readonly vault: Address;
|
|
@@ -98,14 +117,279 @@ export declare class AdapterNotPartOfVaultError extends Error {
|
|
|
98
117
|
*/
|
|
99
118
|
constructor(vault: Address, adapter: Address);
|
|
100
119
|
}
|
|
101
|
-
/**
|
|
102
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Thrown when the Vault V2 adapter cannot expose MorphoMarketV1AdapterV2 market shares.
|
|
122
|
+
*
|
|
123
|
+
* VaultExitBundlesV1 casts the adapter to `IMorphoMarketV1AdapterV2`, so a legacy
|
|
124
|
+
* positions-based `MorphoMarketV1Adapter` or a `MorphoVaultV1Adapter` cannot be exited.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { VaultV2UnsupportedExitAdapterError } from "@morpho-org/morpho-sdk";
|
|
129
|
+
*
|
|
130
|
+
* const error = new VaultV2UnsupportedExitAdapterError(adapter);
|
|
131
|
+
* if (error instanceof VaultV2UnsupportedExitAdapterError) {
|
|
132
|
+
* console.error(error.adapter);
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare class VaultV2UnsupportedExitAdapterError extends Error {
|
|
103
137
|
readonly adapter: Address;
|
|
104
138
|
/**
|
|
105
139
|
* @param adapter - Unsupported Vault V2 adapter address.
|
|
106
140
|
*/
|
|
107
141
|
constructor(adapter: Address);
|
|
108
142
|
}
|
|
143
|
+
/** @deprecated Use {@link VaultV2UnsupportedExitAdapterError}. */
|
|
144
|
+
export declare const UnsupportedInKindAdapterError: typeof VaultV2UnsupportedExitAdapterError;
|
|
145
|
+
/** @deprecated Use {@link VaultV2UnsupportedExitAdapterError}. */
|
|
146
|
+
export type UnsupportedInKindAdapterError = VaultV2UnsupportedExitAdapterError;
|
|
147
|
+
/**
|
|
148
|
+
* Thrown when a Vault V2 exit cannot resolve the vault's configured liquidity adapter.
|
|
149
|
+
*
|
|
150
|
+
* `VaultExitBundlesV1.vaultExitBundlesV1ForceWithdrawVaultV2` casts `liquidityAdapter` to
|
|
151
|
+
* `IMorphoMarketV1AdapterV2` and ABI-decodes `liquidityData` as `MarketParams`. Because the exit
|
|
152
|
+
* also requires `adaptersLength() == 1`, the only resolvable configurations are an unset
|
|
153
|
+
* liquidity adapter or the vault's sole adapter.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* import { VaultV2UnsupportedLiquidityAdapterError } from "@morpho-org/morpho-sdk";
|
|
158
|
+
*
|
|
159
|
+
* const error = new VaultV2UnsupportedLiquidityAdapterError({
|
|
160
|
+
* vault,
|
|
161
|
+
* liquidityAdapter,
|
|
162
|
+
* adapter,
|
|
163
|
+
* });
|
|
164
|
+
* if (error instanceof VaultV2UnsupportedLiquidityAdapterError) {
|
|
165
|
+
* console.error(error.liquidityAdapter, error.adapter);
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export declare class VaultV2UnsupportedLiquidityAdapterError extends Error {
|
|
170
|
+
/** Vault V2 address. */
|
|
171
|
+
readonly vault: Address;
|
|
172
|
+
/** Liquidity adapter configured on the vault. */
|
|
173
|
+
readonly liquidityAdapter: Address;
|
|
174
|
+
/** Sole adapter the exit targets. */
|
|
175
|
+
readonly adapter: Address;
|
|
176
|
+
/**
|
|
177
|
+
* @param params - Liquidity-adapter mismatch details.
|
|
178
|
+
* @param params.vault - Vault V2 address.
|
|
179
|
+
* @param params.liquidityAdapter - Liquidity adapter configured on the vault.
|
|
180
|
+
* @param params.adapter - Sole adapter the exit targets.
|
|
181
|
+
*/
|
|
182
|
+
constructor(params: {
|
|
183
|
+
readonly vault: Address;
|
|
184
|
+
readonly liquidityAdapter: Address;
|
|
185
|
+
readonly adapter: Address;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Thrown when a Vault V2 exit cannot ABI-decode the vault's `liquidityData` as `MarketParams`.
|
|
190
|
+
*
|
|
191
|
+
* Distinct from {@link VaultV2UnsupportedLiquidityAdapterError}: the liquidity adapter *is* the
|
|
192
|
+
* vault's sole adapter, but the market params stored alongside it are unusable, so the contract's
|
|
193
|
+
* `abi.decode` would revert. Only the vault curator can repair this by re-setting the liquidity
|
|
194
|
+
* adapter and data.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* import { VaultV2UndecodableLiquidityDataError } from "@morpho-org/morpho-sdk";
|
|
199
|
+
*
|
|
200
|
+
* try {
|
|
201
|
+
* vault.forceWithdraw({ exitAssets: 1_000_000n, vaultData, userAddress });
|
|
202
|
+
* } catch (error) {
|
|
203
|
+
* if (error instanceof VaultV2UndecodableLiquidityDataError) {
|
|
204
|
+
* console.error(error.liquidityData, error.cause);
|
|
205
|
+
* }
|
|
206
|
+
* }
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export declare class VaultV2UndecodableLiquidityDataError extends Error {
|
|
210
|
+
/** Vault V2 address. */
|
|
211
|
+
readonly vault: Address;
|
|
212
|
+
/** Liquidity adapter configured on the vault. */
|
|
213
|
+
readonly liquidityAdapter: Address;
|
|
214
|
+
/** Raw `liquidityData` that failed to decode. */
|
|
215
|
+
readonly liquidityData: Hex;
|
|
216
|
+
/**
|
|
217
|
+
* @param params - Undecodable liquidity-data details.
|
|
218
|
+
* @param params.vault - Vault V2 address.
|
|
219
|
+
* @param params.liquidityAdapter - Liquidity adapter configured on the vault.
|
|
220
|
+
* @param params.liquidityData - Raw `liquidityData` that failed to decode.
|
|
221
|
+
* @param params.cause - Underlying decode failure.
|
|
222
|
+
*/
|
|
223
|
+
constructor(params: {
|
|
224
|
+
readonly vault: Address;
|
|
225
|
+
readonly liquidityAdapter: Address;
|
|
226
|
+
readonly liquidityData: Hex;
|
|
227
|
+
readonly cause?: unknown;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Thrown when the adapter's markets cannot cover a Vault V2 force withdrawal.
|
|
232
|
+
*
|
|
233
|
+
* `vaultExitBundlesV1ForceWithdrawVaultV2` loops over the adapter's market list without a bound,
|
|
234
|
+
* so an under-covered request reverts on-chain with a raw `panic 0x32`. This error surfaces that
|
|
235
|
+
* failure before submission.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* import { VaultV2ForceWithdrawCoverageError } from "@morpho-org/morpho-sdk";
|
|
240
|
+
*
|
|
241
|
+
* const error = new VaultV2ForceWithdrawCoverageError({
|
|
242
|
+
* required: 100n,
|
|
243
|
+
* covered: 40n,
|
|
244
|
+
* maxExitAssets: 60n,
|
|
245
|
+
* });
|
|
246
|
+
* if (error instanceof VaultV2ForceWithdrawCoverageError) {
|
|
247
|
+
* console.error(error.maxExitAssets);
|
|
248
|
+
* }
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
export declare class VaultV2ForceWithdrawCoverageError extends Error {
|
|
252
|
+
/** Assets that must be force-deallocated from the adapter's markets. */
|
|
253
|
+
readonly required: bigint;
|
|
254
|
+
/** Assets the adapter's markets can actually release. */
|
|
255
|
+
readonly covered: bigint;
|
|
256
|
+
/** Largest penalty-inclusive `exitAssets` the current vault state supports. */
|
|
257
|
+
readonly maxExitAssets: bigint;
|
|
258
|
+
/**
|
|
259
|
+
* @param params - Coverage values used to explain the rejected exit.
|
|
260
|
+
* @param params.required - Assets that must be force-deallocated.
|
|
261
|
+
* @param params.covered - Assets the adapter's markets can release.
|
|
262
|
+
* @param params.maxExitAssets - Largest supported penalty-inclusive `exitAssets`.
|
|
263
|
+
*/
|
|
264
|
+
constructor(params: {
|
|
265
|
+
readonly required: bigint;
|
|
266
|
+
readonly covered: bigint;
|
|
267
|
+
readonly maxExitAssets: bigint;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Thrown when a Vault V2 force withdrawal would withdraw nothing while still consuming its permit.
|
|
272
|
+
*
|
|
273
|
+
* Happens on a dust `exitAssets` when the vault has no penalty-free liquidity and the
|
|
274
|
+
* penalty-adjusted remainder rounds down to zero.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* import { VaultV2ForceWithdrawZeroWithdrawalError } from "@morpho-org/morpho-sdk";
|
|
279
|
+
*
|
|
280
|
+
* const error = new VaultV2ForceWithdrawZeroWithdrawalError({
|
|
281
|
+
* vault,
|
|
282
|
+
* exitAssets: 1n,
|
|
283
|
+
* penalty: 20_000000000000000n,
|
|
284
|
+
* });
|
|
285
|
+
* if (error instanceof VaultV2ForceWithdrawZeroWithdrawalError) {
|
|
286
|
+
* console.error(error.exitAssets, error.penalty);
|
|
287
|
+
* }
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
export declare class VaultV2ForceWithdrawZeroWithdrawalError extends Error {
|
|
291
|
+
/** Vault V2 address. */
|
|
292
|
+
readonly vault: Address;
|
|
293
|
+
/** Positive penalty-inclusive amount requested by the caller. */
|
|
294
|
+
readonly exitAssets: bigint;
|
|
295
|
+
/** WAD-scaled force-deallocation penalty applied by the adapter. */
|
|
296
|
+
readonly penalty: bigint;
|
|
297
|
+
/**
|
|
298
|
+
* @param params - Values that caused the exit to withdraw nothing.
|
|
299
|
+
* @param params.vault - Vault V2 address.
|
|
300
|
+
* @param params.exitAssets - Positive penalty-inclusive amount requested by the caller.
|
|
301
|
+
* @param params.penalty - WAD-scaled force-deallocation penalty applied by the adapter.
|
|
302
|
+
*/
|
|
303
|
+
constructor(params: {
|
|
304
|
+
readonly vault: Address;
|
|
305
|
+
readonly exitAssets: bigint;
|
|
306
|
+
readonly penalty: bigint;
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Thrown when a Vault V2 force withdrawal's derived share-price floor rounds down to zero.
|
|
311
|
+
*
|
|
312
|
+
* VaultExitBundlesV1 reads `minSharePriceE27 == 0` as "no bound at all", so emitting a rounded-down
|
|
313
|
+
* zero would silently ship an exit with none of the slippage protection this path exists to add.
|
|
314
|
+
* Reaching it means the exit burns more shares than `withdrawnAssets` can price at RAY scale — a
|
|
315
|
+
* vault whose share price has collapsed below `1e-27` assets per share, or a dust exit against one.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```ts
|
|
319
|
+
* import { VaultV2ForceWithdrawZeroSharePriceError } from "@morpho-org/morpho-sdk";
|
|
320
|
+
*
|
|
321
|
+
* try {
|
|
322
|
+
* vault.forceWithdraw({ exitAssets, vaultData, userAddress });
|
|
323
|
+
* } catch (error) {
|
|
324
|
+
* if (error instanceof VaultV2ForceWithdrawZeroSharePriceError) {
|
|
325
|
+
* console.error(error.withdrawnAssets, error.sharesBurnt);
|
|
326
|
+
* }
|
|
327
|
+
* }
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
export declare class VaultV2ForceWithdrawZeroSharePriceError extends Error {
|
|
331
|
+
/** Assets the exit withdraws in total, before the referral fee. */
|
|
332
|
+
readonly withdrawnAssets: bigint;
|
|
333
|
+
/** Upper bound of the vault shares the exit burns. */
|
|
334
|
+
readonly sharesBurnt: bigint;
|
|
335
|
+
/** WAD-scaled slippage tolerance applied to the floor. */
|
|
336
|
+
readonly slippageTolerance: bigint;
|
|
337
|
+
/**
|
|
338
|
+
* @param params - Values whose ratio rounded down to a zero share-price floor.
|
|
339
|
+
* @param params.withdrawnAssets - Assets the exit withdraws in total, before the referral fee.
|
|
340
|
+
* @param params.sharesBurnt - Upper bound of the vault shares the exit burns.
|
|
341
|
+
* @param params.slippageTolerance - WAD-scaled slippage tolerance applied to the floor.
|
|
342
|
+
*/
|
|
343
|
+
constructor(params: {
|
|
344
|
+
readonly withdrawnAssets: bigint;
|
|
345
|
+
readonly sharesBurnt: bigint;
|
|
346
|
+
readonly slippageTolerance: bigint;
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Thrown when fee shares projected to the accepted deadline reach the lower force-withdraw
|
|
351
|
+
* burn bound at that time.
|
|
352
|
+
*
|
|
353
|
+
* VaultExitBundlesV1 measures shares burned after its first withdrawal accrues fees. If the
|
|
354
|
+
* recipient's fee shares are at least the measured burn bound, its share-price check is skipped or
|
|
355
|
+
* reverts due to an underflow.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* import { VaultV2ForceWithdrawFeeSharesExceedBurnError } from "@morpho-org/morpho-sdk";
|
|
360
|
+
*
|
|
361
|
+
* try {
|
|
362
|
+
* vault.forceWithdraw({ exitAssets, vaultData, userAddress });
|
|
363
|
+
* } catch (error) {
|
|
364
|
+
* if (error instanceof VaultV2ForceWithdrawFeeSharesExceedBurnError) {
|
|
365
|
+
* console.error(error.sharesBurnt, error.feeShares);
|
|
366
|
+
* }
|
|
367
|
+
* }
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
export declare class VaultV2ForceWithdrawFeeSharesExceedBurnError extends Error {
|
|
371
|
+
/** Vault V2 address being exited. */
|
|
372
|
+
readonly vault: Address;
|
|
373
|
+
/** Fee-recipient account submitting the exit. */
|
|
374
|
+
readonly userAddress: Address;
|
|
375
|
+
/** Lower bound of shares measured as burned by VaultExitBundlesV1. */
|
|
376
|
+
readonly sharesBurnt: bigint;
|
|
377
|
+
/** Fee shares projected for `userAddress` at the accepted deadline. */
|
|
378
|
+
readonly feeShares: bigint;
|
|
379
|
+
/**
|
|
380
|
+
* @param params - Fee-share and burn-bound values that make the exit unsafe.
|
|
381
|
+
* @param params.vault - Vault V2 address being exited.
|
|
382
|
+
* @param params.userAddress - Fee-recipient account submitting the exit.
|
|
383
|
+
* @param params.sharesBurnt - Lower bound of shares measured as burned by VaultExitBundlesV1.
|
|
384
|
+
* @param params.feeShares - Fee shares projected for `userAddress` at the accepted deadline.
|
|
385
|
+
*/
|
|
386
|
+
constructor(params: {
|
|
387
|
+
readonly vault: Address;
|
|
388
|
+
readonly userAddress: Address;
|
|
389
|
+
readonly sharesBurnt: bigint;
|
|
390
|
+
readonly feeShares: bigint;
|
|
391
|
+
});
|
|
392
|
+
}
|
|
109
393
|
/** Thrown when a Vault V2 in-kind redemption rounds to no deallocated assets. */
|
|
110
394
|
export declare class InKindRedeemZeroDeallocationError extends Error {
|
|
111
395
|
/**
|
|
@@ -240,12 +524,6 @@ export declare class BundlesRequirementSignatureMismatchError extends Error {
|
|
|
240
524
|
}
|
|
241
525
|
/** @deprecated Use {@link BundlesRequirementSignatureMismatchError}. */
|
|
242
526
|
export { BundlesRequirementSignatureMismatchError as BlueBundlesV1RequirementSignatureMismatchError, };
|
|
243
|
-
/** Thrown when Permit2 SignatureTransfer is selected without an explicit unordered nonce. */
|
|
244
|
-
export declare class MissingPermit2SignatureTransferNonceError extends Error {
|
|
245
|
-
constructor();
|
|
246
|
-
}
|
|
247
|
-
/** @deprecated Use {@link MissingPermit2SignatureTransferNonceError}. */
|
|
248
|
-
export { MissingPermit2SignatureTransferNonceError as MissingPermit2TransferFromNonceError, };
|
|
249
527
|
/** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
|
|
250
528
|
export declare class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
|
|
251
529
|
readonly owner: Address;
|
|
@@ -1116,7 +1394,7 @@ export declare class MidnightOfferRootOfferCountMismatchError extends Error {
|
|
|
1116
1394
|
actualOffers: number;
|
|
1117
1395
|
});
|
|
1118
1396
|
}
|
|
1119
|
-
/** Thrown when a Midnight offer-root signature
|
|
1397
|
+
/** Thrown when a Midnight offer-root signature carries no encoded payload. */
|
|
1120
1398
|
export declare class UnpreparedMidnightOfferRootSignatureError extends Error {
|
|
1121
1399
|
constructor();
|
|
1122
1400
|
}
|