@morpho-org/morpho-sdk 6.0.0 → 6.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-v5-to-v6.md +1 -1
- package/README.md +1 -1
- package/lib/cjs/abis.d.ts +1 -1
- package/lib/cjs/abis.js +3 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +16 -5
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +16 -5
- package/lib/cjs/constants.d.ts +1 -1
- package/lib/cjs/constants.js +4 -1
- package/lib/cjs/entities/blue/blue.d.ts +28 -0
- package/lib/cjs/entities/blue/blue.js +1 -0
- package/lib/cjs/entities/index.d.ts +1 -1
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -2
- package/lib/cjs/entities/vaultV1/vaultV1.js +1 -0
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +35 -11
- package/lib/cjs/entities/vaultV2/vaultV2.js +1 -0
- package/lib/cjs/errors.d.ts +1 -1
- package/lib/cjs/errors.js +8 -1
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +10 -6
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +10 -6
- package/lib/cjs/helpers/slippage.d.ts +3 -2
- package/lib/cjs/helpers/slippage.js +3 -2
- package/lib/cjs/helpers/validate.d.ts +40 -0
- package/lib/cjs/helpers/validate.js +40 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +94 -59
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +94 -59
- package/lib/cjs/midnight/abis.d.ts +1 -1
- package/lib/cjs/midnight/abis.js +3 -1
- package/lib/cjs/midnight/constants.d.ts +1 -1
- package/lib/cjs/midnight/constants.js +4 -1
- package/lib/cjs/midnight/entities.d.ts +1 -1
- package/lib/cjs/midnight/errors.d.ts +1 -1
- package/lib/cjs/midnight/errors.js +7 -1
- package/lib/cjs/midnight/types.d.ts +1 -1
- package/lib/cjs/midnight/utils.d.ts +11 -1
- package/lib/cjs/midnight/utils.js +13 -1
- package/lib/cjs/types/action.d.ts +34 -0
- package/lib/cjs/types/action.js +10 -0
- package/lib/cjs/types.d.ts +1 -1
- package/lib/cjs/utils.d.ts +11 -1
- package/lib/cjs/utils.js +14 -2
- package/lib/esm/abis.d.ts +1 -1
- package/lib/esm/abis.js +1 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +16 -5
- package/lib/esm/actions/vaultV2/forceWithdraw.js +16 -5
- package/lib/esm/constants.d.ts +1 -1
- package/lib/esm/constants.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +28 -0
- package/lib/esm/entities/blue/blue.js +1 -0
- package/lib/esm/entities/index.d.ts +1 -1
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -2
- package/lib/esm/entities/vaultV1/vaultV1.js +1 -0
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +35 -11
- package/lib/esm/entities/vaultV2/vaultV2.js +1 -0
- package/lib/esm/errors.d.ts +1 -1
- package/lib/esm/errors.js +1 -1
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +10 -6
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +10 -6
- package/lib/esm/helpers/slippage.d.ts +3 -2
- package/lib/esm/helpers/slippage.js +3 -2
- package/lib/esm/helpers/validate.d.ts +40 -0
- package/lib/esm/helpers/validate.js +40 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +94 -59
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +94 -59
- package/lib/esm/midnight/abis.d.ts +1 -1
- package/lib/esm/midnight/abis.js +1 -1
- package/lib/esm/midnight/constants.d.ts +1 -1
- package/lib/esm/midnight/constants.js +1 -1
- package/lib/esm/midnight/entities.d.ts +1 -1
- package/lib/esm/midnight/errors.d.ts +1 -1
- package/lib/esm/midnight/errors.js +1 -1
- package/lib/esm/midnight/types.d.ts +1 -1
- package/lib/esm/midnight/utils.d.ts +11 -1
- package/lib/esm/midnight/utils.js +11 -1
- package/lib/esm/types/action.d.ts +34 -0
- package/lib/esm/types/action.js +10 -0
- package/lib/esm/types.d.ts +1 -1
- package/lib/esm/utils.d.ts +11 -1
- package/lib/esm/utils.js +11 -1
- package/package.json +4 -4
|
@@ -51,11 +51,15 @@ export type VaultV2ForceWithdrawEligibility = {
|
|
|
51
51
|
* describing which precondition failed.
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
54
55
|
* import { resolveVaultV2ForceWithdrawEligibility } from "@morpho-org/morpho-sdk";
|
|
55
56
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
57
|
+
* export function checkEligibility(vaultData: AccrualVaultV2) {
|
|
58
|
+
* const eligibility = resolveVaultV2ForceWithdrawEligibility(vaultData);
|
|
59
|
+
* if (eligibility.type === "eligible") {
|
|
60
|
+
* console.log(eligibility.adapter.address, eligibility.liquidityMarketId);
|
|
61
|
+
* }
|
|
62
|
+
* return eligibility;
|
|
59
63
|
* }
|
|
60
64
|
* ```
|
|
61
65
|
*/
|
|
@@ -76,13 +80,21 @@ export declare function resolveVaultV2ForceWithdrawEligibility(vaultData: Accrua
|
|
|
76
80
|
* owner is not a fee recipient.
|
|
77
81
|
* @example
|
|
78
82
|
* ```ts
|
|
83
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
79
84
|
* import { computeVaultV2ForceWithdrawFeeSharesMinted } from "@morpho-org/morpho-sdk";
|
|
85
|
+
* import type { Address } from "viem";
|
|
80
86
|
*
|
|
81
|
-
*
|
|
82
|
-
* vaultData,
|
|
83
|
-
* owner,
|
|
84
|
-
* timestamp,
|
|
85
|
-
*
|
|
87
|
+
* export function feeShares(
|
|
88
|
+
* vaultData: AccrualVaultV2,
|
|
89
|
+
* owner: Address,
|
|
90
|
+
* timestamp: bigint,
|
|
91
|
+
* ) {
|
|
92
|
+
* return computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
93
|
+
* vaultData,
|
|
94
|
+
* owner,
|
|
95
|
+
* timestamp,
|
|
96
|
+
* });
|
|
97
|
+
* }
|
|
86
98
|
* ```
|
|
87
99
|
*/
|
|
88
100
|
export declare function computeVaultV2ForceWithdrawFeeSharesMinted(params: {
|
|
@@ -155,21 +167,24 @@ export interface VaultV2ForceWithdrawPlan {
|
|
|
155
167
|
* @throws {NonPositiveInputError} when `exitAssets` is not positive.
|
|
156
168
|
* @example
|
|
157
169
|
* ```ts
|
|
170
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
158
171
|
* import {
|
|
159
172
|
* computeVaultV2ForceWithdrawPlan,
|
|
160
173
|
* resolveVaultV2ForceWithdrawEligibility,
|
|
161
174
|
* } from "@morpho-org/morpho-sdk";
|
|
162
175
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
176
|
+
* export function planExit(vaultData: AccrualVaultV2, timestamp: bigint) {
|
|
177
|
+
* const eligibility = resolveVaultV2ForceWithdrawEligibility(vaultData);
|
|
178
|
+
* if (eligibility.type !== "eligible") return undefined;
|
|
165
179
|
* const plan = computeVaultV2ForceWithdrawPlan({
|
|
166
180
|
* vaultData,
|
|
167
181
|
* adapter: eligibility.adapter,
|
|
168
182
|
* liquidityMarketId: eligibility.liquidityMarketId,
|
|
169
183
|
* exitAssets: 1_000_000n,
|
|
170
|
-
* timestamp
|
|
184
|
+
* timestamp,
|
|
171
185
|
* });
|
|
172
186
|
* // plan.withdrawnAssets is what the user receives before the referral fee
|
|
187
|
+
* return plan;
|
|
173
188
|
* }
|
|
174
189
|
* ```
|
|
175
190
|
*/
|
|
@@ -224,55 +239,69 @@ export declare function computeVaultV2ForceWithdrawPlan(params: {
|
|
|
224
239
|
* @returns An upper bound, in vault shares, of what the exit burns.
|
|
225
240
|
* @example
|
|
226
241
|
* ```ts
|
|
227
|
-
* import { MathLib } from "@morpho-org/blue-sdk";
|
|
242
|
+
* import { MathLib, type AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
228
243
|
* import {
|
|
229
244
|
* computeVaultV2ForceWithdrawFeeSharesMinted,
|
|
230
245
|
* computeVaultV2ForceWithdrawSharesBurnt,
|
|
246
|
+
* type VaultV2ForceWithdrawPlan,
|
|
231
247
|
* } from "@morpho-org/morpho-sdk";
|
|
248
|
+
* import { type Address, maxUint256 } from "viem";
|
|
232
249
|
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* });
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
250
|
+
* export function requiredShareAllowance(
|
|
251
|
+
* vaultData: AccrualVaultV2,
|
|
252
|
+
* plan: VaultV2ForceWithdrawPlan,
|
|
253
|
+
* owner: Address,
|
|
254
|
+
* now: bigint,
|
|
255
|
+
* deadline: bigint,
|
|
256
|
+
* exitAssets: bigint,
|
|
257
|
+
* minSharePriceE27: bigint,
|
|
258
|
+
* slippageTolerance: bigint,
|
|
259
|
+
* ) {
|
|
260
|
+
* const { vault: nowVaultData } = vaultData.accrueInterest(now);
|
|
261
|
+
* const sharesBurntRaw = computeVaultV2ForceWithdrawSharesBurnt({
|
|
262
|
+
* vaultData,
|
|
263
|
+
* deadlineVaultData: vaultData,
|
|
264
|
+
* plan,
|
|
265
|
+
* });
|
|
266
|
+
* const sharesBurntNow = computeVaultV2ForceWithdrawSharesBurnt({
|
|
267
|
+
* vaultData: nowVaultData,
|
|
268
|
+
* deadlineVaultData: nowVaultData,
|
|
269
|
+
* plan,
|
|
270
|
+
* });
|
|
271
|
+
* const feeSharesNow = computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
272
|
+
* vaultData,
|
|
273
|
+
* owner,
|
|
274
|
+
* timestamp: now,
|
|
275
|
+
* });
|
|
276
|
+
* const sharesBurntForFloor = MathLib.max(
|
|
277
|
+
* sharesBurntRaw,
|
|
278
|
+
* sharesBurntNow - feeSharesNow,
|
|
279
|
+
* );
|
|
280
|
+
* const allowanceSharePriceE27 = MathLib.max(
|
|
281
|
+
* MathLib.min(
|
|
282
|
+
* MathLib.mulDivDown(
|
|
283
|
+
* minSharePriceE27,
|
|
284
|
+
* MathLib.WAD - slippageTolerance,
|
|
285
|
+
* MathLib.WAD,
|
|
286
|
+
* ),
|
|
287
|
+
* minSharePriceE27 - 1n,
|
|
259
288
|
* ),
|
|
260
|
-
*
|
|
261
|
-
* )
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
289
|
+
* 1n,
|
|
290
|
+
* );
|
|
291
|
+
* const requiredShareAllowance = MathLib.min(
|
|
292
|
+
* MathLib.max(
|
|
293
|
+
* MathLib.mulDivUp(exitAssets, MathLib.RAY, allowanceSharePriceE27),
|
|
294
|
+
* MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) + 1n,
|
|
295
|
+
* ) +
|
|
296
|
+
* computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
297
|
+
* vaultData,
|
|
298
|
+
* owner,
|
|
299
|
+
* timestamp: deadline,
|
|
300
|
+
* }),
|
|
301
|
+
* maxUint256,
|
|
302
|
+
* );
|
|
303
|
+
* return requiredShareAllowance;
|
|
304
|
+
* }
|
|
276
305
|
* ```
|
|
277
306
|
*/
|
|
278
307
|
export declare function computeVaultV2ForceWithdrawSharesBurnt(params: {
|
|
@@ -293,12 +322,18 @@ export declare function computeVaultV2ForceWithdrawSharesBurnt(params: {
|
|
|
293
322
|
* @returns A lower bound, in vault shares, of the burn measured by the contract.
|
|
294
323
|
* @example
|
|
295
324
|
* ```ts
|
|
296
|
-
* import {
|
|
325
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
326
|
+
* import {
|
|
327
|
+
* computeVaultV2ForceWithdrawMinSharesBurnt,
|
|
328
|
+
* type VaultV2ForceWithdrawPlan,
|
|
329
|
+
* } from "@morpho-org/morpho-sdk";
|
|
297
330
|
*
|
|
298
|
-
*
|
|
299
|
-
* vaultData,
|
|
300
|
-
* plan,
|
|
301
|
-
*
|
|
331
|
+
* export function minSharesBurnt(
|
|
332
|
+
* vaultData: AccrualVaultV2,
|
|
333
|
+
* plan: VaultV2ForceWithdrawPlan,
|
|
334
|
+
* ) {
|
|
335
|
+
* return computeVaultV2ForceWithdrawMinSharesBurnt({ vaultData, plan });
|
|
336
|
+
* }
|
|
302
337
|
* ```
|
|
303
338
|
*/
|
|
304
339
|
export declare function computeVaultV2ForceWithdrawMinSharesBurnt(params: {
|
|
@@ -25,11 +25,15 @@ const index_js_1 = require("../types/index.js");
|
|
|
25
25
|
* describing which precondition failed.
|
|
26
26
|
* @example
|
|
27
27
|
* ```ts
|
|
28
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
28
29
|
* import { resolveVaultV2ForceWithdrawEligibility } from "@morpho-org/morpho-sdk";
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* export function checkEligibility(vaultData: AccrualVaultV2) {
|
|
32
|
+
* const eligibility = resolveVaultV2ForceWithdrawEligibility(vaultData);
|
|
33
|
+
* if (eligibility.type === "eligible") {
|
|
34
|
+
* console.log(eligibility.adapter.address, eligibility.liquidityMarketId);
|
|
35
|
+
* }
|
|
36
|
+
* return eligibility;
|
|
33
37
|
* }
|
|
34
38
|
* ```
|
|
35
39
|
*/
|
|
@@ -88,13 +92,21 @@ function resolveVaultV2ForceWithdrawEligibility(vaultData, adapterOverride) {
|
|
|
88
92
|
* owner is not a fee recipient.
|
|
89
93
|
* @example
|
|
90
94
|
* ```ts
|
|
95
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
91
96
|
* import { computeVaultV2ForceWithdrawFeeSharesMinted } from "@morpho-org/morpho-sdk";
|
|
97
|
+
* import type { Address } from "viem";
|
|
92
98
|
*
|
|
93
|
-
*
|
|
94
|
-
* vaultData,
|
|
95
|
-
* owner,
|
|
96
|
-
* timestamp,
|
|
97
|
-
*
|
|
99
|
+
* export function feeShares(
|
|
100
|
+
* vaultData: AccrualVaultV2,
|
|
101
|
+
* owner: Address,
|
|
102
|
+
* timestamp: bigint,
|
|
103
|
+
* ) {
|
|
104
|
+
* return computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
105
|
+
* vaultData,
|
|
106
|
+
* owner,
|
|
107
|
+
* timestamp,
|
|
108
|
+
* });
|
|
109
|
+
* }
|
|
98
110
|
* ```
|
|
99
111
|
*/
|
|
100
112
|
function computeVaultV2ForceWithdrawFeeSharesMinted(params) {
|
|
@@ -144,21 +156,24 @@ function computeVaultV2ForceWithdrawFeeSharesMinted(params) {
|
|
|
144
156
|
* @throws {NonPositiveInputError} when `exitAssets` is not positive.
|
|
145
157
|
* @example
|
|
146
158
|
* ```ts
|
|
159
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
147
160
|
* import {
|
|
148
161
|
* computeVaultV2ForceWithdrawPlan,
|
|
149
162
|
* resolveVaultV2ForceWithdrawEligibility,
|
|
150
163
|
* } from "@morpho-org/morpho-sdk";
|
|
151
164
|
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
165
|
+
* export function planExit(vaultData: AccrualVaultV2, timestamp: bigint) {
|
|
166
|
+
* const eligibility = resolveVaultV2ForceWithdrawEligibility(vaultData);
|
|
167
|
+
* if (eligibility.type !== "eligible") return undefined;
|
|
154
168
|
* const plan = computeVaultV2ForceWithdrawPlan({
|
|
155
169
|
* vaultData,
|
|
156
170
|
* adapter: eligibility.adapter,
|
|
157
171
|
* liquidityMarketId: eligibility.liquidityMarketId,
|
|
158
172
|
* exitAssets: 1_000_000n,
|
|
159
|
-
* timestamp
|
|
173
|
+
* timestamp,
|
|
160
174
|
* });
|
|
161
175
|
* // plan.withdrawnAssets is what the user receives before the referral fee
|
|
176
|
+
* return plan;
|
|
162
177
|
* }
|
|
163
178
|
* ```
|
|
164
179
|
*/
|
|
@@ -301,55 +316,69 @@ function computeVaultV2ForceWithdrawPlan(params) {
|
|
|
301
316
|
* @returns An upper bound, in vault shares, of what the exit burns.
|
|
302
317
|
* @example
|
|
303
318
|
* ```ts
|
|
304
|
-
* import { MathLib } from "@morpho-org/blue-sdk";
|
|
319
|
+
* import { MathLib, type AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
305
320
|
* import {
|
|
306
321
|
* computeVaultV2ForceWithdrawFeeSharesMinted,
|
|
307
322
|
* computeVaultV2ForceWithdrawSharesBurnt,
|
|
323
|
+
* type VaultV2ForceWithdrawPlan,
|
|
308
324
|
* } from "@morpho-org/morpho-sdk";
|
|
325
|
+
* import { type Address, maxUint256 } from "viem";
|
|
309
326
|
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
* });
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
327
|
+
* export function requiredShareAllowance(
|
|
328
|
+
* vaultData: AccrualVaultV2,
|
|
329
|
+
* plan: VaultV2ForceWithdrawPlan,
|
|
330
|
+
* owner: Address,
|
|
331
|
+
* now: bigint,
|
|
332
|
+
* deadline: bigint,
|
|
333
|
+
* exitAssets: bigint,
|
|
334
|
+
* minSharePriceE27: bigint,
|
|
335
|
+
* slippageTolerance: bigint,
|
|
336
|
+
* ) {
|
|
337
|
+
* const { vault: nowVaultData } = vaultData.accrueInterest(now);
|
|
338
|
+
* const sharesBurntRaw = computeVaultV2ForceWithdrawSharesBurnt({
|
|
339
|
+
* vaultData,
|
|
340
|
+
* deadlineVaultData: vaultData,
|
|
341
|
+
* plan,
|
|
342
|
+
* });
|
|
343
|
+
* const sharesBurntNow = computeVaultV2ForceWithdrawSharesBurnt({
|
|
344
|
+
* vaultData: nowVaultData,
|
|
345
|
+
* deadlineVaultData: nowVaultData,
|
|
346
|
+
* plan,
|
|
347
|
+
* });
|
|
348
|
+
* const feeSharesNow = computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
349
|
+
* vaultData,
|
|
350
|
+
* owner,
|
|
351
|
+
* timestamp: now,
|
|
352
|
+
* });
|
|
353
|
+
* const sharesBurntForFloor = MathLib.max(
|
|
354
|
+
* sharesBurntRaw,
|
|
355
|
+
* sharesBurntNow - feeSharesNow,
|
|
356
|
+
* );
|
|
357
|
+
* const allowanceSharePriceE27 = MathLib.max(
|
|
358
|
+
* MathLib.min(
|
|
359
|
+
* MathLib.mulDivDown(
|
|
360
|
+
* minSharePriceE27,
|
|
361
|
+
* MathLib.WAD - slippageTolerance,
|
|
362
|
+
* MathLib.WAD,
|
|
363
|
+
* ),
|
|
364
|
+
* minSharePriceE27 - 1n,
|
|
336
365
|
* ),
|
|
337
|
-
*
|
|
338
|
-
* )
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
366
|
+
* 1n,
|
|
367
|
+
* );
|
|
368
|
+
* const requiredShareAllowance = MathLib.min(
|
|
369
|
+
* MathLib.max(
|
|
370
|
+
* MathLib.mulDivUp(exitAssets, MathLib.RAY, allowanceSharePriceE27),
|
|
371
|
+
* MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) + 1n,
|
|
372
|
+
* ) +
|
|
373
|
+
* computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
374
|
+
* vaultData,
|
|
375
|
+
* owner,
|
|
376
|
+
* timestamp: deadline,
|
|
377
|
+
* }),
|
|
378
|
+
* maxUint256,
|
|
379
|
+
* );
|
|
380
|
+
* return requiredShareAllowance;
|
|
381
|
+
* }
|
|
353
382
|
* ```
|
|
354
383
|
*/
|
|
355
384
|
function computeVaultV2ForceWithdrawSharesBurnt(params) {
|
|
@@ -384,12 +413,18 @@ function computeVaultV2ForceWithdrawSharesBurnt(params) {
|
|
|
384
413
|
* @returns A lower bound, in vault shares, of the burn measured by the contract.
|
|
385
414
|
* @example
|
|
386
415
|
* ```ts
|
|
387
|
-
* import {
|
|
416
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
417
|
+
* import {
|
|
418
|
+
* computeVaultV2ForceWithdrawMinSharesBurnt,
|
|
419
|
+
* type VaultV2ForceWithdrawPlan,
|
|
420
|
+
* } from "@morpho-org/morpho-sdk";
|
|
388
421
|
*
|
|
389
|
-
*
|
|
390
|
-
* vaultData,
|
|
391
|
-
* plan,
|
|
392
|
-
*
|
|
422
|
+
* export function minSharesBurnt(
|
|
423
|
+
* vaultData: AccrualVaultV2,
|
|
424
|
+
* plan: VaultV2ForceWithdrawPlan,
|
|
425
|
+
* ) {
|
|
426
|
+
* return computeVaultV2ForceWithdrawMinSharesBurnt({ vaultData, plan });
|
|
427
|
+
* }
|
|
393
428
|
* ```
|
|
394
429
|
*/
|
|
395
430
|
function computeVaultV2ForceWithdrawMinSharesBurnt(params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
|
|
1
|
+
export { ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, priceRatifierV1Abi, rateRatifierV1Abi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
|
package/lib/cjs/midnight/abis.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setterRatifierAbi = exports.midnightBundlesAbi = exports.midnightAbi = exports.ecrecoverRatifierAbi = void 0;
|
|
3
|
+
exports.setterRatifierAbi = exports.rateRatifierV1Abi = exports.priceRatifierV1Abi = exports.midnightBundlesAbi = exports.midnightAbi = exports.ecrecoverRatifierAbi = void 0;
|
|
4
4
|
var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
5
5
|
Object.defineProperty(exports, "ecrecoverRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.ecrecoverRatifierAbi; } });
|
|
6
6
|
Object.defineProperty(exports, "midnightAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightAbi; } });
|
|
7
7
|
Object.defineProperty(exports, "midnightBundlesAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightBundlesAbi; } });
|
|
8
|
+
Object.defineProperty(exports, "priceRatifierV1Abi", { enumerable: true, get: function () { return midnight_sdk_1.priceRatifierV1Abi; } });
|
|
9
|
+
Object.defineProperty(exports, "rateRatifierV1Abi", { enumerable: true, get: function () { return midnight_sdk_1.rateRatifierV1Abi; } });
|
|
8
10
|
Object.defineProperty(exports, "setterRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.setterRatifierAbi; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { CBP, COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH, MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE, MAX_OFFER_CAP, MAX_SETTLEMENT_FEES, MAX_TICK, OFFER_TYPEHASH, PRICE_ROUNDING_STEP, SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
|
|
1
|
+
export { CBP, COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH, MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE, MAX_OFFER_CAP, MAX_SETTLEMENT_FEES, MAX_TICK, MAX_TREE_HEIGHT, OFFER_TYPEHASH, PRICE_RATIFIER_V1_OFFER_TYPEHASH, PRICE_ROUNDING_STEP, RATE_RATIFIER_V1_OFFER_TYPEHASH, SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TIME_TO_MAX_LIF = exports.SETTLEMENT_FEE_BREAKPOINTS = exports.PRICE_ROUNDING_STEP = exports.OFFER_TYPEHASH = exports.MAX_TICK = exports.MAX_SETTLEMENT_FEES = exports.MAX_OFFER_CAP = exports.MAX_CONTINUOUS_FEE = exports.MAX_COLLATERALS_PER_BORROWER = exports.MAX_COLLATERALS = exports.MARKET_TYPEHASH = exports.EIP712_DOMAIN_TYPEHASH = exports.DEFAULT_TICK_SPACING = exports.COLLATERAL_PARAMS_TYPEHASH = exports.CBP = void 0;
|
|
3
|
+
exports.TIME_TO_MAX_LIF = exports.SETTLEMENT_FEE_BREAKPOINTS = exports.RATE_RATIFIER_V1_OFFER_TYPEHASH = exports.PRICE_ROUNDING_STEP = exports.PRICE_RATIFIER_V1_OFFER_TYPEHASH = exports.OFFER_TYPEHASH = exports.MAX_TREE_HEIGHT = exports.MAX_TICK = exports.MAX_SETTLEMENT_FEES = exports.MAX_OFFER_CAP = exports.MAX_CONTINUOUS_FEE = exports.MAX_COLLATERALS_PER_BORROWER = exports.MAX_COLLATERALS = exports.MARKET_TYPEHASH = exports.EIP712_DOMAIN_TYPEHASH = exports.DEFAULT_TICK_SPACING = exports.COLLATERAL_PARAMS_TYPEHASH = exports.CBP = void 0;
|
|
4
4
|
var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
5
5
|
Object.defineProperty(exports, "CBP", { enumerable: true, get: function () { return midnight_sdk_1.CBP; } });
|
|
6
6
|
Object.defineProperty(exports, "COLLATERAL_PARAMS_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.COLLATERAL_PARAMS_TYPEHASH; } });
|
|
@@ -13,7 +13,10 @@ Object.defineProperty(exports, "MAX_CONTINUOUS_FEE", { enumerable: true, get: fu
|
|
|
13
13
|
Object.defineProperty(exports, "MAX_OFFER_CAP", { enumerable: true, get: function () { return midnight_sdk_1.MAX_OFFER_CAP; } });
|
|
14
14
|
Object.defineProperty(exports, "MAX_SETTLEMENT_FEES", { enumerable: true, get: function () { return midnight_sdk_1.MAX_SETTLEMENT_FEES; } });
|
|
15
15
|
Object.defineProperty(exports, "MAX_TICK", { enumerable: true, get: function () { return midnight_sdk_1.MAX_TICK; } });
|
|
16
|
+
Object.defineProperty(exports, "MAX_TREE_HEIGHT", { enumerable: true, get: function () { return midnight_sdk_1.MAX_TREE_HEIGHT; } });
|
|
16
17
|
Object.defineProperty(exports, "OFFER_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.OFFER_TYPEHASH; } });
|
|
18
|
+
Object.defineProperty(exports, "PRICE_RATIFIER_V1_OFFER_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.PRICE_RATIFIER_V1_OFFER_TYPEHASH; } });
|
|
17
19
|
Object.defineProperty(exports, "PRICE_ROUNDING_STEP", { enumerable: true, get: function () { return midnight_sdk_1.PRICE_ROUNDING_STEP; } });
|
|
20
|
+
Object.defineProperty(exports, "RATE_RATIFIER_V1_OFFER_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.RATE_RATIFIER_V1_OFFER_TYPEHASH; } });
|
|
18
21
|
Object.defineProperty(exports, "SETTLEMENT_FEE_BREAKPOINTS", { enumerable: true, get: function () { return midnight_sdk_1.SETTLEMENT_FEE_BREAKPOINTS; } });
|
|
19
22
|
Object.defineProperty(exports, "TIME_TO_MAX_LIF", { enumerable: true, get: function () { return midnight_sdk_1.TIME_TO_MAX_LIF; } });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { BuildOfferParams, CollateralParams, GroupInput, IAccrualPosition, ICollateralParams, IGroup, IMarket, IMarketParams, IOffer, IPosition, MarketInput, OfferStruct, RatifierTreeInput, SettlementFeeCbps, TreeCreateParams, TreeDescriptor, TreeInput, TreeLike, TreeMempoolValidateParams, TreeMempoolValidateRatification, TreeProof, } from "@morpho-org/midnight-sdk";
|
|
1
|
+
export type { AnyTree, AnyTreeSnapshot, BuildOfferParams, CollateralParams, EcrecoverTreeCreateRequest, GroupInput, IAccrualPosition, ICollateralParams, IGroup, IMarket, IMarketParams, IOffer, IPosition, MarketInput, OfferStruct, PriceRatifierV1TreeCreateRequest, RateRatifierV1TreeCreateRequest, RatifierKind, RatifierTreeInput, RatifierTypes, SetterTreeCreateRequest, SettlementFeeCbps, TreeCreateParams, TreeCreateRequest, TreeData, TreeDescriptor, TreeEntry, TreeInput, TreeLike, TreeMempoolValidateParams, TreeMempoolValidateRatification, TreeProof, TreeSnapshot, TypedRatifierTreeInput, TypedTreeMempoolValidateParams, } from "@morpho-org/midnight-sdk";
|
|
2
2
|
export { AccrualPosition, Group, Market, MarketParams, Offer, Position, Tree, } from "@morpho-org/midnight-sdk";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ChainIdMismatchError, InvalidEcrecoverSignatureVError, InvalidMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError, InvalidOfferParameterError, InvalidPositionAccrualStateError, InvalidPositionAccrualTimestampError, InvalidPositionLossFactorError, InvalidTickSpacingError, InvalidTreeError, InvalidTreeHeightError, InvalidTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError, PriceGreaterThanOneError, SettlementFeeExceedsPriceError, TickOutOfRangeError, UnknownCollateralIndexError, } from "@morpho-org/midnight-sdk";
|
|
1
|
+
export { ChainIdMismatchError, InvalidEcrecoverSignatureVError, InvalidMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError, InvalidOfferParameterError, InvalidPositionAccrualStateError, InvalidPositionAccrualTimestampError, InvalidPositionLossFactorError, InvalidRateRatifierV1RateError, InvalidRateRatifierV1TickError, InvalidRateRatifierV1TimeError, InvalidRatifierV1AddressError, InvalidTickSpacingError, InvalidTreeError, InvalidTreeHeightError, InvalidTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError, PriceGreaterThanOneError, RateRatifierV1BoundOverflowError, RatifierV1TakerNotAllowedError, SettlementFeeExceedsPriceError, TickOutOfRangeError, UnknownCollateralIndexError, } from "@morpho-org/midnight-sdk";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnknownCollateralIndexError = exports.TickOutOfRangeError = exports.SettlementFeeExceedsPriceError = exports.PriceGreaterThanOneError = exports.PayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidTypedDataSignatureError = exports.InvalidTreeHeightError = exports.InvalidTreeError = exports.InvalidTickSpacingError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.InvalidPositionAccrualStateError = exports.InvalidOfferParameterError = exports.InvalidOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMarketParameterError = exports.InvalidEcrecoverSignatureVError = exports.ChainIdMismatchError = void 0;
|
|
3
|
+
exports.UnknownCollateralIndexError = exports.TickOutOfRangeError = exports.SettlementFeeExceedsPriceError = exports.RatifierV1TakerNotAllowedError = exports.RateRatifierV1BoundOverflowError = exports.PriceGreaterThanOneError = exports.PayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidTypedDataSignatureError = exports.InvalidTreeHeightError = exports.InvalidTreeError = exports.InvalidTickSpacingError = exports.InvalidRatifierV1AddressError = exports.InvalidRateRatifierV1TimeError = exports.InvalidRateRatifierV1TickError = exports.InvalidRateRatifierV1RateError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.InvalidPositionAccrualStateError = exports.InvalidOfferParameterError = exports.InvalidOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMarketParameterError = exports.InvalidEcrecoverSignatureVError = exports.ChainIdMismatchError = void 0;
|
|
4
4
|
var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
5
5
|
Object.defineProperty(exports, "ChainIdMismatchError", { enumerable: true, get: function () { return midnight_sdk_1.ChainIdMismatchError; } });
|
|
6
6
|
Object.defineProperty(exports, "InvalidEcrecoverSignatureVError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidEcrecoverSignatureVError; } });
|
|
@@ -12,6 +12,10 @@ Object.defineProperty(exports, "InvalidOfferParameterError", { enumerable: true,
|
|
|
12
12
|
Object.defineProperty(exports, "InvalidPositionAccrualStateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualStateError; } });
|
|
13
13
|
Object.defineProperty(exports, "InvalidPositionAccrualTimestampError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualTimestampError; } });
|
|
14
14
|
Object.defineProperty(exports, "InvalidPositionLossFactorError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionLossFactorError; } });
|
|
15
|
+
Object.defineProperty(exports, "InvalidRateRatifierV1RateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1RateError; } });
|
|
16
|
+
Object.defineProperty(exports, "InvalidRateRatifierV1TickError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TickError; } });
|
|
17
|
+
Object.defineProperty(exports, "InvalidRateRatifierV1TimeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TimeError; } });
|
|
18
|
+
Object.defineProperty(exports, "InvalidRatifierV1AddressError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRatifierV1AddressError; } });
|
|
15
19
|
Object.defineProperty(exports, "InvalidTickSpacingError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTickSpacingError; } });
|
|
16
20
|
Object.defineProperty(exports, "InvalidTreeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeError; } });
|
|
17
21
|
Object.defineProperty(exports, "InvalidTreeHeightError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeHeightError; } });
|
|
@@ -20,6 +24,8 @@ Object.defineProperty(exports, "MidnightApiError", { enumerable: true, get: func
|
|
|
20
24
|
Object.defineProperty(exports, "MidnightMempoolValidationError", { enumerable: true, get: function () { return midnight_sdk_1.MidnightMempoolValidationError; } });
|
|
21
25
|
Object.defineProperty(exports, "PayloadDecodeError", { enumerable: true, get: function () { return midnight_sdk_1.PayloadDecodeError; } });
|
|
22
26
|
Object.defineProperty(exports, "PriceGreaterThanOneError", { enumerable: true, get: function () { return midnight_sdk_1.PriceGreaterThanOneError; } });
|
|
27
|
+
Object.defineProperty(exports, "RateRatifierV1BoundOverflowError", { enumerable: true, get: function () { return midnight_sdk_1.RateRatifierV1BoundOverflowError; } });
|
|
28
|
+
Object.defineProperty(exports, "RatifierV1TakerNotAllowedError", { enumerable: true, get: function () { return midnight_sdk_1.RatifierV1TakerNotAllowedError; } });
|
|
23
29
|
Object.defineProperty(exports, "SettlementFeeExceedsPriceError", { enumerable: true, get: function () { return midnight_sdk_1.SettlementFeeExceedsPriceError; } });
|
|
24
30
|
Object.defineProperty(exports, "TickOutOfRangeError", { enumerable: true, get: function () { return midnight_sdk_1.TickOutOfRangeError; } });
|
|
25
31
|
Object.defineProperty(exports, "UnknownCollateralIndexError", { enumerable: true, get: function () { return midnight_sdk_1.UnknownCollateralIndexError; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { BuildFixedRateOfferChainParams, DecodedEcrecoverRatifierData, DecodedSetterRatifierData, DeploylessFetchParameters, EcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams, EcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams, EcrecoverRatifierRootDigestParams, EcrecoverRatifierTypedDataParams, EcrecoverSignatureInput, FixedRateOfferChainLeg, GetRatifierInfoParams, MidnightCallParameters, MidnightFetchParams, RatifierInfo, SetterRatifierDataParams, SetterRatifierDataVerificationParams, VerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
|
|
1
|
+
export type { BuildFixedRateOfferChainParams, DecodedEcrecoverRatifierData, DecodedPriceRatifierV1Data, DecodedRateRatifierV1Data, DecodedSetterRatifierData, DeploylessFetchParameters, EcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams, EcrecoverRatifierDataRequest, EcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams, EcrecoverRatifierRatifyRequest, EcrecoverRatifierRootDigestParams, EcrecoverRatifierSignRequest, EcrecoverRatifierTypedDataParams, EcrecoverRatifierTypedDataRequest, EcrecoverSignatureInput, FixedRateOfferChainLeg, GetRatifierInfoParams, MidnightCallParameters, MidnightFetchParams, PriceRatifierV1Leaf, PriceRatifierV1LeafStruct, PriceRatifierV1TreeDescriptor, PriceRatifierV1TreeInput, RateRatifierV1Leaf, RateRatifierV1LeafStruct, RateRatifierV1TreeDescriptor, RateRatifierV1TreeInput, RatifierInfo, SetterRatifierDataParams, SetterRatifierDataRequest, SetterRatifierDataVerificationParams, SetterRatifierRatifyRequest, VerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { EcrecoverRatifier,
|
|
2
|
+
/** @deprecated Use EcrecoverRatifier with a tagged tree. */
|
|
3
|
+
EcrecoverRatifierUtils, eip712Digest, GroupUtils, MarketUtils, OfferChainUtils, OfferUtils, Payload, PositionUtils, PriceRatifierV1,
|
|
4
|
+
/** @deprecated Use PriceRatifierV1. */
|
|
5
|
+
PriceRatifierV1Utils, RateRatifierV1,
|
|
6
|
+
/** @deprecated Use RateRatifierV1. */
|
|
7
|
+
RateRatifierV1Utils, Ratifier,
|
|
8
|
+
/** @deprecated Use Ratifier. */
|
|
9
|
+
RatifierUtils, SetterRatifier,
|
|
10
|
+
/** @deprecated Use SetterRatifier with a tagged tree. */
|
|
11
|
+
SetterRatifierUtils, TakeAmountsLib, TickLib, TreeUtils, } from "@morpho-org/midnight-sdk";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TreeUtils = exports.TickLib = exports.TakeAmountsLib = exports.SetterRatifierUtils = exports.RatifierUtils = exports.PositionUtils = exports.Payload = exports.OfferUtils = exports.OfferChainUtils = exports.MarketUtils = exports.GroupUtils = exports.eip712Digest = exports.EcrecoverRatifierUtils = void 0;
|
|
3
|
+
exports.TreeUtils = exports.TickLib = exports.TakeAmountsLib = exports.SetterRatifierUtils = exports.SetterRatifier = exports.RatifierUtils = exports.Ratifier = exports.RateRatifierV1Utils = exports.RateRatifierV1 = exports.PriceRatifierV1Utils = exports.PriceRatifierV1 = exports.PositionUtils = exports.Payload = exports.OfferUtils = exports.OfferChainUtils = exports.MarketUtils = exports.GroupUtils = exports.eip712Digest = exports.EcrecoverRatifierUtils = exports.EcrecoverRatifier = void 0;
|
|
4
4
|
var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
|
|
5
|
+
Object.defineProperty(exports, "EcrecoverRatifier", { enumerable: true, get: function () { return midnight_sdk_1.EcrecoverRatifier; } });
|
|
6
|
+
/** @deprecated Use EcrecoverRatifier with a tagged tree. */
|
|
5
7
|
Object.defineProperty(exports, "EcrecoverRatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.EcrecoverRatifierUtils; } });
|
|
6
8
|
Object.defineProperty(exports, "eip712Digest", { enumerable: true, get: function () { return midnight_sdk_1.eip712Digest; } });
|
|
7
9
|
Object.defineProperty(exports, "GroupUtils", { enumerable: true, get: function () { return midnight_sdk_1.GroupUtils; } });
|
|
@@ -10,7 +12,17 @@ Object.defineProperty(exports, "OfferChainUtils", { enumerable: true, get: funct
|
|
|
10
12
|
Object.defineProperty(exports, "OfferUtils", { enumerable: true, get: function () { return midnight_sdk_1.OfferUtils; } });
|
|
11
13
|
Object.defineProperty(exports, "Payload", { enumerable: true, get: function () { return midnight_sdk_1.Payload; } });
|
|
12
14
|
Object.defineProperty(exports, "PositionUtils", { enumerable: true, get: function () { return midnight_sdk_1.PositionUtils; } });
|
|
15
|
+
Object.defineProperty(exports, "PriceRatifierV1", { enumerable: true, get: function () { return midnight_sdk_1.PriceRatifierV1; } });
|
|
16
|
+
/** @deprecated Use PriceRatifierV1. */
|
|
17
|
+
Object.defineProperty(exports, "PriceRatifierV1Utils", { enumerable: true, get: function () { return midnight_sdk_1.PriceRatifierV1Utils; } });
|
|
18
|
+
Object.defineProperty(exports, "RateRatifierV1", { enumerable: true, get: function () { return midnight_sdk_1.RateRatifierV1; } });
|
|
19
|
+
/** @deprecated Use RateRatifierV1. */
|
|
20
|
+
Object.defineProperty(exports, "RateRatifierV1Utils", { enumerable: true, get: function () { return midnight_sdk_1.RateRatifierV1Utils; } });
|
|
21
|
+
Object.defineProperty(exports, "Ratifier", { enumerable: true, get: function () { return midnight_sdk_1.Ratifier; } });
|
|
22
|
+
/** @deprecated Use Ratifier. */
|
|
13
23
|
Object.defineProperty(exports, "RatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.RatifierUtils; } });
|
|
24
|
+
Object.defineProperty(exports, "SetterRatifier", { enumerable: true, get: function () { return midnight_sdk_1.SetterRatifier; } });
|
|
25
|
+
/** @deprecated Use SetterRatifier with a tagged tree. */
|
|
14
26
|
Object.defineProperty(exports, "SetterRatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.SetterRatifierUtils; } });
|
|
15
27
|
Object.defineProperty(exports, "TakeAmountsLib", { enumerable: true, get: function () { return midnight_sdk_1.TakeAmountsLib; } });
|
|
16
28
|
Object.defineProperty(exports, "TickLib", { enumerable: true, get: function () { return midnight_sdk_1.TickLib; } });
|
|
@@ -16,11 +16,13 @@ export interface BaseAction<TType extends string = string, TArgs extends Record<
|
|
|
16
16
|
readonly type: TType;
|
|
17
17
|
readonly args: TArgs;
|
|
18
18
|
}
|
|
19
|
+
/** Metadata for an ERC-20 `approve` call granting `spender` an `amount` allowance. */
|
|
19
20
|
export interface ERC20ApprovalAction extends BaseAction<"erc20Approval", {
|
|
20
21
|
spender: Address;
|
|
21
22
|
amount: bigint;
|
|
22
23
|
}> {
|
|
23
24
|
}
|
|
25
|
+
/** Metadata for an ERC-2612 permit signature requirement, exposing only the `sign` callback. */
|
|
24
26
|
export interface ERC20PermitAction {
|
|
25
27
|
sign: (client: WalletClient, userAddress: Address) => Promise<Hex>;
|
|
26
28
|
}
|
|
@@ -106,6 +108,7 @@ export interface VaultV2ForceWithdrawAction extends BaseAction<"vaultV2ForceWith
|
|
|
106
108
|
readonly deadline: bigint;
|
|
107
109
|
}> {
|
|
108
110
|
}
|
|
111
|
+
/** Metadata for a Vault V2 force redeem executed through the vault's native multicall. */
|
|
109
112
|
export interface VaultV2ForceRedeemAction extends BaseAction<"vaultV2ForceRedeem", {
|
|
110
113
|
vault: Address;
|
|
111
114
|
deallocations: readonly Deallocation[];
|
|
@@ -637,6 +640,27 @@ export interface ActionOutput<TAction extends BaseAction = TransactionAction, TS
|
|
|
637
640
|
export declare function isRequirementApproval(requirement: unknown): requirement is Transaction<ERC20ApprovalAction>;
|
|
638
641
|
/** Checks whether an action requirement is a Blue authorization call. */
|
|
639
642
|
export declare function isRequirementBlueAuthorization(requirement: unknown): requirement is Transaction<BlueAuthorizationAction>;
|
|
643
|
+
/**
|
|
644
|
+
* Narrows an action requirement to a signature requirement.
|
|
645
|
+
*
|
|
646
|
+
* A signature requirement exposes a `sign` callback; call requirements are plain transactions.
|
|
647
|
+
*
|
|
648
|
+
* @param requirement - The requirement returned by `getRequirements()` to test.
|
|
649
|
+
* @returns `true` when `requirement` carries a `sign` function.
|
|
650
|
+
* @example
|
|
651
|
+
* ```ts
|
|
652
|
+
* import { isRequirementSignature } from "@morpho-org/morpho-sdk";
|
|
653
|
+
*
|
|
654
|
+
* for (const requirement of await handle.getRequirements()) {
|
|
655
|
+
* if (isRequirementSignature(requirement)) {
|
|
656
|
+
* signatures.push(await requirement.sign(walletClient, userAddress));
|
|
657
|
+
* } else {
|
|
658
|
+
* const hash = await walletClient.sendTransaction(requirement);
|
|
659
|
+
* await client.waitForTransactionReceipt({ hash });
|
|
660
|
+
* }
|
|
661
|
+
* }
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
640
664
|
export declare function isRequirementSignature<T extends RequirementSignature = RequirementSignature>(requirement: CallRequirement | Requirement<T> | undefined): requirement is Requirement<T>;
|
|
641
665
|
export declare function isRequirementSignature(requirement: CallRequirement | Requirement | undefined): requirement is Requirement;
|
|
642
666
|
export declare function isRequirementSignature(requirement: ActionRequirement | undefined): requirement is SignatureRequirement;
|
|
@@ -645,6 +669,16 @@ export declare function isRequirementSignature(requirement: ActionRequirement |
|
|
|
645
669
|
*
|
|
646
670
|
* @param signature - The signed requirement to test.
|
|
647
671
|
* @returns `true` when `signature.action.type` is `"permit"`.
|
|
672
|
+
* @example
|
|
673
|
+
* ```ts
|
|
674
|
+
* import {
|
|
675
|
+
* isPermitSignature,
|
|
676
|
+
* type RequirementSignature,
|
|
677
|
+
* } from "@morpho-org/morpho-sdk";
|
|
678
|
+
*
|
|
679
|
+
* const getPermitDeadline = (signature: RequirementSignature): bigint | undefined =>
|
|
680
|
+
* isPermitSignature(signature) ? signature.args.deadline : undefined;
|
|
681
|
+
* ```
|
|
648
682
|
*/
|
|
649
683
|
export declare function isPermitSignature(signature: RequirementSignature): signature is PermitRequirementSignature;
|
|
650
684
|
/**
|