@morpho-org/morpho-sdk 9.2.0 → 9.3.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/README.md +4 -4
- package/lib/cjs/actions/midnight/index.d.ts +1 -0
- package/lib/cjs/actions/midnight/index.js +1 -0
- package/lib/cjs/actions/midnight/withdrawCollateral.d.ts +50 -0
- package/lib/cjs/actions/midnight/withdrawCollateral.js +105 -0
- package/lib/cjs/entities/blue/blue.d.ts +4 -7
- package/lib/cjs/entities/blue/blue.js +0 -3
- package/lib/cjs/entities/index.d.ts +1 -1
- package/lib/cjs/entities/midnight/midnight.d.ts +57 -12
- package/lib/cjs/entities/midnight/midnight.js +102 -12
- package/lib/cjs/entities/midnight/publication.d.ts +2 -1
- package/lib/cjs/entities/midnight/publication.js +44 -64
- package/lib/cjs/entities/midnight/types.d.ts +8 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +0 -8
- package/lib/cjs/entities/vaultV1/vaultV1.js +0 -4
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +0 -4
- package/lib/cjs/entities/vaultV2/vaultV2.js +0 -3
- package/lib/cjs/helpers/deadShares.d.ts +5 -4
- package/lib/cjs/helpers/deadShares.js +5 -4
- package/lib/cjs/types/action.d.ts +10 -1
- package/lib/cjs/types/error.d.ts +1 -6
- package/lib/cjs/types/error.js +1 -6
- package/lib/esm/actions/midnight/index.d.ts +1 -0
- package/lib/esm/actions/midnight/index.js +1 -0
- package/lib/esm/actions/midnight/withdrawCollateral.d.ts +50 -0
- package/lib/esm/actions/midnight/withdrawCollateral.js +101 -0
- package/lib/esm/entities/blue/blue.d.ts +4 -7
- package/lib/esm/entities/blue/blue.js +0 -3
- package/lib/esm/entities/index.d.ts +1 -1
- package/lib/esm/entities/midnight/midnight.d.ts +57 -12
- package/lib/esm/entities/midnight/midnight.js +104 -14
- package/lib/esm/entities/midnight/publication.d.ts +2 -1
- package/lib/esm/entities/midnight/publication.js +45 -65
- package/lib/esm/entities/midnight/types.d.ts +8 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +0 -8
- package/lib/esm/entities/vaultV1/vaultV1.js +0 -4
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +0 -4
- package/lib/esm/entities/vaultV2/vaultV2.js +0 -3
- package/lib/esm/helpers/deadShares.d.ts +5 -4
- package/lib/esm/helpers/deadShares.js +5 -4
- package/lib/esm/types/action.d.ts +10 -1
- package/lib/esm/types/error.d.ts +1 -6
- package/lib/esm/types/error.js +1 -6
- package/package.json +1 -1
|
@@ -84,15 +84,16 @@ export function validateVaultV1DeadShares(vault, path = []) {
|
|
|
84
84
|
/**
|
|
85
85
|
* Checks a Vault V2 against the dead-deposit rule: at least `MIN_DEAD_SHARES` shares at
|
|
86
86
|
* `DEAD_ADDRESS` worth at least `MIN_VAULT_V2_DEAD_ASSETS` assets, a share price above
|
|
87
|
-
* `1 / (10 * virtualShares)`, and
|
|
88
|
-
* absolute cap
|
|
87
|
+
* `1 / (10 * virtualShares)`, and each currently allocated Blue market or Vault V1 with a non-zero
|
|
88
|
+
* absolute cap passing its own rule. A market with a positive cap but no current allocation is not
|
|
89
|
+
* checked; a later reallocation can reach it.
|
|
89
90
|
*
|
|
90
91
|
* @param vault - Fetched vault snapshot with its adapters and `absoluteCaps`.
|
|
91
92
|
* @param path - Vaults leading to this vault, outermost first; empty for a direct deposit.
|
|
92
|
-
* @returns Nothing; returns normally when the vault and
|
|
93
|
+
* @returns Nothing; returns normally when the vault and its checked allocations pass.
|
|
93
94
|
* @throws {MissingDeadSharesDataError} when a dead-share field, an adapter cap, or the data of an
|
|
94
95
|
* adapter the SDK cannot hydrate is missing.
|
|
95
|
-
* @throws {InsufficientDeadSharesError} when the vault or
|
|
96
|
+
* @throws {InsufficientDeadSharesError} when the vault or a checked market or Vault V1 fails the rule.
|
|
96
97
|
* @example
|
|
97
98
|
* ```ts
|
|
98
99
|
* import { validateVaultV2DeadShares } from "@morpho-org/morpho-sdk";
|
|
@@ -435,6 +435,15 @@ export interface MidnightSupplyCollateralAction extends BaseAction<"midnightSupp
|
|
|
435
435
|
readonly onBehalf: Address;
|
|
436
436
|
}> {
|
|
437
437
|
}
|
|
438
|
+
/** Metadata for a direct Midnight collateral withdrawal transaction. */
|
|
439
|
+
export interface MidnightWithdrawCollateralAction extends BaseAction<"midnightWithdrawCollateral", {
|
|
440
|
+
readonly market: Hex;
|
|
441
|
+
readonly collateralIndex: bigint;
|
|
442
|
+
readonly assets: bigint;
|
|
443
|
+
readonly onBehalf: Address;
|
|
444
|
+
readonly receiver: Address;
|
|
445
|
+
}> {
|
|
446
|
+
}
|
|
438
447
|
/** Metadata for a direct Midnight credit redemption transaction. */
|
|
439
448
|
export interface MidnightRedeemAction extends BaseAction<"midnightRedeem", {
|
|
440
449
|
readonly market: Hex;
|
|
@@ -501,7 +510,7 @@ export interface MidnightCancelAndMakeAction extends BaseAction<"midnightCancelA
|
|
|
501
510
|
* VaultV2, Blue, and Midnight flows. The `type` tag discriminates the union so
|
|
502
511
|
* consumers can `switch` exhaustively on it.
|
|
503
512
|
*/
|
|
504
|
-
export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2InKindRedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1InKindRedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueWithdrawAction | BlueRefinanceAction | BlueAuthorizationAction | MidnightAuthorizationAction | MidnightTakeLendAction | MidnightTakeBorrowAction | MidnightTakeWithdrawAction | MidnightSupplyCollateralTakeBorrowAction | MidnightSupplyCollateralAction | MidnightRedeemAction | MidnightTakeRepayWithdrawCollateralAction | MidnightRepayWithdrawCollateralAction | MidnightCancelAndMakeAction;
|
|
513
|
+
export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2InKindRedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1InKindRedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueWithdrawAction | BlueRefinanceAction | BlueAuthorizationAction | MidnightAuthorizationAction | MidnightTakeLendAction | MidnightTakeBorrowAction | MidnightTakeWithdrawAction | MidnightSupplyCollateralTakeBorrowAction | MidnightSupplyCollateralAction | MidnightWithdrawCollateralAction | MidnightRedeemAction | MidnightTakeRepayWithdrawCollateralAction | MidnightRepayWithdrawCollateralAction | MidnightCancelAndMakeAction;
|
|
505
514
|
/**
|
|
506
515
|
* Describes a single, immutable, deep-frozen transaction to submit on-chain:
|
|
507
516
|
* the target `to`, native `value`, encoded call `data`, and the originating
|
package/lib/esm/types/error.d.ts
CHANGED
|
@@ -1321,12 +1321,7 @@ export declare class MidnightOfferCallbackDataMismatchError extends Error {
|
|
|
1321
1321
|
readonly actualCallbackData: Hex;
|
|
1322
1322
|
});
|
|
1323
1323
|
}
|
|
1324
|
-
/**
|
|
1325
|
-
* Thrown when loan assets would be parked in a Morpho Blue market with no existing supply.
|
|
1326
|
-
*
|
|
1327
|
-
* @deprecated `supplyBlueMakeLend` now throws `InsufficientDeadSharesError` or
|
|
1328
|
-
* `MissingDeadSharesDataError` instead; kept exported so existing `instanceof` checks compile.
|
|
1329
|
-
*/
|
|
1324
|
+
/** Thrown when loan assets would be parked in a Morpho Blue market with no existing supply. */
|
|
1330
1325
|
export declare class EmptyBlueParkingMarketError extends Error {
|
|
1331
1326
|
constructor(params: {
|
|
1332
1327
|
readonly marketId: MarketId;
|
package/lib/esm/types/error.js
CHANGED
|
@@ -1585,12 +1585,7 @@ export class MidnightOfferCallbackDataMismatchError extends Error {
|
|
|
1585
1585
|
this.name = "MidnightOfferCallbackDataMismatchError";
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
1588
|
-
/**
|
|
1589
|
-
* Thrown when loan assets would be parked in a Morpho Blue market with no existing supply.
|
|
1590
|
-
*
|
|
1591
|
-
* @deprecated `supplyBlueMakeLend` now throws `InsufficientDeadSharesError` or
|
|
1592
|
-
* `MissingDeadSharesDataError` instead; kept exported so existing `instanceof` checks compile.
|
|
1593
|
-
*/
|
|
1588
|
+
/** Thrown when loan assets would be parked in a Morpho Blue market with no existing supply. */
|
|
1594
1589
|
export class EmptyBlueParkingMarketError extends Error {
|
|
1595
1590
|
constructor(params) {
|
|
1596
1591
|
super(`Morpho Blue market "${params.marketId}" has no supply shares. Parking assets in an empty market is exposed to supply-share-price inflation; choose a market with existing supply.`);
|