@morpho-org/morpho-sdk 7.1.0-next.1 → 8.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION-v7-to-v8.md +290 -0
- package/README.md +11 -6
- 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/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +3 -1
- package/lib/cjs/blue/types.d.ts +1 -1
- package/lib/cjs/blue/utils.d.ts +1 -1
- package/lib/cjs/blue/utils.js +5 -1
- 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 +1 -1
- 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 +54 -12
- package/lib/cjs/entities/vaultV2/vaultV2.js +52 -15
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +12 -6
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +42 -14
- package/lib/cjs/errors.d.ts +1 -1
- package/lib/cjs/errors.js +4 -2
- 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/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/sharedLiquidity.d.ts +12 -7
- package/lib/cjs/types.d.ts +1 -1
- package/lib/cjs/utils.d.ts +2 -1
- package/lib/cjs/utils.js +8 -2
- 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/errors.d.ts +1 -1
- package/lib/esm/blue/errors.js +1 -1
- package/lib/esm/blue/types.d.ts +1 -1
- package/lib/esm/blue/utils.d.ts +1 -1
- package/lib/esm/blue/utils.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +109 -27
- package/lib/esm/entities/blue/blue.js +104 -29
- package/lib/esm/entities/index.d.ts +1 -1
- 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 +54 -12
- package/lib/esm/entities/vaultV2/vaultV2.js +53 -16
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +12 -6
- package/lib/esm/entities/vaultV2BlueReallocationData.js +42 -14
- package/lib/esm/errors.d.ts +1 -1
- package/lib/esm/errors.js +1 -1
- 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/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/sharedLiquidity.d.ts +12 -7
- package/lib/esm/types.d.ts +1 -1
- package/lib/esm/utils.d.ts +2 -1
- package/lib/esm/utils.js +2 -1
- package/package.json +7 -6
|
@@ -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
|
+
}
|