@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
|
@@ -249,6 +249,31 @@ export const validateNativeVaultAsset = (chainId, vaultAsset) => {
|
|
|
249
249
|
* @param params.withdrawAmount - Amount of collateral being withdrawn.
|
|
250
250
|
* @param params.lltv - The market's liquidation LTV.
|
|
251
251
|
* @param params.marketId - The market identifier (for error messages).
|
|
252
|
+
* @returns `void` when the post-withdraw position stays within the safe LTV threshold.
|
|
253
|
+
* @throws {MarketIdMismatchError} when `positionData.marketId` differs from `marketId`.
|
|
254
|
+
* @throws {WithdrawExceedsCollateralError} when `withdrawAmount` exceeds the position's collateral.
|
|
255
|
+
* @throws {MissingMarketPriceError} when the position carries debt but the market has no oracle price.
|
|
256
|
+
* @throws {WithdrawMakesPositionUnhealthyError} when the remaining collateral cannot cover the debt
|
|
257
|
+
* at LLTV minus `DEFAULT_LLTV_BUFFER`.
|
|
258
|
+
* @example
|
|
259
|
+
* ```ts
|
|
260
|
+
* import type { AccrualPosition, MarketId } from "@morpho-org/blue-sdk";
|
|
261
|
+
* import { validatePositionHealthAfterWithdraw } from "@morpho-org/morpho-sdk";
|
|
262
|
+
*
|
|
263
|
+
* export function assertSafeWithdraw(
|
|
264
|
+
* positionData: AccrualPosition,
|
|
265
|
+
* withdrawAmount: bigint,
|
|
266
|
+
* lltv: bigint,
|
|
267
|
+
* marketId: MarketId,
|
|
268
|
+
* ): void {
|
|
269
|
+
* validatePositionHealthAfterWithdraw({
|
|
270
|
+
* positionData,
|
|
271
|
+
* withdrawAmount,
|
|
272
|
+
* lltv,
|
|
273
|
+
* marketId,
|
|
274
|
+
* });
|
|
275
|
+
* }
|
|
276
|
+
* ```
|
|
252
277
|
*/
|
|
253
278
|
export const validatePositionHealthAfterWithdraw = (params) => {
|
|
254
279
|
const { positionData, withdrawAmount, lltv, marketId } = params;
|
|
@@ -307,6 +332,21 @@ export const validateRepayAmount = (params) => {
|
|
|
307
332
|
* @param params.positionData - The current accrual position.
|
|
308
333
|
* @param params.repayShares - The amount of shares to repay.
|
|
309
334
|
* @param params.marketId - The market identifier (for error messages).
|
|
335
|
+
* @returns `void` when `repayShares` does not exceed the position's borrow shares.
|
|
336
|
+
* @throws {RepaySharesExceedDebtError} when `repayShares` exceeds the position's borrow shares.
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* import type { AccrualPosition, MarketId } from "@morpho-org/blue-sdk";
|
|
340
|
+
* import { validateRepayShares } from "@morpho-org/morpho-sdk";
|
|
341
|
+
*
|
|
342
|
+
* export function assertRepayable(
|
|
343
|
+
* positionData: AccrualPosition,
|
|
344
|
+
* repayShares: bigint,
|
|
345
|
+
* marketId: MarketId,
|
|
346
|
+
* ): void {
|
|
347
|
+
* validateRepayShares({ positionData, repayShares, marketId });
|
|
348
|
+
* }
|
|
349
|
+
* ```
|
|
310
350
|
*/
|
|
311
351
|
export const validateRepayShares = (params) => {
|
|
312
352
|
const { positionData, repayShares, marketId } = params;
|
|
@@ -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: {
|
|
@@ -18,11 +18,15 @@ import { NonPositiveInputError } from "../types/index.js";
|
|
|
18
18
|
* describing which precondition failed.
|
|
19
19
|
* @example
|
|
20
20
|
* ```ts
|
|
21
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
21
22
|
* import { resolveVaultV2ForceWithdrawEligibility } from "@morpho-org/morpho-sdk";
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* export function checkEligibility(vaultData: AccrualVaultV2) {
|
|
25
|
+
* const eligibility = resolveVaultV2ForceWithdrawEligibility(vaultData);
|
|
26
|
+
* if (eligibility.type === "eligible") {
|
|
27
|
+
* console.log(eligibility.adapter.address, eligibility.liquidityMarketId);
|
|
28
|
+
* }
|
|
29
|
+
* return eligibility;
|
|
26
30
|
* }
|
|
27
31
|
* ```
|
|
28
32
|
*/
|
|
@@ -81,13 +85,21 @@ export function resolveVaultV2ForceWithdrawEligibility(vaultData, adapterOverrid
|
|
|
81
85
|
* owner is not a fee recipient.
|
|
82
86
|
* @example
|
|
83
87
|
* ```ts
|
|
88
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
84
89
|
* import { computeVaultV2ForceWithdrawFeeSharesMinted } from "@morpho-org/morpho-sdk";
|
|
90
|
+
* import type { Address } from "viem";
|
|
85
91
|
*
|
|
86
|
-
*
|
|
87
|
-
* vaultData,
|
|
88
|
-
* owner,
|
|
89
|
-
* timestamp,
|
|
90
|
-
*
|
|
92
|
+
* export function feeShares(
|
|
93
|
+
* vaultData: AccrualVaultV2,
|
|
94
|
+
* owner: Address,
|
|
95
|
+
* timestamp: bigint,
|
|
96
|
+
* ) {
|
|
97
|
+
* return computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
98
|
+
* vaultData,
|
|
99
|
+
* owner,
|
|
100
|
+
* timestamp,
|
|
101
|
+
* });
|
|
102
|
+
* }
|
|
91
103
|
* ```
|
|
92
104
|
*/
|
|
93
105
|
export function computeVaultV2ForceWithdrawFeeSharesMinted(params) {
|
|
@@ -137,21 +149,24 @@ export function computeVaultV2ForceWithdrawFeeSharesMinted(params) {
|
|
|
137
149
|
* @throws {NonPositiveInputError} when `exitAssets` is not positive.
|
|
138
150
|
* @example
|
|
139
151
|
* ```ts
|
|
152
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
140
153
|
* import {
|
|
141
154
|
* computeVaultV2ForceWithdrawPlan,
|
|
142
155
|
* resolveVaultV2ForceWithdrawEligibility,
|
|
143
156
|
* } from "@morpho-org/morpho-sdk";
|
|
144
157
|
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
158
|
+
* export function planExit(vaultData: AccrualVaultV2, timestamp: bigint) {
|
|
159
|
+
* const eligibility = resolveVaultV2ForceWithdrawEligibility(vaultData);
|
|
160
|
+
* if (eligibility.type !== "eligible") return undefined;
|
|
147
161
|
* const plan = computeVaultV2ForceWithdrawPlan({
|
|
148
162
|
* vaultData,
|
|
149
163
|
* adapter: eligibility.adapter,
|
|
150
164
|
* liquidityMarketId: eligibility.liquidityMarketId,
|
|
151
165
|
* exitAssets: 1_000_000n,
|
|
152
|
-
* timestamp
|
|
166
|
+
* timestamp,
|
|
153
167
|
* });
|
|
154
168
|
* // plan.withdrawnAssets is what the user receives before the referral fee
|
|
169
|
+
* return plan;
|
|
155
170
|
* }
|
|
156
171
|
* ```
|
|
157
172
|
*/
|
|
@@ -294,55 +309,69 @@ export function computeVaultV2ForceWithdrawPlan(params) {
|
|
|
294
309
|
* @returns An upper bound, in vault shares, of what the exit burns.
|
|
295
310
|
* @example
|
|
296
311
|
* ```ts
|
|
297
|
-
* import { MathLib } from "@morpho-org/blue-sdk";
|
|
312
|
+
* import { MathLib, type AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
298
313
|
* import {
|
|
299
314
|
* computeVaultV2ForceWithdrawFeeSharesMinted,
|
|
300
315
|
* computeVaultV2ForceWithdrawSharesBurnt,
|
|
316
|
+
* type VaultV2ForceWithdrawPlan,
|
|
301
317
|
* } from "@morpho-org/morpho-sdk";
|
|
318
|
+
* import { type Address, maxUint256 } from "viem";
|
|
302
319
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* });
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
320
|
+
* export function requiredShareAllowance(
|
|
321
|
+
* vaultData: AccrualVaultV2,
|
|
322
|
+
* plan: VaultV2ForceWithdrawPlan,
|
|
323
|
+
* owner: Address,
|
|
324
|
+
* now: bigint,
|
|
325
|
+
* deadline: bigint,
|
|
326
|
+
* exitAssets: bigint,
|
|
327
|
+
* minSharePriceE27: bigint,
|
|
328
|
+
* slippageTolerance: bigint,
|
|
329
|
+
* ) {
|
|
330
|
+
* const { vault: nowVaultData } = vaultData.accrueInterest(now);
|
|
331
|
+
* const sharesBurntRaw = computeVaultV2ForceWithdrawSharesBurnt({
|
|
332
|
+
* vaultData,
|
|
333
|
+
* deadlineVaultData: vaultData,
|
|
334
|
+
* plan,
|
|
335
|
+
* });
|
|
336
|
+
* const sharesBurntNow = computeVaultV2ForceWithdrawSharesBurnt({
|
|
337
|
+
* vaultData: nowVaultData,
|
|
338
|
+
* deadlineVaultData: nowVaultData,
|
|
339
|
+
* plan,
|
|
340
|
+
* });
|
|
341
|
+
* const feeSharesNow = computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
342
|
+
* vaultData,
|
|
343
|
+
* owner,
|
|
344
|
+
* timestamp: now,
|
|
345
|
+
* });
|
|
346
|
+
* const sharesBurntForFloor = MathLib.max(
|
|
347
|
+
* sharesBurntRaw,
|
|
348
|
+
* sharesBurntNow - feeSharesNow,
|
|
349
|
+
* );
|
|
350
|
+
* const allowanceSharePriceE27 = MathLib.max(
|
|
351
|
+
* MathLib.min(
|
|
352
|
+
* MathLib.mulDivDown(
|
|
353
|
+
* minSharePriceE27,
|
|
354
|
+
* MathLib.WAD - slippageTolerance,
|
|
355
|
+
* MathLib.WAD,
|
|
356
|
+
* ),
|
|
357
|
+
* minSharePriceE27 - 1n,
|
|
329
358
|
* ),
|
|
330
|
-
*
|
|
331
|
-
* )
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
359
|
+
* 1n,
|
|
360
|
+
* );
|
|
361
|
+
* const requiredShareAllowance = MathLib.min(
|
|
362
|
+
* MathLib.max(
|
|
363
|
+
* MathLib.mulDivUp(exitAssets, MathLib.RAY, allowanceSharePriceE27),
|
|
364
|
+
* MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) + 1n,
|
|
365
|
+
* ) +
|
|
366
|
+
* computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
367
|
+
* vaultData,
|
|
368
|
+
* owner,
|
|
369
|
+
* timestamp: deadline,
|
|
370
|
+
* }),
|
|
371
|
+
* maxUint256,
|
|
372
|
+
* );
|
|
373
|
+
* return requiredShareAllowance;
|
|
374
|
+
* }
|
|
346
375
|
* ```
|
|
347
376
|
*/
|
|
348
377
|
export function computeVaultV2ForceWithdrawSharesBurnt(params) {
|
|
@@ -377,12 +406,18 @@ export function computeVaultV2ForceWithdrawSharesBurnt(params) {
|
|
|
377
406
|
* @returns A lower bound, in vault shares, of the burn measured by the contract.
|
|
378
407
|
* @example
|
|
379
408
|
* ```ts
|
|
380
|
-
* import {
|
|
409
|
+
* import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
|
|
410
|
+
* import {
|
|
411
|
+
* computeVaultV2ForceWithdrawMinSharesBurnt,
|
|
412
|
+
* type VaultV2ForceWithdrawPlan,
|
|
413
|
+
* } from "@morpho-org/morpho-sdk";
|
|
381
414
|
*
|
|
382
|
-
*
|
|
383
|
-
* vaultData,
|
|
384
|
-
* plan,
|
|
385
|
-
*
|
|
415
|
+
* export function minSharesBurnt(
|
|
416
|
+
* vaultData: AccrualVaultV2,
|
|
417
|
+
* plan: VaultV2ForceWithdrawPlan,
|
|
418
|
+
* ) {
|
|
419
|
+
* return computeVaultV2ForceWithdrawMinSharesBurnt({ vaultData, plan });
|
|
420
|
+
* }
|
|
386
421
|
* ```
|
|
387
422
|
*/
|
|
388
423
|
export 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/esm/midnight/abis.js
CHANGED
|
@@ -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";
|
|
@@ -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 +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,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 +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 +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 +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";
|
|
@@ -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
|
/**
|
package/lib/esm/types/action.js
CHANGED
|
@@ -36,6 +36,16 @@ export function isRequirementSignature(requirement) {
|
|
|
36
36
|
*
|
|
37
37
|
* @param signature - The signed requirement to test.
|
|
38
38
|
* @returns `true` when `signature.action.type` is `"permit"`.
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import {
|
|
42
|
+
* isPermitSignature,
|
|
43
|
+
* type RequirementSignature,
|
|
44
|
+
* } from "@morpho-org/morpho-sdk";
|
|
45
|
+
*
|
|
46
|
+
* const getPermitDeadline = (signature: RequirementSignature): bigint | undefined =>
|
|
47
|
+
* isPermitSignature(signature) ? signature.args.deadline : undefined;
|
|
48
|
+
* ```
|
|
39
49
|
*/
|
|
40
50
|
export function isPermitSignature(signature) {
|
|
41
51
|
return signature.action.type === "permit";
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams as BlueInputMarketParams, Loadable, MarketId as BlueMarketId, MaxBorrowOptions as BlueMaxBorrowOptions, MaxPositionCapacities as BlueMaxPositionCapacities, MaxWithdrawCollateralOptions as BlueMaxWithdrawCollateralOptions, Pending, } from "@morpho-org/blue-sdk";
|
|
2
2
|
export type { AuthorizationArgs as BlueAuthorizationTypedDataArgs, DeploylessFetchParameters as BlueDeploylessFetchParameters, FetchParameters as BlueFetchParameters, InputAllocation as BlueInputAllocation, MetaMorphoCall as BlueMetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs as PermitTypedDataArgs, } from "@morpho-org/blue-sdk-viem";
|
|
3
|
-
export type { BuildFixedRateOfferChainParams as MidnightBuildFixedRateOfferChainParams, DecodedEcrecoverRatifierData as MidnightDecodedEcrecoverRatifierData, DecodedSetterRatifierData as MidnightDecodedSetterRatifierData, DeploylessFetchParameters as MidnightDeploylessFetchParameters, EcrecoverRatificationTypedData as MidnightEcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams as MidnightEcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams as MidnightEcrecoverRatifierDataParams, EcrecoverRatifierDataVerificationParams as MidnightEcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams as MidnightEcrecoverRatifierRatifyParams, EcrecoverRatifierRootDigestParams as MidnightEcrecoverRatifierRootDigestParams, EcrecoverRatifierTypedDataParams as MidnightEcrecoverRatifierTypedDataParams, EcrecoverSignatureInput as MidnightEcrecoverSignatureInput, FixedRateOfferChainLeg as MidnightFixedRateOfferChainLeg, GetRatifierInfoParams as MidnightGetRatifierInfoParams, MidnightCallParameters, MidnightFetchParams, RatifierInfo as MidnightRatifierInfo, SetterRatifierDataParams as MidnightSetterRatifierDataParams, SetterRatifierDataVerificationParams as MidnightSetterRatifierDataVerificationParams, VerifiedEcrecoverRatifierData as MidnightVerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
|
|
3
|
+
export type { BuildFixedRateOfferChainParams as MidnightBuildFixedRateOfferChainParams, DecodedEcrecoverRatifierData as MidnightDecodedEcrecoverRatifierData, DecodedPriceRatifierV1Data as MidnightDecodedPriceRatifierV1Data, DecodedRateRatifierV1Data as MidnightDecodedRateRatifierV1Data, DecodedSetterRatifierData as MidnightDecodedSetterRatifierData, DeploylessFetchParameters as MidnightDeploylessFetchParameters, EcrecoverRatificationTypedData as MidnightEcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams as MidnightEcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams as MidnightEcrecoverRatifierDataParams, EcrecoverRatifierDataRequest as MidnightEcrecoverRatifierDataRequest, EcrecoverRatifierDataVerificationParams as MidnightEcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams as MidnightEcrecoverRatifierRatifyParams, EcrecoverRatifierRatifyRequest as MidnightEcrecoverRatifierRatifyRequest, EcrecoverRatifierRootDigestParams as MidnightEcrecoverRatifierRootDigestParams, EcrecoverRatifierSignRequest as MidnightEcrecoverRatifierSignRequest, EcrecoverRatifierTypedDataParams as MidnightEcrecoverRatifierTypedDataParams, EcrecoverRatifierTypedDataRequest as MidnightEcrecoverRatifierTypedDataRequest, EcrecoverSignatureInput as MidnightEcrecoverSignatureInput, FixedRateOfferChainLeg as MidnightFixedRateOfferChainLeg, GetRatifierInfoParams as MidnightGetRatifierInfoParams, MidnightCallParameters, MidnightFetchParams, PriceRatifierV1Leaf as MidnightPriceRatifierV1Leaf, PriceRatifierV1LeafStruct as MidnightPriceRatifierV1LeafStruct, PriceRatifierV1TreeDescriptor as MidnightPriceRatifierV1TreeDescriptor, PriceRatifierV1TreeInput as MidnightPriceRatifierV1TreeInput, RateRatifierV1Leaf as MidnightRateRatifierV1Leaf, RateRatifierV1LeafStruct as MidnightRateRatifierV1LeafStruct, RateRatifierV1TreeDescriptor as MidnightRateRatifierV1TreeDescriptor, RateRatifierV1TreeInput as MidnightRateRatifierV1TreeInput, RatifierInfo as MidnightRatifierInfo, SetterRatifierDataParams as MidnightSetterRatifierDataParams, SetterRatifierDataRequest as MidnightSetterRatifierDataRequest, SetterRatifierDataVerificationParams as MidnightSetterRatifierDataVerificationParams, SetterRatifierRatifyRequest as MidnightSetterRatifierRatifyRequest, VerifiedEcrecoverRatifierData as MidnightVerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
|
|
4
4
|
export type { ChainMetadata } from "@morpho-org/morpho-ts";
|
|
5
5
|
export * from "./types/index.js";
|