@morpho-org/morpho-sdk 1.0.1 → 1.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.
@@ -37,14 +37,6 @@ const vaultV2ForceWithdraw = ({ vault: { address: vaultAddress }, args: { deallo
37
37
  if (withdraw.amount <= 0n) {
38
38
  throw new types_1.NonPositiveAssetAmountError(vaultAddress);
39
39
  }
40
- const totalDeallocated = deallocations.reduce((sum, d) => sum + d.amount, 0n);
41
- if (withdraw.amount < totalDeallocated) {
42
- throw new types_1.DeallocationsExceedWithdrawError({
43
- vault: vaultAddress,
44
- withdrawAmount: withdraw.amount,
45
- totalDeallocated,
46
- });
47
- }
48
40
  const calls = [];
49
41
  for (const deallocation of deallocations) {
50
42
  calls.push((0, encodeDeallocation_1.encodeForceDeallocateCall)(deallocation, onBehalf));
@@ -38,13 +38,6 @@ export declare class DepositAmountMismatchError extends Error {
38
38
  export declare class DepositAssetMismatchError extends Error {
39
39
  constructor(depositAsset: Address, signatureAsset: Address);
40
40
  }
41
- export declare class DeallocationsExceedWithdrawError extends Error {
42
- constructor(params: {
43
- vault: Address;
44
- withdrawAmount: bigint;
45
- totalDeallocated: bigint;
46
- });
47
- }
48
41
  export declare class NativeAmountOnNonWNativeVaultError extends Error {
49
42
  constructor(vaultAsset: Address, wNative: Address);
50
43
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NegativeMinSharePriceError = exports.VaultAssetMismatchError = exports.NonPositiveMinBorrowSharePriceError = exports.MissingPublicAllocatorConfigError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.ShareDivideByZeroError = exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.NonPositiveWithdrawCollateralAmountError = exports.NonPositiveRepayMaxSharePriceError = exports.NonPositiveRepayAmountError = exports.MutuallyExclusiveRepayAmountsError = exports.TransferAmountNotEqualToAssetsError = exports.NonPositiveTransferAmountError = exports.UnsortedReallocationWithdrawalsError = exports.ReallocationWithdrawalOnTargetMarketError = exports.NonPositiveReallocationAmountError = exports.EmptyReallocationWithdrawalsError = exports.NegativeReallocationFeeError = exports.AccrualPositionUserMismatchError = exports.MarketIdMismatchError = exports.MissingMarketPriceError = exports.BorrowExceedsSafeLtvError = exports.NativeAmountOnNonWNativeCollateralError = exports.ZeroCollateralAmountError = exports.NonPositiveBorrowAmountError = exports.VaultAddressMismatchError = exports.ZeroDepositAmountError = exports.NegativeNativeAmountError = exports.ChainWNativeMissingError = exports.NativeAmountOnNonWNativeVaultError = exports.DeallocationsExceedWithdrawError = exports.DepositAssetMismatchError = exports.DepositAmountMismatchError = exports.EmptyDeallocationsError = exports.ExcessiveSlippageToleranceError = exports.MissingAccrualPositionError = exports.NegativeSlippageToleranceError = exports.ApprovalAmountLessThanSpendAmountError = exports.MissingClientPropertyError = exports.ChainIdMismatchError = exports.AddressMismatchError = exports.NonPositiveMaxSharePriceError = exports.NonPositiveSharesAmountError = exports.NonPositiveAssetAmountError = void 0;
3
+ exports.NegativeMinSharePriceError = exports.VaultAssetMismatchError = exports.NonPositiveMinBorrowSharePriceError = exports.MissingPublicAllocatorConfigError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.ShareDivideByZeroError = exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.NonPositiveWithdrawCollateralAmountError = exports.NonPositiveRepayMaxSharePriceError = exports.NonPositiveRepayAmountError = exports.MutuallyExclusiveRepayAmountsError = exports.TransferAmountNotEqualToAssetsError = exports.NonPositiveTransferAmountError = exports.UnsortedReallocationWithdrawalsError = exports.ReallocationWithdrawalOnTargetMarketError = exports.NonPositiveReallocationAmountError = exports.EmptyReallocationWithdrawalsError = exports.NegativeReallocationFeeError = exports.AccrualPositionUserMismatchError = exports.MarketIdMismatchError = exports.MissingMarketPriceError = exports.BorrowExceedsSafeLtvError = exports.NativeAmountOnNonWNativeCollateralError = exports.ZeroCollateralAmountError = exports.NonPositiveBorrowAmountError = exports.VaultAddressMismatchError = exports.ZeroDepositAmountError = exports.NegativeNativeAmountError = exports.ChainWNativeMissingError = exports.NativeAmountOnNonWNativeVaultError = exports.DepositAssetMismatchError = exports.DepositAmountMismatchError = exports.EmptyDeallocationsError = exports.ExcessiveSlippageToleranceError = exports.MissingAccrualPositionError = exports.NegativeSlippageToleranceError = exports.ApprovalAmountLessThanSpendAmountError = exports.MissingClientPropertyError = exports.ChainIdMismatchError = exports.AddressMismatchError = exports.NonPositiveMaxSharePriceError = exports.NonPositiveSharesAmountError = exports.NonPositiveAssetAmountError = void 0;
4
4
  class NonPositiveAssetAmountError extends Error {
5
5
  constructor(origin) {
6
6
  super(`Asset amount must be positive for address ${origin}`);
@@ -79,12 +79,6 @@ class DepositAssetMismatchError extends Error {
79
79
  }
80
80
  }
81
81
  exports.DepositAssetMismatchError = DepositAssetMismatchError;
82
- class DeallocationsExceedWithdrawError extends Error {
83
- constructor(params) {
84
- super(`Total deallocated amount (${params.totalDeallocated}) exceed withdraw amount (${params.withdrawAmount}) for vault: ${params.vault}`);
85
- }
86
- }
87
- exports.DeallocationsExceedWithdrawError = DeallocationsExceedWithdrawError;
88
82
  class NativeAmountOnNonWNativeVaultError extends Error {
89
83
  constructor(vaultAsset, wNative) {
90
84
  super(`Cannot use nativeAmount: vault asset ${vaultAsset} is not the wrapped native token ${wNative}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morpho-org/morpho-sdk",
3
3
  "description": "Abstraction layer for Morpho's complexity.",
4
- "version": "1.0.1",
4
+ "version": "1.1.0",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Foulks-Plb <https://x.com/FoulkPlb>"