@morpho-org/morpho-sdk 8.3.0 → 9.1.0-next.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/MIGRATION-v8-to-v9.md +54 -0
- package/README.md +13 -7
- package/lib/cjs/abis.d.ts +1 -1
- package/lib/cjs/abis.js +5 -1
- package/lib/cjs/actions/bundles/common.d.ts +4 -7
- package/lib/cjs/actions/bundles/common.js +8 -14
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -5
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +1 -8
- package/lib/cjs/actions/midnight/authorization.d.ts +3 -1
- package/lib/cjs/actions/midnight/authorization.js +11 -1
- package/lib/cjs/actions/midnight/cancelAndMake.d.ts +2 -0
- package/lib/cjs/actions/midnight/cancelAndMake.js +10 -2
- package/lib/cjs/actions/midnight/redeem.d.ts +3 -1
- package/lib/cjs/actions/midnight/redeem.js +9 -3
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +1 -0
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +7 -3
- package/lib/cjs/actions/midnight/supplyCollateral.d.ts +4 -1
- package/lib/cjs/actions/midnight/supplyCollateral.js +10 -3
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +3 -1
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +9 -3
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +3 -1
- package/lib/cjs/actions/midnight/takeBorrow.js +9 -3
- package/lib/cjs/actions/midnight/takeLend.d.ts +1 -0
- package/lib/cjs/actions/midnight/takeLend.js +7 -2
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -0
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +8 -2
- package/lib/cjs/actions/midnight/takeWithdraw.d.ts +3 -1
- package/lib/cjs/actions/midnight/takeWithdraw.js +10 -3
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +1 -5
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +5 -7
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +7 -11
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +8 -15
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +5 -10
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +11 -8
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +2 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +5 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +1 -1
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +1 -1
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +4 -4
- package/lib/cjs/actions/vaultV1/withdraw.js +4 -4
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +1 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +1 -1
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +1 -1
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +1 -1
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +4 -4
- package/lib/cjs/actions/vaultV2/withdraw.js +4 -4
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +5 -1
- package/lib/cjs/blue/entities.d.ts +4 -4
- package/lib/cjs/blue/entities.js +3 -1
- package/lib/cjs/blue/errors.d.ts +2 -2
- package/lib/cjs/blue/errors.js +5 -1
- package/lib/cjs/blue/fetch.d.ts +2 -2
- package/lib/cjs/blue/fetch.js +3 -1
- package/lib/cjs/blue/utils.d.ts +1 -1
- package/lib/cjs/blue/utils.js +2 -1
- package/lib/cjs/entities/blue/blue.d.ts +2 -12
- package/lib/cjs/entities/blue/blue.js +0 -4
- package/lib/cjs/entities/index.d.ts +4 -4
- package/lib/cjs/entities/index.js +3 -1
- package/lib/cjs/entities/midnight/midnight.d.ts +63 -18
- package/lib/cjs/entities/midnight/midnight.js +138 -53
- package/lib/cjs/entities/midnight/types.d.ts +3 -10
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +0 -4
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +0 -7
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -14
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -20
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +40 -37
- package/lib/cjs/entities/vaultV1/vaultV1.js +5 -34
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +69 -43
- package/lib/cjs/entities/vaultV2/vaultV2.js +41 -35
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +5 -3
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +9 -3
- package/lib/cjs/errors.d.ts +4 -4
- package/lib/cjs/errors.js +10 -5
- package/lib/cjs/fetch.d.ts +2 -2
- package/lib/cjs/fetch.js +3 -1
- package/lib/cjs/helpers/encodeMidnightCalldata.d.ts +48 -0
- package/lib/cjs/helpers/encodeMidnightCalldata.js +74 -0
- package/lib/cjs/helpers/slippage.d.ts +9 -25
- package/lib/cjs/helpers/slippage.js +10 -27
- package/lib/cjs/helpers/validate.d.ts +1 -0
- package/lib/cjs/helpers/validate.js +5 -0
- package/lib/cjs/helpers/validateMidnightAccount.d.ts +34 -0
- package/lib/cjs/helpers/validateMidnightAccount.js +47 -0
- package/lib/cjs/helpers/validateMidnightAuthorizationTarget.d.ts +1 -0
- package/lib/cjs/helpers/validateMidnightAuthorizationTarget.js +4 -0
- package/lib/cjs/helpers/validateMidnightMarket.d.ts +2 -0
- package/lib/cjs/helpers/validateMidnightMarket.js +5 -0
- package/lib/cjs/helpers/validateMidnightPublication.d.ts +11 -0
- package/lib/cjs/helpers/validateMidnightPublication.js +12 -1
- package/lib/cjs/helpers/validateMidnightReceiver.d.ts +1 -0
- package/lib/cjs/helpers/validateMidnightReceiver.js +8 -0
- package/lib/cjs/helpers/validateTakeableOffers.d.ts +2 -1
- package/lib/cjs/helpers/validateTakeableOffers.js +4 -3
- package/lib/cjs/midnight/errors.d.ts +2 -1
- package/lib/cjs/midnight/errors.js +5 -4
- package/lib/cjs/types/action.d.ts +3 -1
- package/lib/cjs/types/error.d.ts +60 -6
- package/lib/cjs/types/error.js +143 -11
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +4 -2
- package/lib/esm/abis.d.ts +1 -1
- package/lib/esm/abis.js +1 -1
- package/lib/esm/actions/bundles/common.d.ts +4 -7
- package/lib/esm/actions/bundles/common.js +8 -14
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -5
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +2 -9
- package/lib/esm/actions/midnight/authorization.d.ts +3 -1
- package/lib/esm/actions/midnight/authorization.js +12 -2
- package/lib/esm/actions/midnight/cancelAndMake.d.ts +2 -0
- package/lib/esm/actions/midnight/cancelAndMake.js +11 -3
- package/lib/esm/actions/midnight/redeem.d.ts +3 -1
- package/lib/esm/actions/midnight/redeem.js +10 -4
- package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +1 -0
- package/lib/esm/actions/midnight/repayWithdrawCollateral.js +8 -4
- package/lib/esm/actions/midnight/supplyCollateral.d.ts +4 -1
- package/lib/esm/actions/midnight/supplyCollateral.js +11 -4
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +3 -1
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +10 -4
- package/lib/esm/actions/midnight/takeBorrow.d.ts +3 -1
- package/lib/esm/actions/midnight/takeBorrow.js +10 -4
- package/lib/esm/actions/midnight/takeLend.d.ts +1 -0
- package/lib/esm/actions/midnight/takeLend.js +8 -3
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -0
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +9 -3
- package/lib/esm/actions/midnight/takeWithdraw.d.ts +3 -1
- package/lib/esm/actions/midnight/takeWithdraw.js +11 -4
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +1 -5
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +6 -8
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +7 -11
- package/lib/esm/actions/requirements/getRequirementsApproval.js +9 -16
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +5 -10
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +12 -9
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +2 -0
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +5 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +1 -1
- package/lib/esm/actions/vaultV1/inKindRedeem.js +1 -1
- package/lib/esm/actions/vaultV1/withdraw.d.ts +4 -4
- package/lib/esm/actions/vaultV1/withdraw.js +4 -4
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +1 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +1 -1
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +1 -1
- package/lib/esm/actions/vaultV2/inKindRedeem.js +1 -1
- package/lib/esm/actions/vaultV2/withdraw.d.ts +4 -4
- package/lib/esm/actions/vaultV2/withdraw.js +4 -4
- 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/blue/blue.d.ts +2 -12
- package/lib/esm/entities/blue/blue.js +0 -4
- package/lib/esm/entities/index.d.ts +4 -4
- package/lib/esm/entities/index.js +2 -2
- package/lib/esm/entities/midnight/midnight.d.ts +63 -18
- package/lib/esm/entities/midnight/midnight.js +139 -54
- package/lib/esm/entities/midnight/types.d.ts +3 -10
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +0 -4
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +1 -8
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -14
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +9 -21
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +40 -37
- package/lib/esm/entities/vaultV1/vaultV1.js +6 -35
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +69 -43
- package/lib/esm/entities/vaultV2/vaultV2.js +41 -35
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +5 -3
- package/lib/esm/entities/vaultV2BlueReallocationData.js +9 -3
- 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/encodeMidnightCalldata.d.ts +48 -0
- package/lib/esm/helpers/encodeMidnightCalldata.js +69 -0
- package/lib/esm/helpers/slippage.d.ts +9 -25
- package/lib/esm/helpers/slippage.js +9 -25
- package/lib/esm/helpers/validate.d.ts +1 -0
- package/lib/esm/helpers/validate.js +5 -0
- package/lib/esm/helpers/validateMidnightAccount.d.ts +34 -0
- package/lib/esm/helpers/validateMidnightAccount.js +43 -0
- package/lib/esm/helpers/validateMidnightAuthorizationTarget.d.ts +1 -0
- package/lib/esm/helpers/validateMidnightAuthorizationTarget.js +4 -0
- package/lib/esm/helpers/validateMidnightMarket.d.ts +2 -0
- package/lib/esm/helpers/validateMidnightMarket.js +5 -0
- package/lib/esm/helpers/validateMidnightPublication.d.ts +11 -0
- package/lib/esm/helpers/validateMidnightPublication.js +10 -0
- package/lib/esm/helpers/validateMidnightReceiver.d.ts +1 -0
- package/lib/esm/helpers/validateMidnightReceiver.js +8 -0
- package/lib/esm/helpers/validateTakeableOffers.d.ts +2 -1
- package/lib/esm/helpers/validateTakeableOffers.js +4 -3
- package/lib/esm/midnight/errors.d.ts +2 -1
- package/lib/esm/midnight/errors.js +2 -1
- package/lib/esm/types/action.d.ts +3 -1
- package/lib/esm/types/error.d.ts +60 -6
- package/lib/esm/types/error.js +138 -7
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/package.json +8 -7
|
@@ -8,11 +8,6 @@ export interface GetMidnightApprovalRequirementsParams {
|
|
|
8
8
|
readonly owner: Address;
|
|
9
9
|
readonly spender: Address;
|
|
10
10
|
readonly amount: bigint;
|
|
11
|
-
/**
|
|
12
|
-
* Allowance to set when an approval is needed. Defaults to `maxUint256`; must be
|
|
13
|
-
* at least `amount`.
|
|
14
|
-
*/
|
|
15
|
-
readonly approvalAmount?: bigint;
|
|
16
11
|
}
|
|
17
12
|
/**
|
|
18
13
|
* Resolves classic ERC20 approval requirements for a Midnight spender.
|
|
@@ -24,7 +19,7 @@ export interface GetMidnightApprovalRequirementsParams {
|
|
|
24
19
|
* The returned approval sets an unlimited allowance (`maxUint256`, capped per
|
|
25
20
|
* token by `MAX_TOKEN_APPROVALS`) whenever the current allowance is below
|
|
26
21
|
* `amount`, because all of an account's Midnight offers and bundle calls share
|
|
27
|
-
* one allowance per token.
|
|
22
|
+
* one allowance per token.
|
|
28
23
|
*
|
|
29
24
|
* @param params.viemClient - Viem client used to read ERC20 allowance.
|
|
30
25
|
* @param params.chainId - Chain id expected by the viem client.
|
|
@@ -32,14 +27,14 @@ export interface GetMidnightApprovalRequirementsParams {
|
|
|
32
27
|
* @param params.owner - Token owner.
|
|
33
28
|
* @param params.spender - Midnight spender that will pull tokens.
|
|
34
29
|
* @param params.amount - Minimum allowance the spender needs.
|
|
35
|
-
* @param params.approvalAmount - Allowance to approve when one is needed; defaults to `maxUint256` and must be at least `amount`.
|
|
36
30
|
* @returns Approval transactions required for `spender` to pull `amount`.
|
|
37
31
|
* @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId`,
|
|
38
32
|
* another chain than `params.chainId`.
|
|
33
|
+
* @throws {MidnightCalldataEncodingError} when `owner`, `token` or `spender` is not a well-formed address.
|
|
34
|
+
* @throws {MidnightZeroAccountError} when `owner` is the zero address.
|
|
39
35
|
* @throws {viem.BaseError} when the `eth_chainId` request or allowance read fails.
|
|
40
|
-
* @throws {NegativeInputError} when `amount`
|
|
41
|
-
* @throws {InputExceedsMaxError} when `amount`
|
|
42
|
-
* @throws {ApprovalAmountLessThanSpendAmountError} when `approvalAmount < amount`.
|
|
36
|
+
* @throws {NegativeInputError} when `amount` is negative.
|
|
37
|
+
* @throws {InputExceedsMaxError} when `amount` exceeds `maxUint256`.
|
|
43
38
|
* @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not the chain's Midnight or MidnightBundlesV2 deployment.
|
|
44
39
|
* @example
|
|
45
40
|
* ```ts
|
|
@@ -5,6 +5,7 @@ const viem_1 = require("viem");
|
|
|
5
5
|
const actions_1 = require("viem/actions");
|
|
6
6
|
const index_js_1 = require("../../../helpers/index.js");
|
|
7
7
|
const validate_js_1 = require("../../../helpers/validate.js");
|
|
8
|
+
const validateMidnightAccount_js_1 = require("../../../helpers/validateMidnightAccount.js");
|
|
8
9
|
const getRequirementsApproval_js_1 = require("../getRequirementsApproval.js");
|
|
9
10
|
const validateClientChainId_js_1 = require("../validateClientChainId.js");
|
|
10
11
|
/**
|
|
@@ -17,7 +18,7 @@ const validateClientChainId_js_1 = require("../validateClientChainId.js");
|
|
|
17
18
|
* The returned approval sets an unlimited allowance (`maxUint256`, capped per
|
|
18
19
|
* token by `MAX_TOKEN_APPROVALS`) whenever the current allowance is below
|
|
19
20
|
* `amount`, because all of an account's Midnight offers and bundle calls share
|
|
20
|
-
* one allowance per token.
|
|
21
|
+
* one allowance per token.
|
|
21
22
|
*
|
|
22
23
|
* @param params.viemClient - Viem client used to read ERC20 allowance.
|
|
23
24
|
* @param params.chainId - Chain id expected by the viem client.
|
|
@@ -25,14 +26,14 @@ const validateClientChainId_js_1 = require("../validateClientChainId.js");
|
|
|
25
26
|
* @param params.owner - Token owner.
|
|
26
27
|
* @param params.spender - Midnight spender that will pull tokens.
|
|
27
28
|
* @param params.amount - Minimum allowance the spender needs.
|
|
28
|
-
* @param params.approvalAmount - Allowance to approve when one is needed; defaults to `maxUint256` and must be at least `amount`.
|
|
29
29
|
* @returns Approval transactions required for `spender` to pull `amount`.
|
|
30
30
|
* @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId`,
|
|
31
31
|
* another chain than `params.chainId`.
|
|
32
|
+
* @throws {MidnightCalldataEncodingError} when `owner`, `token` or `spender` is not a well-formed address.
|
|
33
|
+
* @throws {MidnightZeroAccountError} when `owner` is the zero address.
|
|
32
34
|
* @throws {viem.BaseError} when the `eth_chainId` request or allowance read fails.
|
|
33
|
-
* @throws {NegativeInputError} when `amount`
|
|
34
|
-
* @throws {InputExceedsMaxError} when `amount`
|
|
35
|
-
* @throws {ApprovalAmountLessThanSpendAmountError} when `approvalAmount < amount`.
|
|
35
|
+
* @throws {NegativeInputError} when `amount` is negative.
|
|
36
|
+
* @throws {InputExceedsMaxError} when `amount` exceeds `maxUint256`.
|
|
36
37
|
* @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not the chain's Midnight or MidnightBundlesV2 deployment.
|
|
37
38
|
* @example
|
|
38
39
|
* ```ts
|
|
@@ -58,10 +59,13 @@ const validateClientChainId_js_1 = require("../validateClientChainId.js");
|
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
61
|
const getMidnightApprovalRequirements = async (params) => {
|
|
62
|
+
// Reject the zero account before reading state for it.
|
|
63
|
+
(0, validateMidnightAccount_js_1.validateMidnightAccount)("owner", params.owner);
|
|
64
|
+
// Reject malformed addresses typed before the spender comparison and the allowance read.
|
|
65
|
+
(0, validateMidnightAccount_js_1.validateMidnightAddress)("token", params.token);
|
|
66
|
+
(0, validateMidnightAccount_js_1.validateMidnightAddress)("spender", params.spender);
|
|
61
67
|
(0, index_js_1.validateChainId)(params.viemClient.chain?.id, params.chainId);
|
|
62
68
|
(0, validate_js_1.validateUint256Field)("amount", params.amount);
|
|
63
|
-
if (params.approvalAmount !== undefined)
|
|
64
|
-
(0, validate_js_1.validateUint256Field)("approvalAmount", params.approvalAmount);
|
|
65
69
|
// Validate the target even when no approval transaction needs to be encoded.
|
|
66
70
|
(0, index_js_1.validateRequirementSpender)({
|
|
67
71
|
chainId: params.chainId,
|
|
@@ -83,7 +87,6 @@ const getMidnightApprovalRequirements = async (params) => {
|
|
|
83
87
|
args: {
|
|
84
88
|
spender: params.spender,
|
|
85
89
|
spendAmount: params.amount,
|
|
86
|
-
approvalAmount: params.approvalAmount ?? viem_1.maxUint256,
|
|
87
90
|
},
|
|
88
91
|
allowances: allowance,
|
|
89
92
|
});
|
|
@@ -23,6 +23,8 @@ export interface GetMidnightAuthorizationRequirementParams {
|
|
|
23
23
|
* @returns Authorization transaction, or `null` when already authorized.
|
|
24
24
|
* @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId`,
|
|
25
25
|
* another chain than `params.chainId`.
|
|
26
|
+
* @throws {MidnightCalldataEncodingError} when `owner` or `authorized` is not a well-formed address.
|
|
27
|
+
* @throws {MidnightZeroAccountError} when `owner` is the zero address.
|
|
26
28
|
* @throws {viem.BaseError} when the `eth_chainId` request or authorization read fails.
|
|
27
29
|
* @throws {UnsupportedMidnightAuthorizationTargetError} when `authorized` is not MidnightBundlesV2.
|
|
28
30
|
* @example
|
|
@@ -6,6 +6,7 @@ const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const actions_1 = require("viem/actions");
|
|
8
8
|
const index_js_1 = require("../../../helpers/index.js");
|
|
9
|
+
const validateMidnightAccount_js_1 = require("../../../helpers/validateMidnightAccount.js");
|
|
9
10
|
const validateMidnightAuthorizationTarget_js_1 = require("../../../helpers/validateMidnightAuthorizationTarget.js");
|
|
10
11
|
const validateClientChainId_js_1 = require("../validateClientChainId.js");
|
|
11
12
|
/**
|
|
@@ -24,6 +25,8 @@ const validateClientChainId_js_1 = require("../validateClientChainId.js");
|
|
|
24
25
|
* @returns Authorization transaction, or `null` when already authorized.
|
|
25
26
|
* @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId`,
|
|
26
27
|
* another chain than `params.chainId`.
|
|
28
|
+
* @throws {MidnightCalldataEncodingError} when `owner` or `authorized` is not a well-formed address.
|
|
29
|
+
* @throws {MidnightZeroAccountError} when `owner` is the zero address.
|
|
27
30
|
* @throws {viem.BaseError} when the `eth_chainId` request or authorization read fails.
|
|
28
31
|
* @throws {UnsupportedMidnightAuthorizationTargetError} when `authorized` is not MidnightBundlesV2.
|
|
29
32
|
* @example
|
|
@@ -49,6 +52,8 @@ const validateClientChainId_js_1 = require("../validateClientChainId.js");
|
|
|
49
52
|
* ```
|
|
50
53
|
*/
|
|
51
54
|
const getMidnightAuthorizationRequirement = async (params) => {
|
|
55
|
+
// Reject the zero account before reading state for it.
|
|
56
|
+
(0, validateMidnightAccount_js_1.validateMidnightAccount)("owner", params.owner);
|
|
52
57
|
(0, index_js_1.validateChainId)(params.viemClient.chain?.id, params.chainId);
|
|
53
58
|
// Reject unknown operators before reading authorization state.
|
|
54
59
|
(0, validateMidnightAuthorizationTarget_js_1.validateMidnightAuthorizationTarget)({
|
|
@@ -31,7 +31,7 @@ export interface VaultV1InKindRedeemParams {
|
|
|
31
31
|
* the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
|
|
32
32
|
* `msg.sender`'s vault shares, so the submitting account must equal this address.
|
|
33
33
|
* @param params.args.deadline - Permit and bundle deadline.
|
|
34
|
-
* @param params.args.requirementSignature - Optional
|
|
34
|
+
* @param params.args.requirementSignature - Optional unlimited Vault V1 shares permit.
|
|
35
35
|
* @param params.metadata - Optional analytics metadata.
|
|
36
36
|
* @returns A deep-frozen `Readonly<Transaction<VaultV1InKindRedeemAction>>` with `to`, `value`,
|
|
37
37
|
* `data`, and the typed action discriminator.
|
|
@@ -23,7 +23,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
23
23
|
* the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
|
|
24
24
|
* `msg.sender`'s vault shares, so the submitting account must equal this address.
|
|
25
25
|
* @param params.args.deadline - Permit and bundle deadline.
|
|
26
|
-
* @param params.args.requirementSignature - Optional
|
|
26
|
+
* @param params.args.requirementSignature - Optional unlimited Vault V1 shares permit.
|
|
27
27
|
* @param params.metadata - Optional analytics metadata.
|
|
28
28
|
* @returns A deep-frozen `Readonly<Transaction<VaultV1InKindRedeemAction>>` with `to`, `value`,
|
|
29
29
|
* `data`, and the typed action discriminator.
|
|
@@ -21,8 +21,8 @@ export interface VaultV1WithdrawParams {
|
|
|
21
21
|
/**
|
|
22
22
|
* Encodes an exact-assets Vault V1 withdrawal through VaultBundlesV1.
|
|
23
23
|
*
|
|
24
|
-
* This low-level builder does not bind `permit.value` to
|
|
25
|
-
* `MorphoVaultV1.withdraw().buildTx()` to validate it against the
|
|
24
|
+
* This low-level builder does not bind `permit.value` to the required share amount; use
|
|
25
|
+
* `MorphoVaultV1.withdraw().buildTx()` to validate it against the minimum derived from the handle's `vaultData`.
|
|
26
26
|
*
|
|
27
27
|
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
28
28
|
* @param params.vault.address - Vault V1 whose shares are burned for the withdrawal.
|
|
@@ -31,7 +31,7 @@ export interface VaultV1WithdrawParams {
|
|
|
31
31
|
* @param params.args.recipient - Unsupported; net assets are always paid to the transaction sender.
|
|
32
32
|
* @param params.args.onBehalf - Unsupported; VaultBundlesV1 always burns the transaction sender's shares.
|
|
33
33
|
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
34
|
-
* and the registered VaultBundlesV1 spender. Omit when the
|
|
34
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance meets the required amount.
|
|
35
35
|
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
36
36
|
* The fee is rounded down and deducted from the gross withdrawn assets.
|
|
37
37
|
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
@@ -60,7 +60,7 @@ export interface VaultV1WithdrawParams {
|
|
|
60
60
|
*
|
|
61
61
|
* export function buildUsdcWithdrawal(userAddress: Address, deadline: bigint) {
|
|
62
62
|
* const vault = "0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB";
|
|
63
|
-
* //
|
|
63
|
+
* // Satisfy the required vault-share allowance before submitting; the entity API derives it.
|
|
64
64
|
* const tx = vaultV1Withdraw({
|
|
65
65
|
* vault: { chainId: mainnet.id, address: vault },
|
|
66
66
|
* args: { amount: 1_000_000n, userAddress, deadline },
|
|
@@ -10,8 +10,8 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
10
10
|
/**
|
|
11
11
|
* Encodes an exact-assets Vault V1 withdrawal through VaultBundlesV1.
|
|
12
12
|
*
|
|
13
|
-
* This low-level builder does not bind `permit.value` to
|
|
14
|
-
* `MorphoVaultV1.withdraw().buildTx()` to validate it against the
|
|
13
|
+
* This low-level builder does not bind `permit.value` to the required share amount; use
|
|
14
|
+
* `MorphoVaultV1.withdraw().buildTx()` to validate it against the minimum derived from the handle's `vaultData`.
|
|
15
15
|
*
|
|
16
16
|
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
17
17
|
* @param params.vault.address - Vault V1 whose shares are burned for the withdrawal.
|
|
@@ -20,7 +20,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
20
20
|
* @param params.args.recipient - Unsupported; net assets are always paid to the transaction sender.
|
|
21
21
|
* @param params.args.onBehalf - Unsupported; VaultBundlesV1 always burns the transaction sender's shares.
|
|
22
22
|
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
23
|
-
* and the registered VaultBundlesV1 spender. Omit when the
|
|
23
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance meets the required amount.
|
|
24
24
|
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
25
25
|
* The fee is rounded down and deducted from the gross withdrawn assets.
|
|
26
26
|
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
@@ -49,7 +49,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
49
49
|
*
|
|
50
50
|
* export function buildUsdcWithdrawal(userAddress: Address, deadline: bigint) {
|
|
51
51
|
* const vault = "0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB";
|
|
52
|
-
* //
|
|
52
|
+
* // Satisfy the required vault-share allowance before submitting; the entity API derives it.
|
|
53
53
|
* const tx = vaultV1Withdraw({
|
|
54
54
|
* vault: { chainId: mainnet.id, address: vault },
|
|
55
55
|
* args: { amount: 1_000_000n, userAddress, deadline },
|
|
@@ -50,7 +50,7 @@ export interface VaultV2ForceWithdrawParams {
|
|
|
50
50
|
* is outside that bound's protection.
|
|
51
51
|
* @param params.args.referralFeeRecipient - Optional referral fee recipient. Defaults to the zero
|
|
52
52
|
* address, which is only valid alongside a zero `referralFeePct`.
|
|
53
|
-
* @param params.args.requirementSignature - Optional
|
|
53
|
+
* @param params.args.requirementSignature - Optional unlimited Vault V2 shares permit.
|
|
54
54
|
* @param params.metadata - Optional analytics metadata.
|
|
55
55
|
* @returns A deep-frozen `Readonly<Transaction<VaultV2ForceWithdrawAction>>` with `to`, `value`,
|
|
56
56
|
* `data`, and the typed action discriminator.
|
|
@@ -40,7 +40,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
40
40
|
* is outside that bound's protection.
|
|
41
41
|
* @param params.args.referralFeeRecipient - Optional referral fee recipient. Defaults to the zero
|
|
42
42
|
* address, which is only valid alongside a zero `referralFeePct`.
|
|
43
|
-
* @param params.args.requirementSignature - Optional
|
|
43
|
+
* @param params.args.requirementSignature - Optional unlimited Vault V2 shares permit.
|
|
44
44
|
* @param params.metadata - Optional analytics metadata.
|
|
45
45
|
* @returns A deep-frozen `Readonly<Transaction<VaultV2ForceWithdrawAction>>` with `to`, `value`,
|
|
46
46
|
* `data`, and the typed action discriminator.
|
|
@@ -34,7 +34,7 @@ export interface VaultV2InKindRedeemParams {
|
|
|
34
34
|
* the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
|
|
35
35
|
* `msg.sender`'s vault shares, so the submitting account must equal this address.
|
|
36
36
|
* @param params.args.deadline - Permit and bundle deadline.
|
|
37
|
-
* @param params.args.requirementSignature - Optional
|
|
37
|
+
* @param params.args.requirementSignature - Optional unlimited Vault V2 shares permit.
|
|
38
38
|
* @param params.metadata - Optional analytics metadata.
|
|
39
39
|
* @returns A deep-frozen `Readonly<Transaction<VaultV2InKindRedeemAction>>` with `to`, `value`,
|
|
40
40
|
* `data`, and the typed action discriminator.
|
|
@@ -25,7 +25,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
25
25
|
* the expected owner of an optional `requirementSignature` permit. VaultExitBundlesV1 burns
|
|
26
26
|
* `msg.sender`'s vault shares, so the submitting account must equal this address.
|
|
27
27
|
* @param params.args.deadline - Permit and bundle deadline.
|
|
28
|
-
* @param params.args.requirementSignature - Optional
|
|
28
|
+
* @param params.args.requirementSignature - Optional unlimited Vault V2 shares permit.
|
|
29
29
|
* @param params.metadata - Optional analytics metadata.
|
|
30
30
|
* @returns A deep-frozen `Readonly<Transaction<VaultV2InKindRedeemAction>>` with `to`, `value`,
|
|
31
31
|
* `data`, and the typed action discriminator.
|
|
@@ -21,8 +21,8 @@ export interface VaultV2WithdrawParams {
|
|
|
21
21
|
/**
|
|
22
22
|
* Encodes an exact-assets Vault V2 withdrawal through VaultBundlesV1.
|
|
23
23
|
*
|
|
24
|
-
* This low-level builder does not bind `permit.value` to
|
|
25
|
-
* `MorphoVaultV2.withdraw().buildTx()` to validate it against the
|
|
24
|
+
* This low-level builder does not bind `permit.value` to the required share amount; use
|
|
25
|
+
* `MorphoVaultV2.withdraw().buildTx()` to validate it against the minimum derived from the handle's `vaultData`.
|
|
26
26
|
*
|
|
27
27
|
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
28
28
|
* @param params.vault.address - Vault V2 whose shares are burned for the withdrawal.
|
|
@@ -31,7 +31,7 @@ export interface VaultV2WithdrawParams {
|
|
|
31
31
|
* @param params.args.recipient - Unsupported; net assets are always paid to the transaction sender.
|
|
32
32
|
* @param params.args.onBehalf - Unsupported; VaultBundlesV1 always burns the transaction sender's shares.
|
|
33
33
|
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
34
|
-
* and the registered VaultBundlesV1 spender. Omit when the
|
|
34
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance meets the required amount.
|
|
35
35
|
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
36
36
|
* The fee is rounded down and deducted from the gross withdrawn assets.
|
|
37
37
|
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
@@ -60,7 +60,7 @@ export interface VaultV2WithdrawParams {
|
|
|
60
60
|
*
|
|
61
61
|
* export function buildUsdcWithdrawal(userAddress: Address, deadline: bigint) {
|
|
62
62
|
* const vault = "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145";
|
|
63
|
-
* //
|
|
63
|
+
* // Satisfy the required vault-share allowance before submitting; the entity API derives it.
|
|
64
64
|
* const tx = vaultV2Withdraw({
|
|
65
65
|
* vault: { chainId: mainnet.id, address: vault },
|
|
66
66
|
* args: { amount: 1_000_000n, userAddress, deadline },
|
|
@@ -10,8 +10,8 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
10
10
|
/**
|
|
11
11
|
* Encodes an exact-assets Vault V2 withdrawal through VaultBundlesV1.
|
|
12
12
|
*
|
|
13
|
-
* This low-level builder does not bind `permit.value` to
|
|
14
|
-
* `MorphoVaultV2.withdraw().buildTx()` to validate it against the
|
|
13
|
+
* This low-level builder does not bind `permit.value` to the required share amount; use
|
|
14
|
+
* `MorphoVaultV2.withdraw().buildTx()` to validate it against the minimum derived from the handle's `vaultData`.
|
|
15
15
|
*
|
|
16
16
|
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
17
17
|
* @param params.vault.address - Vault V2 whose shares are burned for the withdrawal.
|
|
@@ -20,7 +20,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
20
20
|
* @param params.args.recipient - Unsupported; net assets are always paid to the transaction sender.
|
|
21
21
|
* @param params.args.onBehalf - Unsupported; VaultBundlesV1 always burns the transaction sender's shares.
|
|
22
22
|
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
23
|
-
* and the registered VaultBundlesV1 spender. Omit when the
|
|
23
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance meets the required amount.
|
|
24
24
|
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
25
25
|
* The fee is rounded down and deducted from the gross withdrawn assets.
|
|
26
26
|
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
@@ -49,7 +49,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
49
49
|
*
|
|
50
50
|
* export function buildUsdcWithdrawal(userAddress: Address, deadline: bigint) {
|
|
51
51
|
* const vault = "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145";
|
|
52
|
-
* //
|
|
52
|
+
* // Satisfy the required vault-share allowance before submitting; the entity API derives it.
|
|
53
53
|
* const tx = vaultV2Withdraw({
|
|
54
54
|
* vault: { chainId: mainnet.id, address: vault },
|
|
55
55
|
* args: { amount: 1_000_000n, userAddress, deadline },
|
package/lib/cjs/blue/abis.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { marketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
|
|
2
|
+
export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, midnightAdapterAbi, midnightAdapterFactoryAbi, midnightAdapterPriceRatifierV1Abi, midnightAdapterRateRatifierV1Abi, 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/cjs/blue/abis.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.preLiquidationFactoryAbi = exports.preLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.adaptiveCurveIrmAbi = exports.marketParamsAbi = void 0;
|
|
3
|
+
exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.preLiquidationFactoryAbi = exports.preLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.midnightAdapterRateRatifierV1Abi = exports.midnightAdapterPriceRatifierV1Abi = exports.midnightAdapterFactoryAbi = exports.midnightAdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.adaptiveCurveIrmAbi = exports.marketParamsAbi = void 0;
|
|
4
4
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
Object.defineProperty(exports, "marketParamsAbi", { enumerable: true, get: function () { return blue_sdk_1.marketParamsAbi; } });
|
|
6
6
|
var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
@@ -11,6 +11,10 @@ Object.defineProperty(exports, "erc2612Abi", { enumerable: true, get: function (
|
|
|
11
11
|
Object.defineProperty(exports, "erc5267Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.erc5267Abi; } });
|
|
12
12
|
Object.defineProperty(exports, "metaMorphoAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.metaMorphoAbi; } });
|
|
13
13
|
Object.defineProperty(exports, "metaMorphoFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.metaMorphoFactoryAbi; } });
|
|
14
|
+
Object.defineProperty(exports, "midnightAdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.midnightAdapterAbi; } });
|
|
15
|
+
Object.defineProperty(exports, "midnightAdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.midnightAdapterFactoryAbi; } });
|
|
16
|
+
Object.defineProperty(exports, "midnightAdapterPriceRatifierV1Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.midnightAdapterPriceRatifierV1Abi; } });
|
|
17
|
+
Object.defineProperty(exports, "midnightAdapterRateRatifierV1Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.midnightAdapterRateRatifierV1Abi; } });
|
|
14
18
|
Object.defineProperty(exports, "morphoMarketV1AdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.morphoMarketV1AdapterAbi; } });
|
|
15
19
|
Object.defineProperty(exports, "morphoMarketV1AdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.morphoMarketV1AdapterFactoryAbi; } });
|
|
16
20
|
Object.defineProperty(exports, "morphoMarketV1AdapterV2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.morphoMarketV1AdapterV2Abi; } });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
|
|
1
|
+
export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MidnightAdapter, 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, 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,
|
|
5
|
+
IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MidnightAdapter, IVaultV2MidnightAdapterAccrualMarket, IVaultV2MidnightAdapterCollateralParams, IVaultV2MidnightAdapterMarket, IVaultV2MidnightAdapterMarketData, IVaultV2MidnightAdapterMarketState, IVaultV2MidnightAdapterPosition, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, VaultV2MidnightAdapterAccrualMarket, VaultV2MidnightAdapterMarketData, } from "@morpho-org/blue-sdk";
|
|
6
|
+
export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MidnightAdapter, 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, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
|
|
10
|
+
PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MidnightAdapter, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
|
package/lib/cjs/blue/entities.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WrappedToken = exports.VaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoMarketV1AdapterV2 = exports.VaultV2MorphoMarketV1Adapter = exports.VaultV2BluePublicAllocatorConfig = exports.VaultV2BlueMarketPublicAllocatorConfig = exports.VaultV2Adapter = exports.VaultV2 = exports.VaultUser = exports.VaultToken = exports.VaultMarketConfig = exports.VaultMarketAllocation = exports.VaultConfig = exports.Vault = exports.User = exports.Token = exports.PreLiquidationPosition = exports.PreLiquidationParams = exports.Position = exports.MarketParams = exports.Market = exports.Holding = exports.ExchangeRateWrappedToken = exports.Eip5267Domain = exports.ConstantWrappedToken = exports.AssetBalances = exports.AccrualVaultV2MorphoVaultV1Adapter = exports.AccrualVaultV2MorphoMarketV1AdapterV2 = exports.AccrualVaultV2MorphoMarketV1Adapter = exports.AccrualVaultV2 = exports.AccrualVault = exports.AccrualPosition = void 0;
|
|
3
|
+
exports.WrappedToken = exports.VaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoMarketV1AdapterV2 = exports.VaultV2MorphoMarketV1Adapter = exports.VaultV2MidnightAdapter = exports.VaultV2BluePublicAllocatorConfig = exports.VaultV2BlueMarketPublicAllocatorConfig = exports.VaultV2Adapter = exports.VaultV2 = exports.VaultUser = exports.VaultToken = exports.VaultMarketConfig = exports.VaultMarketAllocation = exports.VaultConfig = exports.Vault = exports.User = exports.Token = exports.PreLiquidationPosition = exports.PreLiquidationParams = exports.Position = exports.MarketParams = exports.Market = exports.Holding = exports.ExchangeRateWrappedToken = exports.Eip5267Domain = exports.ConstantWrappedToken = exports.AssetBalances = exports.AccrualVaultV2MorphoVaultV1Adapter = exports.AccrualVaultV2MorphoMarketV1AdapterV2 = exports.AccrualVaultV2MorphoMarketV1Adapter = exports.AccrualVaultV2MidnightAdapter = exports.AccrualVaultV2 = exports.AccrualVault = exports.AccrualPosition = void 0;
|
|
4
4
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
Object.defineProperty(exports, "AccrualPosition", { enumerable: true, get: function () { return blue_sdk_1.AccrualPosition; } });
|
|
6
6
|
Object.defineProperty(exports, "AccrualVault", { enumerable: true, get: function () { return blue_sdk_1.AccrualVault; } });
|
|
7
7
|
Object.defineProperty(exports, "AccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2; } });
|
|
8
|
+
Object.defineProperty(exports, "AccrualVaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MidnightAdapter; } });
|
|
8
9
|
Object.defineProperty(exports, "AccrualVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter; } });
|
|
9
10
|
Object.defineProperty(exports, "AccrualVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2; } });
|
|
10
11
|
Object.defineProperty(exports, "AccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter; } });
|
|
@@ -32,6 +33,7 @@ Object.defineProperty(exports, "VaultV2", { enumerable: true, get: function () {
|
|
|
32
33
|
Object.defineProperty(exports, "VaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Adapter; } });
|
|
33
34
|
Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfig; } });
|
|
34
35
|
Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfig; } });
|
|
36
|
+
Object.defineProperty(exports, "VaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MidnightAdapter; } });
|
|
35
37
|
Object.defineProperty(exports, "VaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoMarketV1Adapter; } });
|
|
36
38
|
Object.defineProperty(exports, "VaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoMarketV1AdapterV2; } });
|
|
37
39
|
Object.defineProperty(exports, "VaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoVaultV1Adapter; } });
|
package/lib/cjs/blue/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
|
|
1
|
+
export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, InvalidPositionAccrualStateError, InvalidPositionLossFactorError, InvalidVaultV2MidnightAdapterMarketsError, 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, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
|
|
4
|
+
export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnresolvedBlockNumberError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
|
package/lib/cjs/blue/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnsupportedPermitDomainExtensionsError = exports.UnnamedAbiOutputsError = exports.UnknownAbiFunctionError = exports.NonTupleReturnValueError = exports.MissingPermitDomainNameError = exports.MarketParamsIdMismatchError = exports.MalformedTokenMetadataError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.InvalidAddressError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
|
|
3
|
+
exports.UnsupportedPermitDomainExtensionsError = exports.UnresolvedBlockNumberError = exports.UnnamedAbiOutputsError = exports.UnknownAbiFunctionError = exports.NonTupleReturnValueError = exports.MissingPermitDomainNameError = exports.MarketParamsIdMismatchError = exports.MalformedTokenMetadataError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidVaultV2MidnightAdapterMarketsError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualStateError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.InvalidAddressError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
|
|
4
4
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
|
|
6
6
|
Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return blue_sdk_1.DivisionByZeroError; } });
|
|
@@ -8,6 +8,9 @@ Object.defineProperty(exports, "IncompleteChainRegistryError", { enumerable: tru
|
|
|
8
8
|
Object.defineProperty(exports, "InvalidAddressError", { enumerable: true, get: function () { return blue_sdk_1.InvalidAddressError; } });
|
|
9
9
|
Object.defineProperty(exports, "InvalidBitLengthError", { enumerable: true, get: function () { return blue_sdk_1.InvalidBitLengthError; } });
|
|
10
10
|
Object.defineProperty(exports, "InvalidMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidMarketParamsError; } });
|
|
11
|
+
Object.defineProperty(exports, "InvalidPositionAccrualStateError", { enumerable: true, get: function () { return blue_sdk_1.InvalidPositionAccrualStateError; } });
|
|
12
|
+
Object.defineProperty(exports, "InvalidPositionLossFactorError", { enumerable: true, get: function () { return blue_sdk_1.InvalidPositionLossFactorError; } });
|
|
13
|
+
Object.defineProperty(exports, "InvalidVaultV2MidnightAdapterMarketsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidVaultV2MidnightAdapterMarketsError; } });
|
|
11
14
|
Object.defineProperty(exports, "RegistryValueAlreadyRegisteredError", { enumerable: true, get: function () { return blue_sdk_1.RegistryValueAlreadyRegisteredError; } });
|
|
12
15
|
Object.defineProperty(exports, "UnknownAddressError", { enumerable: true, get: function () { return blue_sdk_1.UnknownAddressError; } });
|
|
13
16
|
Object.defineProperty(exports, "UnknownDataError", { enumerable: true, get: function () { return blue_sdk_1.UnknownDataError; } });
|
|
@@ -36,4 +39,5 @@ Object.defineProperty(exports, "MissingPermitDomainNameError", { enumerable: tru
|
|
|
36
39
|
Object.defineProperty(exports, "NonTupleReturnValueError", { enumerable: true, get: function () { return blue_sdk_viem_1.NonTupleReturnValueError; } });
|
|
37
40
|
Object.defineProperty(exports, "UnknownAbiFunctionError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnknownAbiFunctionError; } });
|
|
38
41
|
Object.defineProperty(exports, "UnnamedAbiOutputsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnnamedAbiOutputsError; } });
|
|
42
|
+
Object.defineProperty(exports, "UnresolvedBlockNumberError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnresolvedBlockNumberError; } });
|
|
39
43
|
Object.defineProperty(exports, "UnsupportedPermitDomainExtensionsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnsupportedPermitDomainExtensionsError; } });
|
package/lib/cjs/blue/fetch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
|
|
1
|
+
export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MidnightAdapter, 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, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
|
|
5
|
+
fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MidnightAdapter, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
|
package/lib/cjs/blue/fetch.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.fetchVaultMarketConfig = exports.fetchVaultMarketAllocation = exports.fetchVaultConfig = exports.fetchVault = exports.fetchUser = exports.fetchToken = exports.fetchPreLiquidationPosition = exports.fetchPreLiquidationParams = exports.fetchPosition = exports.fetchMarketParams = exports.fetchMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchAccrualPosition = void 0;
|
|
3
|
+
exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2MidnightAdapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.fetchVaultMarketConfig = exports.fetchVaultMarketAllocation = exports.fetchVaultConfig = exports.fetchVault = exports.fetchUser = exports.fetchToken = exports.fetchPreLiquidationPosition = exports.fetchPreLiquidationParams = exports.fetchPosition = exports.fetchMarketParams = exports.fetchMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2MidnightAdapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchAccrualPosition = void 0;
|
|
4
4
|
var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
5
5
|
Object.defineProperty(exports, "fetchAccrualPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualPosition; } });
|
|
6
6
|
Object.defineProperty(exports, "fetchAccrualVault", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVault; } });
|
|
7
7
|
Object.defineProperty(exports, "fetchAccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2; } });
|
|
8
8
|
Object.defineProperty(exports, "fetchAccrualVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2Adapter; } });
|
|
9
|
+
Object.defineProperty(exports, "fetchAccrualVaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MidnightAdapter; } });
|
|
9
10
|
Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoMarketV1Adapter; } });
|
|
10
11
|
Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoMarketV1AdapterV2; } });
|
|
11
12
|
Object.defineProperty(exports, "fetchAccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoVaultV1Adapter; } });
|
|
@@ -29,6 +30,7 @@ Object.defineProperty(exports, "fetchVaultV2Adapter", { enumerable: true, get: f
|
|
|
29
30
|
Object.defineProperty(exports, "fetchVaultV2BlueMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BlueMarketPublicAllocatorConfig; } });
|
|
30
31
|
Object.defineProperty(exports, "fetchVaultV2BluePublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BluePublicAllocatorConfig; } });
|
|
31
32
|
Object.defineProperty(exports, "fetchVaultV2BluePublicAllocatorData", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BluePublicAllocatorData; } });
|
|
33
|
+
Object.defineProperty(exports, "fetchVaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MidnightAdapter; } });
|
|
32
34
|
Object.defineProperty(exports, "fetchVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoMarketV1Adapter; } });
|
|
33
35
|
Object.defineProperty(exports, "fetchVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoMarketV1AdapterV2; } });
|
|
34
36
|
Object.defineProperty(exports, "fetchVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoVaultV1Adapter; } });
|
package/lib/cjs/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, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
6
|
+
getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2MidnightAdapterUtils, 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/cjs/blue/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.MetaMorphoAction = exports.isUndecodableResultError = exports.isTransportError = exports.isContractRevertError = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getAuthorizationTypedData = exports.decodeBytes32String = exports.catchRevertOnly = exports.VaultV2Utils = exports.VaultV2BluePublicAllocatorConfigUtils = exports.VaultV2BlueMarketPublicAllocatorConfigUtils = exports.VaultUtils = exports.SharesMath = exports.MathLib = exports.MarketUtils = exports.getDefaultPreLiquidationParams = exports.defaultPreLiquidationParamsRegistry = exports.CapacityLimitReason = exports.AdaptiveCurveIrmLib = void 0;
|
|
3
|
+
exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.MetaMorphoAction = exports.isUndecodableResultError = exports.isTransportError = exports.isContractRevertError = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getAuthorizationTypedData = exports.decodeBytes32String = exports.catchRevertOnly = exports.VaultV2Utils = exports.VaultV2MidnightAdapterUtils = exports.VaultV2BluePublicAllocatorConfigUtils = exports.VaultV2BlueMarketPublicAllocatorConfigUtils = exports.VaultUtils = exports.SharesMath = exports.MathLib = exports.MarketUtils = exports.getDefaultPreLiquidationParams = exports.defaultPreLiquidationParamsRegistry = exports.CapacityLimitReason = exports.AdaptiveCurveIrmLib = void 0;
|
|
4
4
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
Object.defineProperty(exports, "AdaptiveCurveIrmLib", { enumerable: true, get: function () { return blue_sdk_1.AdaptiveCurveIrmLib; } });
|
|
6
6
|
Object.defineProperty(exports, "CapacityLimitReason", { enumerable: true, get: function () { return blue_sdk_1.CapacityLimitReason; } });
|
|
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "SharesMath", { enumerable: true, get: function (
|
|
|
14
14
|
Object.defineProperty(exports, "VaultUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultUtils; } });
|
|
15
15
|
Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfigUtils; } });
|
|
16
16
|
Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils; } });
|
|
17
|
+
Object.defineProperty(exports, "VaultV2MidnightAdapterUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MidnightAdapterUtils; } });
|
|
17
18
|
Object.defineProperty(exports, "VaultV2Utils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Utils; } });
|
|
18
19
|
var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
19
20
|
Object.defineProperty(exports, "catchRevertOnly", { enumerable: true, get: function () { return blue_sdk_viem_1.catchRevertOnly; } });
|
|
@@ -18,11 +18,6 @@ export interface BlueTokenRequirementsParams {
|
|
|
18
18
|
readonly useSimplePermit?: boolean;
|
|
19
19
|
/** Explicit unused Permit2 SignatureTransfer unordered nonce; defaults to the lowest unused nonce. */
|
|
20
20
|
readonly permit2Nonce?: bigint;
|
|
21
|
-
/**
|
|
22
|
-
* Classic ERC-20 allowance to set when an approval is needed, enabling a reusable approval (for
|
|
23
|
-
* example `maxUint256`). Defaults to the exact pulled amount. Ignored by signature paths.
|
|
24
|
-
*/
|
|
25
|
-
readonly approvalAmount?: bigint;
|
|
26
21
|
}
|
|
27
22
|
/** Action surface for Morpho Blue reads and writes; writes route through BlueBundlesV1. */
|
|
28
23
|
export interface BlueActions {
|
|
@@ -169,7 +164,6 @@ export interface BlueActions {
|
|
|
169
164
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
170
165
|
* @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
|
|
171
166
|
* @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
|
|
172
|
-
* @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when a classic `approvalAmount` is below the funded `assets`.
|
|
173
167
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
174
168
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when the route cannot consume a supplied signature.
|
|
175
169
|
* @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
|
|
@@ -405,8 +399,6 @@ export interface BlueActions {
|
|
|
405
399
|
* @throws {RepayExceedsDebtError} when an exact asset repay exceeds current debt.
|
|
406
400
|
* @throws {RepaySharesExceedDebtError} when non-saturated shares exceed current debt shares.
|
|
407
401
|
* @throws {InputExceedsMaxError} when a fee is out of bounds or a share quote deadline is too far away.
|
|
408
|
-
* @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when a classic
|
|
409
|
-
* `approvalAmount` is below the derived `maxRepayAssets`.
|
|
410
402
|
* @throws {MaxRepayAssetsBelowRepayAssetsError} when a signed share cap no longer covers the fresh quote.
|
|
411
403
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
412
404
|
* @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
|
|
@@ -550,8 +542,8 @@ export interface BlueActions {
|
|
|
550
542
|
* saturated full close; the entity derives `maxRepayAssets` from debt projected through the
|
|
551
543
|
* requested deadline plus the referral fee, and the contract refunds unused funding. A
|
|
552
544
|
* previously signed share-mode cap remains valid when it still covers the fresh derived minimum.
|
|
553
|
-
* Full-repay requirements
|
|
554
|
-
*
|
|
545
|
+
* Full-repay requirements use unlimited classic approvals while the transaction remains bounded
|
|
546
|
+
* by the derived `maxRepayAssets` cap.
|
|
555
547
|
* Share-mode deadlines cannot exceed the two-hour quote horizon. Blue authorization is required
|
|
556
548
|
* only for collateral withdrawal. Pure repay uses `maxLtv = maxUint256`; withdrawals use buffered
|
|
557
549
|
* LLTV. No share-price or `slippageTolerance` input exists.
|
|
@@ -582,8 +574,6 @@ export interface BlueActions {
|
|
|
582
574
|
* @throws {WithdrawMakesPositionUnhealthyError} when the post-repay withdrawal exceeds buffered LLTV.
|
|
583
575
|
* @throws {ExpiredDeadlineError} when the deadline is stale.
|
|
584
576
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD or a share-mode deadline exceeds the funding quote horizon.
|
|
585
|
-
* @throws {ApprovalAmountLessThanSpendAmountError} from `getRequirements()` when a classic
|
|
586
|
-
* `approvalAmount` is below the derived `maxRepayAssets`.
|
|
587
577
|
* @throws {MaxRepayAssetsBelowRepayAssetsError} from `buildTx()` when a previously signed share-mode cap no longer covers the fresh derived minimum.
|
|
588
578
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
589
579
|
* @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
|
|
@@ -87,7 +87,6 @@ class MorphoBlue {
|
|
|
87
87
|
supportDeployless: this.client.options.supportDeployless,
|
|
88
88
|
useSimplePermit: params.useSimplePermit,
|
|
89
89
|
permit2Nonce: params.permit2Nonce,
|
|
90
|
-
approvalAmount: params.approvalAmount,
|
|
91
90
|
now: params.now,
|
|
92
91
|
});
|
|
93
92
|
}
|
|
@@ -147,7 +146,6 @@ class MorphoBlue {
|
|
|
147
146
|
now,
|
|
148
147
|
useSimplePermit: requirementsParams?.useSimplePermit,
|
|
149
148
|
permit2Nonce: requirementsParams?.permit2Nonce,
|
|
150
|
-
approvalAmount: requirementsParams?.approvalAmount,
|
|
151
149
|
});
|
|
152
150
|
});
|
|
153
151
|
},
|
|
@@ -485,7 +483,6 @@ class MorphoBlue {
|
|
|
485
483
|
? this.getTokenRequirements({
|
|
486
484
|
token: this.marketParams.loanToken,
|
|
487
485
|
amount: maxRepayAssets,
|
|
488
|
-
approvalAmount: requirementsParams?.approvalAmount,
|
|
489
486
|
userAddress,
|
|
490
487
|
deadline,
|
|
491
488
|
now,
|
|
@@ -597,7 +594,6 @@ class MorphoBlue {
|
|
|
597
594
|
? this.getTokenRequirements({
|
|
598
595
|
token: this.marketParams.collateralToken,
|
|
599
596
|
amount: collateralAssets,
|
|
600
|
-
approvalAmount: requirementsParams?.approvalAmount,
|
|
601
597
|
userAddress,
|
|
602
598
|
deadline,
|
|
603
599
|
now,
|