@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,332 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
/** Thrown when a maker offer expires at or before the pinned publication timestamp.
|
|
3
|
+
*
|
|
4
|
+
* @throws {MidnightOfferExpiredError} when expiry is not later than the pinned publication timestamp.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { MidnightOfferExpiredError } from "@morpho-org/morpho-sdk";
|
|
9
|
+
* const error = new MidnightOfferExpiredError({ index: 0, expiry: 10n, now: 10n });
|
|
10
|
+
* console.log(error.message);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare class MidnightOfferExpiredError extends Error {
|
|
14
|
+
/** Creates an expiry error. */
|
|
15
|
+
constructor(params: {
|
|
16
|
+
readonly index: number;
|
|
17
|
+
readonly expiry: bigint;
|
|
18
|
+
readonly now: bigint;
|
|
19
|
+
});
|
|
20
|
+
/** Offer index in its tree. */
|
|
21
|
+
readonly index: number;
|
|
22
|
+
/** Offer expiry timestamp. */
|
|
23
|
+
readonly expiry: bigint;
|
|
24
|
+
/** Pinned publication timestamp. */
|
|
25
|
+
readonly now: bigint;
|
|
26
|
+
}
|
|
27
|
+
/** Thrown when an offer expires after its market matures.
|
|
28
|
+
*
|
|
29
|
+
* @throws {MidnightOfferExpiryAfterMaturityError} when expiry exceeds market maturity.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { MidnightOfferExpiryAfterMaturityError } from "@morpho-org/morpho-sdk";
|
|
34
|
+
* const error = new MidnightOfferExpiryAfterMaturityError({ index: 0, expiry: 20n, maturity: 10n });
|
|
35
|
+
* console.log(error.message);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare class MidnightOfferExpiryAfterMaturityError extends Error {
|
|
39
|
+
/** Creates an expiry-after-maturity error. */
|
|
40
|
+
constructor(params: {
|
|
41
|
+
readonly index: number;
|
|
42
|
+
readonly expiry: bigint;
|
|
43
|
+
readonly maturity: bigint;
|
|
44
|
+
});
|
|
45
|
+
/** Offer index in its tree. */
|
|
46
|
+
readonly index: number;
|
|
47
|
+
/** Offer expiry timestamp. */
|
|
48
|
+
readonly expiry: bigint;
|
|
49
|
+
/** Market maturity timestamp. */
|
|
50
|
+
readonly maturity: bigint;
|
|
51
|
+
}
|
|
52
|
+
/** Thrown when a maker's offer group has no remaining consumable units.
|
|
53
|
+
*
|
|
54
|
+
* @throws {MidnightOfferGroupConsumedError} when the group's remaining cap is zero.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { MidnightOfferGroupConsumedError } from "@morpho-org/morpho-sdk";
|
|
59
|
+
* const error = new MidnightOfferGroupConsumedError({ index: 0, group: `0x${"00".repeat(32)}`, consumed: 1n });
|
|
60
|
+
* console.log(error.message);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare class MidnightOfferGroupConsumedError extends Error {
|
|
64
|
+
/** Creates a consumed-group error. */
|
|
65
|
+
constructor(params: {
|
|
66
|
+
readonly index: number;
|
|
67
|
+
readonly group: Hex;
|
|
68
|
+
readonly consumed: bigint;
|
|
69
|
+
});
|
|
70
|
+
/** Offer index in its tree. */
|
|
71
|
+
readonly index: number;
|
|
72
|
+
/** Consumed group identifier. */
|
|
73
|
+
readonly group: Hex;
|
|
74
|
+
/** Onchain consumed cap. */
|
|
75
|
+
readonly consumed: bigint;
|
|
76
|
+
}
|
|
77
|
+
/** Thrown when an offer tick is not aligned with its market's spacing.
|
|
78
|
+
*
|
|
79
|
+
* @throws {MidnightOfferTickSpacingError} when the tick is not accessible.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { MidnightOfferTickSpacingError } from "@morpho-org/morpho-sdk";
|
|
84
|
+
* const error = new MidnightOfferTickSpacingError({ index: 0, tick: 5n, tickSpacing: 4 });
|
|
85
|
+
* console.log(error.message);
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare class MidnightOfferTickSpacingError extends Error {
|
|
89
|
+
/** Creates a tick-spacing error. */
|
|
90
|
+
constructor(params: {
|
|
91
|
+
readonly index: number;
|
|
92
|
+
readonly tick: bigint;
|
|
93
|
+
readonly tickSpacing: number;
|
|
94
|
+
});
|
|
95
|
+
/** Offer index in its tree. */
|
|
96
|
+
readonly index: number;
|
|
97
|
+
/** Offer tick. */
|
|
98
|
+
readonly tick: bigint;
|
|
99
|
+
/** Onchain market tick spacing. */
|
|
100
|
+
readonly tickSpacing: number;
|
|
101
|
+
}
|
|
102
|
+
/** Thrown when the market continuous fee exceeds an offer's fee cap.
|
|
103
|
+
*
|
|
104
|
+
* @throws {MidnightOfferContinuousFeeCapBelowMarketFeeError} when the market fee exceeds the offer cap.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* import { MidnightOfferContinuousFeeCapBelowMarketFeeError } from "@morpho-org/morpho-sdk";
|
|
109
|
+
* const error = new MidnightOfferContinuousFeeCapBelowMarketFeeError({ index: 0, marketId: `0x${"00".repeat(32)}`, continuousFeeCap: 0n, continuousFee: 1n });
|
|
110
|
+
* console.log(error.message);
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export declare class MidnightOfferContinuousFeeCapBelowMarketFeeError extends Error {
|
|
114
|
+
/** Creates a continuous-fee error. */
|
|
115
|
+
constructor(params: {
|
|
116
|
+
readonly index: number;
|
|
117
|
+
readonly marketId: Hex;
|
|
118
|
+
readonly continuousFeeCap: bigint;
|
|
119
|
+
readonly continuousFee: bigint;
|
|
120
|
+
});
|
|
121
|
+
/** Offer index in its tree. */
|
|
122
|
+
readonly index: number;
|
|
123
|
+
/** Midnight market identifier. */
|
|
124
|
+
readonly marketId: Hex;
|
|
125
|
+
/** Maximum continuous fee accepted by the offer. */
|
|
126
|
+
readonly continuousFeeCap: bigint;
|
|
127
|
+
/** Current market continuous fee. */
|
|
128
|
+
readonly continuousFee: bigint;
|
|
129
|
+
}
|
|
130
|
+
/** Thrown when a sell offer has zero price.
|
|
131
|
+
*
|
|
132
|
+
* @throws {MidnightOfferZeroPriceSellError} when a sell offer has a zero tick.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* import { MidnightOfferZeroPriceSellError } from "@morpho-org/morpho-sdk";
|
|
137
|
+
* const error = new MidnightOfferZeroPriceSellError({ index: 0 });
|
|
138
|
+
* console.log(error.message);
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare class MidnightOfferZeroPriceSellError extends Error {
|
|
142
|
+
/** Creates a zero-price sell error. */
|
|
143
|
+
constructor(params: {
|
|
144
|
+
readonly index: number;
|
|
145
|
+
});
|
|
146
|
+
/** Offer index in its tree. */
|
|
147
|
+
readonly index: number;
|
|
148
|
+
}
|
|
149
|
+
/** Thrown when a Rate V1 offer's price bound cannot become fillable.
|
|
150
|
+
*
|
|
151
|
+
* @throws {MidnightOfferRateBoundUnreachableError} when the bound cannot become fillable.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* import { MidnightOfferRateBoundUnreachableError } from "@morpho-org/morpho-sdk";
|
|
156
|
+
* const error = new MidnightOfferRateBoundUnreachableError({ index: 0, rate: 1n, tick: 5n });
|
|
157
|
+
* console.log(error.message);
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare class MidnightOfferRateBoundUnreachableError extends Error {
|
|
161
|
+
/** Creates an unreachable-rate-bound error. */
|
|
162
|
+
constructor(params: {
|
|
163
|
+
readonly index: number;
|
|
164
|
+
readonly rate: bigint;
|
|
165
|
+
readonly tick: bigint;
|
|
166
|
+
});
|
|
167
|
+
/** Offer index in its tree. */
|
|
168
|
+
readonly index: number;
|
|
169
|
+
/** Rate V1 entry rate. */
|
|
170
|
+
readonly rate: bigint;
|
|
171
|
+
/** Offer tick. */
|
|
172
|
+
readonly tick: bigint;
|
|
173
|
+
}
|
|
174
|
+
/** Thrown when a reduce-only buy offer has no debt to repay.
|
|
175
|
+
*
|
|
176
|
+
* @throws {MidnightOfferNoDebtError} when a reduce-only buy has no maker debt.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* import { MidnightOfferNoDebtError } from "@morpho-org/morpho-sdk";
|
|
181
|
+
* const error = new MidnightOfferNoDebtError({ index: 0, marketId: `0x${"00".repeat(32)}` });
|
|
182
|
+
* console.log(error.message);
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export declare class MidnightOfferNoDebtError extends Error {
|
|
186
|
+
/** Creates a no-debt error. */
|
|
187
|
+
constructor(params: {
|
|
188
|
+
readonly index: number;
|
|
189
|
+
readonly marketId: Hex;
|
|
190
|
+
});
|
|
191
|
+
/** Offer index in its tree. */
|
|
192
|
+
readonly index: number;
|
|
193
|
+
/** Midnight market identifier. */
|
|
194
|
+
readonly marketId: Hex;
|
|
195
|
+
}
|
|
196
|
+
/** Thrown when a reduce-only sell offer has no credit to withdraw.
|
|
197
|
+
*
|
|
198
|
+
* @throws {MidnightOfferNoCreditError} when a reduce-only sell has no maker credit.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```ts
|
|
202
|
+
* import { MidnightOfferNoCreditError } from "@morpho-org/morpho-sdk";
|
|
203
|
+
* const error = new MidnightOfferNoCreditError({ index: 0, marketId: `0x${"00".repeat(32)}` });
|
|
204
|
+
* console.log(error.message);
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare class MidnightOfferNoCreditError extends Error {
|
|
208
|
+
/** Creates a no-credit error. */
|
|
209
|
+
constructor(params: {
|
|
210
|
+
readonly index: number;
|
|
211
|
+
readonly marketId: Hex;
|
|
212
|
+
});
|
|
213
|
+
/** Offer index in its tree. */
|
|
214
|
+
readonly index: number;
|
|
215
|
+
/** Midnight market identifier. */
|
|
216
|
+
readonly marketId: Hex;
|
|
217
|
+
}
|
|
218
|
+
/** Thrown when an uncreated market's maturity is more than 100 years after its latest possible
|
|
219
|
+
* market creation time.
|
|
220
|
+
*
|
|
221
|
+
* @throws {MidnightMarketMaturityTooFarError} when an uncreated market's maturity exceeds the
|
|
222
|
+
* latest possible market creation time by more than 100 years.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* import { MidnightMarketMaturityTooFarError } from "@morpho-org/morpho-sdk";
|
|
227
|
+
* const error = new MidnightMarketMaturityTooFarError({ index: 0, maturity: 1_000n, maxMaturity: 500n });
|
|
228
|
+
* console.log(error.message);
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export declare class MidnightMarketMaturityTooFarError extends Error {
|
|
232
|
+
/** Creates a maturity-range error. */
|
|
233
|
+
constructor(params: {
|
|
234
|
+
readonly index: number;
|
|
235
|
+
readonly maturity: bigint;
|
|
236
|
+
readonly maxMaturity: bigint;
|
|
237
|
+
});
|
|
238
|
+
/** Offer index in its tree. */
|
|
239
|
+
readonly index: number;
|
|
240
|
+
/** Market maturity timestamp. */
|
|
241
|
+
readonly maturity: bigint;
|
|
242
|
+
/** Latest allowed maturity timestamp. */
|
|
243
|
+
readonly maxMaturity: bigint;
|
|
244
|
+
}
|
|
245
|
+
/** Thrown when an uncreated market uses a disabled LLTV.
|
|
246
|
+
*
|
|
247
|
+
* @throws {MidnightMarketLltvNotEnabledError} when the market LLTV is disabled.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* import { MidnightMarketLltvNotEnabledError } from "@morpho-org/morpho-sdk";
|
|
252
|
+
* const error = new MidnightMarketLltvNotEnabledError({ index: 0, lltv: 1n });
|
|
253
|
+
* console.log(error.message);
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export declare class MidnightMarketLltvNotEnabledError extends Error {
|
|
257
|
+
/** Creates a disabled-LLTV error. */
|
|
258
|
+
constructor(params: {
|
|
259
|
+
readonly index: number;
|
|
260
|
+
readonly lltv: bigint;
|
|
261
|
+
});
|
|
262
|
+
/** Offer index in its tree. */
|
|
263
|
+
readonly index: number;
|
|
264
|
+
/** Disabled LLTV value. */
|
|
265
|
+
readonly lltv: bigint;
|
|
266
|
+
}
|
|
267
|
+
/** Thrown when an uncreated market uses a disabled liquidation cursor.
|
|
268
|
+
*
|
|
269
|
+
* @throws {MidnightMarketLiquidationCursorNotEnabledError} when the liquidation cursor is disabled.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* import { MidnightMarketLiquidationCursorNotEnabledError } from "@morpho-org/morpho-sdk";
|
|
274
|
+
* const error = new MidnightMarketLiquidationCursorNotEnabledError({ index: 0, liquidationCursor: 1n });
|
|
275
|
+
* console.log(error.message);
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
export declare class MidnightMarketLiquidationCursorNotEnabledError extends Error {
|
|
279
|
+
/** Creates a disabled-cursor error. */
|
|
280
|
+
constructor(params: {
|
|
281
|
+
readonly index: number;
|
|
282
|
+
readonly liquidationCursor: bigint;
|
|
283
|
+
});
|
|
284
|
+
/** Offer index in its tree. */
|
|
285
|
+
readonly index: number;
|
|
286
|
+
/** Disabled liquidation cursor value. */
|
|
287
|
+
readonly liquidationCursor: bigint;
|
|
288
|
+
}
|
|
289
|
+
/** Thrown when an uncreated market's oracle address has no contract code.
|
|
290
|
+
*
|
|
291
|
+
* @throws {MidnightMarketOracleWithoutCodeError} when the oracle has no code.
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* import { MidnightMarketOracleWithoutCodeError } from "@morpho-org/morpho-sdk";
|
|
296
|
+
* const error = new MidnightMarketOracleWithoutCodeError({ index: 0, oracle: "0x0000000000000000000000000000000000000001" });
|
|
297
|
+
* console.log(error.message);
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
export declare class MidnightMarketOracleWithoutCodeError extends Error {
|
|
301
|
+
/** Creates an oracle-code error. */
|
|
302
|
+
constructor(params: {
|
|
303
|
+
readonly index: number;
|
|
304
|
+
readonly oracle: Address;
|
|
305
|
+
});
|
|
306
|
+
/** Offer index in its tree. */
|
|
307
|
+
readonly index: number;
|
|
308
|
+
/** Oracle address without code. */
|
|
309
|
+
readonly oracle: Address;
|
|
310
|
+
}
|
|
311
|
+
/** Thrown when a maker offer uses a callback unsupported by the selected flow.
|
|
312
|
+
*
|
|
313
|
+
* @throws {MidnightOfferCallbackNotSupportedError} when the callback is nonzero.
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```ts
|
|
317
|
+
* import { MidnightOfferCallbackNotSupportedError } from "@morpho-org/morpho-sdk";
|
|
318
|
+
* const error = new MidnightOfferCallbackNotSupportedError({ index: 0, callback: "0x0000000000000000000000000000000000000001" });
|
|
319
|
+
* console.log(error.message);
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
export declare class MidnightOfferCallbackNotSupportedError extends Error {
|
|
323
|
+
/** Creates an unsupported-callback error. */
|
|
324
|
+
constructor(params: {
|
|
325
|
+
readonly index: number;
|
|
326
|
+
readonly callback: Address;
|
|
327
|
+
});
|
|
328
|
+
/** Offer index in its tree. */
|
|
329
|
+
readonly index: number;
|
|
330
|
+
/** Unsupported callback address. */
|
|
331
|
+
readonly callback: Address;
|
|
332
|
+
}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/** Thrown when a maker offer expires at or before the pinned publication timestamp.
|
|
2
|
+
*
|
|
3
|
+
* @throws {MidnightOfferExpiredError} when expiry is not later than the pinned publication timestamp.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { MidnightOfferExpiredError } from "@morpho-org/morpho-sdk";
|
|
8
|
+
* const error = new MidnightOfferExpiredError({ index: 0, expiry: 10n, now: 10n });
|
|
9
|
+
* console.log(error.message);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export class MidnightOfferExpiredError extends Error {
|
|
13
|
+
/** Creates an expiry error. */
|
|
14
|
+
constructor(params) {
|
|
15
|
+
super(`Midnight offer "${params.index}" expires at "${params.expiry}", which is not after publication timestamp "${params.now}". Choose a future expiry.`);
|
|
16
|
+
this.index = params.index;
|
|
17
|
+
this.expiry = params.expiry;
|
|
18
|
+
this.now = params.now;
|
|
19
|
+
this.name = "MidnightOfferExpiredError";
|
|
20
|
+
}
|
|
21
|
+
/** Offer index in its tree. */
|
|
22
|
+
index;
|
|
23
|
+
/** Offer expiry timestamp. */
|
|
24
|
+
expiry;
|
|
25
|
+
/** Pinned publication timestamp. */
|
|
26
|
+
now;
|
|
27
|
+
}
|
|
28
|
+
/** Thrown when an offer expires after its market matures.
|
|
29
|
+
*
|
|
30
|
+
* @throws {MidnightOfferExpiryAfterMaturityError} when expiry exceeds market maturity.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { MidnightOfferExpiryAfterMaturityError } from "@morpho-org/morpho-sdk";
|
|
35
|
+
* const error = new MidnightOfferExpiryAfterMaturityError({ index: 0, expiry: 20n, maturity: 10n });
|
|
36
|
+
* console.log(error.message);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export class MidnightOfferExpiryAfterMaturityError extends Error {
|
|
40
|
+
/** Creates an expiry-after-maturity error. */
|
|
41
|
+
constructor(params) {
|
|
42
|
+
super(`Midnight offer "${params.index}" expires at "${params.expiry}", after market maturity "${params.maturity}". Choose an expiry at or before maturity.`);
|
|
43
|
+
this.index = params.index;
|
|
44
|
+
this.expiry = params.expiry;
|
|
45
|
+
this.maturity = params.maturity;
|
|
46
|
+
this.name = "MidnightOfferExpiryAfterMaturityError";
|
|
47
|
+
}
|
|
48
|
+
/** Offer index in its tree. */
|
|
49
|
+
index;
|
|
50
|
+
/** Offer expiry timestamp. */
|
|
51
|
+
expiry;
|
|
52
|
+
/** Market maturity timestamp. */
|
|
53
|
+
maturity;
|
|
54
|
+
}
|
|
55
|
+
/** Thrown when a maker's offer group has no remaining consumable units.
|
|
56
|
+
*
|
|
57
|
+
* @throws {MidnightOfferGroupConsumedError} when the group's remaining cap is zero.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { MidnightOfferGroupConsumedError } from "@morpho-org/morpho-sdk";
|
|
62
|
+
* const error = new MidnightOfferGroupConsumedError({ index: 0, group: `0x${"00".repeat(32)}`, consumed: 1n });
|
|
63
|
+
* console.log(error.message);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export class MidnightOfferGroupConsumedError extends Error {
|
|
67
|
+
/** Creates a consumed-group error. */
|
|
68
|
+
constructor(params) {
|
|
69
|
+
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.`);
|
|
70
|
+
this.index = params.index;
|
|
71
|
+
this.group = params.group;
|
|
72
|
+
this.consumed = params.consumed;
|
|
73
|
+
this.name = "MidnightOfferGroupConsumedError";
|
|
74
|
+
}
|
|
75
|
+
/** Offer index in its tree. */
|
|
76
|
+
index;
|
|
77
|
+
/** Consumed group identifier. */
|
|
78
|
+
group;
|
|
79
|
+
/** Onchain consumed cap. */
|
|
80
|
+
consumed;
|
|
81
|
+
}
|
|
82
|
+
/** Thrown when an offer tick is not aligned with its market's spacing.
|
|
83
|
+
*
|
|
84
|
+
* @throws {MidnightOfferTickSpacingError} when the tick is not accessible.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { MidnightOfferTickSpacingError } from "@morpho-org/morpho-sdk";
|
|
89
|
+
* const error = new MidnightOfferTickSpacingError({ index: 0, tick: 5n, tickSpacing: 4 });
|
|
90
|
+
* console.log(error.message);
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export class MidnightOfferTickSpacingError extends Error {
|
|
94
|
+
/** Creates a tick-spacing error. */
|
|
95
|
+
constructor(params) {
|
|
96
|
+
super(`Midnight offer "${params.index}" tick "${params.tick}" is not aligned to spacing "${params.tickSpacing}". Rebuild it on an accessible tick.`);
|
|
97
|
+
this.index = params.index;
|
|
98
|
+
this.tick = params.tick;
|
|
99
|
+
this.tickSpacing = params.tickSpacing;
|
|
100
|
+
this.name = "MidnightOfferTickSpacingError";
|
|
101
|
+
}
|
|
102
|
+
/** Offer index in its tree. */
|
|
103
|
+
index;
|
|
104
|
+
/** Offer tick. */
|
|
105
|
+
tick;
|
|
106
|
+
/** Onchain market tick spacing. */
|
|
107
|
+
tickSpacing;
|
|
108
|
+
}
|
|
109
|
+
/** Thrown when the market continuous fee exceeds an offer's fee cap.
|
|
110
|
+
*
|
|
111
|
+
* @throws {MidnightOfferContinuousFeeCapBelowMarketFeeError} when the market fee exceeds the offer cap.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* import { MidnightOfferContinuousFeeCapBelowMarketFeeError } from "@morpho-org/morpho-sdk";
|
|
116
|
+
* const error = new MidnightOfferContinuousFeeCapBelowMarketFeeError({ index: 0, marketId: `0x${"00".repeat(32)}`, continuousFeeCap: 0n, continuousFee: 1n });
|
|
117
|
+
* console.log(error.message);
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export class MidnightOfferContinuousFeeCapBelowMarketFeeError extends Error {
|
|
121
|
+
/** Creates a continuous-fee error. */
|
|
122
|
+
constructor(params) {
|
|
123
|
+
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.`);
|
|
124
|
+
this.index = params.index;
|
|
125
|
+
this.marketId = params.marketId;
|
|
126
|
+
this.continuousFeeCap = params.continuousFeeCap;
|
|
127
|
+
this.continuousFee = params.continuousFee;
|
|
128
|
+
this.name = "MidnightOfferContinuousFeeCapBelowMarketFeeError";
|
|
129
|
+
}
|
|
130
|
+
/** Offer index in its tree. */
|
|
131
|
+
index;
|
|
132
|
+
/** Midnight market identifier. */
|
|
133
|
+
marketId;
|
|
134
|
+
/** Maximum continuous fee accepted by the offer. */
|
|
135
|
+
continuousFeeCap;
|
|
136
|
+
/** Current market continuous fee. */
|
|
137
|
+
continuousFee;
|
|
138
|
+
}
|
|
139
|
+
/** Thrown when a sell offer has zero price.
|
|
140
|
+
*
|
|
141
|
+
* @throws {MidnightOfferZeroPriceSellError} when a sell offer has a zero tick.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* import { MidnightOfferZeroPriceSellError } from "@morpho-org/morpho-sdk";
|
|
146
|
+
* const error = new MidnightOfferZeroPriceSellError({ index: 0 });
|
|
147
|
+
* console.log(error.message);
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export class MidnightOfferZeroPriceSellError extends Error {
|
|
151
|
+
/** Creates a zero-price sell error. */
|
|
152
|
+
constructor(params) {
|
|
153
|
+
super(`Midnight sell offer "${params.index}" has tick "0" and would sell credit for no proceeds. Choose a positive tick.`);
|
|
154
|
+
this.index = params.index;
|
|
155
|
+
this.name = "MidnightOfferZeroPriceSellError";
|
|
156
|
+
}
|
|
157
|
+
/** Offer index in its tree. */
|
|
158
|
+
index;
|
|
159
|
+
}
|
|
160
|
+
/** Thrown when a Rate V1 offer's price bound cannot become fillable.
|
|
161
|
+
*
|
|
162
|
+
* @throws {MidnightOfferRateBoundUnreachableError} when the bound cannot become fillable.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* import { MidnightOfferRateBoundUnreachableError } from "@morpho-org/morpho-sdk";
|
|
167
|
+
* const error = new MidnightOfferRateBoundUnreachableError({ index: 0, rate: 1n, tick: 5n });
|
|
168
|
+
* console.log(error.message);
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export class MidnightOfferRateBoundUnreachableError extends Error {
|
|
172
|
+
/** Creates an unreachable-rate-bound error. */
|
|
173
|
+
constructor(params) {
|
|
174
|
+
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.`);
|
|
175
|
+
this.index = params.index;
|
|
176
|
+
this.rate = params.rate;
|
|
177
|
+
this.tick = params.tick;
|
|
178
|
+
this.name = "MidnightOfferRateBoundUnreachableError";
|
|
179
|
+
}
|
|
180
|
+
/** Offer index in its tree. */
|
|
181
|
+
index;
|
|
182
|
+
/** Rate V1 entry rate. */
|
|
183
|
+
rate;
|
|
184
|
+
/** Offer tick. */
|
|
185
|
+
tick;
|
|
186
|
+
}
|
|
187
|
+
/** Thrown when a reduce-only buy offer has no debt to repay.
|
|
188
|
+
*
|
|
189
|
+
* @throws {MidnightOfferNoDebtError} when a reduce-only buy has no maker debt.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* import { MidnightOfferNoDebtError } from "@morpho-org/morpho-sdk";
|
|
194
|
+
* const error = new MidnightOfferNoDebtError({ index: 0, marketId: `0x${"00".repeat(32)}` });
|
|
195
|
+
* console.log(error.message);
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
export class MidnightOfferNoDebtError extends Error {
|
|
199
|
+
/** Creates a no-debt error. */
|
|
200
|
+
constructor(params) {
|
|
201
|
+
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.`);
|
|
202
|
+
this.index = params.index;
|
|
203
|
+
this.marketId = params.marketId;
|
|
204
|
+
this.name = "MidnightOfferNoDebtError";
|
|
205
|
+
}
|
|
206
|
+
/** Offer index in its tree. */
|
|
207
|
+
index;
|
|
208
|
+
/** Midnight market identifier. */
|
|
209
|
+
marketId;
|
|
210
|
+
}
|
|
211
|
+
/** Thrown when a reduce-only sell offer has no credit to withdraw.
|
|
212
|
+
*
|
|
213
|
+
* @throws {MidnightOfferNoCreditError} when a reduce-only sell has no maker credit.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* import { MidnightOfferNoCreditError } from "@morpho-org/morpho-sdk";
|
|
218
|
+
* const error = new MidnightOfferNoCreditError({ index: 0, marketId: `0x${"00".repeat(32)}` });
|
|
219
|
+
* console.log(error.message);
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
export class MidnightOfferNoCreditError extends Error {
|
|
223
|
+
/** Creates a no-credit error. */
|
|
224
|
+
constructor(params) {
|
|
225
|
+
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.`);
|
|
226
|
+
this.index = params.index;
|
|
227
|
+
this.marketId = params.marketId;
|
|
228
|
+
this.name = "MidnightOfferNoCreditError";
|
|
229
|
+
}
|
|
230
|
+
/** Offer index in its tree. */
|
|
231
|
+
index;
|
|
232
|
+
/** Midnight market identifier. */
|
|
233
|
+
marketId;
|
|
234
|
+
}
|
|
235
|
+
/** Thrown when an uncreated market's maturity is more than 100 years after its latest possible
|
|
236
|
+
* market creation time.
|
|
237
|
+
*
|
|
238
|
+
* @throws {MidnightMarketMaturityTooFarError} when an uncreated market's maturity exceeds the
|
|
239
|
+
* latest possible market creation time by more than 100 years.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* import { MidnightMarketMaturityTooFarError } from "@morpho-org/morpho-sdk";
|
|
244
|
+
* const error = new MidnightMarketMaturityTooFarError({ index: 0, maturity: 1_000n, maxMaturity: 500n });
|
|
245
|
+
* console.log(error.message);
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export class MidnightMarketMaturityTooFarError extends Error {
|
|
249
|
+
/** Creates a maturity-range error. */
|
|
250
|
+
constructor(params) {
|
|
251
|
+
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}".`);
|
|
252
|
+
this.index = params.index;
|
|
253
|
+
this.maturity = params.maturity;
|
|
254
|
+
this.maxMaturity = params.maxMaturity;
|
|
255
|
+
this.name = "MidnightMarketMaturityTooFarError";
|
|
256
|
+
}
|
|
257
|
+
/** Offer index in its tree. */
|
|
258
|
+
index;
|
|
259
|
+
/** Market maturity timestamp. */
|
|
260
|
+
maturity;
|
|
261
|
+
/** Latest allowed maturity timestamp. */
|
|
262
|
+
maxMaturity;
|
|
263
|
+
}
|
|
264
|
+
/** Thrown when an uncreated market uses a disabled LLTV.
|
|
265
|
+
*
|
|
266
|
+
* @throws {MidnightMarketLltvNotEnabledError} when the market LLTV is disabled.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* import { MidnightMarketLltvNotEnabledError } from "@morpho-org/morpho-sdk";
|
|
271
|
+
* const error = new MidnightMarketLltvNotEnabledError({ index: 0, lltv: 1n });
|
|
272
|
+
* console.log(error.message);
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
export class MidnightMarketLltvNotEnabledError extends Error {
|
|
276
|
+
/** Creates a disabled-LLTV error. */
|
|
277
|
+
constructor(params) {
|
|
278
|
+
super(`Midnight offer "${params.index}" uses disabled LLTV "${params.lltv}" for an uncreated market. Choose an enabled LLTV.`);
|
|
279
|
+
this.index = params.index;
|
|
280
|
+
this.lltv = params.lltv;
|
|
281
|
+
this.name = "MidnightMarketLltvNotEnabledError";
|
|
282
|
+
}
|
|
283
|
+
/** Offer index in its tree. */
|
|
284
|
+
index;
|
|
285
|
+
/** Disabled LLTV value. */
|
|
286
|
+
lltv;
|
|
287
|
+
}
|
|
288
|
+
/** Thrown when an uncreated market uses a disabled liquidation cursor.
|
|
289
|
+
*
|
|
290
|
+
* @throws {MidnightMarketLiquidationCursorNotEnabledError} when the liquidation cursor is disabled.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* import { MidnightMarketLiquidationCursorNotEnabledError } from "@morpho-org/morpho-sdk";
|
|
295
|
+
* const error = new MidnightMarketLiquidationCursorNotEnabledError({ index: 0, liquidationCursor: 1n });
|
|
296
|
+
* console.log(error.message);
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
export class MidnightMarketLiquidationCursorNotEnabledError extends Error {
|
|
300
|
+
/** Creates a disabled-cursor error. */
|
|
301
|
+
constructor(params) {
|
|
302
|
+
super(`Midnight offer "${params.index}" uses disabled liquidation cursor "${params.liquidationCursor}" for an uncreated market. Choose an enabled cursor.`);
|
|
303
|
+
this.index = params.index;
|
|
304
|
+
this.liquidationCursor = params.liquidationCursor;
|
|
305
|
+
this.name = "MidnightMarketLiquidationCursorNotEnabledError";
|
|
306
|
+
}
|
|
307
|
+
/** Offer index in its tree. */
|
|
308
|
+
index;
|
|
309
|
+
/** Disabled liquidation cursor value. */
|
|
310
|
+
liquidationCursor;
|
|
311
|
+
}
|
|
312
|
+
/** Thrown when an uncreated market's oracle address has no contract code.
|
|
313
|
+
*
|
|
314
|
+
* @throws {MidnightMarketOracleWithoutCodeError} when the oracle has no code.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```ts
|
|
318
|
+
* import { MidnightMarketOracleWithoutCodeError } from "@morpho-org/morpho-sdk";
|
|
319
|
+
* const error = new MidnightMarketOracleWithoutCodeError({ index: 0, oracle: "0x0000000000000000000000000000000000000001" });
|
|
320
|
+
* console.log(error.message);
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
export class MidnightMarketOracleWithoutCodeError extends Error {
|
|
324
|
+
/** Creates an oracle-code error. */
|
|
325
|
+
constructor(params) {
|
|
326
|
+
super(`Midnight offer "${params.index}" uses oracle "${params.oracle}" without contract code for an uncreated market. Choose a deployed oracle.`);
|
|
327
|
+
this.index = params.index;
|
|
328
|
+
this.oracle = params.oracle;
|
|
329
|
+
this.name = "MidnightMarketOracleWithoutCodeError";
|
|
330
|
+
}
|
|
331
|
+
/** Offer index in its tree. */
|
|
332
|
+
index;
|
|
333
|
+
/** Oracle address without code. */
|
|
334
|
+
oracle;
|
|
335
|
+
}
|
|
336
|
+
/** Thrown when a maker offer uses a callback unsupported by the selected flow.
|
|
337
|
+
*
|
|
338
|
+
* @throws {MidnightOfferCallbackNotSupportedError} when the callback is nonzero.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* import { MidnightOfferCallbackNotSupportedError } from "@morpho-org/morpho-sdk";
|
|
343
|
+
* const error = new MidnightOfferCallbackNotSupportedError({ index: 0, callback: "0x0000000000000000000000000000000000000001" });
|
|
344
|
+
* console.log(error.message);
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
export class MidnightOfferCallbackNotSupportedError extends Error {
|
|
348
|
+
/** Creates an unsupported-callback error. */
|
|
349
|
+
constructor(params) {
|
|
350
|
+
super(`Midnight offer "${params.index}" uses callback "${params.callback}", which this maker flow cannot execute. Use the zero address or a supported callback flow.`);
|
|
351
|
+
this.index = params.index;
|
|
352
|
+
this.callback = params.callback;
|
|
353
|
+
this.name = "MidnightOfferCallbackNotSupportedError";
|
|
354
|
+
}
|
|
355
|
+
/** Offer index in its tree. */
|
|
356
|
+
index;
|
|
357
|
+
/** Unsupported callback address. */
|
|
358
|
+
callback;
|
|
359
|
+
}
|