@morpho-org/morpho-sdk 5.4.1 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -7
- package/lib/cjs/abis.d.ts +314 -1
- package/lib/cjs/abis.js +169 -1
- package/lib/cjs/actions/blue/borrow.d.ts +21 -15
- package/lib/cjs/actions/blue/borrow.js +25 -18
- package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +1 -1
- package/lib/cjs/actions/blue/buildAssetFundingActions.js +1 -1
- package/lib/cjs/actions/blue/buildReallocationActions.d.ts +62 -19
- package/lib/cjs/actions/blue/buildReallocationActions.js +123 -27
- package/lib/cjs/actions/blue/refinance.d.ts +14 -7
- package/lib/cjs/actions/blue/refinance.js +18 -10
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +28 -19
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +39 -23
- package/lib/cjs/actions/blue/withdraw.d.ts +20 -13
- package/lib/cjs/actions/blue/withdraw.js +23 -18
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +9 -2
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +64 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +131 -0
- 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/getRequirementsApproval.d.ts +3 -2
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -3
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +52 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +91 -0
- package/lib/cjs/actions/signatures/index.d.ts +1 -0
- package/lib/cjs/actions/signatures/index.js +1 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +54 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +96 -0
- package/lib/cjs/actions/vaultV1/index.d.ts +1 -0
- package/lib/cjs/actions/vaultV1/index.js +1 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +56 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +97 -0
- package/lib/cjs/actions/vaultV2/index.d.ts +1 -0
- package/lib/cjs/actions/vaultV2/index.js +1 -0
- package/lib/cjs/bundler/actions.d.ts +118 -2
- package/lib/cjs/bundler/actions.js +212 -6
- package/lib/cjs/bundler/types.d.ts +20 -0
- package/lib/cjs/constants.d.ts +1 -1
- package/lib/cjs/constants.js +3 -1
- package/lib/cjs/entities/blue/blue.d.ts +365 -76
- package/lib/cjs/entities/blue/blue.js +285 -52
- package/lib/cjs/entities/index.d.ts +2 -1
- package/lib/cjs/entities/index.js +6 -3
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +82 -4
- package/lib/cjs/entities/vaultV1/vaultV1.js +164 -0
- package/lib/cjs/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +41 -17
- package/lib/cjs/entities/{reallocationData.js → vaultV1ReallocationData.js} +30 -18
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +89 -3
- package/lib/cjs/entities/vaultV2/vaultV2.js +181 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +511 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +1311 -0
- package/lib/{esm/helpers/computeReallocations.d.ts → cjs/helpers/computeVaultV1Reallocations.d.ts} +14 -8
- package/lib/cjs/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +27 -13
- package/lib/cjs/helpers/constant.d.ts +5 -3
- package/lib/cjs/helpers/constant.js +6 -4
- package/lib/cjs/helpers/index.d.ts +3 -2
- package/lib/cjs/helpers/index.js +8 -3
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +49 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +73 -0
- package/lib/cjs/helpers/validate.d.ts +31 -15
- package/lib/cjs/helpers/validate.js +140 -27
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +2 -1
- package/lib/cjs/types/action.d.ts +33 -1
- package/lib/cjs/types/error.d.ts +363 -5
- package/lib/cjs/types/error.js +455 -6
- package/lib/cjs/types/sharedLiquidity.d.ts +72 -8
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +6 -4
- package/lib/esm/abis.d.ts +314 -1
- package/lib/esm/abis.js +167 -1
- package/lib/esm/actions/blue/borrow.d.ts +21 -15
- package/lib/esm/actions/blue/borrow.js +26 -19
- package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +1 -1
- package/lib/esm/actions/blue/buildAssetFundingActions.js +1 -1
- package/lib/esm/actions/blue/buildReallocationActions.d.ts +62 -19
- package/lib/esm/actions/blue/buildReallocationActions.js +119 -25
- package/lib/esm/actions/blue/refinance.d.ts +14 -7
- package/lib/esm/actions/blue/refinance.js +19 -11
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +28 -19
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +40 -24
- package/lib/esm/actions/blue/withdraw.d.ts +20 -13
- package/lib/esm/actions/blue/withdraw.js +24 -19
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +9 -2
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +64 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +127 -0
- 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/getRequirementsApproval.d.ts +3 -2
- package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -3
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +52 -0
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +87 -0
- package/lib/esm/actions/signatures/index.d.ts +1 -0
- package/lib/esm/actions/signatures/index.js +1 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +54 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.js +92 -0
- package/lib/esm/actions/vaultV1/index.d.ts +1 -0
- package/lib/esm/actions/vaultV1/index.js +1 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +56 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.js +93 -0
- package/lib/esm/actions/vaultV2/index.d.ts +1 -0
- package/lib/esm/actions/vaultV2/index.js +1 -0
- package/lib/esm/bundler/actions.d.ts +118 -2
- package/lib/esm/bundler/actions.js +215 -9
- package/lib/esm/bundler/types.d.ts +20 -0
- package/lib/esm/constants.d.ts +1 -1
- package/lib/esm/constants.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +362 -73
- package/lib/esm/entities/blue/blue.js +288 -55
- package/lib/esm/entities/index.d.ts +2 -1
- package/lib/esm/entities/index.js +2 -1
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +80 -2
- package/lib/esm/entities/vaultV1/vaultV1.js +170 -6
- package/lib/esm/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +41 -17
- package/lib/esm/entities/{reallocationData.js → vaultV1ReallocationData.js} +33 -16
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +88 -2
- package/lib/esm/entities/vaultV2/vaultV2.js +187 -6
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +511 -0
- package/lib/esm/entities/vaultV2BlueReallocationData.js +1307 -0
- package/lib/{cjs/helpers/computeReallocations.d.ts → esm/helpers/computeVaultV1Reallocations.d.ts} +14 -8
- package/lib/esm/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +25 -11
- package/lib/esm/helpers/constant.d.ts +5 -3
- package/lib/esm/helpers/constant.js +5 -3
- package/lib/esm/helpers/index.d.ts +3 -2
- package/lib/esm/helpers/index.js +3 -2
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +49 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +70 -0
- package/lib/esm/helpers/validate.d.ts +31 -15
- package/lib/esm/helpers/validate.js +141 -30
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +2 -1
- package/lib/esm/types/action.d.ts +33 -1
- package/lib/esm/types/error.d.ts +363 -5
- package/lib/esm/types/error.js +428 -4
- package/lib/esm/types/sharedLiquidity.d.ts +72 -8
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/package.json +9 -11
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InputMarketParams } from "@morpho-org/blue-sdk";
|
|
1
2
|
import type { Address, Hex, WalletClient } from "viem";
|
|
2
3
|
import type { Deallocation } from "./deallocation.js";
|
|
3
4
|
export interface BaseAction<TType extends string = string, TArgs extends Record<string, unknown> = Record<string, unknown>> {
|
|
@@ -32,6 +33,16 @@ export interface VaultV2RedeemAction extends BaseAction<"vaultV2Redeem", {
|
|
|
32
33
|
recipient: Address;
|
|
33
34
|
}> {
|
|
34
35
|
}
|
|
36
|
+
/** Metadata for a Vault V2 in-kind redemption into Morpho Blue supply positions. */
|
|
37
|
+
export interface VaultV2InKindRedeemAction extends BaseAction<"vaultV2InKindRedeem", {
|
|
38
|
+
readonly vault: Address;
|
|
39
|
+
readonly adapter: Address;
|
|
40
|
+
readonly amount: bigint;
|
|
41
|
+
readonly marketParamsList: readonly InputMarketParams[];
|
|
42
|
+
readonly onBehalf: Address;
|
|
43
|
+
readonly deadline: bigint;
|
|
44
|
+
}> {
|
|
45
|
+
}
|
|
35
46
|
export interface VaultV2ForceWithdrawAction extends BaseAction<"vaultV2ForceWithdraw", {
|
|
36
47
|
vault: Address;
|
|
37
48
|
deallocations: readonly Deallocation[];
|
|
@@ -72,6 +83,15 @@ export interface VaultV1RedeemAction extends BaseAction<"vaultV1Redeem", {
|
|
|
72
83
|
recipient: Address;
|
|
73
84
|
}> {
|
|
74
85
|
}
|
|
86
|
+
/** Metadata for a Vault V1 in-kind redemption into Morpho Blue supply positions. */
|
|
87
|
+
export interface VaultV1InKindRedeemAction extends BaseAction<"vaultV1InKindRedeem", {
|
|
88
|
+
readonly vault: Address;
|
|
89
|
+
readonly amount: bigint;
|
|
90
|
+
readonly marketParamsList: readonly InputMarketParams[];
|
|
91
|
+
readonly onBehalf: Address;
|
|
92
|
+
readonly deadline: bigint;
|
|
93
|
+
}> {
|
|
94
|
+
}
|
|
75
95
|
export interface VaultV1MigrateToV2Action extends BaseAction<"vaultV1MigrateToV2", {
|
|
76
96
|
sourceVault: Address;
|
|
77
97
|
targetVault: Address;
|
|
@@ -95,7 +115,10 @@ export interface BlueWithdrawAction extends BaseAction<"blueWithdraw", {
|
|
|
95
115
|
shares: bigint;
|
|
96
116
|
receiver: Address;
|
|
97
117
|
minSharePrice: bigint;
|
|
118
|
+
/** Native-token fees paid to PublicAllocator V1. */
|
|
98
119
|
reallocationFee: bigint;
|
|
120
|
+
/** Loan-token assets donated as BluePublicAllocator V2 penalties. */
|
|
121
|
+
readonly reallocationPenaltyAssets: bigint;
|
|
99
122
|
}> {
|
|
100
123
|
}
|
|
101
124
|
export interface BlueSupplyCollateralAction extends BaseAction<"blueSupplyCollateral", {
|
|
@@ -110,7 +133,10 @@ export interface BlueBorrowAction extends BaseAction<"blueBorrow", {
|
|
|
110
133
|
amount: bigint;
|
|
111
134
|
receiver: Address;
|
|
112
135
|
minSharePrice: bigint;
|
|
136
|
+
/** Native-token fees paid to PublicAllocator V1. */
|
|
113
137
|
reallocationFee: bigint;
|
|
138
|
+
/** Loan-token assets donated as BluePublicAllocator V2 penalties. */
|
|
139
|
+
readonly reallocationPenaltyAssets: bigint;
|
|
114
140
|
}> {
|
|
115
141
|
}
|
|
116
142
|
export interface BlueSupplyCollateralBorrowAction extends BaseAction<"blueSupplyCollateralBorrow", {
|
|
@@ -121,7 +147,10 @@ export interface BlueSupplyCollateralBorrowAction extends BaseAction<"blueSupply
|
|
|
121
147
|
onBehalf: Address;
|
|
122
148
|
receiver: Address;
|
|
123
149
|
nativeAmount?: bigint;
|
|
150
|
+
/** Native-token fees paid to PublicAllocator V1. */
|
|
124
151
|
reallocationFee: bigint;
|
|
152
|
+
/** Loan-token assets donated as BluePublicAllocator V2 penalties. */
|
|
153
|
+
readonly reallocationPenaltyAssets: bigint;
|
|
125
154
|
}> {
|
|
126
155
|
}
|
|
127
156
|
export interface BlueRepayAction extends BaseAction<"blueRepay", {
|
|
@@ -165,7 +194,10 @@ export interface BlueRefinanceAction extends BaseAction<"blueRefinance", {
|
|
|
165
194
|
readonly minBorrowSharePrice: bigint;
|
|
166
195
|
readonly maxRepaySharePrice: bigint;
|
|
167
196
|
readonly user: Address;
|
|
197
|
+
/** Native-token fees paid to PublicAllocator V1. */
|
|
168
198
|
readonly reallocationFee: bigint;
|
|
199
|
+
/** Loan-token assets donated as BluePublicAllocator V2 penalties. */
|
|
200
|
+
readonly reallocationPenaltyAssets: bigint;
|
|
169
201
|
}> {
|
|
170
202
|
}
|
|
171
203
|
/**
|
|
@@ -326,7 +358,7 @@ export interface MidnightCancelOfferAction extends BaseAction<"midnightCancelOff
|
|
|
326
358
|
readonly onBehalf: Address;
|
|
327
359
|
}> {
|
|
328
360
|
}
|
|
329
|
-
export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueWithdrawAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueRefinanceAction | BlueAuthorizationAction | MidnightAuthorizationAction | SetterRatifierRatifyRootAction | MidnightTakeLendAction | MidnightTakeBorrowAction | MidnightSupplyCollateralTakeBorrowAction | MidnightSupplyCollateralAction | MempoolSubmitOffersAction | MidnightRedeemAction | MidnightRepayWithdrawCollateralAction | MidnightCancelOfferAction;
|
|
361
|
+
export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2InKindRedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1InKindRedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueWithdrawAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueRefinanceAction | BlueAuthorizationAction | MidnightAuthorizationAction | SetterRatifierRatifyRootAction | MidnightTakeLendAction | MidnightTakeBorrowAction | MidnightSupplyCollateralTakeBorrowAction | MidnightSupplyCollateralAction | MempoolSubmitOffersAction | MidnightRedeemAction | MidnightRepayWithdrawCollateralAction | MidnightCancelOfferAction;
|
|
330
362
|
export interface Transaction<TAction extends BaseAction = TransactionAction> {
|
|
331
363
|
readonly to: Address;
|
|
332
364
|
readonly value: bigint;
|
package/lib/esm/types/error.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MarketId, UnknownDataError } from "@morpho-org/blue-sdk";
|
|
2
|
-
import type { Address } from "viem";
|
|
2
|
+
import type { Address, Hash } from "viem";
|
|
3
3
|
/**
|
|
4
4
|
* Thrown when a morpho-sdk input that must be non-negative is negative.
|
|
5
5
|
*
|
|
@@ -44,6 +44,165 @@ export declare class NonPositiveInputError extends Error {
|
|
|
44
44
|
*/
|
|
45
45
|
constructor(field: string, value: bigint);
|
|
46
46
|
}
|
|
47
|
+
/** Thrown when an integer input exceeds its protocol-defined maximum. */
|
|
48
|
+
export declare class InputExceedsMaxError extends Error {
|
|
49
|
+
/**
|
|
50
|
+
* @param params - Maximum-bound validation details.
|
|
51
|
+
* @param params.field - Public input field whose value is invalid.
|
|
52
|
+
* @param params.value - Supplied value.
|
|
53
|
+
* @param params.max - Largest accepted value.
|
|
54
|
+
*/
|
|
55
|
+
constructor(params: {
|
|
56
|
+
readonly field: string;
|
|
57
|
+
readonly value: bigint;
|
|
58
|
+
readonly max: bigint;
|
|
59
|
+
});
|
|
60
|
+
/** Public input field whose value is invalid. */
|
|
61
|
+
readonly field: string;
|
|
62
|
+
/** Supplied value. */
|
|
63
|
+
readonly value: bigint;
|
|
64
|
+
/** Largest accepted value. */
|
|
65
|
+
readonly max: bigint;
|
|
66
|
+
}
|
|
67
|
+
/** Thrown when an in-kind redemption does not include any Morpho Blue market parameters. */
|
|
68
|
+
export declare class EmptyMarketParamsListError extends Error {
|
|
69
|
+
constructor();
|
|
70
|
+
}
|
|
71
|
+
/** Thrown when an in-kind redemption deadline has already passed. */
|
|
72
|
+
export declare class ExpiredDeadlineError extends Error {
|
|
73
|
+
readonly deadline: bigint;
|
|
74
|
+
readonly timestamp: bigint;
|
|
75
|
+
/**
|
|
76
|
+
* @param deadline - Expired deadline supplied by the caller.
|
|
77
|
+
* @param timestamp - Current timestamp used for validation.
|
|
78
|
+
*/
|
|
79
|
+
constructor(deadline: bigint, timestamp: bigint);
|
|
80
|
+
}
|
|
81
|
+
/** Thrown when Vault V2 in-kind redemption is attempted with anything other than one adapter. */
|
|
82
|
+
export declare class InKindRedeemRequiresSingleAdapterError extends Error {
|
|
83
|
+
readonly vault: Address;
|
|
84
|
+
readonly adapters: number;
|
|
85
|
+
/**
|
|
86
|
+
* @param vault - Vault V2 address.
|
|
87
|
+
* @param adapters - Number of adapters in the supplied vault snapshot.
|
|
88
|
+
*/
|
|
89
|
+
constructor(vault: Address, adapters: number);
|
|
90
|
+
}
|
|
91
|
+
/** Thrown when a requested in-kind redemption adapter is not part of the Vault V2 snapshot. */
|
|
92
|
+
export declare class AdapterNotPartOfVaultError extends Error {
|
|
93
|
+
readonly vault: Address;
|
|
94
|
+
readonly adapter: Address;
|
|
95
|
+
/**
|
|
96
|
+
* @param vault - Vault V2 address.
|
|
97
|
+
* @param adapter - Adapter rejected by the vault snapshot.
|
|
98
|
+
*/
|
|
99
|
+
constructor(vault: Address, adapter: Address);
|
|
100
|
+
}
|
|
101
|
+
/** Thrown when the Vault V2 adapter cannot expose MorphoMarketV1AdapterV2 market shares. */
|
|
102
|
+
export declare class UnsupportedInKindAdapterError extends Error {
|
|
103
|
+
readonly adapter: Address;
|
|
104
|
+
/**
|
|
105
|
+
* @param adapter - Unsupported Vault V2 adapter address.
|
|
106
|
+
*/
|
|
107
|
+
constructor(adapter: Address);
|
|
108
|
+
}
|
|
109
|
+
/** Thrown when a Vault V2 in-kind redemption rounds to no deallocated assets. */
|
|
110
|
+
export declare class InKindRedeemZeroDeallocationError extends Error {
|
|
111
|
+
/**
|
|
112
|
+
* @param params - Values that caused the exit to round to zero deallocated assets.
|
|
113
|
+
* @param params.vault - Vault V2 address with no idle assets available for the exit.
|
|
114
|
+
* @param params.amount - Positive penalty-inclusive amount requested by the caller.
|
|
115
|
+
* @param params.penalty - WAD-scaled force-deallocation penalty applied by the adapter.
|
|
116
|
+
*/
|
|
117
|
+
readonly vault: Address;
|
|
118
|
+
readonly amount: bigint;
|
|
119
|
+
readonly penalty: bigint;
|
|
120
|
+
constructor(params: {
|
|
121
|
+
readonly vault: Address;
|
|
122
|
+
readonly amount: bigint;
|
|
123
|
+
readonly penalty: bigint;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** Thrown when the ordered market list cannot cover the requested in-kind redemption. */
|
|
127
|
+
export declare class InKindRedeemCoverageError extends Error {
|
|
128
|
+
/**
|
|
129
|
+
* @param params - Coverage values used to explain the rejected exit.
|
|
130
|
+
* @param params.required - Assets that must be deallocated from listed markets.
|
|
131
|
+
* @param params.covered - Assets covered by the supplied market list.
|
|
132
|
+
* @param params.maxExitAssets - Largest penalty-inclusive exit supported by the list.
|
|
133
|
+
*/
|
|
134
|
+
readonly required: bigint;
|
|
135
|
+
readonly covered: bigint;
|
|
136
|
+
readonly maxExitAssets: bigint;
|
|
137
|
+
constructor(params: {
|
|
138
|
+
readonly required: bigint;
|
|
139
|
+
readonly covered: bigint;
|
|
140
|
+
readonly maxExitAssets: bigint;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/** Thrown when Morpho Blue lacks the physical loan-token balance needed during an exit callback. */
|
|
144
|
+
export declare class InsufficientBlueBalanceForInKindRedeemError extends Error {
|
|
145
|
+
/**
|
|
146
|
+
* @param params - Morpho Blue balance values used to explain the rejected exit.
|
|
147
|
+
* @param params.asset - Loan token required by the exit.
|
|
148
|
+
* @param params.available - Current token balance held by Morpho Blue.
|
|
149
|
+
* @param params.required - Peak token balance required by the exit.
|
|
150
|
+
*/
|
|
151
|
+
readonly asset: Address;
|
|
152
|
+
readonly available: bigint;
|
|
153
|
+
readonly required: bigint;
|
|
154
|
+
constructor(params: {
|
|
155
|
+
readonly asset: Address;
|
|
156
|
+
readonly available: bigint;
|
|
157
|
+
readonly required: bigint;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/** Thrown when a MetaMorpho vault is connected to a different Morpho deployment. */
|
|
161
|
+
export declare class VaultMorphoMismatchError extends Error {
|
|
162
|
+
/**
|
|
163
|
+
* @param params - Vault and Morpho addresses used to explain the mismatch.
|
|
164
|
+
* @param params.vault - MetaMorpho vault address.
|
|
165
|
+
* @param params.expected - Morpho Blue address expected for the target chain.
|
|
166
|
+
* @param params.actual - Morpho address returned by the vault.
|
|
167
|
+
*/
|
|
168
|
+
readonly vault: Address;
|
|
169
|
+
readonly expected: Address;
|
|
170
|
+
readonly actual: Address;
|
|
171
|
+
constructor(params: {
|
|
172
|
+
readonly vault: Address;
|
|
173
|
+
readonly expected: Address;
|
|
174
|
+
readonly actual: Address;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/** Thrown when a Vault V1 is Morpho Blue's fee recipient and cannot safely redeem in kind. */
|
|
178
|
+
export declare class VaultIsBlueFeeRecipientError extends Error {
|
|
179
|
+
readonly vault: Address;
|
|
180
|
+
readonly blue: Address;
|
|
181
|
+
/**
|
|
182
|
+
* @param vault - Unsupported Vault V1 address.
|
|
183
|
+
* @param blue - Morpho Blue deployment whose fees accrue to the vault.
|
|
184
|
+
*/
|
|
185
|
+
constructor(vault: Address, blue: Address);
|
|
186
|
+
}
|
|
187
|
+
/** Thrown when a vault-shares requirement cannot be safely encoded as an ERC-2612 permit. */
|
|
188
|
+
export declare class VaultExitBundlesV1PermitMismatchError extends Error {
|
|
189
|
+
/**
|
|
190
|
+
* @param params - Permit mismatch values used to explain the rejection.
|
|
191
|
+
* @param params.field - Permit field that does not match the exit.
|
|
192
|
+
* @param params.expected - Value required by the exit.
|
|
193
|
+
* @param params.actual - Value supplied by the signature.
|
|
194
|
+
* @param params.cause - Original parser failure when signature decoding is wrapped.
|
|
195
|
+
*/
|
|
196
|
+
readonly field: "type" | "asset" | "signature";
|
|
197
|
+
readonly expected: string;
|
|
198
|
+
readonly actual: string;
|
|
199
|
+
constructor(params: {
|
|
200
|
+
readonly field: "type" | "asset" | "signature";
|
|
201
|
+
readonly expected: string;
|
|
202
|
+
readonly actual: string;
|
|
203
|
+
readonly cause?: unknown;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
47
206
|
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
48
207
|
export declare const NonPositiveAssetAmountError: typeof NonPositiveInputError;
|
|
49
208
|
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
@@ -194,6 +353,26 @@ export declare namespace BundlerErrors {
|
|
|
194
353
|
*/
|
|
195
354
|
constructor(authorized: Address);
|
|
196
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Thrown when a skippable Blue Public Allocator call would leave a usable
|
|
358
|
+
* token allowance behind after the allocator call reverts.
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```ts
|
|
362
|
+
* import { BundlerErrors } from "@morpho-org/morpho-sdk";
|
|
363
|
+
*
|
|
364
|
+
* if (error instanceof BundlerErrors.SkippableAllocatorPenalty) {
|
|
365
|
+
* // Rebuild the allocator call with skipRevert set to false.
|
|
366
|
+
* }
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
class SkippableAllocatorPenalty extends Error {
|
|
370
|
+
readonly penaltyAssets: bigint;
|
|
371
|
+
/**
|
|
372
|
+
* @param penaltyAssets - Exact token amount approved to the allocator.
|
|
373
|
+
*/
|
|
374
|
+
constructor(penaltyAssets: bigint);
|
|
375
|
+
}
|
|
197
376
|
}
|
|
198
377
|
/** Requirement signature kind accepted by action-output transaction builders. */
|
|
199
378
|
export type RequirementSignatureKind = "permit" | "authorization" | "midnightOfferRootSignature";
|
|
@@ -349,10 +528,115 @@ export declare class AccrualPositionUserMismatchError extends Error {
|
|
|
349
528
|
export declare class EmptyReallocationWithdrawalsError extends Error {
|
|
350
529
|
constructor(vault: string);
|
|
351
530
|
}
|
|
352
|
-
/** Thrown when a
|
|
531
|
+
/** Thrown when a Public Allocator source references the target Blue market. */
|
|
353
532
|
export declare class ReallocationWithdrawalOnTargetMarketError extends Error {
|
|
354
533
|
constructor(vault: string, marketId: string);
|
|
355
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Thrown when a Public Allocator reallocation does not match exactly one V1 or
|
|
537
|
+
* V2 input shape.
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* ```ts
|
|
541
|
+
* import { InvalidReallocationShapeError } from "@morpho-org/morpho-sdk";
|
|
542
|
+
*
|
|
543
|
+
* const error = new InvalidReallocationShapeError();
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
546
|
+
export declare class InvalidReallocationShapeError extends Error {
|
|
547
|
+
constructor();
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Thrown when one reallocation plan contains both Vault V1 and Vault V2 entries.
|
|
551
|
+
*
|
|
552
|
+
* @example
|
|
553
|
+
* ```ts
|
|
554
|
+
* import { MixedReallocationVersionsError } from "@morpho-org/morpho-sdk";
|
|
555
|
+
*
|
|
556
|
+
* const error = new MixedReallocationVersionsError();
|
|
557
|
+
* ```
|
|
558
|
+
*/
|
|
559
|
+
export declare class MixedReallocationVersionsError extends Error {
|
|
560
|
+
constructor();
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Thrown when a Blue Public Allocator reallocation contains a malformed vault
|
|
564
|
+
* or adapter address.
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```ts
|
|
568
|
+
* import { InvalidReallocationAddressError } from "@morpho-org/morpho-sdk";
|
|
569
|
+
*
|
|
570
|
+
* const error = new InvalidReallocationAddressError("to.adapter");
|
|
571
|
+
* if (error instanceof InvalidReallocationAddressError) {
|
|
572
|
+
* console.error(error.field);
|
|
573
|
+
* }
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
576
|
+
export declare class InvalidReallocationAddressError extends Error {
|
|
577
|
+
readonly field: "vault" | "from.adapter" | "to.adapter";
|
|
578
|
+
/**
|
|
579
|
+
* @param field - Reallocation address field that is absent or malformed.
|
|
580
|
+
*/
|
|
581
|
+
constructor(field: "vault" | "from.adapter" | "to.adapter");
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Thrown when a Blue Public Allocator source is absent, incomplete, or has an
|
|
585
|
+
* unknown discriminator.
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```ts
|
|
589
|
+
* import { InvalidReallocationSourceTypeError } from "@morpho-org/morpho-sdk";
|
|
590
|
+
*
|
|
591
|
+
* const error = new InvalidReallocationSourceTypeError("marketTypo");
|
|
592
|
+
* ```
|
|
593
|
+
*/
|
|
594
|
+
export declare class InvalidReallocationSourceTypeError extends Error {
|
|
595
|
+
readonly sourceType: string | undefined;
|
|
596
|
+
readonly missingField?: "adapter" | "marketParams" | undefined;
|
|
597
|
+
/**
|
|
598
|
+
* @param sourceType - Invalid runtime value received for `reallocation.from.type`,
|
|
599
|
+
* or `undefined` when the source or discriminator is absent.
|
|
600
|
+
* @param missingField - Required market-source field that is absent or malformed.
|
|
601
|
+
*/
|
|
602
|
+
constructor(sourceType: string | undefined, missingField?: "adapter" | "marketParams" | undefined);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Thrown when one bundle assigns different penalty rates to the same Vault V2.
|
|
606
|
+
*
|
|
607
|
+
* @example
|
|
608
|
+
* ```ts
|
|
609
|
+
* import { InconsistentReallocationPenaltyError } from "@morpho-org/morpho-sdk";
|
|
610
|
+
* import type { Address } from "viem";
|
|
611
|
+
*
|
|
612
|
+
* const vaultFixture =
|
|
613
|
+
* "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" satisfies Address;
|
|
614
|
+
* const error = new InconsistentReallocationPenaltyError({
|
|
615
|
+
* vault: vaultFixture,
|
|
616
|
+
* expected: 5n,
|
|
617
|
+
* actual: 11n,
|
|
618
|
+
* });
|
|
619
|
+
* ```
|
|
620
|
+
*/
|
|
621
|
+
export declare class InconsistentReallocationPenaltyError extends Error {
|
|
622
|
+
/** Vault whose configured penalty must be reused. */
|
|
623
|
+
readonly vault: Address;
|
|
624
|
+
/** Penalty rate established by the first matching bundle entry. */
|
|
625
|
+
readonly expected: bigint;
|
|
626
|
+
/** Conflicting penalty rate supplied by a later bundle entry. */
|
|
627
|
+
readonly actual: bigint;
|
|
628
|
+
/**
|
|
629
|
+
* @param params - Conflicting vault penalty details.
|
|
630
|
+
* @param params.vault - Vault whose configured penalty applies.
|
|
631
|
+
* @param params.expected - Penalty rate established by the first matching entry.
|
|
632
|
+
* @param params.actual - Conflicting penalty rate supplied by a later entry.
|
|
633
|
+
*/
|
|
634
|
+
constructor(params: {
|
|
635
|
+
readonly vault: Address;
|
|
636
|
+
readonly expected: bigint;
|
|
637
|
+
readonly actual: bigint;
|
|
638
|
+
});
|
|
639
|
+
}
|
|
356
640
|
/** Thrown when reallocation withdrawals within a vault are not strictly sorted by market id. */
|
|
357
641
|
export declare class UnsortedReallocationWithdrawalsError extends Error {
|
|
358
642
|
constructor(vault: string, marketId: string);
|
|
@@ -424,8 +708,8 @@ export declare class DisabledReallocationMarketError extends Error {
|
|
|
424
708
|
constructor(vault: Address, marketId: MarketId);
|
|
425
709
|
}
|
|
426
710
|
/**
|
|
427
|
-
* Thrown when shared liquidity selected by
|
|
428
|
-
* the operation's absolute shortfall on the target market — the resulting
|
|
711
|
+
* Thrown when shared liquidity selected by a Vault V1 or Vault V2 reallocation planner cannot
|
|
712
|
+
* cover the operation's absolute shortfall on the target market — the resulting
|
|
429
713
|
* `morphoBorrow` or `morphoWithdraw` would still revert onchain.
|
|
430
714
|
*
|
|
431
715
|
* Pattern-match on the class and inspect `params` to surface the gap to users.
|
|
@@ -478,6 +762,80 @@ export declare class UnknownReallocationPositionError extends UnknownDataError {
|
|
|
478
762
|
*/
|
|
479
763
|
constructor(user: Address, marketId: MarketId);
|
|
480
764
|
}
|
|
765
|
+
/** Thrown when Vault V2 reallocation state does not contain a requested allocation id. */
|
|
766
|
+
export declare class UnknownReallocationAllocationError extends UnknownDataError {
|
|
767
|
+
readonly vault: Address;
|
|
768
|
+
readonly id: Hash;
|
|
769
|
+
/**
|
|
770
|
+
* @param vault - Vault V2 address for the missing allocation.
|
|
771
|
+
* @param id - Missing Vault V2 allocation id.
|
|
772
|
+
*/
|
|
773
|
+
constructor(vault: Address, id: Hash);
|
|
774
|
+
}
|
|
775
|
+
/** Thrown when Vault V2 reallocation state lacks the vault-wide allocator configuration. */
|
|
776
|
+
export declare class UnknownReallocationPublicAllocatorConfigError extends UnknownDataError {
|
|
777
|
+
readonly vault: Address;
|
|
778
|
+
/** @param vault - Vault V2 address with missing allocator configuration. */
|
|
779
|
+
constructor(vault: Address);
|
|
780
|
+
}
|
|
781
|
+
/** Thrown when Vault V2 reallocation state lacks the fetched active-adapter set. */
|
|
782
|
+
export declare class UnknownReallocationActiveAdaptersError extends UnknownDataError {
|
|
783
|
+
readonly vault: Address;
|
|
784
|
+
/** @param vault - Vault V2 address with missing active-adapter state. */
|
|
785
|
+
constructor(vault: Address);
|
|
786
|
+
}
|
|
787
|
+
/** Thrown when Vault V2 reallocation state lacks an adapter-market allocator configuration. */
|
|
788
|
+
export declare class UnknownReallocationMarketPublicAllocatorConfigError extends UnknownDataError {
|
|
789
|
+
readonly vault: Address;
|
|
790
|
+
readonly adapterMarketCapId: Hash;
|
|
791
|
+
/**
|
|
792
|
+
* @param vault - Vault V2 address for the missing configuration.
|
|
793
|
+
* @param adapterMarketCapId - Missing adapter-scoped market cap id.
|
|
794
|
+
*/
|
|
795
|
+
constructor(vault: Address, adapterMarketCapId: Hash);
|
|
796
|
+
}
|
|
797
|
+
/** Thrown when Vault V2 reallocation state does not contain a requested adapter. */
|
|
798
|
+
export declare class UnknownReallocationAdapterError extends UnknownDataError {
|
|
799
|
+
readonly vault: Address;
|
|
800
|
+
readonly adapter: Address;
|
|
801
|
+
/**
|
|
802
|
+
* @param vault - Vault V2 address expected to own the adapter.
|
|
803
|
+
* @param adapter - Missing adapter address.
|
|
804
|
+
*/
|
|
805
|
+
constructor(vault: Address, adapter: Address);
|
|
806
|
+
}
|
|
807
|
+
/** Thrown when a simulated Vault V2 allocation transition would underflow. */
|
|
808
|
+
export declare class ReallocationAllocationUnderflowError extends Error {
|
|
809
|
+
readonly params: {
|
|
810
|
+
readonly vault: Address;
|
|
811
|
+
readonly id: Hash;
|
|
812
|
+
readonly allocation: bigint;
|
|
813
|
+
readonly change: bigint;
|
|
814
|
+
};
|
|
815
|
+
constructor(params: {
|
|
816
|
+
readonly vault: Address;
|
|
817
|
+
readonly id: Hash;
|
|
818
|
+
readonly allocation: bigint;
|
|
819
|
+
readonly change: bigint;
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
/** Thrown when a simulated Vault V2 market withdrawal exceeds the adapter's supply shares. */
|
|
823
|
+
export declare class ReallocationAdapterSupplySharesUnderflowError extends Error {
|
|
824
|
+
readonly params: {
|
|
825
|
+
readonly vault: Address;
|
|
826
|
+
readonly adapter: Address;
|
|
827
|
+
readonly marketId: MarketId;
|
|
828
|
+
readonly supplyShares: bigint;
|
|
829
|
+
readonly withdrawnShares: bigint;
|
|
830
|
+
};
|
|
831
|
+
constructor(params: {
|
|
832
|
+
readonly vault: Address;
|
|
833
|
+
readonly adapter: Address;
|
|
834
|
+
readonly marketId: MarketId;
|
|
835
|
+
readonly supplyShares: bigint;
|
|
836
|
+
readonly withdrawnShares: bigint;
|
|
837
|
+
});
|
|
838
|
+
}
|
|
481
839
|
/** Thrown when a Midnight amount exceeds the maximum offer-cap value accepted onchain. */
|
|
482
840
|
export declare class MidnightAmountExceedsMaxOfferCapError extends Error {
|
|
483
841
|
constructor(params: {
|
|
@@ -630,7 +988,7 @@ export declare class WithdrawSharesExceedSupplyError extends Error {
|
|
|
630
988
|
});
|
|
631
989
|
}
|
|
632
990
|
/**
|
|
633
|
-
* Thrown when
|
|
991
|
+
* Thrown when a Vault V1 or Vault V2 reallocation planner receives a withdraw `amount` greater
|
|
634
992
|
* than the target market's current `totalSupplyAssets` — the post-withdraw
|
|
635
993
|
* supply would be negative, making the on-chain `morphoWithdraw` revert
|
|
636
994
|
* regardless of any reallocation. Caught here so callers do not pay
|