@morpho-org/morpho-sdk 9.6.0-next.0 → 9.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 +59 -0
- package/lib/cjs/abis.d.ts +1 -1
- package/lib/cjs/abis.js +1 -5
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/cjs/actions/bundles/common.js +39 -32
- package/lib/cjs/actions/midnight/cancelAndMake.js +20 -98
- package/lib/cjs/actions/midnight/index.d.ts +2 -0
- package/lib/cjs/actions/midnight/index.js +2 -0
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +5 -6
- package/lib/cjs/actions/midnight/supplyCollateralBatch.d.ts +39 -0
- package/lib/cjs/actions/midnight/supplyCollateralBatch.js +91 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +31 -32
- package/lib/cjs/actions/midnight/takeBorrow.js +24 -23
- package/lib/cjs/actions/midnight/takeLend.js +24 -23
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +20 -19
- package/lib/cjs/actions/midnight/takeWithdraw.js +24 -23
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.d.ts +44 -0
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +104 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +1 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +1 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +1 -0
- package/lib/cjs/actions/vaultV1/migrateToV2.js +7 -7
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +1 -5
- package/lib/cjs/blue/entities.d.ts +4 -4
- package/lib/cjs/blue/entities.js +1 -3
- package/lib/cjs/blue/errors.d.ts +2 -2
- package/lib/cjs/blue/errors.js +1 -5
- package/lib/cjs/blue/fetch.d.ts +2 -2
- package/lib/cjs/blue/fetch.js +1 -3
- package/lib/cjs/blue/utils.d.ts +1 -1
- package/lib/cjs/blue/utils.js +1 -2
- package/lib/cjs/entities/index.d.ts +5 -5
- package/lib/cjs/entities/index.js +1 -3
- package/lib/cjs/entities/midnight/midnight.d.ts +77 -3
- package/lib/cjs/entities/midnight/midnight.js +174 -0
- package/lib/cjs/entities/midnight/types.d.ts +16 -0
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +8 -33
- package/lib/cjs/entities/vaultV2/vaultV2.js +1 -33
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +3 -5
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +3 -9
- package/lib/cjs/errors.d.ts +4 -4
- package/lib/cjs/errors.js +6 -7
- package/lib/cjs/fetch.d.ts +2 -2
- package/lib/cjs/fetch.js +1 -3
- package/lib/cjs/helpers/deadShares.js +0 -2
- package/lib/cjs/helpers/signAndVerifyTypedData.d.ts +1 -0
- package/lib/cjs/helpers/signAndVerifyTypedData.js +12 -5
- package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.d.ts +68 -0
- package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.js +129 -0
- package/lib/cjs/helpers/validateMidnightCollateralBatch.d.ts +14 -0
- package/lib/cjs/helpers/validateMidnightCollateralBatch.js +27 -0
- package/lib/cjs/helpers/validateMidnightCollateralSupplies.d.ts +17 -0
- package/lib/cjs/helpers/validateMidnightCollateralSupplies.js +28 -0
- package/lib/cjs/helpers/validatePositiveInput.d.ts +10 -0
- package/lib/cjs/helpers/validatePositiveInput.js +18 -0
- package/lib/cjs/midnight/errors.d.ts +1 -2
- package/lib/cjs/midnight/errors.js +5 -5
- package/lib/cjs/types/action.d.ts +18 -3
- package/lib/cjs/types/error.d.ts +23 -2
- package/lib/cjs/types/error.js +45 -5
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +2 -4
- package/lib/esm/abis.d.ts +1 -1
- package/lib/esm/abis.js +1 -1
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/esm/actions/bundles/common.js +39 -32
- package/lib/esm/actions/midnight/cancelAndMake.js +25 -103
- package/lib/esm/actions/midnight/index.d.ts +2 -0
- package/lib/esm/actions/midnight/index.js +2 -0
- package/lib/esm/actions/midnight/repayWithdrawCollateral.js +5 -6
- package/lib/esm/actions/midnight/supplyCollateralBatch.d.ts +39 -0
- package/lib/esm/actions/midnight/supplyCollateralBatch.js +87 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +33 -34
- package/lib/esm/actions/midnight/takeBorrow.js +25 -24
- package/lib/esm/actions/midnight/takeLend.js +25 -24
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +20 -19
- package/lib/esm/actions/midnight/takeWithdraw.js +25 -24
- package/lib/esm/actions/midnight/withdrawCollateralBatch.d.ts +44 -0
- package/lib/esm/actions/midnight/withdrawCollateralBatch.js +100 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +1 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +1 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +1 -0
- package/lib/esm/actions/vaultV1/migrateToV2.js +8 -8
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/entities.d.ts +4 -4
- package/lib/esm/blue/entities.js +2 -2
- package/lib/esm/blue/errors.d.ts +2 -2
- package/lib/esm/blue/errors.js +2 -2
- package/lib/esm/blue/fetch.d.ts +2 -2
- package/lib/esm/blue/fetch.js +2 -2
- package/lib/esm/blue/utils.d.ts +1 -1
- package/lib/esm/blue/utils.js +1 -1
- package/lib/esm/entities/index.d.ts +5 -5
- package/lib/esm/entities/index.js +2 -2
- package/lib/esm/entities/midnight/midnight.d.ts +77 -3
- package/lib/esm/entities/midnight/midnight.js +176 -2
- package/lib/esm/entities/midnight/types.d.ts +16 -0
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +8 -33
- package/lib/esm/entities/vaultV2/vaultV2.js +1 -33
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +3 -5
- package/lib/esm/entities/vaultV2BlueReallocationData.js +3 -9
- package/lib/esm/errors.d.ts +4 -4
- package/lib/esm/errors.js +4 -4
- package/lib/esm/fetch.d.ts +2 -2
- package/lib/esm/fetch.js +2 -2
- package/lib/esm/helpers/deadShares.js +1 -3
- package/lib/esm/helpers/signAndVerifyTypedData.d.ts +1 -0
- package/lib/esm/helpers/signAndVerifyTypedData.js +13 -6
- package/lib/esm/helpers/validateMidnightCancelAndMakePublication.d.ts +68 -0
- package/lib/esm/helpers/validateMidnightCancelAndMakePublication.js +124 -0
- package/lib/esm/helpers/validateMidnightCollateralBatch.d.ts +14 -0
- package/lib/esm/helpers/validateMidnightCollateralBatch.js +24 -0
- package/lib/esm/helpers/validateMidnightCollateralSupplies.d.ts +17 -0
- package/lib/esm/helpers/validateMidnightCollateralSupplies.js +24 -0
- package/lib/esm/helpers/validatePositiveInput.d.ts +10 -0
- package/lib/esm/helpers/validatePositiveInput.js +14 -0
- package/lib/esm/midnight/errors.d.ts +1 -2
- package/lib/esm/midnight/errors.js +1 -2
- package/lib/esm/types/action.d.ts +18 -3
- package/lib/esm/types/error.d.ts +23 -2
- package/lib/esm/types/error.js +40 -3
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/package.json +6 -6
|
@@ -8,6 +8,7 @@ import { validateMidnightAddress } from "../../helpers/validateMidnightAccount.j
|
|
|
8
8
|
import { validateMidnightReferralFeeCap, validateMidnightTakeableOfferBounds, validateMidnightUint128Field, } from "../../helpers/validateMidnightBounds.js";
|
|
9
9
|
import { validateMidnightMarket } from "../../helpers/validateMidnightMarket.js";
|
|
10
10
|
import { validateMidnightReceiver } from "../../helpers/validateMidnightReceiver.js";
|
|
11
|
+
import { validatePositiveInput } from "../../helpers/validatePositiveInput.js";
|
|
11
12
|
import { validateTakeableOffers } from "../../helpers/validateTakeableOffers.js";
|
|
12
13
|
import { NonPositiveInputError, UnboundedMidnightTakeInputError, } from "../../types/index.js";
|
|
13
14
|
/**
|
|
@@ -100,9 +101,8 @@ export const midnightTakeRepayWithdrawCollateral = (params) => {
|
|
|
100
101
|
// Reject markets from another chain deployment before checking offers against them.
|
|
101
102
|
validateMidnightMarket({ market: params.market, chainId: params.chainId });
|
|
102
103
|
for (const [index, { collateralIndex, assets },] of params.collateralWithdrawals.entries()) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
104
|
+
// Validation only; rejects non-positive amounts.
|
|
105
|
+
validatePositiveInput(`collateralWithdrawals[${index}].assets`, assets);
|
|
106
106
|
if (assets !== maxUint256) {
|
|
107
107
|
validateMidnightUint128Field(`collateralWithdrawals[${index}].assets`, assets);
|
|
108
108
|
}
|
|
@@ -126,24 +126,25 @@ export const midnightTakeRepayWithdrawCollateral = (params) => {
|
|
|
126
126
|
});
|
|
127
127
|
validateMidnightTakeableOfferBounds(params.takeableOffers);
|
|
128
128
|
const { target } = params;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
else {
|
|
137
|
-
if (target.units <= 0n) {
|
|
138
|
-
throw new NonPositiveInputError("target.units", target.units);
|
|
139
|
-
}
|
|
140
|
-
if (target.maxBuyerAssets <= 0n) {
|
|
141
|
-
throw new NonPositiveInputError("target.maxBuyerAssets", target.maxBuyerAssets);
|
|
129
|
+
switch (target.type) {
|
|
130
|
+
case "assets": {
|
|
131
|
+
// Validation only; rejects non-positive amounts.
|
|
132
|
+
validatePositiveInput("target.minUnits", target.minUnits);
|
|
133
|
+
validateMidnightUint128Field("target.assets", target.assets);
|
|
134
|
+
validateMidnightUint128Field("target.minUnits", target.minUnits);
|
|
135
|
+
break;
|
|
142
136
|
}
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
default: {
|
|
138
|
+
// Validation only; rejects non-positive amounts.
|
|
139
|
+
validatePositiveInput("target.units", target.units);
|
|
140
|
+
// Validation only; rejects non-positive amounts.
|
|
141
|
+
validatePositiveInput("target.maxBuyerAssets", target.maxBuyerAssets);
|
|
142
|
+
if (target.units !== maxUint256) {
|
|
143
|
+
validateMidnightUint128Field("target.units", target.units);
|
|
144
|
+
}
|
|
145
|
+
validateMidnightUint128Field("target.maxBuyerAssets", target.maxBuyerAssets);
|
|
146
|
+
break;
|
|
145
147
|
}
|
|
146
|
-
validateMidnightUint128Field("target.maxBuyerAssets", target.maxBuyerAssets);
|
|
147
148
|
}
|
|
148
149
|
validateUint256Field("maxContinuousFee", params.maxContinuousFee);
|
|
149
150
|
if (params.deadline === maxUint256) {
|
|
@@ -9,8 +9,9 @@ import { validateMidnightReferralFeeCap, validateMidnightTakeableOfferBounds, va
|
|
|
9
9
|
import { validateMidnightMarket } from "../../helpers/validateMidnightMarket.js";
|
|
10
10
|
import { validateMidnightReceiver } from "../../helpers/validateMidnightReceiver.js";
|
|
11
11
|
import { validateMidnightSellTargetBounds } from "../../helpers/validateMidnightTakeFeasibility.js";
|
|
12
|
+
import { validatePositiveInput } from "../../helpers/validatePositiveInput.js";
|
|
12
13
|
import { validateTakeableOffers } from "../../helpers/validateTakeableOffers.js";
|
|
13
|
-
import {
|
|
14
|
+
import { UnboundedMidnightTakeInputError, } from "../../types/index.js";
|
|
14
15
|
const validateParams = (params) => {
|
|
15
16
|
// Reject markets from another chain deployment before checking offers against them.
|
|
16
17
|
validateMidnightMarket({ market: params.market, chainId: params.chainId });
|
|
@@ -29,31 +30,31 @@ const validateParams = (params) => {
|
|
|
29
30
|
receiver: params.receiver,
|
|
30
31
|
});
|
|
31
32
|
const { target } = params;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
switch (target.type) {
|
|
34
|
+
case "assets": {
|
|
35
|
+
// Validation only; rejects non-positive amounts.
|
|
36
|
+
validatePositiveInput("target.assets", target.assets);
|
|
37
|
+
if (target.maxUnits === maxUint256) {
|
|
38
|
+
throw new UnboundedMidnightTakeInputError("target.maxUnits");
|
|
39
|
+
}
|
|
40
|
+
// Validation only; rejects non-positive amounts.
|
|
41
|
+
validatePositiveInput("target.maxUnits", target.maxUnits);
|
|
42
|
+
validateMidnightUint128Field("target.assets", target.assets);
|
|
43
|
+
validateMidnightUint128Field("target.maxUnits", target.maxUnits);
|
|
44
|
+
break;
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
default: {
|
|
47
|
+
if (target.units === maxUint256) {
|
|
48
|
+
throw new UnboundedMidnightTakeInputError("target.units");
|
|
49
|
+
}
|
|
50
|
+
// Validation only; rejects non-positive amounts.
|
|
51
|
+
validatePositiveInput("target.units", target.units);
|
|
52
|
+
// Validation only; rejects non-positive amounts.
|
|
53
|
+
validatePositiveInput("target.minSellerAssets", target.minSellerAssets);
|
|
54
|
+
validateMidnightUint128Field("target.units", target.units);
|
|
55
|
+
validateMidnightUint128Field("target.minSellerAssets", target.minSellerAssets);
|
|
56
|
+
break;
|
|
38
57
|
}
|
|
39
|
-
if (target.maxUnits <= 0n) {
|
|
40
|
-
throw new NonPositiveInputError("target.maxUnits", target.maxUnits);
|
|
41
|
-
}
|
|
42
|
-
validateMidnightUint128Field("target.assets", target.assets);
|
|
43
|
-
validateMidnightUint128Field("target.maxUnits", target.maxUnits);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
if (target.units === maxUint256) {
|
|
47
|
-
throw new UnboundedMidnightTakeInputError("target.units");
|
|
48
|
-
}
|
|
49
|
-
if (target.units <= 0n) {
|
|
50
|
-
throw new NonPositiveInputError("target.units", target.units);
|
|
51
|
-
}
|
|
52
|
-
if (target.minSellerAssets <= 0n) {
|
|
53
|
-
throw new NonPositiveInputError("target.minSellerAssets", target.minSellerAssets);
|
|
54
|
-
}
|
|
55
|
-
validateMidnightUint128Field("target.units", target.units);
|
|
56
|
-
validateMidnightUint128Field("target.minSellerAssets", target.minSellerAssets);
|
|
57
58
|
}
|
|
58
59
|
if (params.deadline === maxUint256) {
|
|
59
60
|
throw new UnboundedMidnightTakeInputError("deadline");
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type MarketInput } from "@morpho-org/midnight-sdk";
|
|
2
|
+
import { type Address } from "viem";
|
|
3
|
+
import { type Metadata, type MidnightCollateralTransfer, type MidnightWithdrawCollateralBatchAction, type Transaction } from "../../types/index.js";
|
|
4
|
+
/** Parameters for an atomic direct Midnight collateral withdrawal batch. */
|
|
5
|
+
export interface MidnightWithdrawCollateralBatchParams {
|
|
6
|
+
readonly chainId: number;
|
|
7
|
+
readonly market: MarketInput;
|
|
8
|
+
readonly collateralWithdrawals: readonly MidnightCollateralTransfer[];
|
|
9
|
+
readonly onBehalf: Address;
|
|
10
|
+
readonly receiver: Address;
|
|
11
|
+
readonly metadata?: Metadata;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Encodes ordered collateral withdrawals in one Midnight multicall, even for one entry.
|
|
15
|
+
* Duplicates are rejected: pass one entry per index, unlike bundle flows which sum them.
|
|
16
|
+
*
|
|
17
|
+
* @param params - Market, ordered withdrawals, owner, shared receiver and optional metadata.
|
|
18
|
+
* @param params.chainId - Chain containing Midnight.
|
|
19
|
+
* @param params.market - Market holding collateral.
|
|
20
|
+
* @param params.collateralWithdrawals - Nonempty ordered withdrawals, with unique collateral indexes.
|
|
21
|
+
* @param params.onBehalf - Collateral owner; this account or an authorized operator must send the transaction.
|
|
22
|
+
* @param params.receiver - Shared recipient of all withdrawn collateral.
|
|
23
|
+
* @param params.metadata - Optional analytics metadata appended to calldata.
|
|
24
|
+
* @returns A deep-frozen transaction targeting Midnight.
|
|
25
|
+
* @throws {EmptyMidnightCollateralWithdrawalsError} when the list is empty.
|
|
26
|
+
* @throws {DuplicateMidnightCollateralIndexError} when an index repeats.
|
|
27
|
+
* @throws {MidnightZeroReceiverError} when receiver is zero.
|
|
28
|
+
* @throws {MidnightContractReceiverError} when receiver cannot safely receive collateral.
|
|
29
|
+
* @throws {NonPositiveInputError} when assets are not positive.
|
|
30
|
+
* @throws {InputExceedsMaxError} when assets exceed uint128.
|
|
31
|
+
* @throws {MidnightZeroOnBehalfError} when onBehalf is zero.
|
|
32
|
+
* @throws {ChainIdMismatchError} when the market targets another chain.
|
|
33
|
+
* @throws {MidnightMarketAddressMismatchError} when the deployment differs.
|
|
34
|
+
* @throws {UnknownCollateralIndexError} when an index is not configured.
|
|
35
|
+
* @throws {MidnightCalldataEncodingError} when an address or ABI input is malformed.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const tx = midnightWithdrawCollateralBatch({
|
|
39
|
+
* chainId: 8453, market: marketData.params, onBehalf: user, receiver: user,
|
|
40
|
+
* collateralWithdrawals: [{ collateralIndex: 0n, assets: 100n }],
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare const midnightWithdrawCollateralBatch: (params: MidnightWithdrawCollateralBatchParams) => Readonly<Transaction<MidnightWithdrawCollateralBatchAction>>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { MarketUtils, midnightAbi, } from "@morpho-org/midnight-sdk";
|
|
2
|
+
import { deepFreeze, getChainAddress } from "@morpho-org/morpho-ts";
|
|
3
|
+
import { isAddressEqual, zeroAddress } from "viem";
|
|
4
|
+
import { encodeMidnightCalldata, encodeMidnightMarketId, } from "../../helpers/encodeMidnightCalldata.js";
|
|
5
|
+
import { addTransactionMetadata } from "../../helpers/index.js";
|
|
6
|
+
import { validateMidnightAddress } from "../../helpers/validateMidnightAccount.js";
|
|
7
|
+
import { validateMidnightUint128Field } from "../../helpers/validateMidnightBounds.js";
|
|
8
|
+
import { validateMidnightCollateralBatch } from "../../helpers/validateMidnightCollateralBatch.js";
|
|
9
|
+
import { validateMidnightMarket } from "../../helpers/validateMidnightMarket.js";
|
|
10
|
+
import { validateMidnightReceiver } from "../../helpers/validateMidnightReceiver.js";
|
|
11
|
+
import { EmptyMidnightCollateralWithdrawalsError, MidnightZeroOnBehalfError, NonPositiveInputError, } from "../../types/index.js";
|
|
12
|
+
/**
|
|
13
|
+
* Encodes ordered collateral withdrawals in one Midnight multicall, even for one entry.
|
|
14
|
+
* Duplicates are rejected: pass one entry per index, unlike bundle flows which sum them.
|
|
15
|
+
*
|
|
16
|
+
* @param params - Market, ordered withdrawals, owner, shared receiver and optional metadata.
|
|
17
|
+
* @param params.chainId - Chain containing Midnight.
|
|
18
|
+
* @param params.market - Market holding collateral.
|
|
19
|
+
* @param params.collateralWithdrawals - Nonempty ordered withdrawals, with unique collateral indexes.
|
|
20
|
+
* @param params.onBehalf - Collateral owner; this account or an authorized operator must send the transaction.
|
|
21
|
+
* @param params.receiver - Shared recipient of all withdrawn collateral.
|
|
22
|
+
* @param params.metadata - Optional analytics metadata appended to calldata.
|
|
23
|
+
* @returns A deep-frozen transaction targeting Midnight.
|
|
24
|
+
* @throws {EmptyMidnightCollateralWithdrawalsError} when the list is empty.
|
|
25
|
+
* @throws {DuplicateMidnightCollateralIndexError} when an index repeats.
|
|
26
|
+
* @throws {MidnightZeroReceiverError} when receiver is zero.
|
|
27
|
+
* @throws {MidnightContractReceiverError} when receiver cannot safely receive collateral.
|
|
28
|
+
* @throws {NonPositiveInputError} when assets are not positive.
|
|
29
|
+
* @throws {InputExceedsMaxError} when assets exceed uint128.
|
|
30
|
+
* @throws {MidnightZeroOnBehalfError} when onBehalf is zero.
|
|
31
|
+
* @throws {ChainIdMismatchError} when the market targets another chain.
|
|
32
|
+
* @throws {MidnightMarketAddressMismatchError} when the deployment differs.
|
|
33
|
+
* @throws {UnknownCollateralIndexError} when an index is not configured.
|
|
34
|
+
* @throws {MidnightCalldataEncodingError} when an address or ABI input is malformed.
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const tx = midnightWithdrawCollateralBatch({
|
|
38
|
+
* chainId: 8453, market: marketData.params, onBehalf: user, receiver: user,
|
|
39
|
+
* collateralWithdrawals: [{ collateralIndex: 0n, assets: 100n }],
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const midnightWithdrawCollateralBatch = (params) => {
|
|
44
|
+
// Reject malformed addresses before comparing with zero.
|
|
45
|
+
validateMidnightAddress("onBehalf", params.onBehalf);
|
|
46
|
+
if (isAddressEqual(params.onBehalf, zeroAddress)) {
|
|
47
|
+
throw new MidnightZeroOnBehalfError("onBehalf");
|
|
48
|
+
}
|
|
49
|
+
// Reject markets from another deployment before encoding.
|
|
50
|
+
validateMidnightMarket({ market: params.market, chainId: params.chainId });
|
|
51
|
+
validateMidnightReceiver({
|
|
52
|
+
chainId: params.chainId,
|
|
53
|
+
market: params.market,
|
|
54
|
+
field: "receiver",
|
|
55
|
+
receiver: params.receiver,
|
|
56
|
+
});
|
|
57
|
+
// Direct batches require one entry per index rather than summing duplicates.
|
|
58
|
+
validateMidnightCollateralBatch(params.collateralWithdrawals, new EmptyMidnightCollateralWithdrawalsError());
|
|
59
|
+
const calls = params.collateralWithdrawals.map(({ collateralIndex, assets }) => {
|
|
60
|
+
if (assets <= 0n)
|
|
61
|
+
throw new NonPositiveInputError("assets", assets);
|
|
62
|
+
validateMidnightUint128Field("assets", assets);
|
|
63
|
+
// Reject indexes not configured on the market.
|
|
64
|
+
MarketUtils.getCollateralByIndex(params.market, collateralIndex);
|
|
65
|
+
return encodeMidnightCalldata({
|
|
66
|
+
abi: midnightAbi,
|
|
67
|
+
functionName: "withdrawCollateral",
|
|
68
|
+
args: [
|
|
69
|
+
MarketUtils.toStruct(params.market),
|
|
70
|
+
collateralIndex,
|
|
71
|
+
assets,
|
|
72
|
+
params.onBehalf,
|
|
73
|
+
params.receiver,
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
let tx = {
|
|
78
|
+
to: getChainAddress(params.chainId, "midnight"),
|
|
79
|
+
value: 0n,
|
|
80
|
+
data: encodeMidnightCalldata({
|
|
81
|
+
abi: midnightAbi,
|
|
82
|
+
functionName: "multicall",
|
|
83
|
+
args: [calls],
|
|
84
|
+
}),
|
|
85
|
+
};
|
|
86
|
+
if (params.metadata)
|
|
87
|
+
tx = addTransactionMetadata(tx, params.metadata);
|
|
88
|
+
return deepFreeze({
|
|
89
|
+
...tx,
|
|
90
|
+
action: {
|
|
91
|
+
type: "midnightWithdrawCollateralBatch",
|
|
92
|
+
args: {
|
|
93
|
+
market: encodeMidnightMarketId(params.market),
|
|
94
|
+
collateralWithdrawals: params.collateralWithdrawals.map(({ collateralIndex, assets }) => ({ collateralIndex, assets })),
|
|
95
|
+
onBehalf: params.onBehalf,
|
|
96
|
+
receiver: params.receiver,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
};
|
|
@@ -55,6 +55,7 @@ interface EncodeBlueSignatureAuthorizationParams {
|
|
|
55
55
|
* @throws {AddressMismatchError} from `sign()` when `userAddress` differs from `owner`, or when the
|
|
56
56
|
* client account differs from `userAddress`.
|
|
57
57
|
* @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
|
|
58
|
+
* @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
|
|
58
59
|
* @example
|
|
59
60
|
* ```ts
|
|
60
61
|
* import { createWalletClient, http } from "viem";
|
|
@@ -41,6 +41,7 @@ import { ChainIdMismatchError, ExpiredDeadlineError, UnsupportedAuthorizationOpe
|
|
|
41
41
|
* @throws {AddressMismatchError} from `sign()` when `userAddress` differs from `owner`, or when the
|
|
42
42
|
* client account differs from `userAddress`.
|
|
43
43
|
* @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
|
|
44
|
+
* @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
|
|
44
45
|
* @example
|
|
45
46
|
* ```ts
|
|
46
47
|
* import { createWalletClient, http } from "viem";
|
|
@@ -62,6 +62,7 @@ interface EncodeErc20PermitParams {
|
|
|
62
62
|
* @throws {AddressMismatchError} from `sign()` when `userAddress` differs from `owner`, or when the
|
|
63
63
|
* client account differs from `userAddress`.
|
|
64
64
|
* @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
|
|
65
|
+
* @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
|
|
65
66
|
* @example
|
|
66
67
|
* ```ts
|
|
67
68
|
* import { createWalletClient, http } from "viem";
|
|
@@ -52,6 +52,7 @@ import { validateClientChainId } from "../validateClientChainId.js";
|
|
|
52
52
|
* @throws {AddressMismatchError} from `sign()` when `userAddress` differs from `owner`, or when the
|
|
53
53
|
* client account differs from `userAddress`.
|
|
54
54
|
* @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
|
|
55
|
+
* @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
|
|
55
56
|
* @example
|
|
56
57
|
* ```ts
|
|
57
58
|
* import { createWalletClient, http } from "viem";
|
|
@@ -48,6 +48,7 @@ export interface EncodeErc20Permit2SignatureTransferParams {
|
|
|
48
48
|
* @throws {AddressMismatchError} from `sign()` when the wallet account differs from `userAddress`.
|
|
49
49
|
* @throws {ChainIdMismatchError} from `sign()` when the wallet chain differs from `chainId`.
|
|
50
50
|
* @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
|
|
51
|
+
* @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
|
|
51
52
|
* @example
|
|
52
53
|
* ```ts
|
|
53
54
|
* import { addressesRegistry } from "@morpho-org/blue-sdk";
|
|
@@ -33,6 +33,7 @@ import { ExpiredDeadlineError, InputExceedsMaxError, NonPositiveInputError, } fr
|
|
|
33
33
|
* @throws {AddressMismatchError} from `sign()` when the wallet account differs from `userAddress`.
|
|
34
34
|
* @throws {ChainIdMismatchError} from `sign()` when the wallet chain differs from `chainId`.
|
|
35
35
|
* @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
|
|
36
|
+
* @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
|
|
36
37
|
* @example
|
|
37
38
|
* ```ts
|
|
38
39
|
* import { addressesRegistry } from "@morpho-org/blue-sdk";
|
|
@@ -46,6 +46,7 @@ export interface EncodeVaultSharesPermitParams {
|
|
|
46
46
|
* wallet account differs from `userAddress`.
|
|
47
47
|
* @throws {ChainIdMismatchError} from `sign()` when the wallet targets another chain.
|
|
48
48
|
* @throws {InvalidSignatureError} from `sign()` when signature recovery fails.
|
|
49
|
+
* @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
|
|
49
50
|
* @throws {InvalidPermitDomainChainIdError} when a Vault V1 permit domain targets another chain or omits `chainId`.
|
|
50
51
|
* @throws {InvalidPermitDomainVerifyingContractError} when a Vault V1 permit domain targets another token or omits `verifyingContract`.
|
|
51
52
|
* @throws {UnsupportedPermitDomainExtensionsError} when a Vault V1 permit domain advertises unsupported extensions.
|
|
@@ -33,6 +33,7 @@ import { ExpiredDeadlineError, } from "../../../types/index.js";
|
|
|
33
33
|
* wallet account differs from `userAddress`.
|
|
34
34
|
* @throws {ChainIdMismatchError} from `sign()` when the wallet targets another chain.
|
|
35
35
|
* @throws {InvalidSignatureError} from `sign()` when signature recovery fails.
|
|
36
|
+
* @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
|
|
36
37
|
* @throws {InvalidPermitDomainChainIdError} when a Vault V1 permit domain targets another chain or omits `chainId`.
|
|
37
38
|
* @throws {InvalidPermitDomainVerifyingContractError} when a Vault V1 permit domain targets another token or omits `verifyingContract`.
|
|
38
39
|
* @throws {UnsupportedPermitDomainExtensionsError} when a Vault V1 permit domain advertises unsupported extensions.
|
|
@@ -2,7 +2,8 @@ import { getChainAddress } from "@morpho-org/morpho-ts";
|
|
|
2
2
|
import { encodeFunctionData, isAddressEqual } from "viem";
|
|
3
3
|
import { vaultBundlesV1Abi } from "../../abis.js";
|
|
4
4
|
import { validateUint256Field } from "../../helpers/validate.js";
|
|
5
|
-
import {
|
|
5
|
+
import { validatePositiveInput } from "../../helpers/validatePositiveInput.js";
|
|
6
|
+
import { AmountAndSharesExclusiveError, SameVaultMigrationError, VaultAssetMismatchError, } from "../../types/index.js";
|
|
6
7
|
import { finalizeVaultBundlesV1Transaction, getBundlesReferralFeeAssets, getBundlesSharesPermit, normalizeBundlesCommonParams, } from "../bundles/common.js";
|
|
7
8
|
/**
|
|
8
9
|
* Encodes an assets-or-shares Vault V1 to Vault V2 migration through VaultBundlesV1.
|
|
@@ -86,14 +87,13 @@ export const vaultV1MigrateToV2 = (params) => {
|
|
|
86
87
|
throw new AmountAndSharesExclusiveError();
|
|
87
88
|
}
|
|
88
89
|
const selectedAmount = assets ?? shares ?? 0n;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
90
|
+
const amountField = assets != null ? "assets" : "shares";
|
|
91
|
+
// Validation only; rejects non-positive migration amounts.
|
|
92
|
+
validatePositiveInput(amountField, selectedAmount);
|
|
93
|
+
// Validation only; rejects non-positive share-price bounds.
|
|
94
|
+
validatePositiveInput("maxSharePriceVaultV2", params.args.maxSharePriceVaultV2);
|
|
95
95
|
// Reject ABI overflow with SDK errors before calldata encoding.
|
|
96
|
-
validateUint256Field(
|
|
96
|
+
validateUint256Field(amountField, selectedAmount);
|
|
97
97
|
validateUint256Field("maxSharePriceVaultV2", params.args.maxSharePriceVaultV2);
|
|
98
98
|
const common = normalizeBundlesCommonParams(params.args);
|
|
99
99
|
const spender = getChainAddress(params.vault.chainId, "bundles.vaultBundlesV1");
|
package/lib/esm/blue/abis.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { marketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi,
|
|
2
|
+
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
|
|
3
3
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
4
4
|
preLiquidationAbi,
|
|
5
5
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
package/lib/esm/blue/abis.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { marketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi,
|
|
2
|
+
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
|
|
3
3
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
4
4
|
preLiquidationAbi,
|
|
5
5
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter,
|
|
1
|
+
export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
IPreLiquidationParams,
|
|
4
4
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
5
|
-
IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig,
|
|
6
|
-
export { AccrualPosition, AccrualVault, AccrualVaultV2,
|
|
5
|
+
IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
|
|
6
|
+
export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
|
|
7
7
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
8
8
|
PreLiquidationParams,
|
|
9
9
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
10
|
-
PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig,
|
|
10
|
+
PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
|
package/lib/esm/blue/entities.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AccrualPosition, AccrualVault, AccrualVaultV2,
|
|
1
|
+
export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
PreLiquidationParams,
|
|
4
4
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
5
|
-
PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig,
|
|
5
|
+
PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
|
package/lib/esm/blue/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError,
|
|
1
|
+
export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
|
|
4
|
-
export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError,
|
|
4
|
+
export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
|
package/lib/esm/blue/errors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError,
|
|
1
|
+
export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
|
|
4
|
-
export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError,
|
|
4
|
+
export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
|
package/lib/esm/blue/fetch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter,
|
|
1
|
+
export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
fetchPreLiquidationParams,
|
|
4
4
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
5
|
-
fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData,
|
|
5
|
+
fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
|
package/lib/esm/blue/fetch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter,
|
|
1
|
+
export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
fetchPreLiquidationParams,
|
|
4
4
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
5
|
-
fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData,
|
|
5
|
+
fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
|
package/lib/esm/blue/utils.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export { AdaptiveCurveIrmLib, CapacityLimitReason,
|
|
|
3
3
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
4
4
|
defaultPreLiquidationParamsRegistry,
|
|
5
5
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
6
|
-
getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils,
|
|
6
|
+
getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
7
7
|
export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
package/lib/esm/blue/utils.js
CHANGED
|
@@ -2,5 +2,5 @@ export { AdaptiveCurveIrmLib, CapacityLimitReason,
|
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
defaultPreLiquidationParamsRegistry,
|
|
4
4
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
5
|
-
getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils,
|
|
5
|
+
getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
6
6
|
export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export type { IAccrualPosition as IBlueAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter,
|
|
1
|
+
export type { IAccrualPosition as IBlueAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket as IBlueMarket, IMarketParams as IBlueMarketParams, IPosition as IBluePosition,
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
IPreLiquidationParams as IBluePreLiquidationParams,
|
|
4
4
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
5
|
-
IPreLiquidationPosition as IBluePreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig,
|
|
6
|
-
export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2,
|
|
5
|
+
IPreLiquidationPosition as IBluePreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
|
|
6
|
+
export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
|
|
7
7
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
8
8
|
PreLiquidationParams as BluePreLiquidationParams,
|
|
9
9
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
10
|
-
PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig,
|
|
10
|
+
PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
|
|
11
11
|
export type { AnyTree as MidnightAnyTree, AnyTreeSnapshot as MidnightAnyTreeSnapshot, BuildOfferParams as MidnightBuildOfferParams, CollateralParams as MidnightCollateralParams, EcrecoverTreeCreateRequest as MidnightEcrecoverTreeCreateRequest, 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, PriceRatifierV1TreeCreateRequest as MidnightPriceRatifierV1TreeCreateRequest, RateRatifierV1TreeCreateRequest as MidnightRateRatifierV1TreeCreateRequest, RatifierKind as MidnightRatifierKind, RatifierTreeInput as MidnightRatifierTreeInput, RatifierTypes as MidnightRatifierTypes, SetterTreeCreateRequest as MidnightSetterTreeCreateRequest, SettlementFeeCbps as MidnightSettlementFeeCbps, TreeCreateParams as MidnightTreeCreateParams, TreeCreateRequest as MidnightTreeCreateRequest, TreeData as MidnightTreeData, TreeDescriptor as MidnightTreeDescriptor, TreeEntry as MidnightTreeEntry, TreeInput as MidnightTreeInput, TreeLike as MidnightTreeLike, TreeMempoolValidateParams as MidnightTreeMempoolValidateParams, TreeMempoolValidateRatification as MidnightTreeMempoolValidateRatification, TreeProof as MidnightTreeProof, TreeSnapshot as MidnightTreeSnapshot, TypedRatifierTreeInput as MidnightTypedRatifierTreeInput, TypedTreeMempoolValidateParams as MidnightTypedTreeMempoolValidateParams, } from "@morpho-org/midnight-sdk";
|
|
12
12
|
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";
|
|
13
13
|
export type { BlueActions, BlueTokenRequirementsParams, } from "./blue/index.js";
|
|
14
14
|
export { MorphoBlue } from "./blue/index.js";
|
|
15
|
-
export type { GetOffersDataParams as MidnightGetOffersDataParams, GetPositionDataParams as MidnightGetPositionDataParams, MakeLendParams as MidnightMakeLendParams, MakeOffersOutput as MidnightMakeOffersOutput, MakeOffersParams as MidnightMakeOffersParams, MarketActionParams as MidnightMarketActionParams, MidnightMakerTreeInput, MidnightPositionHealthParams, OffersData as MidnightOffersData, OfferValidationParams as MidnightOfferValidationParams, RedeemParams as MidnightRedeemParams, RepayWithdrawCollateralParams as MidnightRepayWithdrawCollateralParams, SupplyBlueMakeLendParams as MidnightSupplyBlueMakeLendParams, SupplyCollateralMakeBorrowParams as MidnightSupplyCollateralMakeBorrowParams, SupplyCollateralParams as MidnightSupplyCollateralParams, SupplyCollateralTakeBorrowParams as MidnightSupplyCollateralTakeBorrowParams, TakeBorrowParams as MidnightTakeBorrowParams, TakeLendParams as MidnightTakeLendParams, TakeRepayWithdrawCollateralParams as MidnightTakeRepayWithdrawCollateralParams, TakeWithdrawParams as MidnightTakeWithdrawParams, WithdrawCollateralParams as MidnightWithdrawCollateralParams, } from "./midnight/index.js";
|
|
15
|
+
export type { GetOffersDataParams as MidnightGetOffersDataParams, GetPositionDataParams as MidnightGetPositionDataParams, MakeLendParams as MidnightMakeLendParams, MakeOffersOutput as MidnightMakeOffersOutput, MakeOffersParams as MidnightMakeOffersParams, MarketActionParams as MidnightMarketActionParams, MidnightMakerTreeInput, MidnightPositionHealthParams, OffersData as MidnightOffersData, OfferValidationParams as MidnightOfferValidationParams, RedeemParams as MidnightRedeemParams, RepayWithdrawCollateralParams as MidnightRepayWithdrawCollateralParams, SupplyBlueMakeLendParams as MidnightSupplyBlueMakeLendParams, SupplyCollateralBatchParams as MidnightSupplyCollateralBatchParams, SupplyCollateralMakeBorrowParams as MidnightSupplyCollateralMakeBorrowParams, SupplyCollateralParams as MidnightSupplyCollateralParams, SupplyCollateralTakeBorrowParams as MidnightSupplyCollateralTakeBorrowParams, TakeBorrowParams as MidnightTakeBorrowParams, TakeLendParams as MidnightTakeLendParams, TakeRepayWithdrawCollateralParams as MidnightTakeRepayWithdrawCollateralParams, TakeWithdrawParams as MidnightTakeWithdrawParams, WithdrawCollateralBatchParams as MidnightWithdrawCollateralBatchParams, WithdrawCollateralParams as MidnightWithdrawCollateralParams, } from "./midnight/index.js";
|
|
16
16
|
export { type MidnightActionOutput, type MidnightActions, type MidnightRequirementsParams, MorphoMidnight, } from "./midnight/index.js";
|
|
17
17
|
export * from "./requirements/index.js";
|
|
18
18
|
export { MorphoVaultV1 } from "./vaultV1/index.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2,
|
|
1
|
+
export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
|
|
2
2
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
3
3
|
PreLiquidationParams as BluePreLiquidationParams,
|
|
4
4
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
5
|
-
PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig,
|
|
5
|
+
PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
|
|
6
6
|
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";
|
|
7
7
|
export { MorphoBlue } from "./blue/index.js";
|
|
8
8
|
export { MorphoMidnight, } from "./midnight/index.js";
|