@morpho-org/morpho-sdk 7.1.0-next.1 → 8.1.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-v7-to-v8.md +290 -0
- package/README.md +11 -6
- package/lib/cjs/abis.d.ts +1 -1
- package/lib/cjs/abis.js +1 -5
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +2 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +2 -0
- package/lib/cjs/actions/midnight/cancelAndMake.d.ts +17 -71
- package/lib/cjs/actions/midnight/cancelAndMake.js +41 -29
- package/lib/cjs/actions/midnight/redeem.d.ts +8 -1
- package/lib/cjs/actions/midnight/redeem.js +18 -1
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +19 -3
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +24 -2
- package/lib/cjs/actions/midnight/supplyCollateral.d.ts +1 -0
- package/lib/cjs/actions/midnight/supplyCollateral.js +3 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +21 -6
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +49 -14
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +18 -5
- package/lib/cjs/actions/midnight/takeBorrow.js +44 -12
- package/lib/cjs/actions/midnight/takeLend.d.ts +10 -5
- package/lib/cjs/actions/midnight/takeLend.js +27 -9
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -7
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +51 -27
- package/lib/cjs/actions/midnight/takeWithdraw.d.ts +14 -5
- package/lib/cjs/actions/midnight/takeWithdraw.js +40 -9
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -2
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +11 -6
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +3 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +2 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +13 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +17 -6
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +3 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +2 -1
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +5 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +4 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +3 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +5 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +3 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +5 -1
- package/lib/cjs/actions/requirements/validateClientChainId.d.ts +26 -0
- package/lib/cjs/actions/requirements/validateClientChainId.js +34 -0
- 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 +3 -5
- package/lib/cjs/blue/fetch.d.ts +2 -2
- package/lib/cjs/blue/fetch.js +1 -3
- package/lib/cjs/blue/types.d.ts +1 -1
- package/lib/cjs/blue/utils.d.ts +2 -2
- package/lib/cjs/blue/utils.js +5 -2
- package/lib/cjs/entities/blue/blue.d.ts +109 -27
- package/lib/cjs/entities/blue/blue.js +103 -28
- package/lib/cjs/entities/index.d.ts +5 -5
- package/lib/cjs/entities/index.js +1 -3
- package/lib/cjs/entities/midnight/deadline.d.ts +15 -0
- package/lib/cjs/entities/midnight/deadline.js +24 -0
- package/lib/cjs/entities/midnight/midnight.d.ts +427 -72
- package/lib/cjs/entities/midnight/midnight.js +864 -186
- package/lib/cjs/entities/midnight/publication.d.ts +134 -0
- package/lib/cjs/entities/midnight/publication.js +404 -0
- package/lib/cjs/entities/midnight/types.d.ts +26 -5
- package/lib/cjs/entities/requirements/assertContractCode.d.ts +49 -0
- package/lib/cjs/entities/requirements/assertContractCode.js +79 -0
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +19 -4
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +45 -18
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.d.ts +3 -2
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.js +5 -2
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -1
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -2
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +63 -11
- package/lib/cjs/entities/vaultV1/vaultV1.js +52 -15
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +62 -44
- package/lib/cjs/entities/vaultV2/vaultV2.js +53 -48
- 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 +7 -10
- package/lib/cjs/fetch.d.ts +2 -2
- package/lib/cjs/fetch.js +1 -3
- package/lib/cjs/helpers/constant.d.ts +5 -0
- package/lib/cjs/helpers/constant.js +6 -1
- package/lib/cjs/helpers/index.d.ts +1 -1
- package/lib/cjs/helpers/index.js +2 -1
- package/lib/cjs/helpers/validate.d.ts +163 -8
- package/lib/cjs/helpers/validate.js +179 -8
- package/lib/cjs/helpers/validateMidnightBounds.d.ts +47 -0
- package/lib/cjs/helpers/validateMidnightBounds.js +79 -0
- package/lib/cjs/helpers/validateMidnightPublication.d.ts +12 -0
- package/lib/cjs/helpers/validateMidnightPublication.js +144 -0
- package/lib/cjs/helpers/validateMidnightReceiver.d.ts +29 -0
- package/lib/cjs/helpers/validateMidnightReceiver.js +84 -0
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.d.ts +102 -0
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +231 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +3 -0
- package/lib/cjs/midnight/errors.d.ts +1 -2
- package/lib/cjs/midnight/errors.js +4 -5
- package/lib/cjs/types/error.d.ts +197 -4
- package/lib/cjs/types/error.js +265 -5
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +1 -0
- package/lib/cjs/types/midnightCancelAndMake.d.ts +70 -0
- package/lib/cjs/types/midnightCancelAndMake.js +2 -0
- package/lib/cjs/types/midnightPublicationError.d.ts +332 -0
- package/lib/cjs/types/midnightPublicationError.js +376 -0
- package/lib/cjs/types.d.ts +1 -1
- package/lib/cjs/utils.d.ts +4 -3
- package/lib/cjs/utils.js +8 -4
- package/lib/esm/abis.d.ts +1 -1
- package/lib/esm/abis.js +1 -1
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +2 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +2 -0
- package/lib/esm/actions/midnight/cancelAndMake.d.ts +17 -71
- package/lib/esm/actions/midnight/cancelAndMake.js +42 -30
- package/lib/esm/actions/midnight/redeem.d.ts +8 -1
- package/lib/esm/actions/midnight/redeem.js +18 -1
- package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +19 -3
- package/lib/esm/actions/midnight/repayWithdrawCollateral.js +24 -2
- package/lib/esm/actions/midnight/supplyCollateral.d.ts +1 -0
- package/lib/esm/actions/midnight/supplyCollateral.js +3 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +21 -6
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +52 -17
- package/lib/esm/actions/midnight/takeBorrow.d.ts +18 -5
- package/lib/esm/actions/midnight/takeBorrow.js +47 -15
- package/lib/esm/actions/midnight/takeLend.d.ts +10 -5
- package/lib/esm/actions/midnight/takeLend.js +27 -9
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -7
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +52 -28
- package/lib/esm/actions/midnight/takeWithdraw.d.ts +14 -5
- package/lib/esm/actions/midnight/takeWithdraw.js +41 -10
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -2
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +13 -8
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +3 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +2 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +13 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +17 -6
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +3 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +2 -1
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +5 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +4 -1
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +3 -1
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +5 -1
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +3 -1
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +5 -1
- package/lib/esm/actions/requirements/validateClientChainId.d.ts +26 -0
- package/lib/esm/actions/requirements/validateClientChainId.js +30 -0
- 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/types.d.ts +1 -1
- package/lib/esm/blue/utils.d.ts +2 -2
- package/lib/esm/blue/utils.js +2 -2
- package/lib/esm/entities/blue/blue.d.ts +109 -27
- package/lib/esm/entities/blue/blue.js +104 -29
- package/lib/esm/entities/index.d.ts +5 -5
- package/lib/esm/entities/index.js +2 -2
- package/lib/esm/entities/midnight/deadline.d.ts +15 -0
- package/lib/esm/entities/midnight/deadline.js +20 -0
- package/lib/esm/entities/midnight/midnight.d.ts +427 -72
- package/lib/esm/entities/midnight/midnight.js +865 -187
- package/lib/esm/entities/midnight/publication.d.ts +134 -0
- package/lib/esm/entities/midnight/publication.js +397 -0
- package/lib/esm/entities/midnight/types.d.ts +26 -5
- package/lib/esm/entities/requirements/assertContractCode.d.ts +49 -0
- package/lib/esm/entities/requirements/assertContractCode.js +74 -0
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +19 -4
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +47 -20
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.d.ts +3 -2
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.js +5 -2
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -1
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +8 -2
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +63 -11
- package/lib/esm/entities/vaultV1/vaultV1.js +53 -16
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +62 -44
- package/lib/esm/entities/vaultV2/vaultV2.js +54 -49
- 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/constant.d.ts +5 -0
- package/lib/esm/helpers/constant.js +5 -0
- package/lib/esm/helpers/index.d.ts +1 -1
- package/lib/esm/helpers/index.js +1 -1
- package/lib/esm/helpers/validate.d.ts +163 -8
- package/lib/esm/helpers/validate.js +177 -7
- package/lib/esm/helpers/validateMidnightBounds.d.ts +47 -0
- package/lib/esm/helpers/validateMidnightBounds.js +72 -0
- package/lib/esm/helpers/validateMidnightPublication.d.ts +12 -0
- package/lib/esm/helpers/validateMidnightPublication.js +139 -0
- package/lib/esm/helpers/validateMidnightReceiver.d.ts +29 -0
- package/lib/esm/helpers/validateMidnightReceiver.js +80 -0
- package/lib/esm/helpers/validateMidnightTakeFeasibility.d.ts +102 -0
- package/lib/esm/helpers/validateMidnightTakeFeasibility.js +226 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/midnight/errors.d.ts +1 -2
- package/lib/esm/midnight/errors.js +1 -2
- package/lib/esm/types/error.d.ts +197 -4
- package/lib/esm/types/error.js +253 -2
- package/lib/esm/types/index.d.ts +1 -0
- package/lib/esm/types/index.js +1 -0
- package/lib/esm/types/midnightCancelAndMake.d.ts +70 -0
- package/lib/esm/types/midnightCancelAndMake.js +1 -0
- package/lib/esm/types/midnightPublicationError.d.ts +332 -0
- package/lib/esm/types/midnightPublicationError.js +359 -0
- package/lib/esm/types.d.ts +1 -1
- package/lib/esm/utils.d.ts +4 -3
- package/lib/esm/utils.js +4 -3
- package/package.json +9 -8
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MidnightOfferCallbackNotSupportedError = exports.MidnightMarketOracleWithoutCodeError = exports.MidnightMarketLiquidationCursorNotEnabledError = exports.MidnightMarketLltvNotEnabledError = exports.MidnightMarketMaturityTooFarError = exports.MidnightOfferNoCreditError = exports.MidnightOfferNoDebtError = exports.MidnightOfferRateBoundUnreachableError = exports.MidnightOfferZeroPriceSellError = exports.MidnightOfferContinuousFeeCapBelowMarketFeeError = exports.MidnightOfferTickSpacingError = exports.MidnightOfferGroupConsumedError = exports.MidnightOfferExpiryAfterMaturityError = exports.MidnightOfferExpiredError = void 0;
|
|
4
|
+
/** Thrown when a maker offer expires at or before the pinned publication timestamp.
|
|
5
|
+
*
|
|
6
|
+
* @throws {MidnightOfferExpiredError} when expiry is not later than the pinned publication timestamp.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { MidnightOfferExpiredError } from "@morpho-org/morpho-sdk";
|
|
11
|
+
* const error = new MidnightOfferExpiredError({ index: 0, expiry: 10n, now: 10n });
|
|
12
|
+
* console.log(error.message);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
class MidnightOfferExpiredError extends Error {
|
|
16
|
+
/** Creates an expiry error. */
|
|
17
|
+
constructor(params) {
|
|
18
|
+
super(`Midnight offer "${params.index}" expires at "${params.expiry}", which is not after publication timestamp "${params.now}". Choose a future expiry.`);
|
|
19
|
+
this.index = params.index;
|
|
20
|
+
this.expiry = params.expiry;
|
|
21
|
+
this.now = params.now;
|
|
22
|
+
this.name = "MidnightOfferExpiredError";
|
|
23
|
+
}
|
|
24
|
+
/** Offer index in its tree. */
|
|
25
|
+
index;
|
|
26
|
+
/** Offer expiry timestamp. */
|
|
27
|
+
expiry;
|
|
28
|
+
/** Pinned publication timestamp. */
|
|
29
|
+
now;
|
|
30
|
+
}
|
|
31
|
+
exports.MidnightOfferExpiredError = MidnightOfferExpiredError;
|
|
32
|
+
/** Thrown when an offer expires after its market matures.
|
|
33
|
+
*
|
|
34
|
+
* @throws {MidnightOfferExpiryAfterMaturityError} when expiry exceeds market maturity.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { MidnightOfferExpiryAfterMaturityError } from "@morpho-org/morpho-sdk";
|
|
39
|
+
* const error = new MidnightOfferExpiryAfterMaturityError({ index: 0, expiry: 20n, maturity: 10n });
|
|
40
|
+
* console.log(error.message);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
class MidnightOfferExpiryAfterMaturityError extends Error {
|
|
44
|
+
/** Creates an expiry-after-maturity error. */
|
|
45
|
+
constructor(params) {
|
|
46
|
+
super(`Midnight offer "${params.index}" expires at "${params.expiry}", after market maturity "${params.maturity}". Choose an expiry at or before maturity.`);
|
|
47
|
+
this.index = params.index;
|
|
48
|
+
this.expiry = params.expiry;
|
|
49
|
+
this.maturity = params.maturity;
|
|
50
|
+
this.name = "MidnightOfferExpiryAfterMaturityError";
|
|
51
|
+
}
|
|
52
|
+
/** Offer index in its tree. */
|
|
53
|
+
index;
|
|
54
|
+
/** Offer expiry timestamp. */
|
|
55
|
+
expiry;
|
|
56
|
+
/** Market maturity timestamp. */
|
|
57
|
+
maturity;
|
|
58
|
+
}
|
|
59
|
+
exports.MidnightOfferExpiryAfterMaturityError = MidnightOfferExpiryAfterMaturityError;
|
|
60
|
+
/** Thrown when a maker's offer group has no remaining consumable units.
|
|
61
|
+
*
|
|
62
|
+
* @throws {MidnightOfferGroupConsumedError} when the group's remaining cap is zero.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { MidnightOfferGroupConsumedError } from "@morpho-org/morpho-sdk";
|
|
67
|
+
* const error = new MidnightOfferGroupConsumedError({ index: 0, group: `0x${"00".repeat(32)}`, consumed: 1n });
|
|
68
|
+
* console.log(error.message);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
class MidnightOfferGroupConsumedError extends Error {
|
|
72
|
+
/** Creates a consumed-group error. */
|
|
73
|
+
constructor(params) {
|
|
74
|
+
super(`Midnight offer "${params.index}" uses group "${params.group}" with consumed cap "${params.consumed}" and no remaining units. Rebuild the offers with a fresh group.`);
|
|
75
|
+
this.index = params.index;
|
|
76
|
+
this.group = params.group;
|
|
77
|
+
this.consumed = params.consumed;
|
|
78
|
+
this.name = "MidnightOfferGroupConsumedError";
|
|
79
|
+
}
|
|
80
|
+
/** Offer index in its tree. */
|
|
81
|
+
index;
|
|
82
|
+
/** Consumed group identifier. */
|
|
83
|
+
group;
|
|
84
|
+
/** Onchain consumed cap. */
|
|
85
|
+
consumed;
|
|
86
|
+
}
|
|
87
|
+
exports.MidnightOfferGroupConsumedError = MidnightOfferGroupConsumedError;
|
|
88
|
+
/** Thrown when an offer tick is not aligned with its market's spacing.
|
|
89
|
+
*
|
|
90
|
+
* @throws {MidnightOfferTickSpacingError} when the tick is not accessible.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* import { MidnightOfferTickSpacingError } from "@morpho-org/morpho-sdk";
|
|
95
|
+
* const error = new MidnightOfferTickSpacingError({ index: 0, tick: 5n, tickSpacing: 4 });
|
|
96
|
+
* console.log(error.message);
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
class MidnightOfferTickSpacingError extends Error {
|
|
100
|
+
/** Creates a tick-spacing error. */
|
|
101
|
+
constructor(params) {
|
|
102
|
+
super(`Midnight offer "${params.index}" tick "${params.tick}" is not aligned to spacing "${params.tickSpacing}". Rebuild it on an accessible tick.`);
|
|
103
|
+
this.index = params.index;
|
|
104
|
+
this.tick = params.tick;
|
|
105
|
+
this.tickSpacing = params.tickSpacing;
|
|
106
|
+
this.name = "MidnightOfferTickSpacingError";
|
|
107
|
+
}
|
|
108
|
+
/** Offer index in its tree. */
|
|
109
|
+
index;
|
|
110
|
+
/** Offer tick. */
|
|
111
|
+
tick;
|
|
112
|
+
/** Onchain market tick spacing. */
|
|
113
|
+
tickSpacing;
|
|
114
|
+
}
|
|
115
|
+
exports.MidnightOfferTickSpacingError = MidnightOfferTickSpacingError;
|
|
116
|
+
/** Thrown when the market continuous fee exceeds an offer's fee cap.
|
|
117
|
+
*
|
|
118
|
+
* @throws {MidnightOfferContinuousFeeCapBelowMarketFeeError} when the market fee exceeds the offer cap.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* import { MidnightOfferContinuousFeeCapBelowMarketFeeError } from "@morpho-org/morpho-sdk";
|
|
123
|
+
* const error = new MidnightOfferContinuousFeeCapBelowMarketFeeError({ index: 0, marketId: `0x${"00".repeat(32)}`, continuousFeeCap: 0n, continuousFee: 1n });
|
|
124
|
+
* console.log(error.message);
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
class MidnightOfferContinuousFeeCapBelowMarketFeeError extends Error {
|
|
128
|
+
/** Creates a continuous-fee error. */
|
|
129
|
+
constructor(params) {
|
|
130
|
+
super(`Midnight offer "${params.index}" for market "${params.marketId}" accepts continuous fee up to "${params.continuousFeeCap}", below market fee "${params.continuousFee}". Use a market with a fee within the offer cap.`);
|
|
131
|
+
this.index = params.index;
|
|
132
|
+
this.marketId = params.marketId;
|
|
133
|
+
this.continuousFeeCap = params.continuousFeeCap;
|
|
134
|
+
this.continuousFee = params.continuousFee;
|
|
135
|
+
this.name = "MidnightOfferContinuousFeeCapBelowMarketFeeError";
|
|
136
|
+
}
|
|
137
|
+
/** Offer index in its tree. */
|
|
138
|
+
index;
|
|
139
|
+
/** Midnight market identifier. */
|
|
140
|
+
marketId;
|
|
141
|
+
/** Maximum continuous fee accepted by the offer. */
|
|
142
|
+
continuousFeeCap;
|
|
143
|
+
/** Current market continuous fee. */
|
|
144
|
+
continuousFee;
|
|
145
|
+
}
|
|
146
|
+
exports.MidnightOfferContinuousFeeCapBelowMarketFeeError = MidnightOfferContinuousFeeCapBelowMarketFeeError;
|
|
147
|
+
/** Thrown when a sell offer has zero price.
|
|
148
|
+
*
|
|
149
|
+
* @throws {MidnightOfferZeroPriceSellError} when a sell offer has a zero tick.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* import { MidnightOfferZeroPriceSellError } from "@morpho-org/morpho-sdk";
|
|
154
|
+
* const error = new MidnightOfferZeroPriceSellError({ index: 0 });
|
|
155
|
+
* console.log(error.message);
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
class MidnightOfferZeroPriceSellError extends Error {
|
|
159
|
+
/** Creates a zero-price sell error. */
|
|
160
|
+
constructor(params) {
|
|
161
|
+
super(`Midnight sell offer "${params.index}" has tick "0" and would sell credit for no proceeds. Choose a positive tick.`);
|
|
162
|
+
this.index = params.index;
|
|
163
|
+
this.name = "MidnightOfferZeroPriceSellError";
|
|
164
|
+
}
|
|
165
|
+
/** Offer index in its tree. */
|
|
166
|
+
index;
|
|
167
|
+
}
|
|
168
|
+
exports.MidnightOfferZeroPriceSellError = MidnightOfferZeroPriceSellError;
|
|
169
|
+
/** Thrown when a Rate V1 offer's price bound cannot become fillable.
|
|
170
|
+
*
|
|
171
|
+
* @throws {MidnightOfferRateBoundUnreachableError} when the bound cannot become fillable.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* import { MidnightOfferRateBoundUnreachableError } from "@morpho-org/morpho-sdk";
|
|
176
|
+
* const error = new MidnightOfferRateBoundUnreachableError({ index: 0, rate: 1n, tick: 5n });
|
|
177
|
+
* console.log(error.message);
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
class MidnightOfferRateBoundUnreachableError extends Error {
|
|
181
|
+
/** Creates an unreachable-rate-bound error. */
|
|
182
|
+
constructor(params) {
|
|
183
|
+
super(`Midnight Rate V1 offer "${params.index}" at tick "${params.tick}" cannot satisfy rate bound "${params.rate}" before its best fill time. Choose a reachable tick or rate.`);
|
|
184
|
+
this.index = params.index;
|
|
185
|
+
this.rate = params.rate;
|
|
186
|
+
this.tick = params.tick;
|
|
187
|
+
this.name = "MidnightOfferRateBoundUnreachableError";
|
|
188
|
+
}
|
|
189
|
+
/** Offer index in its tree. */
|
|
190
|
+
index;
|
|
191
|
+
/** Rate V1 entry rate. */
|
|
192
|
+
rate;
|
|
193
|
+
/** Offer tick. */
|
|
194
|
+
tick;
|
|
195
|
+
}
|
|
196
|
+
exports.MidnightOfferRateBoundUnreachableError = MidnightOfferRateBoundUnreachableError;
|
|
197
|
+
/** Thrown when a reduce-only buy offer has no debt to repay.
|
|
198
|
+
*
|
|
199
|
+
* @throws {MidnightOfferNoDebtError} when a reduce-only buy has no maker debt.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* import { MidnightOfferNoDebtError } from "@morpho-org/morpho-sdk";
|
|
204
|
+
* const error = new MidnightOfferNoDebtError({ index: 0, marketId: `0x${"00".repeat(32)}` });
|
|
205
|
+
* console.log(error.message);
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
class MidnightOfferNoDebtError extends Error {
|
|
209
|
+
/** Creates a no-debt error. */
|
|
210
|
+
constructor(params) {
|
|
211
|
+
super(`Midnight reduce-only buy offer "${params.index}" for market "${params.marketId}" has no maker debt to repay. Use a market where the maker has debt.`);
|
|
212
|
+
this.index = params.index;
|
|
213
|
+
this.marketId = params.marketId;
|
|
214
|
+
this.name = "MidnightOfferNoDebtError";
|
|
215
|
+
}
|
|
216
|
+
/** Offer index in its tree. */
|
|
217
|
+
index;
|
|
218
|
+
/** Midnight market identifier. */
|
|
219
|
+
marketId;
|
|
220
|
+
}
|
|
221
|
+
exports.MidnightOfferNoDebtError = MidnightOfferNoDebtError;
|
|
222
|
+
/** Thrown when a reduce-only sell offer has no credit to withdraw.
|
|
223
|
+
*
|
|
224
|
+
* @throws {MidnightOfferNoCreditError} when a reduce-only sell has no maker credit.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* import { MidnightOfferNoCreditError } from "@morpho-org/morpho-sdk";
|
|
229
|
+
* const error = new MidnightOfferNoCreditError({ index: 0, marketId: `0x${"00".repeat(32)}` });
|
|
230
|
+
* console.log(error.message);
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
class MidnightOfferNoCreditError extends Error {
|
|
234
|
+
/** Creates a no-credit error. */
|
|
235
|
+
constructor(params) {
|
|
236
|
+
super(`Midnight reduce-only sell offer "${params.index}" for market "${params.marketId}" has no maker credit to withdraw. Use a market where the maker has credit.`);
|
|
237
|
+
this.index = params.index;
|
|
238
|
+
this.marketId = params.marketId;
|
|
239
|
+
this.name = "MidnightOfferNoCreditError";
|
|
240
|
+
}
|
|
241
|
+
/** Offer index in its tree. */
|
|
242
|
+
index;
|
|
243
|
+
/** Midnight market identifier. */
|
|
244
|
+
marketId;
|
|
245
|
+
}
|
|
246
|
+
exports.MidnightOfferNoCreditError = MidnightOfferNoCreditError;
|
|
247
|
+
/** Thrown when an uncreated market's maturity is more than 100 years after its latest possible
|
|
248
|
+
* market creation time.
|
|
249
|
+
*
|
|
250
|
+
* @throws {MidnightMarketMaturityTooFarError} when an uncreated market's maturity exceeds the
|
|
251
|
+
* latest possible market creation time by more than 100 years.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* import { MidnightMarketMaturityTooFarError } from "@morpho-org/morpho-sdk";
|
|
256
|
+
* const error = new MidnightMarketMaturityTooFarError({ index: 0, maturity: 1_000n, maxMaturity: 500n });
|
|
257
|
+
* console.log(error.message);
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
class MidnightMarketMaturityTooFarError extends Error {
|
|
261
|
+
/** Creates a maturity-range error. */
|
|
262
|
+
constructor(params) {
|
|
263
|
+
super(`Midnight offer "${params.index}" market maturity "${params.maturity}" exceeds maximum "${params.maxMaturity}" for an uncreated market. Choose a maturity at or before "${params.maxMaturity}".`);
|
|
264
|
+
this.index = params.index;
|
|
265
|
+
this.maturity = params.maturity;
|
|
266
|
+
this.maxMaturity = params.maxMaturity;
|
|
267
|
+
this.name = "MidnightMarketMaturityTooFarError";
|
|
268
|
+
}
|
|
269
|
+
/** Offer index in its tree. */
|
|
270
|
+
index;
|
|
271
|
+
/** Market maturity timestamp. */
|
|
272
|
+
maturity;
|
|
273
|
+
/** Latest allowed maturity timestamp. */
|
|
274
|
+
maxMaturity;
|
|
275
|
+
}
|
|
276
|
+
exports.MidnightMarketMaturityTooFarError = MidnightMarketMaturityTooFarError;
|
|
277
|
+
/** Thrown when an uncreated market uses a disabled LLTV.
|
|
278
|
+
*
|
|
279
|
+
* @throws {MidnightMarketLltvNotEnabledError} when the market LLTV is disabled.
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* import { MidnightMarketLltvNotEnabledError } from "@morpho-org/morpho-sdk";
|
|
284
|
+
* const error = new MidnightMarketLltvNotEnabledError({ index: 0, lltv: 1n });
|
|
285
|
+
* console.log(error.message);
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
class MidnightMarketLltvNotEnabledError extends Error {
|
|
289
|
+
/** Creates a disabled-LLTV error. */
|
|
290
|
+
constructor(params) {
|
|
291
|
+
super(`Midnight offer "${params.index}" uses disabled LLTV "${params.lltv}" for an uncreated market. Choose an enabled LLTV.`);
|
|
292
|
+
this.index = params.index;
|
|
293
|
+
this.lltv = params.lltv;
|
|
294
|
+
this.name = "MidnightMarketLltvNotEnabledError";
|
|
295
|
+
}
|
|
296
|
+
/** Offer index in its tree. */
|
|
297
|
+
index;
|
|
298
|
+
/** Disabled LLTV value. */
|
|
299
|
+
lltv;
|
|
300
|
+
}
|
|
301
|
+
exports.MidnightMarketLltvNotEnabledError = MidnightMarketLltvNotEnabledError;
|
|
302
|
+
/** Thrown when an uncreated market uses a disabled liquidation cursor.
|
|
303
|
+
*
|
|
304
|
+
* @throws {MidnightMarketLiquidationCursorNotEnabledError} when the liquidation cursor is disabled.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* import { MidnightMarketLiquidationCursorNotEnabledError } from "@morpho-org/morpho-sdk";
|
|
309
|
+
* const error = new MidnightMarketLiquidationCursorNotEnabledError({ index: 0, liquidationCursor: 1n });
|
|
310
|
+
* console.log(error.message);
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
class MidnightMarketLiquidationCursorNotEnabledError extends Error {
|
|
314
|
+
/** Creates a disabled-cursor error. */
|
|
315
|
+
constructor(params) {
|
|
316
|
+
super(`Midnight offer "${params.index}" uses disabled liquidation cursor "${params.liquidationCursor}" for an uncreated market. Choose an enabled cursor.`);
|
|
317
|
+
this.index = params.index;
|
|
318
|
+
this.liquidationCursor = params.liquidationCursor;
|
|
319
|
+
this.name = "MidnightMarketLiquidationCursorNotEnabledError";
|
|
320
|
+
}
|
|
321
|
+
/** Offer index in its tree. */
|
|
322
|
+
index;
|
|
323
|
+
/** Disabled liquidation cursor value. */
|
|
324
|
+
liquidationCursor;
|
|
325
|
+
}
|
|
326
|
+
exports.MidnightMarketLiquidationCursorNotEnabledError = MidnightMarketLiquidationCursorNotEnabledError;
|
|
327
|
+
/** Thrown when an uncreated market's oracle address has no contract code.
|
|
328
|
+
*
|
|
329
|
+
* @throws {MidnightMarketOracleWithoutCodeError} when the oracle has no code.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```ts
|
|
333
|
+
* import { MidnightMarketOracleWithoutCodeError } from "@morpho-org/morpho-sdk";
|
|
334
|
+
* const error = new MidnightMarketOracleWithoutCodeError({ index: 0, oracle: "0x0000000000000000000000000000000000000001" });
|
|
335
|
+
* console.log(error.message);
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
class MidnightMarketOracleWithoutCodeError extends Error {
|
|
339
|
+
/** Creates an oracle-code error. */
|
|
340
|
+
constructor(params) {
|
|
341
|
+
super(`Midnight offer "${params.index}" uses oracle "${params.oracle}" without contract code for an uncreated market. Choose a deployed oracle.`);
|
|
342
|
+
this.index = params.index;
|
|
343
|
+
this.oracle = params.oracle;
|
|
344
|
+
this.name = "MidnightMarketOracleWithoutCodeError";
|
|
345
|
+
}
|
|
346
|
+
/** Offer index in its tree. */
|
|
347
|
+
index;
|
|
348
|
+
/** Oracle address without code. */
|
|
349
|
+
oracle;
|
|
350
|
+
}
|
|
351
|
+
exports.MidnightMarketOracleWithoutCodeError = MidnightMarketOracleWithoutCodeError;
|
|
352
|
+
/** Thrown when a maker offer uses a callback unsupported by the selected flow.
|
|
353
|
+
*
|
|
354
|
+
* @throws {MidnightOfferCallbackNotSupportedError} when the callback is nonzero.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* import { MidnightOfferCallbackNotSupportedError } from "@morpho-org/morpho-sdk";
|
|
359
|
+
* const error = new MidnightOfferCallbackNotSupportedError({ index: 0, callback: "0x0000000000000000000000000000000000000001" });
|
|
360
|
+
* console.log(error.message);
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
class MidnightOfferCallbackNotSupportedError extends Error {
|
|
364
|
+
/** Creates an unsupported-callback error. */
|
|
365
|
+
constructor(params) {
|
|
366
|
+
super(`Midnight offer "${params.index}" uses callback "${params.callback}", which this maker flow cannot execute. Use the zero address or a supported callback flow.`);
|
|
367
|
+
this.index = params.index;
|
|
368
|
+
this.callback = params.callback;
|
|
369
|
+
this.name = "MidnightOfferCallbackNotSupportedError";
|
|
370
|
+
}
|
|
371
|
+
/** Offer index in its tree. */
|
|
372
|
+
index;
|
|
373
|
+
/** Unsupported callback address. */
|
|
374
|
+
callback;
|
|
375
|
+
}
|
|
376
|
+
exports.MidnightOfferCallbackNotSupportedError = MidnightOfferCallbackNotSupportedError;
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams as BlueInputMarketParams, Loadable, MarketId as BlueMarketId, MaxBorrowOptions as BlueMaxBorrowOptions, MaxPositionCapacities as BlueMaxPositionCapacities, MaxWithdrawCollateralOptions as BlueMaxWithdrawCollateralOptions, Pending, } from "@morpho-org/blue-sdk";
|
|
2
|
-
export type { AuthorizationArgs as BlueAuthorizationTypedDataArgs, DeploylessFetchParameters as BlueDeploylessFetchParameters, FetchParameters as BlueFetchParameters, InputAllocation as BlueInputAllocation, MetaMorphoCall as BlueMetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs as PermitTypedDataArgs, } from "@morpho-org/blue-sdk-viem";
|
|
2
|
+
export type { AuthorizationArgs as BlueAuthorizationTypedDataArgs, DeploylessFetchParameters as BlueDeploylessFetchParameters, FetchParameters as BlueFetchParameters, InputAllocation as BlueInputAllocation, MetaMorphoCall as BlueMetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs as PermitTypedDataArgs, TokenMetadataField, } from "@morpho-org/blue-sdk-viem";
|
|
3
3
|
export type { BuildFixedRateOfferChainParams as MidnightBuildFixedRateOfferChainParams, DecodedEcrecoverRatifierData as MidnightDecodedEcrecoverRatifierData, DecodedPriceRatifierV1Data as MidnightDecodedPriceRatifierV1Data, DecodedRateRatifierV1Data as MidnightDecodedRateRatifierV1Data, DecodedSetterRatifierData as MidnightDecodedSetterRatifierData, DeploylessFetchParameters as MidnightDeploylessFetchParameters, EcrecoverRatificationTypedData as MidnightEcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams as MidnightEcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams as MidnightEcrecoverRatifierDataParams, EcrecoverRatifierDataRequest as MidnightEcrecoverRatifierDataRequest, EcrecoverRatifierDataVerificationParams as MidnightEcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams as MidnightEcrecoverRatifierRatifyParams, EcrecoverRatifierRatifyRequest as MidnightEcrecoverRatifierRatifyRequest, EcrecoverRatifierRootDigestParams as MidnightEcrecoverRatifierRootDigestParams, EcrecoverRatifierSignRequest as MidnightEcrecoverRatifierSignRequest, EcrecoverRatifierTypedDataParams as MidnightEcrecoverRatifierTypedDataParams, EcrecoverRatifierTypedDataRequest as MidnightEcrecoverRatifierTypedDataRequest, EcrecoverSignatureInput as MidnightEcrecoverSignatureInput, FixedRateOfferChainLeg as MidnightFixedRateOfferChainLeg, GetRatifierInfoParams as MidnightGetRatifierInfoParams, MidnightCallParameters, MidnightFetchParams, PriceRatifierV1Leaf as MidnightPriceRatifierV1Leaf, PriceRatifierV1LeafStruct as MidnightPriceRatifierV1LeafStruct, PriceRatifierV1TreeDescriptor as MidnightPriceRatifierV1TreeDescriptor, PriceRatifierV1TreeInput as MidnightPriceRatifierV1TreeInput, RateRatifierV1Leaf as MidnightRateRatifierV1Leaf, RateRatifierV1LeafStruct as MidnightRateRatifierV1LeafStruct, RateRatifierV1TreeDescriptor as MidnightRateRatifierV1TreeDescriptor, RateRatifierV1TreeInput as MidnightRateRatifierV1TreeInput, RatifierInfo as MidnightRatifierInfo, SetterRatifierDataParams as MidnightSetterRatifierDataParams, SetterRatifierDataRequest as MidnightSetterRatifierDataRequest, SetterRatifierDataVerificationParams as MidnightSetterRatifierDataVerificationParams, SetterRatifierRatifyRequest as MidnightSetterRatifierRatifyRequest, VerifiedEcrecoverRatifierData as MidnightVerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
|
|
4
4
|
export type { ChainMetadata } from "@morpho-org/morpho-ts";
|
|
5
5
|
export * from "./types/index.js";
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib, CapacityLimitReason,
|
|
|
3
3
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
4
4
|
defaultPreLiquidationParamsRegistry as blueDefaultPreLiquidationParamsRegistry,
|
|
5
5
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
6
|
-
getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils,
|
|
7
|
-
export { decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
6
|
+
getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
7
|
+
export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
8
8
|
export { EcrecoverRatifier as MidnightEcrecoverRatifier,
|
|
9
9
|
/** @deprecated Use MidnightEcrecoverRatifier with a tagged tree. */
|
|
10
10
|
EcrecoverRatifierUtils as MidnightEcrecoverRatifierUtils, eip712Digest, GroupUtils as MidnightGroupUtils, MarketUtils as MidnightMarketUtils, OfferChainUtils as MidnightOfferChainUtils, OfferUtils as MidnightOfferUtils, Payload as MidnightPayload, PositionUtils as MidnightPositionUtils, PriceRatifierV1 as MidnightPriceRatifierV1,
|
|
@@ -17,7 +17,8 @@ RatifierUtils as MidnightRatifierUtils, SetterRatifier as MidnightSetterRatifier
|
|
|
17
17
|
/** @deprecated Use MidnightSetterRatifier with a tagged tree. */
|
|
18
18
|
SetterRatifierUtils as MidnightSetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib, TickLib as MidnightTickLib, TreeUtils as MidnightTreeUtils, } from "@morpho-org/midnight-sdk";
|
|
19
19
|
export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDottedKeys, } from "@morpho-org/morpho-ts";
|
|
20
|
-
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys,
|
|
20
|
+
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
|
|
21
|
+
export { validateClientChainId } from "./actions/requirements/validateClientChainId.js";
|
|
21
22
|
export { addTransactionMetadata } from "./helpers/metadata.js";
|
|
22
23
|
export { type PreviewVaultV2ForceWithdrawParams, previewVaultV2ForceWithdraw, type VaultV2ForceWithdrawPreview, } from "./helpers/previewVaultV2ForceWithdraw.js";
|
|
23
24
|
export { type PreviewVaultV2InKindRedeemParams, previewVaultV2InKindRedeem, type VaultV2InKindRedeemMarketPreview, } from "./helpers/previewVaultV2InKindRedeem.js";
|
package/lib/cjs/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.resolveVaultV2ForceWithdrawEligibility = exports.computeVaultV2ForceWithdrawSharesBurnt = exports.computeVaultV2ForceWithdrawPlan = exports.computeVaultV2ForceWithdrawMinSharesBurnt = exports.computeVaultV2ForceWithdrawFeeSharesMinted = exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateChainId = exports.validateAccrualPosition = exports.computeMinForceWithdrawSharePrice = exports.previewVaultV2InKindRedeem = exports.previewVaultV2ForceWithdraw = exports.addTransactionMetadata = exports.values = exports.transformValue = exports.Time = exports.retryPromiseLinearBackoff = exports.mergeEntries = exports.
|
|
3
|
+
exports.createHasValue = exports.createGetValue = exports.bigIntComparator = exports.MidnightTreeUtils = exports.MidnightTickLib = exports.MidnightTakeAmountsLib = exports.MidnightSetterRatifierUtils = exports.MidnightSetterRatifier = exports.MidnightRatifierUtils = exports.MidnightRatifier = exports.MidnightRateRatifierV1Utils = exports.MidnightRateRatifierV1 = exports.MidnightPriceRatifierV1Utils = exports.MidnightPriceRatifierV1 = exports.MidnightPositionUtils = exports.MidnightPayload = exports.MidnightOfferUtils = exports.MidnightOfferChainUtils = exports.MidnightMarketUtils = exports.MidnightGroupUtils = exports.eip712Digest = exports.MidnightEcrecoverRatifierUtils = exports.MidnightEcrecoverRatifier = exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.BlueMetaMorphoAction = exports.isUndecodableResultError = exports.isTransportError = exports.isContractRevertError = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getBlueAuthorizationTypedData = exports.decodeBytes32String = exports.catchRevertOnly = exports.VaultV2Utils = exports.VaultV2BluePublicAllocatorConfigUtils = exports.VaultV2BlueMarketPublicAllocatorConfigUtils = exports.VaultUtils = exports.BlueSharesMath = exports.MathLib = exports.BlueMarketUtils = exports.getBlueDefaultPreLiquidationParams = exports.blueDefaultPreLiquidationParamsRegistry = exports.CapacityLimitReason = exports.BlueAdaptiveCurveIrmLib = void 0;
|
|
4
|
+
exports.resolveVaultV2ForceWithdrawEligibility = exports.computeVaultV2ForceWithdrawSharesBurnt = exports.computeVaultV2ForceWithdrawPlan = exports.computeVaultV2ForceWithdrawMinSharesBurnt = exports.computeVaultV2ForceWithdrawFeeSharesMinted = exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateChainId = exports.validateAccrualPosition = exports.computeMinForceWithdrawSharePrice = exports.previewVaultV2InKindRedeem = exports.previewVaultV2ForceWithdraw = exports.addTransactionMetadata = exports.validateClientChainId = exports.values = exports.transformValue = exports.Time = exports.retryPromiseLinearBackoff = exports.mergeEntries = exports.keys = exports.isNotUndefined = exports.isNotNull = exports.isDefined = exports.hasValue = exports.getValue = exports.getSubdomainBaseUrl = exports.getLastDefined = exports.getLast = exports.fromEntries = exports.filterDefined = exports.entries = exports.deepFreeze = void 0;
|
|
5
5
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
6
6
|
Object.defineProperty(exports, "BlueAdaptiveCurveIrmLib", { enumerable: true, get: function () { return blue_sdk_1.AdaptiveCurveIrmLib; } });
|
|
7
7
|
Object.defineProperty(exports, "CapacityLimitReason", { enumerable: true, get: function () { return blue_sdk_1.CapacityLimitReason; } });
|
|
@@ -15,14 +15,17 @@ Object.defineProperty(exports, "BlueSharesMath", { enumerable: true, get: functi
|
|
|
15
15
|
Object.defineProperty(exports, "VaultUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultUtils; } });
|
|
16
16
|
Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfigUtils; } });
|
|
17
17
|
Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils; } });
|
|
18
|
-
Object.defineProperty(exports, "VaultV2MidnightAdapterUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MidnightAdapterUtils; } });
|
|
19
18
|
Object.defineProperty(exports, "VaultV2Utils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Utils; } });
|
|
20
19
|
var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
20
|
+
Object.defineProperty(exports, "catchRevertOnly", { enumerable: true, get: function () { return blue_sdk_viem_1.catchRevertOnly; } });
|
|
21
21
|
Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return blue_sdk_viem_1.decodeBytes32String; } });
|
|
22
22
|
Object.defineProperty(exports, "getBlueAuthorizationTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getAuthorizationTypedData; } });
|
|
23
23
|
Object.defineProperty(exports, "getPermit2PermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermit2PermitTypedData; } });
|
|
24
24
|
Object.defineProperty(exports, "getPermit2TransferFromTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermit2TransferFromTypedData; } });
|
|
25
25
|
Object.defineProperty(exports, "getPermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermitTypedData; } });
|
|
26
|
+
Object.defineProperty(exports, "isContractRevertError", { enumerable: true, get: function () { return blue_sdk_viem_1.isContractRevertError; } });
|
|
27
|
+
Object.defineProperty(exports, "isTransportError", { enumerable: true, get: function () { return blue_sdk_viem_1.isTransportError; } });
|
|
28
|
+
Object.defineProperty(exports, "isUndecodableResultError", { enumerable: true, get: function () { return blue_sdk_viem_1.isUndecodableResultError; } });
|
|
26
29
|
Object.defineProperty(exports, "BlueMetaMorphoAction", { enumerable: true, get: function () { return blue_sdk_viem_1.MetaMorphoAction; } });
|
|
27
30
|
Object.defineProperty(exports, "optionalBoolean", { enumerable: true, get: function () { return blue_sdk_viem_1.optionalBoolean; } });
|
|
28
31
|
Object.defineProperty(exports, "readContractRestructured", { enumerable: true, get: function () { return blue_sdk_viem_1.readContractRestructured; } });
|
|
@@ -73,12 +76,13 @@ Object.defineProperty(exports, "isDefined", { enumerable: true, get: function ()
|
|
|
73
76
|
Object.defineProperty(exports, "isNotNull", { enumerable: true, get: function () { return morpho_ts_1.isNotNull; } });
|
|
74
77
|
Object.defineProperty(exports, "isNotUndefined", { enumerable: true, get: function () { return morpho_ts_1.isNotUndefined; } });
|
|
75
78
|
Object.defineProperty(exports, "keys", { enumerable: true, get: function () { return morpho_ts_1.keys; } });
|
|
76
|
-
Object.defineProperty(exports, "MidnightPositionLib", { enumerable: true, get: function () { return morpho_ts_1.MidnightPositionLib; } });
|
|
77
79
|
Object.defineProperty(exports, "mergeEntries", { enumerable: true, get: function () { return morpho_ts_1.mergeEntries; } });
|
|
78
80
|
Object.defineProperty(exports, "retryPromiseLinearBackoff", { enumerable: true, get: function () { return morpho_ts_1.retryPromiseLinearBackoff; } });
|
|
79
81
|
Object.defineProperty(exports, "Time", { enumerable: true, get: function () { return morpho_ts_1.Time; } });
|
|
80
82
|
Object.defineProperty(exports, "transformValue", { enumerable: true, get: function () { return morpho_ts_1.transformValue; } });
|
|
81
83
|
Object.defineProperty(exports, "values", { enumerable: true, get: function () { return morpho_ts_1.values; } });
|
|
84
|
+
var validateClientChainId_js_1 = require("./actions/requirements/validateClientChainId.js");
|
|
85
|
+
Object.defineProperty(exports, "validateClientChainId", { enumerable: true, get: function () { return validateClientChainId_js_1.validateClientChainId; } });
|
|
82
86
|
var metadata_js_1 = require("./helpers/metadata.js");
|
|
83
87
|
Object.defineProperty(exports, "addTransactionMetadata", { enumerable: true, get: function () { return metadata_js_1.addTransactionMetadata; } });
|
|
84
88
|
var previewVaultV2ForceWithdraw_js_1 = require("./helpers/previewVaultV2ForceWithdraw.js");
|
package/lib/esm/abis.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { marketParamsAbi as blueMarketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi,
|
|
2
|
+
export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, 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 as bluePreLiquidationAbi,
|
|
5
5
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
package/lib/esm/abis.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { marketParamsAbi as blueMarketParamsAbi } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi,
|
|
2
|
+
export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, 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 as bluePreLiquidationAbi,
|
|
5
5
|
/** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
|
|
@@ -32,6 +32,7 @@ export type BundlesTokenRequirementsState = {
|
|
|
32
32
|
* @param params.amount - Exact pull amount in the token's smallest unit; zero returns no requirements.
|
|
33
33
|
* @param params.deadline - Signature expiration as a Unix timestamp in seconds; in the
|
|
34
34
|
* SignatureTransfer branch it must be positive, within uint256, and in the future.
|
|
35
|
+
* @param params.now - Timestamp the SignatureTransfer deadline is validated against; defaults to the current time.
|
|
35
36
|
* @param params.state - Prefetched state for either classic approval or Permit2 SignatureTransfer.
|
|
36
37
|
* @param params.state.type - `approval` for a direct allowance or `permit2SignatureTransfer` for a signed pull.
|
|
37
38
|
* @param params.state.allowance - In the approval branch, current token allowance from `owner` to `spender`.
|
|
@@ -76,5 +77,6 @@ export declare const resolveBundlesTokenRequirements: (params: {
|
|
|
76
77
|
readonly chainId: number;
|
|
77
78
|
readonly amount: bigint;
|
|
78
79
|
readonly deadline: bigint;
|
|
80
|
+
readonly now?: bigint;
|
|
79
81
|
readonly state: BundlesTokenRequirementsState;
|
|
80
82
|
}) => readonly (Readonly<Transaction<ERC20ApprovalAction>> | BundlesTokenSignatureRequirement)[];
|
|
@@ -24,6 +24,7 @@ import { getRequirementsApproval } from "../requirements/getRequirementsApproval
|
|
|
24
24
|
* @param params.amount - Exact pull amount in the token's smallest unit; zero returns no requirements.
|
|
25
25
|
* @param params.deadline - Signature expiration as a Unix timestamp in seconds; in the
|
|
26
26
|
* SignatureTransfer branch it must be positive, within uint256, and in the future.
|
|
27
|
+
* @param params.now - Timestamp the SignatureTransfer deadline is validated against; defaults to the current time.
|
|
27
28
|
* @param params.state - Prefetched state for either classic approval or Permit2 SignatureTransfer.
|
|
28
29
|
* @param params.state.type - `approval` for a direct allowance or `permit2SignatureTransfer` for a signed pull.
|
|
29
30
|
* @param params.state.allowance - In the approval branch, current token allowance from `owner` to `spender`.
|
|
@@ -120,6 +121,7 @@ export const resolveBundlesTokenRequirements = (params) => {
|
|
|
120
121
|
chainId: params.chainId,
|
|
121
122
|
nonce: params.state.permit2Nonce,
|
|
122
123
|
deadline: params.deadline,
|
|
124
|
+
now: params.now,
|
|
123
125
|
}),
|
|
124
126
|
];
|
|
125
127
|
};
|
|
@@ -1,78 +1,19 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Delegated root-activation signature passed to the ratifier's `setIsRootRatifiedWithSig`.
|
|
6
|
-
* Omit it to activate the root directly with `setIsRootRatified`.
|
|
7
|
-
*/
|
|
8
|
-
export interface MidnightRootActivationSignature {
|
|
9
|
-
/** Tree height committed by the signature. */
|
|
10
|
-
readonly height: bigint;
|
|
11
|
-
/** Ratifier signature nonce. */
|
|
12
|
-
readonly nonce: bigint;
|
|
13
|
-
/** Signature deadline timestamp, independent of the bundle deadline. */
|
|
14
|
-
readonly deadline: bigint;
|
|
15
|
-
readonly v: number;
|
|
16
|
-
readonly r: Hex;
|
|
17
|
-
readonly s: Hex;
|
|
18
|
-
}
|
|
19
|
-
/** Collateral supplied for the maker before root activation; every offer must target `market`. */
|
|
20
|
-
export interface MidnightMakeBorrowCollateral {
|
|
21
|
-
readonly market: MarketInput;
|
|
22
|
-
readonly supplies: readonly MidnightCollateralTransfer[];
|
|
23
|
-
}
|
|
24
|
-
/** Offer root activated and published by a Midnight Bundles V2 maker bundle. */
|
|
25
|
-
export interface MidnightOfferPublication {
|
|
26
|
-
/**
|
|
27
|
-
* The chain's registered `priceRatifierV1` or `rateRatifierV1`, which activates `root`.
|
|
28
|
-
* MidnightBundlesV2 authorizes it over the maker's whole Midnight account.
|
|
29
|
-
*/
|
|
30
|
-
readonly ratifier: Address;
|
|
31
|
-
/** Offer tree root to activate. */
|
|
32
|
-
readonly root: Hex;
|
|
33
|
-
/** Distinct offer groups contained in `root`. */
|
|
34
|
-
readonly groups: readonly Hex[];
|
|
35
|
-
/** Encoded offer payload for `root`, published to the Midnight log. */
|
|
36
|
-
readonly payload: Hex;
|
|
37
|
-
/** Optional delegated root-activation signature. */
|
|
38
|
-
readonly rootSignature?: MidnightRootActivationSignature;
|
|
39
|
-
/** Optional loan assets parked on Morpho Blue for the maker; share-price slippage is not checked. */
|
|
40
|
-
readonly blueSupply?: MidnightBlueSupply;
|
|
41
|
-
/** Optional collateral supplied to `market` for the maker before activation. */
|
|
42
|
-
readonly collateral?: MidnightMakeBorrowCollateral;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Parameters for encoding a Midnight Bundles V2 maker bundle: an offer publication or repost, or,
|
|
46
|
-
* without a publication, a cancellation of offer groups only.
|
|
47
|
-
*/
|
|
48
|
-
export interface MidnightCancelAndMakeParams {
|
|
49
|
-
/** Chain id used to resolve `MidnightBundlesV2`. */
|
|
50
|
-
readonly chainId: number;
|
|
51
|
-
/** Offer groups to cancel, each with its largest accepted consumption. Empty for a new publication. */
|
|
52
|
-
readonly cancellations: readonly MidnightGroupCancellation[];
|
|
53
|
-
/** Bundle execution deadline timestamp. Pass `maxUint256` explicitly for no expiry. */
|
|
54
|
-
readonly deadline: bigint;
|
|
55
|
-
/**
|
|
56
|
-
* Optional native ETH sent as `value`; the bundle wraps it into the chain's wNative and transfers
|
|
57
|
-
* it to `msg.sender` before pulling. It may cover part or all of the maximum wNative amount this
|
|
58
|
-
* call can pull, but not more. Any wrapped native not pulled stays in the sender's wallet as
|
|
59
|
-
* wNative. The wNative approval to `MidnightBundlesV2` is still required for the full pulled amount.
|
|
60
|
-
*/
|
|
61
|
-
readonly nativeAmount?: bigint;
|
|
62
|
-
/** Optional analytics metadata appended to calldata. */
|
|
63
|
-
readonly metadata?: Metadata;
|
|
64
|
-
/** Offers to publish after the cancellations. Omit to cancel offer groups only. */
|
|
65
|
-
readonly publication?: MidnightOfferPublication;
|
|
66
|
-
}
|
|
1
|
+
import { type MidnightCancelAndMakeAction, type Transaction } from "../../types/index.js";
|
|
2
|
+
import type { MidnightCancelAndMakeParams } from "../../types/midnightCancelAndMake.js";
|
|
3
|
+
export type { MidnightCancelAndMakeParams, MidnightMakeBorrowCollateral, MidnightOfferPublication, MidnightRootActivationSignature, } from "../../types/midnightCancelAndMake.js";
|
|
67
4
|
/**
|
|
68
5
|
* Encodes `MidnightBundlesV2.midnightBundlesV2CancelAndMake` for `msg.sender`: cancel previous
|
|
69
6
|
* groups under consumption guards, optionally park loan assets on Morpho Blue for the maker's
|
|
70
7
|
* `BlueBuyCallback` or supply collateral, activate `root`, and publish `payload`.
|
|
71
8
|
* Without `publication`, it only cancels groups (`cancelOffers` uses this).
|
|
72
9
|
* Execution reverts as a whole if any group's consumption exceeds its `maxConsumed` ceiling.
|
|
10
|
+
* The builder snapshots every input field once before validation and encoding. It checks root,
|
|
11
|
+
* groups, cancellation groups, Blue callback salt, and root-signature `r`/`s` as 32-byte hex and
|
|
12
|
+
* checks payload hex shape and size, but cannot decode it; callers must supply a mutually
|
|
13
|
+
* consistent root, group list, and payload.
|
|
73
14
|
*
|
|
74
|
-
* The contract does not check that `payload` matches `root
|
|
75
|
-
*
|
|
15
|
+
* The contract does not check that `payload` matches `root`. Prefer
|
|
16
|
+
* `client.morpho.midnight(chainId).makeLend(...)`,
|
|
76
17
|
* `makeBorrow(...)`, `supplyCollateralMakeBorrow(...)`, or `supplyBlueMakeLend(...)`, which derive
|
|
77
18
|
* the tree data and resolve the requirements for each flow; `supplyBlueMakeLend` also runs the
|
|
78
19
|
* Blue parking checks (callback, callbackData, empty-market and zero-share guards) that this builder
|
|
@@ -80,7 +21,7 @@ export interface MidnightCancelAndMakeParams {
|
|
|
80
21
|
*
|
|
81
22
|
* @param params.chainId - Chain id used to resolve `MidnightBundlesV2`.
|
|
82
23
|
* @param params.cancellations - Offer groups to cancel and their consumption ceilings.
|
|
83
|
-
* @param params.deadline - Bundle execution deadline timestamp; pass `maxUint256` explicitly for no expiry.
|
|
24
|
+
* @param params.deadline - Bundle execution deadline timestamp; pass `maxUint256` explicitly for no expiry. Not checked against the clock; validate freshness before building.
|
|
84
25
|
* @param params.nativeAmount - Optional native ETH sent as `value`; the bundle wraps it into the
|
|
85
26
|
* chain's wNative and transfers it to `msg.sender` before pulling. It may cover part or all of the
|
|
86
27
|
* maximum wNative amount this call can pull, but not more. Any wrapped native not pulled stays in
|
|
@@ -93,7 +34,9 @@ export interface MidnightCancelAndMakeParams {
|
|
|
93
34
|
* @param params.publication.root - Offer tree root to activate.
|
|
94
35
|
* @param params.publication.groups - Distinct offer groups contained in the root.
|
|
95
36
|
* @param params.publication.payload - Encoded offer payload published to the Midnight log.
|
|
96
|
-
* @param params.publication.rootSignature - Optional delegated root-activation
|
|
37
|
+
* @param params.publication.rootSignature - Optional builder-only delegated root-activation
|
|
38
|
+
* signature. Maker entity methods never set it; they encode zero signature fields and rely on
|
|
39
|
+
* MidnightBundlesV2 authorization.
|
|
97
40
|
* @param params.publication.rootSignature.height - Tree height committed by the signature.
|
|
98
41
|
* @param params.publication.rootSignature.nonce - Ratifier signature nonce.
|
|
99
42
|
* @param params.publication.rootSignature.deadline - Signature deadline timestamp, independent of the bundle `deadline`.
|
|
@@ -114,11 +57,14 @@ export interface MidnightCancelAndMakeParams {
|
|
|
114
57
|
* @throws {EmptyMidnightGroupCancellationsError} when nothing is published and no groups are cancelled.
|
|
115
58
|
* @throws {EmptyMidnightCollateralSuppliesError} when a collateral market has no collateral supplies.
|
|
116
59
|
* @throws {InvalidTreeError} when `root` is zero, or `payload` or `groups` is empty.
|
|
60
|
+
* @throws {InvalidMidnightHexInputError} when a publication root or group, cancellation group,
|
|
61
|
+
* Blue callback salt, or root-signature `r`/`s` is not 32-byte hex, or when payload is malformed,
|
|
62
|
+
* odd-length, or larger than 1,000,000 bytes.
|
|
117
63
|
* @throws {MidnightReplacementGroupCancelledError} when a published group is also cancelled.
|
|
118
64
|
* @throws {DuplicateMidnightGroupCancellationError} when a cancelled group appears more than once.
|
|
119
65
|
* @throws {NonPositiveInputError} when `deadline` is not positive.
|
|
120
66
|
* @throws {NegativeInputError} when a `maxConsumed` ceiling or `nativeAmount` is negative.
|
|
121
|
-
* @throws {InputExceedsMaxError} when a `maxConsumed` ceiling
|
|
67
|
+
* @throws {InputExceedsMaxError} when a `maxConsumed` ceiling, collateral supply amount, collateral supply sum, or Blue supply amount exceeds `uint128`, `deadline` exceeds `uint256`, or `nativeAmount` exceeds the maximum wNative pull, including zero when no wNative is pulled.
|
|
122
68
|
* @throws {ChainWNativeMissingError} when wNative is not configured for the chain.
|
|
123
69
|
* @throws {NativeAmountOnNonWNativeAssetError} when configured token pulls contain no wNative token.
|
|
124
70
|
* @throws {ChainIdMismatchError} when the collateral market targets another chain.
|