@morpho-org/morpho-sdk 5.5.0 → 5.7.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 +11 -7
- package/lib/cjs/abis.d.ts +15 -3
- package/lib/cjs/abis.js +15 -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/midnight/mempoolSubmitOffers.d.ts +2 -2
- package/lib/cjs/actions/midnight/mempoolSubmitOffers.js +2 -2
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +1 -1
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +1 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -1
- package/lib/cjs/blue/abis.d.ts +2 -0
- package/lib/cjs/blue/abis.js +33 -0
- package/lib/cjs/blue/addresses.d.ts +2 -0
- package/lib/cjs/blue/addresses.js +19 -0
- package/lib/cjs/blue/constants.d.ts +1 -0
- package/lib/cjs/blue/constants.js +13 -0
- package/lib/cjs/blue/entities.d.ts +2 -0
- package/lib/cjs/blue/entities.js +37 -0
- package/lib/cjs/blue/errors.d.ts +2 -0
- package/lib/cjs/blue/errors.js +29 -0
- package/lib/cjs/blue/fetch.d.ts +1 -0
- package/lib/cjs/blue/fetch.js +33 -0
- package/lib/cjs/blue/types.d.ts +2 -0
- package/lib/cjs/blue/types.js +2 -0
- package/lib/cjs/blue/utils.d.ts +3 -0
- package/lib/cjs/blue/utils.js +29 -0
- package/lib/cjs/bundler/actions.d.ts +122 -3
- package/lib/cjs/bundler/actions.js +216 -7
- package/lib/cjs/bundler/types.d.ts +20 -0
- package/lib/cjs/constants.d.ts +37 -3
- package/lib/cjs/constants.js +41 -1
- package/lib/cjs/entities/blue/blue.d.ts +362 -71
- package/lib/cjs/entities/blue/blue.js +286 -52
- package/lib/cjs/entities/index.d.ts +64 -4
- package/lib/cjs/entities/index.js +37 -22
- package/lib/cjs/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +40 -15
- package/lib/cjs/entities/{reallocationData.js → vaultV1ReallocationData.js} +29 -16
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +1 -1
- package/lib/cjs/entities/vaultV2/vaultV2.js +1 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +511 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +1300 -0
- package/lib/cjs/errors.d.ts +48 -3
- package/lib/cjs/errors.js +62 -1
- package/lib/cjs/fetch.d.ts +16 -1
- package/lib/cjs/fetch.js +24 -1
- 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 +2 -2
- package/lib/cjs/helpers/index.js +6 -3
- package/lib/cjs/helpers/validate.d.ts +32 -16
- package/lib/cjs/helpers/validate.js +142 -29
- package/lib/cjs/midnight/abis.d.ts +1 -0
- package/lib/cjs/midnight/abis.js +8 -0
- package/lib/cjs/midnight/constants.d.ts +1 -0
- package/lib/cjs/midnight/constants.js +19 -0
- package/lib/cjs/midnight/entities.d.ts +2 -0
- package/lib/cjs/midnight/entities.js +11 -0
- package/lib/cjs/midnight/errors.d.ts +1 -0
- package/lib/cjs/midnight/errors.js +24 -0
- package/lib/cjs/midnight/fetch.d.ts +1 -0
- package/lib/cjs/midnight/fetch.js +9 -0
- package/lib/cjs/midnight/types.d.ts +1 -0
- package/lib/cjs/midnight/types.js +2 -0
- package/lib/cjs/midnight/utils.d.ts +1 -0
- package/lib/cjs/midnight/utils.js +17 -0
- package/lib/cjs/types/action.d.ts +12 -0
- package/lib/cjs/types/error.d.ts +224 -5
- package/lib/cjs/types/error.js +269 -7
- package/lib/cjs/types/sharedLiquidity.d.ts +72 -8
- package/lib/cjs/types.d.ts +17 -2
- package/lib/cjs/utils.d.ts +31 -4
- package/lib/cjs/utils.js +44 -4
- package/lib/esm/abis.d.ts +15 -3
- package/lib/esm/abis.js +15 -3
- 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/midnight/mempoolSubmitOffers.d.ts +2 -2
- package/lib/esm/actions/midnight/mempoolSubmitOffers.js +2 -2
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +1 -1
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +1 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.js +2 -1
- package/lib/esm/blue/abis.d.ts +2 -0
- package/lib/esm/blue/abis.js +2 -0
- package/lib/esm/blue/addresses.d.ts +2 -0
- package/lib/esm/blue/addresses.js +1 -0
- package/lib/esm/blue/constants.d.ts +1 -0
- package/lib/esm/blue/constants.js +1 -0
- package/lib/esm/blue/entities.d.ts +2 -0
- package/lib/esm/blue/entities.js +1 -0
- package/lib/esm/blue/errors.d.ts +2 -0
- package/lib/esm/blue/errors.js +2 -0
- package/lib/esm/blue/fetch.d.ts +1 -0
- package/lib/esm/blue/fetch.js +1 -0
- package/lib/esm/blue/types.d.ts +2 -0
- package/lib/esm/blue/types.js +1 -0
- package/lib/esm/blue/utils.d.ts +3 -0
- package/lib/esm/blue/utils.js +2 -0
- package/lib/esm/bundler/actions.d.ts +122 -3
- package/lib/esm/bundler/actions.js +219 -10
- package/lib/esm/bundler/types.d.ts +20 -0
- package/lib/esm/constants.d.ts +37 -3
- package/lib/esm/constants.js +37 -3
- package/lib/esm/entities/blue/blue.d.ts +362 -71
- package/lib/esm/entities/blue/blue.js +289 -55
- package/lib/esm/entities/index.d.ts +64 -4
- package/lib/esm/entities/index.js +19 -3
- package/lib/esm/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +40 -15
- package/lib/esm/entities/{reallocationData.js → vaultV1ReallocationData.js} +32 -14
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +1 -1
- package/lib/esm/entities/vaultV2/vaultV2.js +1 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +511 -0
- package/lib/esm/entities/vaultV2BlueReallocationData.js +1296 -0
- package/lib/esm/errors.d.ts +48 -3
- package/lib/esm/errors.js +48 -3
- package/lib/esm/fetch.d.ts +16 -1
- package/lib/esm/fetch.js +16 -1
- 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 +2 -2
- package/lib/esm/helpers/index.js +2 -2
- package/lib/esm/helpers/validate.d.ts +32 -16
- package/lib/esm/helpers/validate.js +143 -32
- package/lib/esm/midnight/abis.d.ts +1 -0
- package/lib/esm/midnight/abis.js +1 -0
- package/lib/esm/midnight/constants.d.ts +1 -0
- package/lib/esm/midnight/constants.js +1 -0
- package/lib/esm/midnight/entities.d.ts +2 -0
- package/lib/esm/midnight/entities.js +1 -0
- package/lib/esm/midnight/errors.d.ts +1 -0
- package/lib/esm/midnight/errors.js +1 -0
- package/lib/esm/midnight/fetch.d.ts +1 -0
- package/lib/esm/midnight/fetch.js +1 -0
- package/lib/esm/midnight/types.d.ts +1 -0
- package/lib/esm/midnight/types.js +1 -0
- package/lib/esm/midnight/utils.d.ts +1 -0
- package/lib/esm/midnight/utils.js +1 -0
- package/lib/esm/types/action.d.ts +12 -0
- package/lib/esm/types/error.d.ts +224 -5
- package/lib/esm/types/error.js +253 -4
- package/lib/esm/types/sharedLiquidity.d.ts +72 -8
- package/lib/esm/types.d.ts +17 -2
- package/lib/esm/utils.d.ts +31 -4
- package/lib/esm/utils.js +31 -4
- package/package.json +23 -7
|
@@ -7,8 +7,10 @@ const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
|
7
7
|
const viem_1 = require("viem");
|
|
8
8
|
const index_js_1 = require("../../actions/index.js");
|
|
9
9
|
const index_js_2 = require("../../helpers/index.js");
|
|
10
|
+
const validate_js_1 = require("../../helpers/validate.js");
|
|
10
11
|
const index_js_3 = require("../../types/index.js");
|
|
11
|
-
const
|
|
12
|
+
const vaultV1ReallocationData_js_1 = require("../vaultV1ReallocationData.js");
|
|
13
|
+
const vaultV2BlueReallocationData_js_1 = require("../vaultV2BlueReallocationData.js");
|
|
12
14
|
class MorphoBlue {
|
|
13
15
|
client;
|
|
14
16
|
marketParams;
|
|
@@ -19,6 +21,22 @@ class MorphoBlue {
|
|
|
19
21
|
this.marketParams = marketParams;
|
|
20
22
|
this.chainId = chainId;
|
|
21
23
|
}
|
|
24
|
+
getReallocationPenaltyRequirements(userAddress, reallocationPlan) {
|
|
25
|
+
if (reallocationPlan.type === "vaultV1")
|
|
26
|
+
return [];
|
|
27
|
+
const { reallocations } = reallocationPlan;
|
|
28
|
+
const amount = reallocations.reduce((total, reallocation) => total +
|
|
29
|
+
blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils.getPenaltyAssets(reallocation, reallocation.assets), 0n);
|
|
30
|
+
// Separate-token penalty funding uses a classic GeneralAdapter1 allowance so a collateral
|
|
31
|
+
// permit and a loan-token penalty can coexist in one bundle. The shared-token path aggregates
|
|
32
|
+
// both amounts into the collateral requirement instead.
|
|
33
|
+
return (0, index_js_1.getGeneralAdapterRequirements)(this.client.viemClient, {
|
|
34
|
+
address: this.marketParams.loanToken,
|
|
35
|
+
chainId: this.chainId,
|
|
36
|
+
supportSignature: false,
|
|
37
|
+
args: { amount, from: userAddress },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
22
40
|
async getMarketData(parameters) {
|
|
23
41
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
24
42
|
return (0, blue_sdk_viem_1.fetchMarket)(this.marketParams.id, this.client.viemClient, {
|
|
@@ -92,6 +110,12 @@ class MorphoBlue {
|
|
|
92
110
|
withdraw(params) {
|
|
93
111
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
94
112
|
const { userAddress, receiver = userAddress, positionData, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, reallocations, } = params;
|
|
113
|
+
const reallocationPlan = (0, validate_js_1.validateAndNormalizeReallocations)({
|
|
114
|
+
reallocations,
|
|
115
|
+
targetMarketId: this.marketParams.id,
|
|
116
|
+
chainId: this.chainId,
|
|
117
|
+
});
|
|
118
|
+
const reallocationList = reallocationPlan.reallocations;
|
|
95
119
|
// Mode normalization: a missing or undefined `assets`/`shares` key collapses to `0n`
|
|
96
120
|
// so the mutual-exclusion and positivity checks below are pure value comparisons.
|
|
97
121
|
const assets = ("assets" in params ? params.assets : undefined) ?? 0n;
|
|
@@ -113,9 +137,6 @@ class MorphoBlue {
|
|
|
113
137
|
throw new index_js_3.NonPositiveInputError("assets or shares", 0n);
|
|
114
138
|
}
|
|
115
139
|
(0, index_js_2.validateSlippageTolerance)(slippageTolerance);
|
|
116
|
-
if (reallocations) {
|
|
117
|
-
(0, index_js_2.validateReallocations)(reallocations, this.marketParams.id);
|
|
118
|
-
}
|
|
119
140
|
if (!positionData) {
|
|
120
141
|
throw new index_js_3.MissingAccrualPositionError(this.marketParams.id);
|
|
121
142
|
}
|
|
@@ -146,13 +167,16 @@ class MorphoBlue {
|
|
|
146
167
|
});
|
|
147
168
|
return {
|
|
148
169
|
getRequirements: async () => {
|
|
149
|
-
const authTx = await
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
const [penaltyRequirements, authTx] = await Promise.all([
|
|
171
|
+
this.getReallocationPenaltyRequirements(userAddress, reallocationPlan),
|
|
172
|
+
(0, index_js_1.getBlueAuthorizationRequirement)({
|
|
173
|
+
viemClient: this.client.viemClient,
|
|
174
|
+
chainId: this.chainId,
|
|
175
|
+
userAddress,
|
|
176
|
+
supportSignature: this.client.options.supportSignature,
|
|
177
|
+
}),
|
|
178
|
+
]);
|
|
179
|
+
return [...penaltyRequirements, ...(authTx ? [authTx] : [])];
|
|
156
180
|
},
|
|
157
181
|
buildTx: (signatures) => {
|
|
158
182
|
const { authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
@@ -165,7 +189,7 @@ class MorphoBlue {
|
|
|
165
189
|
shares,
|
|
166
190
|
receiver,
|
|
167
191
|
minSharePrice,
|
|
168
|
-
reallocations,
|
|
192
|
+
reallocations: reallocationList,
|
|
169
193
|
authorizationSignature: authorization,
|
|
170
194
|
},
|
|
171
195
|
metadata: this.client.options.metadata,
|
|
@@ -219,13 +243,16 @@ class MorphoBlue {
|
|
|
219
243
|
}
|
|
220
244
|
borrow({ amount, userAddress, positionData, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, reallocations, }) {
|
|
221
245
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
246
|
+
const reallocationPlan = (0, validate_js_1.validateAndNormalizeReallocations)({
|
|
247
|
+
reallocations,
|
|
248
|
+
targetMarketId: this.marketParams.id,
|
|
249
|
+
chainId: this.chainId,
|
|
250
|
+
});
|
|
251
|
+
const reallocationList = reallocationPlan.reallocations;
|
|
222
252
|
if (amount <= 0n) {
|
|
223
253
|
throw new index_js_3.NonPositiveInputError("amount", amount);
|
|
224
254
|
}
|
|
225
255
|
(0, index_js_2.validateSlippageTolerance)(slippageTolerance);
|
|
226
|
-
if (reallocations) {
|
|
227
|
-
(0, index_js_2.validateReallocations)(reallocations, this.marketParams.id);
|
|
228
|
-
}
|
|
229
256
|
if (!positionData) {
|
|
230
257
|
throw new index_js_3.MissingAccrualPositionError(this.marketParams.id);
|
|
231
258
|
}
|
|
@@ -248,13 +275,16 @@ class MorphoBlue {
|
|
|
248
275
|
});
|
|
249
276
|
return {
|
|
250
277
|
getRequirements: async () => {
|
|
251
|
-
const authTx = await
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
278
|
+
const [penaltyRequirements, authTx] = await Promise.all([
|
|
279
|
+
this.getReallocationPenaltyRequirements(userAddress, reallocationPlan),
|
|
280
|
+
(0, index_js_1.getBlueAuthorizationRequirement)({
|
|
281
|
+
viemClient: this.client.viemClient,
|
|
282
|
+
chainId: this.chainId,
|
|
283
|
+
userAddress,
|
|
284
|
+
supportSignature: this.client.options.supportSignature,
|
|
285
|
+
}),
|
|
286
|
+
]);
|
|
287
|
+
return [...penaltyRequirements, ...(authTx ? [authTx] : [])];
|
|
258
288
|
},
|
|
259
289
|
buildTx: (signatures) => {
|
|
260
290
|
const { authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
@@ -269,7 +299,7 @@ class MorphoBlue {
|
|
|
269
299
|
amount,
|
|
270
300
|
receiver: userAddress,
|
|
271
301
|
minSharePrice,
|
|
272
|
-
reallocations,
|
|
302
|
+
reallocations: reallocationList,
|
|
273
303
|
authorizationSignature: authorization,
|
|
274
304
|
},
|
|
275
305
|
metadata: this.client.options.metadata,
|
|
@@ -606,6 +636,12 @@ class MorphoBlue {
|
|
|
606
636
|
}
|
|
607
637
|
supplyCollateralBorrow({ amount = 0n, userAddress, positionData, borrowAmount, nativeAmount, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, reallocations, }) {
|
|
608
638
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
639
|
+
const reallocationPlan = (0, validate_js_1.validateAndNormalizeReallocations)({
|
|
640
|
+
reallocations,
|
|
641
|
+
targetMarketId: this.marketParams.id,
|
|
642
|
+
chainId: this.chainId,
|
|
643
|
+
});
|
|
644
|
+
const reallocationList = reallocationPlan.reallocations;
|
|
609
645
|
if (amount < 0n) {
|
|
610
646
|
throw new index_js_3.NegativeInputError("amount", amount);
|
|
611
647
|
}
|
|
@@ -620,9 +656,6 @@ class MorphoBlue {
|
|
|
620
656
|
throw new index_js_3.NonPositiveInputError("totalCollateral", totalCollateral);
|
|
621
657
|
}
|
|
622
658
|
(0, index_js_2.validateSlippageTolerance)(slippageTolerance);
|
|
623
|
-
if (reallocations) {
|
|
624
|
-
(0, index_js_2.validateReallocations)(reallocations, this.marketParams.id);
|
|
625
|
-
}
|
|
626
659
|
if (!positionData) {
|
|
627
660
|
throw new index_js_3.MissingAccrualPositionError(this.marketParams.id);
|
|
628
661
|
}
|
|
@@ -648,15 +681,26 @@ class MorphoBlue {
|
|
|
648
681
|
});
|
|
649
682
|
return {
|
|
650
683
|
getRequirements: async (params) => {
|
|
651
|
-
const
|
|
684
|
+
const penaltyAssets = reallocationPlan.type === "vaultV2Blue"
|
|
685
|
+
? reallocationPlan.reallocations.reduce((total, reallocation) => total +
|
|
686
|
+
blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils.getPenaltyAssets(reallocation, reallocation.assets), 0n)
|
|
687
|
+
: 0n;
|
|
688
|
+
const usesSharedFundingToken = (0, viem_1.isAddressEqual)(this.marketParams.collateralToken, this.marketParams.loanToken);
|
|
689
|
+
const [erc20Requirements, penaltyRequirements, authTx] = await Promise.all([
|
|
652
690
|
(0, index_js_1.getGeneralAdapterRequirements)(this.client.viemClient, {
|
|
653
691
|
address: this.marketParams.collateralToken,
|
|
654
692
|
chainId: this.chainId,
|
|
655
693
|
supportSignature: this.client.options.supportSignature,
|
|
656
694
|
supportDeployless: this.client.options.supportDeployless,
|
|
657
695
|
useSimplePermit: params?.useSimplePermit,
|
|
658
|
-
args: {
|
|
696
|
+
args: {
|
|
697
|
+
amount: amount + (usesSharedFundingToken ? penaltyAssets : 0n),
|
|
698
|
+
from: userAddress,
|
|
699
|
+
},
|
|
659
700
|
}),
|
|
701
|
+
usesSharedFundingToken
|
|
702
|
+
? []
|
|
703
|
+
: this.getReallocationPenaltyRequirements(userAddress, reallocationPlan),
|
|
660
704
|
(0, index_js_1.getBlueAuthorizationRequirement)({
|
|
661
705
|
viemClient: this.client.viemClient,
|
|
662
706
|
chainId: this.chainId,
|
|
@@ -664,7 +708,11 @@ class MorphoBlue {
|
|
|
664
708
|
supportSignature: this.client.options.supportSignature,
|
|
665
709
|
}),
|
|
666
710
|
]);
|
|
667
|
-
return [
|
|
711
|
+
return [
|
|
712
|
+
...erc20Requirements,
|
|
713
|
+
...penaltyRequirements,
|
|
714
|
+
...(authTx ? [authTx] : []),
|
|
715
|
+
];
|
|
668
716
|
},
|
|
669
717
|
buildTx: (signatures) => {
|
|
670
718
|
const { permit, authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, { permit: true, authorization: true });
|
|
@@ -682,7 +730,7 @@ class MorphoBlue {
|
|
|
682
730
|
minSharePrice,
|
|
683
731
|
requirementSignature: permit,
|
|
684
732
|
authorizationSignature: authorization,
|
|
685
|
-
reallocations,
|
|
733
|
+
reallocations: reallocationList,
|
|
686
734
|
},
|
|
687
735
|
metadata: this.client.options.metadata,
|
|
688
736
|
});
|
|
@@ -692,6 +740,12 @@ class MorphoBlue {
|
|
|
692
740
|
refinance({ userAddress, positionData, target, collateralAmount, borrowAssets, borrowShares, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, targetReallocations, }) {
|
|
693
741
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
694
742
|
(0, index_js_2.validateSlippageTolerance)(slippageTolerance);
|
|
743
|
+
const targetReallocationPlan = (0, validate_js_1.validateAndNormalizeReallocations)({
|
|
744
|
+
reallocations: targetReallocations,
|
|
745
|
+
targetMarketId: target.marketParams.id,
|
|
746
|
+
chainId: this.chainId,
|
|
747
|
+
});
|
|
748
|
+
const targetReallocationList = targetReallocationPlan.reallocations;
|
|
695
749
|
if (collateralAmount <= 0n) {
|
|
696
750
|
throw new index_js_3.NonPositiveInputError("collateralAmount", collateralAmount);
|
|
697
751
|
}
|
|
@@ -706,9 +760,6 @@ class MorphoBlue {
|
|
|
706
760
|
if (requestedAssets > 0n && requestedShares > 0n) {
|
|
707
761
|
throw new index_js_3.BorrowAmountAndSharesExclusiveError(this.marketParams.id);
|
|
708
762
|
}
|
|
709
|
-
if (targetReallocations) {
|
|
710
|
-
(0, index_js_2.validateReallocations)(targetReallocations, target.marketParams.id);
|
|
711
|
-
}
|
|
712
763
|
if (!positionData) {
|
|
713
764
|
throw new index_js_3.MissingAccrualPositionError(this.marketParams.id);
|
|
714
765
|
}
|
|
@@ -822,13 +873,16 @@ class MorphoBlue {
|
|
|
822
873
|
: 0n;
|
|
823
874
|
return {
|
|
824
875
|
getRequirements: async () => {
|
|
825
|
-
const authTx = await
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
876
|
+
const [penaltyRequirements, authTx] = await Promise.all([
|
|
877
|
+
this.getReallocationPenaltyRequirements(userAddress, targetReallocationPlan),
|
|
878
|
+
(0, index_js_1.getBlueAuthorizationRequirement)({
|
|
879
|
+
viemClient: this.client.viemClient,
|
|
880
|
+
chainId: this.chainId,
|
|
881
|
+
userAddress,
|
|
882
|
+
supportSignature: this.client.options.supportSignature,
|
|
883
|
+
}),
|
|
884
|
+
]);
|
|
885
|
+
return [...penaltyRequirements, ...(authTx ? [authTx] : [])];
|
|
832
886
|
},
|
|
833
887
|
buildTx: (signatures) => {
|
|
834
888
|
const { authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
@@ -847,7 +901,7 @@ class MorphoBlue {
|
|
|
847
901
|
borrowShares: requestedShares,
|
|
848
902
|
minBorrowSharePrice,
|
|
849
903
|
maxRepaySharePrice,
|
|
850
|
-
targetReallocations,
|
|
904
|
+
targetReallocations: targetReallocationList,
|
|
851
905
|
authorizationSignature: authorization,
|
|
852
906
|
},
|
|
853
907
|
metadata: this.client.options.metadata,
|
|
@@ -858,13 +912,30 @@ class MorphoBlue {
|
|
|
858
912
|
/**
|
|
859
913
|
* Fetches all on-chain inputs needed to compute public allocator reallocations.
|
|
860
914
|
*
|
|
861
|
-
* @param params - Reallocation data fetch parameters.
|
|
862
915
|
* @param params.vaultAddresses - Vaults to inspect for source-market liquidity.
|
|
863
|
-
* @param params.block - Block number
|
|
864
|
-
* @
|
|
916
|
+
* @param params.block.number - Block number used for every RPC read.
|
|
917
|
+
* @param params.block.timestamp - Timestamp corresponding to the fetched block.
|
|
918
|
+
* @returns Reallocation data ready for {@link getVaultV1Reallocations}.
|
|
865
919
|
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
920
|
+
* @example
|
|
921
|
+
* ```ts
|
|
922
|
+
* import { markets, vaults } from "@morpho-org/morpho-test";
|
|
923
|
+
* import { createPublicClient, http } from "viem";
|
|
924
|
+
* import { mainnet } from "viem/chains";
|
|
925
|
+
* import { morphoViemExtension } from "@morpho-org/morpho-sdk";
|
|
926
|
+
* import type { VaultV1ReallocationData } from "@morpho-org/morpho-sdk/entities";
|
|
927
|
+
*
|
|
928
|
+
* const client = createPublicClient({ chain: mainnet, transport: http() })
|
|
929
|
+
* .extend(morphoViemExtension());
|
|
930
|
+
* const market = client.morpho.blue(markets[mainnet.id].usdc_wbtc, mainnet.id);
|
|
931
|
+
* const block = await client.getBlock();
|
|
932
|
+
* const data: VaultV1ReallocationData = await market.getVaultV1ReallocationData({
|
|
933
|
+
* vaultAddresses: [vaults[mainnet.id].steakUsdc.address],
|
|
934
|
+
* block,
|
|
935
|
+
* });
|
|
936
|
+
* ```
|
|
866
937
|
*/
|
|
867
|
-
async
|
|
938
|
+
async getVaultV1ReallocationData({ vaultAddresses, block, }) {
|
|
868
939
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
869
940
|
const client = this.client.viemClient;
|
|
870
941
|
const fetchParams = {
|
|
@@ -904,7 +975,7 @@ class MorphoBlue {
|
|
|
904
975
|
position,
|
|
905
976
|
})))),
|
|
906
977
|
]);
|
|
907
|
-
// Assemble records for
|
|
978
|
+
// Assemble records for VaultV1ReallocationData.
|
|
908
979
|
const marketsRecord = {
|
|
909
980
|
[targetMarketId]: targetMarket,
|
|
910
981
|
};
|
|
@@ -923,7 +994,7 @@ class MorphoBlue {
|
|
|
923
994
|
for (const { vault, mid, position } of positions) {
|
|
924
995
|
(positionsRecord[vault] ??= {})[mid] = position;
|
|
925
996
|
}
|
|
926
|
-
return new
|
|
997
|
+
return new vaultV1ReallocationData_js_1.VaultV1ReallocationData({
|
|
927
998
|
chainId: this.chainId,
|
|
928
999
|
markets: marketsRecord,
|
|
929
1000
|
vaults: vaultsRecord,
|
|
@@ -932,13 +1003,109 @@ class MorphoBlue {
|
|
|
932
1003
|
});
|
|
933
1004
|
}
|
|
934
1005
|
/**
|
|
935
|
-
*
|
|
1006
|
+
* Fetches Vault V1 PublicAllocator state using the deprecated unversioned name.
|
|
1007
|
+
*
|
|
1008
|
+
* @param params.vaultAddresses - Addresses of MetaMorpho vaults that allocate to this market.
|
|
1009
|
+
* @param params.block.number - Block number used for every RPC read.
|
|
1010
|
+
* @param params.block.timestamp - Timestamp corresponding to the fetched block.
|
|
1011
|
+
* @returns A `VaultV1ReallocationData` snapshot populated from one block.
|
|
1012
|
+
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
1013
|
+
* @deprecated Use {@link getVaultV1ReallocationData} instead.
|
|
1014
|
+
* @example
|
|
1015
|
+
* ```ts
|
|
1016
|
+
* const data = await market.getReallocationData({ vaultAddresses, block });
|
|
1017
|
+
* // Equivalent to market.getVaultV1ReallocationData({ vaultAddresses, block }).
|
|
1018
|
+
* ```
|
|
1019
|
+
*/
|
|
1020
|
+
getReallocationData(params) {
|
|
1021
|
+
return this.getVaultV1ReallocationData(params);
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Fetches Vault V2 BluePublicAllocator state for this target market.
|
|
1025
|
+
*
|
|
1026
|
+
* Reads the target Morpho Blue market, each Vault V2 accrual tree, and each
|
|
1027
|
+
* vault's BluePublicAllocator permissions and allocation caps at one block.
|
|
1028
|
+
*
|
|
1029
|
+
* @param params.vaultAddresses - Vault V2 addresses to inspect for market or idle liquidity.
|
|
1030
|
+
* @param params.block.number - Block number used for every RPC read.
|
|
1031
|
+
* @param params.block.timestamp - Timestamp corresponding to the fetched block.
|
|
1032
|
+
* @returns A `VaultV2BlueReallocationData` snapshot ready for {@link getVaultV2BlueReallocations}.
|
|
1033
|
+
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
1034
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
1035
|
+
* @throws {UnknownAddressError} when the chain has no BluePublicAllocator deployment.
|
|
1036
|
+
* @throws {UnknownBlueFactory} when the chain has no Vault V2 factory.
|
|
1037
|
+
* @throws {UnknownBlueOfFactory} when a requested address is not a Vault V2 from that factory.
|
|
1038
|
+
* @throws {UnsupportedBlueVaultV2AdapterError} when a vault contains an unsupported adapter.
|
|
1039
|
+
* @throws {viem.BaseError} when an RPC or contract read fails with no fallback left.
|
|
1040
|
+
* @example
|
|
1041
|
+
* ```ts
|
|
1042
|
+
* import { markets } from "@morpho-org/morpho-test";
|
|
1043
|
+
* import { createPublicClient, http } from "viem";
|
|
1044
|
+
* import { mainnet } from "viem/chains";
|
|
1045
|
+
* import { morphoViemExtension } from "@morpho-org/morpho-sdk";
|
|
1046
|
+
* import type { VaultV2BlueReallocationData } from "@morpho-org/morpho-sdk/entities";
|
|
1047
|
+
*
|
|
1048
|
+
* const client = createPublicClient({ chain: mainnet, transport: http() })
|
|
1049
|
+
* .extend(morphoViemExtension());
|
|
1050
|
+
* const market = client.morpho.blue(markets[mainnet.id].usdc_wbtc, mainnet.id);
|
|
1051
|
+
* const block = await client.getBlock();
|
|
1052
|
+
* const keyrockUsdcVaultV2 = "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145";
|
|
1053
|
+
* const data: VaultV2BlueReallocationData =
|
|
1054
|
+
* await market.getVaultV2BlueReallocationData({
|
|
1055
|
+
* vaultAddresses: [keyrockUsdcVaultV2],
|
|
1056
|
+
* block,
|
|
1057
|
+
* });
|
|
1058
|
+
* ```
|
|
1059
|
+
*/
|
|
1060
|
+
async getVaultV2BlueReallocationData({ vaultAddresses, block, }) {
|
|
1061
|
+
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
1062
|
+
const client = this.client.viemClient;
|
|
1063
|
+
const fetchParams = {
|
|
1064
|
+
blockNumber: block.number,
|
|
1065
|
+
chainId: this.chainId,
|
|
1066
|
+
deployless: this.client.options.supportDeployless,
|
|
1067
|
+
};
|
|
1068
|
+
const [targetMarket, vaultEntries] = await Promise.all([
|
|
1069
|
+
(0, blue_sdk_viem_1.fetchMarket)(this.marketParams.id, client, fetchParams),
|
|
1070
|
+
Promise.all(vaultAddresses.map(async (address) => {
|
|
1071
|
+
const vault = await (0, blue_sdk_viem_1.fetchAccrualVaultV2)(address, client, fetchParams);
|
|
1072
|
+
const publicAllocatorData = await (0, blue_sdk_viem_1.fetchVaultV2BluePublicAllocatorData)(vault, client, {
|
|
1073
|
+
...fetchParams,
|
|
1074
|
+
targetMarketParams: this.marketParams,
|
|
1075
|
+
});
|
|
1076
|
+
return { publicAllocatorData, vault };
|
|
1077
|
+
})),
|
|
1078
|
+
]);
|
|
1079
|
+
return new vaultV2BlueReallocationData_js_1.VaultV2BlueReallocationData({
|
|
1080
|
+
chainId: this.chainId,
|
|
1081
|
+
markets: { [targetMarket.id]: targetMarket },
|
|
1082
|
+
vaults: Object.fromEntries(vaultEntries.map(({ vault }) => [vault.address, vault])),
|
|
1083
|
+
allocations: Object.fromEntries(vaultEntries.map(({ publicAllocatorData, vault }) => [
|
|
1084
|
+
vault.address,
|
|
1085
|
+
publicAllocatorData.allocations,
|
|
1086
|
+
])),
|
|
1087
|
+
publicAllocatorConfigs: Object.fromEntries(vaultEntries.map(({ publicAllocatorData, vault }) => [
|
|
1088
|
+
vault.address,
|
|
1089
|
+
publicAllocatorData.publicAllocatorConfig,
|
|
1090
|
+
])),
|
|
1091
|
+
activeAdapters: Object.fromEntries(vaultEntries.map(({ publicAllocatorData, vault }) => [
|
|
1092
|
+
vault.address,
|
|
1093
|
+
publicAllocatorData.activeAdapters,
|
|
1094
|
+
])),
|
|
1095
|
+
marketPublicAllocatorConfigs: Object.fromEntries(vaultEntries.map(({ publicAllocatorData, vault }) => [
|
|
1096
|
+
vault.address,
|
|
1097
|
+
publicAllocatorData.marketPublicAllocatorConfigs,
|
|
1098
|
+
])),
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Computes Vault V1 PublicAllocator reallocations for this market.
|
|
936
1103
|
*
|
|
937
1104
|
* Pass `{ borrowAmount }` for a borrow (legacy alias, equivalent to `{ operation: "borrow", amount }`)
|
|
938
1105
|
* or `{ operation, amount }` for a borrow or loan-asset withdraw.
|
|
939
1106
|
*
|
|
940
1107
|
* @param params - Reallocation computation parameters.
|
|
941
|
-
* @param params.reallocationData - State returned by {@link
|
|
1108
|
+
* @param params.reallocationData - State returned by {@link getVaultV1ReallocationData}.
|
|
942
1109
|
* @param params.operation - The operation driving the reallocation (`"borrow"` or `"withdraw"`).
|
|
943
1110
|
* @param params.amount - The borrow or withdraw amount used to compute the post-state utilization.
|
|
944
1111
|
* @param params.borrowAmount - {@deprecated Pass `{ operation: "borrow", amount }` instead.}
|
|
@@ -949,13 +1116,21 @@ class MorphoBlue {
|
|
|
949
1116
|
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
|
|
950
1117
|
* @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
|
|
951
1118
|
* @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
|
|
1119
|
+
* @example
|
|
1120
|
+
* ```ts
|
|
1121
|
+
* const reallocations = market.getVaultV1Reallocations({
|
|
1122
|
+
* reallocationData,
|
|
1123
|
+
* operation: "borrow",
|
|
1124
|
+
* amount: 1_000_000n,
|
|
1125
|
+
* });
|
|
1126
|
+
* ```
|
|
952
1127
|
*/
|
|
953
|
-
|
|
1128
|
+
getVaultV1Reallocations(params) {
|
|
954
1129
|
(0, index_js_2.validateChainId)(params.reallocationData.chainId, this.chainId);
|
|
955
1130
|
const marketId = this.marketParams.id;
|
|
956
1131
|
const options = { enabled: true, ...params.options };
|
|
957
1132
|
if (params.borrowAmount !== undefined) {
|
|
958
|
-
return (0, index_js_2.
|
|
1133
|
+
return (0, index_js_2.computeVaultV1Reallocations)({
|
|
959
1134
|
reallocationData: params.reallocationData,
|
|
960
1135
|
marketId,
|
|
961
1136
|
operation: "borrow",
|
|
@@ -963,7 +1138,7 @@ class MorphoBlue {
|
|
|
963
1138
|
options,
|
|
964
1139
|
});
|
|
965
1140
|
}
|
|
966
|
-
return (0, index_js_2.
|
|
1141
|
+
return (0, index_js_2.computeVaultV1Reallocations)({
|
|
967
1142
|
reallocationData: params.reallocationData,
|
|
968
1143
|
marketId,
|
|
969
1144
|
operation: params.operation,
|
|
@@ -971,5 +1146,64 @@ class MorphoBlue {
|
|
|
971
1146
|
options,
|
|
972
1147
|
});
|
|
973
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Computes Vault V1 PublicAllocator reallocations using the deprecated unversioned name.
|
|
1151
|
+
*
|
|
1152
|
+
* @param params.reallocationData - State returned by {@link getVaultV1ReallocationData}.
|
|
1153
|
+
* @param params.operation - The operation driving the reallocation (`"borrow"` or `"withdraw"`).
|
|
1154
|
+
* @param params.amount - The borrow or withdraw amount used to compute post-state utilization.
|
|
1155
|
+
* @param params.borrowAmount - Deprecated borrow amount alias.
|
|
1156
|
+
* @param params.options - Optional allocator and utilization options.
|
|
1157
|
+
* @returns Vault V1 reallocations ready for a Blue action.
|
|
1158
|
+
* @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
|
|
1159
|
+
* @throws {InsufficientSharedLiquidityError} when shared liquidity cannot cover the operation.
|
|
1160
|
+
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
|
|
1161
|
+
* @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
|
|
1162
|
+
* @throws {UnknownReallocationMarketError} when the target market is absent.
|
|
1163
|
+
* @deprecated Use {@link getVaultV1Reallocations} instead.
|
|
1164
|
+
* @example
|
|
1165
|
+
* ```ts
|
|
1166
|
+
* const reallocations = market.getReallocations({
|
|
1167
|
+
* reallocationData,
|
|
1168
|
+
* operation: "borrow",
|
|
1169
|
+
* amount: 1_000_000n,
|
|
1170
|
+
* });
|
|
1171
|
+
* ```
|
|
1172
|
+
*/
|
|
1173
|
+
getReallocations(params) {
|
|
1174
|
+
return this.getVaultV1Reallocations(params);
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Computes Vault V2 BluePublicAllocator reallocations for this market.
|
|
1178
|
+
*
|
|
1179
|
+
* @param params.reallocationData - State returned by {@link getVaultV2BlueReallocationData}.
|
|
1180
|
+
* @param params.options - Optional allocator discovery controls and operation to support.
|
|
1181
|
+
* @returns Action-ready reallocations and their post-simulation state.
|
|
1182
|
+
* @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
|
|
1183
|
+
* @throws {NegativeInputError} when a utilization or penalty limit is negative.
|
|
1184
|
+
* @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
|
|
1185
|
+
* @throws {NonPositiveInputError} when an enabled operation amount is not positive.
|
|
1186
|
+
* @throws {UnknownReallocationMarketError} when a required market is absent.
|
|
1187
|
+
* @throws {UnknownReallocationVaultError} when configured vault state is absent.
|
|
1188
|
+
* @throws {UnknownReallocationPublicAllocatorConfigError} when allocator authorization state is absent.
|
|
1189
|
+
* @throws {UnknownReallocationActiveAdaptersError} when active-adapter state is absent.
|
|
1190
|
+
* @throws {UnknownReallocationMarketPublicAllocatorConfigError} when an adapter-market allocator configuration is absent.
|
|
1191
|
+
* @throws {UnknownReallocationAllocationError} when required allocation state is absent.
|
|
1192
|
+
* @throws {ReallocationAdapterSupplySharesUnderflowError} when an inconsistent adapter snapshot underflows during the final transition.
|
|
1193
|
+
* @throws {ReallocationAllocationUnderflowError} when an inconsistent allocation snapshot underflows during the final transition.
|
|
1194
|
+
* @throws {InsufficientSharedLiquidityError} when selected liquidity cannot cover the shortfall.
|
|
1195
|
+
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```ts
|
|
1198
|
+
* const result = market.getVaultV2BlueReallocations({
|
|
1199
|
+
* reallocationData,
|
|
1200
|
+
* options: { operation: { type: "borrow", amount: 1_000_000n } },
|
|
1201
|
+
* });
|
|
1202
|
+
* ```
|
|
1203
|
+
*/
|
|
1204
|
+
getVaultV2BlueReallocations({ reallocationData, options, }) {
|
|
1205
|
+
(0, index_js_2.validateChainId)(reallocationData.chainId, this.chainId);
|
|
1206
|
+
return reallocationData.computeVaultV2BlueReallocations(this.marketParams.id, options);
|
|
1207
|
+
}
|
|
974
1208
|
}
|
|
975
1209
|
exports.MorphoBlue = MorphoBlue;
|
|
@@ -1,7 +1,67 @@
|
|
|
1
|
-
export type { IAccrualPosition
|
|
2
|
-
|
|
1
|
+
export type { IAccrualPosition as IBlueAccrualPosition,
|
|
2
|
+
/** @deprecated Use `IBlueAccrualPosition` or the raw Blue subpath. */
|
|
3
|
+
IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket as IBlueMarket,
|
|
4
|
+
/** @deprecated Use `IBlueMarket` or the raw Blue subpath. */
|
|
5
|
+
IMarket, IMarketParams as IBlueMarketParams,
|
|
6
|
+
/** @deprecated Use `IBlueMarketParams` or the raw Blue subpath. */
|
|
7
|
+
IMarketParams, IPosition as IBluePosition,
|
|
8
|
+
/** @deprecated Use `IBluePosition` or the raw Blue subpath. */
|
|
9
|
+
IPosition, IPreLiquidationParams as IBluePreLiquidationParams,
|
|
10
|
+
/** @deprecated Use `IBluePreLiquidationParams` or the raw Blue subpath. */
|
|
11
|
+
IPreLiquidationParams, IPreLiquidationPosition as IBluePreLiquidationPosition,
|
|
12
|
+
/** @deprecated Use `IBluePreLiquidationPosition` or the raw Blue subpath. */
|
|
13
|
+
IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultMarketPublicAllocatorConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, VaultPublicAllocatorConfig, } from "@morpho-org/blue-sdk";
|
|
14
|
+
export { AccrualPosition as BlueAccrualPosition,
|
|
15
|
+
/** @deprecated Use `BlueAccrualPosition` or the raw Blue subpath. */
|
|
16
|
+
AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket,
|
|
17
|
+
/** @deprecated Use `BlueMarket` or the raw Blue subpath. */
|
|
18
|
+
Market, MarketParams as BlueMarketParams,
|
|
19
|
+
/** @deprecated Use `BlueMarketParams` or the raw Blue subpath. */
|
|
20
|
+
MarketParams, Position as BluePosition,
|
|
21
|
+
/** @deprecated Use `BluePosition` or the raw Blue subpath. */
|
|
22
|
+
Position, PreLiquidationParams as BluePreLiquidationParams,
|
|
23
|
+
/** @deprecated Use `BluePreLiquidationParams` or the raw Blue subpath. */
|
|
24
|
+
PreLiquidationParams, PreLiquidationPosition as BluePreLiquidationPosition,
|
|
25
|
+
/** @deprecated Use `BluePreLiquidationPosition` or the raw Blue subpath. */
|
|
26
|
+
PreLiquidationPosition, Token, User as BlueUser,
|
|
27
|
+
/** @deprecated Use `BlueUser` or the raw Blue subpath. */
|
|
28
|
+
User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultMarketPublicAllocatorConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
|
|
29
|
+
export type { BuildOfferParams as MidnightBuildOfferParams, CollateralParams as MidnightCollateralParams, GroupInput as MidnightGroupInput, IAccrualPosition as IMidnightAccrualPosition, ICollateralParams as IMidnightCollateralParams, IGroup as IMidnightGroup, IMarket as IMidnightMarket, IMarketParams as IMidnightMarketParams, IOffer as IMidnightOffer, IPosition as IMidnightPosition, MarketInput as MidnightMarketInput, OfferStruct as MidnightOfferStruct, RatifierTreeInput as MidnightRatifierTreeInput, SettlementFeeCbps as MidnightSettlementFeeCbps, TreeCreateParams as MidnightTreeCreateParams, TreeDescriptor as MidnightTreeDescriptor, TreeInput as MidnightTreeInput, TreeLike as MidnightTreeLike, TreeMempoolValidateParams as MidnightTreeMempoolValidateParams, TreeMempoolValidateRatification as MidnightTreeMempoolValidateRatification, TreeProof as MidnightTreeProof, } from "@morpho-org/midnight-sdk";
|
|
30
|
+
export { AccrualPosition as MidnightAccrualPosition, Group as MidnightGroup, Market as MidnightMarket, MarketParams as MidnightMarketParams, Offer as MidnightOffer, Position as MidnightPosition, Tree as MidnightTree, } from "@morpho-org/midnight-sdk";
|
|
3
31
|
export { MorphoBlue } from "./blue/index.js";
|
|
4
|
-
export
|
|
5
|
-
|
|
32
|
+
export type { GetOffersDataParams as MidnightGetOffersDataParams,
|
|
33
|
+
/** @deprecated Use `MidnightGetOffersDataParams`. */
|
|
34
|
+
GetOffersDataParams, GetPositionDataParams as MidnightGetPositionDataParams,
|
|
35
|
+
/** @deprecated Use `MidnightGetPositionDataParams`. */
|
|
36
|
+
GetPositionDataParams, MakeLendParams as MidnightMakeLendParams,
|
|
37
|
+
/** @deprecated Use `MidnightMakeLendParams`. */
|
|
38
|
+
MakeLendParams, MakeOffersOutput as MidnightMakeOffersOutput,
|
|
39
|
+
/** @deprecated Use `MidnightMakeOffersOutput`. */
|
|
40
|
+
MakeOffersOutput, MakeOffersParams as MidnightMakeOffersParams,
|
|
41
|
+
/** @deprecated Use `MidnightMakeOffersParams`. */
|
|
42
|
+
MakeOffersParams, MarketActionParams as MidnightMarketActionParams,
|
|
43
|
+
/** @deprecated Use `MidnightMarketActionParams`. */
|
|
44
|
+
MarketActionParams, OffersData as MidnightOffersData,
|
|
45
|
+
/** @deprecated Use `MidnightOffersData`. */
|
|
46
|
+
OffersData, OfferValidationParams as MidnightOfferValidationParams,
|
|
47
|
+
/** @deprecated Use `MidnightOfferValidationParams`. */
|
|
48
|
+
OfferValidationParams, RedeemParams as MidnightRedeemParams,
|
|
49
|
+
/** @deprecated Use `MidnightRedeemParams`. */
|
|
50
|
+
RedeemParams, RepayWithdrawCollateralParams as MidnightRepayWithdrawCollateralParams,
|
|
51
|
+
/** @deprecated Use `MidnightRepayWithdrawCollateralParams`. */
|
|
52
|
+
RepayWithdrawCollateralParams, SupplyCollateralMakeBorrowParams as MidnightSupplyCollateralMakeBorrowParams,
|
|
53
|
+
/** @deprecated Use `MidnightSupplyCollateralMakeBorrowParams`. */
|
|
54
|
+
SupplyCollateralMakeBorrowParams, SupplyCollateralParams as MidnightSupplyCollateralParams,
|
|
55
|
+
/** @deprecated Use `MidnightSupplyCollateralParams`. */
|
|
56
|
+
SupplyCollateralParams, SupplyCollateralTakeBorrowParams as MidnightSupplyCollateralTakeBorrowParams,
|
|
57
|
+
/** @deprecated Use `MidnightSupplyCollateralTakeBorrowParams`. */
|
|
58
|
+
SupplyCollateralTakeBorrowParams, TakeBorrowParams as MidnightTakeBorrowParams,
|
|
59
|
+
/** @deprecated Use `MidnightTakeBorrowParams`. */
|
|
60
|
+
TakeBorrowParams, TakeLendParams as MidnightTakeLendParams,
|
|
61
|
+
/** @deprecated Use `MidnightTakeLendParams`. */
|
|
62
|
+
TakeLendParams, } from "./midnight/index.js";
|
|
63
|
+
export { type MidnightActionOutput, type MidnightActionSignatures, type MidnightActions, MorphoMidnight, } from "./midnight/index.js";
|
|
6
64
|
export { MorphoVaultV1 } from "./vaultV1/index.js";
|
|
65
|
+
export { type InputReallocationData, type InputVaultV1ReallocationData, ReallocationData, VaultV1ReallocationData, } from "./vaultV1ReallocationData.js";
|
|
7
66
|
export { MorphoVaultV2 } from "./vaultV2/index.js";
|
|
67
|
+
export { type InputVaultV2BlueReallocationData, VaultV2BlueReallocationData, } from "./vaultV2BlueReallocationData.js";
|