@morpho-org/morpho-sdk 6.0.0-next.2 → 6.0.0-next.3
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 +83 -29
- package/README.md +9 -7
- package/lib/cjs/abis.d.ts +3 -2844
- package/lib/cjs/abis.js +1 -1951
- package/lib/cjs/actions/blue/borrow.d.ts +3 -2
- package/lib/cjs/actions/blue/borrow.js +3 -2
- package/lib/cjs/actions/blue/common.js +1 -9
- package/lib/cjs/actions/blue/refinance.d.ts +2 -2
- package/lib/cjs/actions/blue/refinance.js +2 -2
- package/lib/cjs/actions/blue/repay.d.ts +1 -1
- package/lib/cjs/actions/blue/repay.js +1 -1
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/cjs/actions/blue/supply.d.ts +2 -2
- package/lib/cjs/actions/blue/supply.js +2 -2
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
- package/lib/cjs/actions/blue/withdraw.js +3 -3
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
- package/lib/cjs/actions/bundles/common.d.ts +6 -2
- package/lib/cjs/actions/bundles/common.js +23 -5
- package/lib/cjs/actions/index.d.ts +0 -1
- package/lib/cjs/actions/index.js +0 -1
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -8
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +11 -16
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +5 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +6 -11
- package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/encode/index.js +0 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/cjs/actions/requirements/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/index.js +0 -1
- package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV1/deposit.js +1 -2
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -5
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +10 -7
- package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV2/deposit.js +1 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +1 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +3 -3
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +6 -5
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +10 -7
- package/lib/cjs/augment.d.ts +0 -1
- package/lib/cjs/augment.js +0 -1
- package/lib/cjs/blue/abis.d.ts +1 -5
- package/lib/cjs/blue/abis.js +1 -7
- package/lib/cjs/blue/entities.d.ts +2 -8
- package/lib/cjs/blue/entities.js +1 -3
- package/lib/cjs/blue/fetch.d.ts +1 -3
- package/lib/cjs/blue/fetch.js +1 -3
- package/lib/cjs/blue/types.d.ts +2 -4
- package/lib/cjs/blue/utils.d.ts +1 -3
- package/lib/cjs/blue/utils.js +1 -3
- package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
- package/lib/cjs/client/morphoViemExtension.js +1 -1
- package/lib/cjs/constants.d.ts +3 -37
- package/lib/cjs/constants.js +1 -39
- package/lib/cjs/entities/blue/blue.d.ts +30 -265
- package/lib/cjs/entities/blue/blue.js +1 -205
- package/lib/cjs/entities/index.d.ts +3 -66
- package/lib/cjs/entities/index.js +1 -21
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -2
- package/lib/cjs/entities/vaultV1/vaultV1.js +12 -7
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +22 -9
- package/lib/cjs/entities/vaultV2/vaultV2.js +28 -15
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +4 -21
- package/lib/cjs/errors.d.ts +2 -46
- package/lib/cjs/errors.js +1 -46
- package/lib/cjs/fetch.d.ts +1 -17
- package/lib/cjs/fetch.js +1 -17
- package/lib/cjs/helpers/constant.d.ts +0 -2
- package/lib/cjs/helpers/constant.js +0 -2
- package/lib/cjs/helpers/index.d.ts +2 -3
- package/lib/cjs/helpers/index.js +1 -9
- package/lib/cjs/helpers/slippage.d.ts +1 -103
- package/lib/cjs/helpers/slippage.js +0 -150
- package/lib/cjs/helpers/utilization.d.ts +12 -10
- package/lib/cjs/helpers/utilization.js +27 -12
- package/lib/cjs/helpers/validate.d.ts +1 -24
- package/lib/cjs/helpers/validate.js +2 -49
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
- package/lib/cjs/types/action.d.ts +17 -65
- package/lib/cjs/types/action.js +11 -4
- package/lib/cjs/types/error.d.ts +50 -381
- package/lib/cjs/types/error.js +64 -395
- package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
- package/lib/cjs/types.d.ts +2 -18
- package/lib/cjs/utils.d.ts +6 -35
- package/lib/cjs/utils.js +2 -36
- package/lib/esm/abis.d.ts +3 -2844
- package/lib/esm/abis.js +3 -1950
- package/lib/esm/actions/blue/borrow.d.ts +3 -2
- package/lib/esm/actions/blue/borrow.js +3 -2
- package/lib/esm/actions/blue/common.js +1 -9
- package/lib/esm/actions/blue/refinance.d.ts +2 -2
- package/lib/esm/actions/blue/refinance.js +2 -2
- package/lib/esm/actions/blue/repay.d.ts +1 -1
- package/lib/esm/actions/blue/repay.js +1 -1
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/esm/actions/blue/supply.d.ts +2 -2
- package/lib/esm/actions/blue/supply.js +2 -2
- package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/supplyCollateral.js +2 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/esm/actions/blue/withdraw.d.ts +3 -3
- package/lib/esm/actions/blue/withdraw.js +3 -3
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
- package/lib/esm/actions/bundles/common.d.ts +6 -2
- package/lib/esm/actions/bundles/common.js +24 -6
- package/lib/esm/actions/index.d.ts +0 -1
- package/lib/esm/actions/index.js +0 -1
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -8
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +12 -17
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +5 -6
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +5 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +6 -11
- package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
- package/lib/esm/actions/requirements/encode/index.js +0 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/esm/actions/requirements/index.d.ts +0 -1
- package/lib/esm/actions/requirements/index.js +0 -1
- package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV1/deposit.js +1 -2
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -5
- package/lib/esm/actions/vaultV1/inKindRedeem.js +10 -7
- package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV2/deposit.js +1 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +1 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +3 -3
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -5
- package/lib/esm/actions/vaultV2/inKindRedeem.js +10 -7
- package/lib/esm/augment.d.ts +0 -1
- package/lib/esm/augment.js +0 -1
- package/lib/esm/blue/abis.d.ts +1 -5
- package/lib/esm/blue/abis.js +1 -5
- package/lib/esm/blue/entities.d.ts +2 -8
- package/lib/esm/blue/entities.js +1 -3
- package/lib/esm/blue/fetch.d.ts +1 -3
- package/lib/esm/blue/fetch.js +1 -3
- package/lib/esm/blue/types.d.ts +2 -4
- package/lib/esm/blue/utils.d.ts +1 -3
- package/lib/esm/blue/utils.js +1 -3
- package/lib/esm/client/morphoViemExtension.d.ts +1 -1
- package/lib/esm/client/morphoViemExtension.js +1 -1
- package/lib/esm/constants.d.ts +3 -37
- package/lib/esm/constants.js +3 -37
- package/lib/esm/entities/blue/blue.d.ts +30 -265
- package/lib/esm/entities/blue/blue.js +4 -208
- package/lib/esm/entities/index.d.ts +3 -66
- package/lib/esm/entities/index.js +1 -18
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -2
- package/lib/esm/entities/vaultV1/vaultV1.js +15 -10
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +22 -9
- package/lib/esm/entities/vaultV2/vaultV2.js +32 -19
- package/lib/esm/entities/vaultV2BlueReallocationData.js +2 -19
- package/lib/esm/errors.d.ts +2 -46
- package/lib/esm/errors.js +2 -46
- package/lib/esm/fetch.d.ts +1 -17
- package/lib/esm/fetch.js +1 -17
- package/lib/esm/helpers/constant.d.ts +0 -2
- package/lib/esm/helpers/constant.js +0 -2
- package/lib/esm/helpers/index.d.ts +2 -3
- package/lib/esm/helpers/index.js +2 -3
- package/lib/esm/helpers/slippage.d.ts +1 -103
- package/lib/esm/helpers/slippage.js +1 -147
- package/lib/esm/helpers/utilization.d.ts +12 -10
- package/lib/esm/helpers/utilization.js +26 -11
- package/lib/esm/helpers/validate.d.ts +1 -24
- package/lib/esm/helpers/validate.js +2 -48
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +1 -3
- package/lib/esm/types/action.d.ts +17 -65
- package/lib/esm/types/action.js +12 -5
- package/lib/esm/types/error.d.ts +50 -381
- package/lib/esm/types/error.js +58 -377
- package/lib/esm/types/sharedLiquidity.d.ts +1 -117
- package/lib/esm/types.d.ts +2 -18
- package/lib/esm/utils.d.ts +6 -35
- package/lib/esm/utils.js +5 -34
- package/package.json +5 -13
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -152
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -53
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
- package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -50
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -45
- package/lib/cjs/actions/signatures/index.d.ts +0 -3
- package/lib/cjs/actions/signatures/index.js +0 -19
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -11
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
- package/lib/cjs/bundler/actions.d.ts +0 -797
- package/lib/cjs/bundler/actions.js +0 -1371
- package/lib/cjs/bundler/index.d.ts +0 -2
- package/lib/cjs/bundler/index.js +0 -18
- package/lib/cjs/bundler/types.d.ts +0 -235
- package/lib/cjs/bundler/types.js +0 -2
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -332
- package/lib/cjs/entities/vaultV1ReallocationData.js +0 -557
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -80
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -245
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -44
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -84
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -148
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -40
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -49
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
- package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -50
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -41
- package/lib/esm/actions/signatures/index.d.ts +0 -3
- package/lib/esm/actions/signatures/index.js +0 -3
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -11
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -7
- package/lib/esm/bundler/actions.d.ts +0 -797
- package/lib/esm/bundler/actions.js +0 -1368
- package/lib/esm/bundler/index.d.ts +0 -2
- package/lib/esm/bundler/index.js +0 -2
- package/lib/esm/bundler/types.d.ts +0 -235
- package/lib/esm/bundler/types.js +0 -1
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -332
- package/lib/esm/entities/vaultV1ReallocationData.js +0 -559
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -80
- package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -241
package/lib/esm/types/error.js
CHANGED
|
@@ -127,8 +127,6 @@ export class VaultV2SingleAdapterRequiredError extends Error {
|
|
|
127
127
|
this.name = "VaultV2SingleAdapterRequiredError";
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
/** @deprecated Use {@link VaultV2SingleAdapterRequiredError}. */
|
|
131
|
-
export const InKindRedeemRequiresSingleAdapterError = VaultV2SingleAdapterRequiredError;
|
|
132
130
|
/** Thrown when a requested in-kind redemption adapter is not part of the Vault V2 snapshot. */
|
|
133
131
|
export class AdapterNotPartOfVaultError extends Error {
|
|
134
132
|
vault;
|
|
@@ -171,8 +169,6 @@ export class VaultV2UnsupportedExitAdapterError extends Error {
|
|
|
171
169
|
this.name = "VaultV2UnsupportedExitAdapterError";
|
|
172
170
|
}
|
|
173
171
|
}
|
|
174
|
-
/** @deprecated Use {@link VaultV2UnsupportedExitAdapterError}. */
|
|
175
|
-
export const UnsupportedInKindAdapterError = VaultV2UnsupportedExitAdapterError;
|
|
176
172
|
/**
|
|
177
173
|
* Thrown when a Vault V2 exit cannot resolve the vault's configured liquidity adapter.
|
|
178
174
|
*
|
|
@@ -384,6 +380,43 @@ export class VaultV2ForceWithdrawZeroSharePriceError extends Error {
|
|
|
384
380
|
this.name = "VaultV2ForceWithdrawZeroSharePriceError";
|
|
385
381
|
}
|
|
386
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Thrown when a supplied force-withdraw share-price floor is below the SDK safety floor.
|
|
385
|
+
*
|
|
386
|
+
* An override below the floor derived at `MAX_SLIPPAGE_TOLERANCE` would weaken the on-chain
|
|
387
|
+
* share-price protection and let the required share allowance grow without bound, so the entity
|
|
388
|
+
* rejects it instead of encoding it.
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```ts
|
|
392
|
+
* import { VaultV2ForceWithdrawSharePriceBelowFloorError } from "@morpho-org/morpho-sdk";
|
|
393
|
+
*
|
|
394
|
+
* try {
|
|
395
|
+
* vault.forceWithdraw({ exitAssets, vaultData, userAddress, minSharePriceE27 });
|
|
396
|
+
* } catch (error) {
|
|
397
|
+
* if (error instanceof VaultV2ForceWithdrawSharePriceBelowFloorError) {
|
|
398
|
+
* console.error(error.minSharePriceE27, error.floorE27);
|
|
399
|
+
* }
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
export class VaultV2ForceWithdrawSharePriceBelowFloorError extends Error {
|
|
404
|
+
/** Supplied force-withdraw share-price floor. */
|
|
405
|
+
minSharePriceE27;
|
|
406
|
+
/** Minimum share-price floor allowed at maximum SDK slippage tolerance. */
|
|
407
|
+
floorE27;
|
|
408
|
+
/**
|
|
409
|
+
* @param params - Supplied and minimum allowed share-price floors.
|
|
410
|
+
* @param params.minSharePriceE27 - Supplied force-withdraw share-price floor.
|
|
411
|
+
* @param params.floorE27 - Minimum floor derived at maximum SDK slippage tolerance.
|
|
412
|
+
*/
|
|
413
|
+
constructor(params) {
|
|
414
|
+
super(`Force-withdraw share price floor "${params.minSharePriceE27}" is below the minimum allowed "${params.floorE27}" (max slippage tolerance). Raise minSharePriceE27 or use slippageTolerance.`);
|
|
415
|
+
this.minSharePriceE27 = params.minSharePriceE27;
|
|
416
|
+
this.floorE27 = params.floorE27;
|
|
417
|
+
this.name = "VaultV2ForceWithdrawSharePriceBelowFloorError";
|
|
418
|
+
}
|
|
419
|
+
}
|
|
387
420
|
/**
|
|
388
421
|
* Thrown when fee shares projected to the accepted deadline reach the lower force-withdraw
|
|
389
422
|
* burn bound at that time.
|
|
@@ -541,18 +574,6 @@ export class BundlesPermitMismatchError extends Error {
|
|
|
541
574
|
this.name = "BundlesPermitMismatchError";
|
|
542
575
|
}
|
|
543
576
|
}
|
|
544
|
-
/**
|
|
545
|
-
* Thrown by the deprecated VaultExitBundlesV1 permit compatibility helper.
|
|
546
|
-
*
|
|
547
|
-
* @deprecated Use {@link BundlesPermitMismatchError} with `getBundlesSharesPermit`.
|
|
548
|
-
*/
|
|
549
|
-
export class VaultExitBundlesV1PermitMismatchError extends BundlesPermitMismatchError {
|
|
550
|
-
constructor(params) {
|
|
551
|
-
super(params);
|
|
552
|
-
this.message = `VaultExitBundlesV1 permit ${params.field} mismatch: expected "${params.expected}", got "${params.actual}". Rebuild and sign the vault-exit permit.`;
|
|
553
|
-
this.name = "VaultExitBundlesV1PermitMismatchError";
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
577
|
/** Thrown when a signed requirement cannot be safely encoded for a fixed bundles call. */
|
|
557
578
|
export class BundlesRequirementSignatureMismatchError extends Error {
|
|
558
579
|
/** Field whose signed value or encoding is invalid for the fixed bundles call. */
|
|
@@ -576,8 +597,6 @@ export class BundlesRequirementSignatureMismatchError extends Error {
|
|
|
576
597
|
this.name = "BundlesRequirementSignatureMismatchError";
|
|
577
598
|
}
|
|
578
599
|
}
|
|
579
|
-
/** @deprecated Use {@link BundlesRequirementSignatureMismatchError}. */
|
|
580
|
-
export { BundlesRequirementSignatureMismatchError as BlueBundlesV1RequirementSignatureMismatchError, };
|
|
581
600
|
/** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
|
|
582
601
|
export class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
|
|
583
602
|
owner;
|
|
@@ -608,8 +627,6 @@ export class NoUnusedPermit2NonceError extends Error {
|
|
|
608
627
|
this.name = "NoUnusedPermit2NonceError";
|
|
609
628
|
}
|
|
610
629
|
}
|
|
611
|
-
/** @deprecated Use {@link Permit2SignatureTransferNonceAlreadyUsedError}. */
|
|
612
|
-
export { Permit2SignatureTransferNonceAlreadyUsedError as Permit2TransferFromNonceAlreadyUsedError, };
|
|
613
630
|
/** Thrown when native funding does not exactly match the contract's gross token pull. */
|
|
614
631
|
export class NativeFundingAmountMismatchError extends Error {
|
|
615
632
|
nativeAmount;
|
|
@@ -632,8 +649,6 @@ export class ReferralFeeRecipientMissingError extends Error {
|
|
|
632
649
|
this.name = "ReferralFeeRecipientMissingError";
|
|
633
650
|
}
|
|
634
651
|
}
|
|
635
|
-
/** @deprecated Use {@link ReferralFeeRecipientMissingError}. */
|
|
636
|
-
export const MissingReferralFeeRecipientError = ReferralFeeRecipientMissingError;
|
|
637
652
|
/**
|
|
638
653
|
* Thrown when a referral fee percentage is outside the contract's `[0, WAD)` range.
|
|
639
654
|
*
|
|
@@ -694,9 +709,7 @@ export class ReallocationLoanTokenMismatchError extends Error {
|
|
|
694
709
|
}
|
|
695
710
|
}
|
|
696
711
|
/**
|
|
697
|
-
* Thrown when a Blue authorization operator is not
|
|
698
|
-
* (GeneralAdapter1 or BlueBundlesV1). Guards the exported authorization builder so a misconfigured
|
|
699
|
-
* `authorized` cannot grant an arbitrary address control over the user's Morpho positions.
|
|
712
|
+
* Thrown when a Blue authorization operator is not the chain's registered BlueBundlesV1 contract.
|
|
700
713
|
*/
|
|
701
714
|
export class UnsupportedAuthorizationOperatorError extends Error {
|
|
702
715
|
authorized;
|
|
@@ -706,7 +719,7 @@ export class UnsupportedAuthorizationOperatorError extends Error {
|
|
|
706
719
|
* @param chainId - Chain whose registry was consulted for the supported operators.
|
|
707
720
|
*/
|
|
708
721
|
constructor(authorized, chainId) {
|
|
709
|
-
super(`Authorization operator "${authorized}" is not
|
|
722
|
+
super(`Authorization operator "${authorized}" is not supported on chain ${chainId}. Pass the chain's registered BlueBundlesV1 address.`);
|
|
710
723
|
this.authorized = authorized;
|
|
711
724
|
this.chainId = chainId;
|
|
712
725
|
this.name = "UnsupportedAuthorizationOperatorError";
|
|
@@ -734,148 +747,6 @@ export class MaxRepayAssetsBelowRepayAssetsError extends Error {
|
|
|
734
747
|
this.name = "MaxRepayAssetsBelowRepayAssetsError";
|
|
735
748
|
}
|
|
736
749
|
}
|
|
737
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
738
|
-
export const NonPositiveAssetAmountError = NonPositiveInputError;
|
|
739
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
740
|
-
export const NonPositiveSharesAmountError = NonPositiveInputError;
|
|
741
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
742
|
-
export const NonPositiveMaxSharePriceError = NonPositiveInputError;
|
|
743
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
744
|
-
export const ZeroDepositAmountError = NonPositiveInputError;
|
|
745
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
746
|
-
export const NonPositiveBorrowAmountError = NonPositiveInputError;
|
|
747
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
748
|
-
export const ZeroCollateralAmountError = NonPositiveInputError;
|
|
749
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
750
|
-
export const NonPositiveReallocationAmountError = NonPositiveInputError;
|
|
751
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
752
|
-
export const NonPositiveRepayAmountError = NonPositiveInputError;
|
|
753
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
754
|
-
export const NonPositiveRepayMaxSharePriceError = NonPositiveInputError;
|
|
755
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
756
|
-
export const NonPositiveWithdrawCollateralAmountError = NonPositiveInputError;
|
|
757
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
758
|
-
export const ZeroSupplyAmountError = NonPositiveInputError;
|
|
759
|
-
/** @deprecated Use {@link NonPositiveInputError}. */
|
|
760
|
-
export const NonPositiveWithdrawAmountError = NonPositiveInputError;
|
|
761
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
762
|
-
export const NegativeSlippageToleranceError = NegativeInputError;
|
|
763
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
764
|
-
export const NegativeNativeAmountError = NegativeInputError;
|
|
765
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
766
|
-
export const NegativeReallocationFeeError = NegativeInputError;
|
|
767
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
768
|
-
export const NonPositiveMinBorrowSharePriceError = NegativeInputError;
|
|
769
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
770
|
-
export const NegativeSupplyAmountError = NegativeInputError;
|
|
771
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
772
|
-
export const NegativeSupplyMaxSharePriceError = NegativeInputError;
|
|
773
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
774
|
-
export const NegativeWithdrawMinSharePriceError = NegativeInputError;
|
|
775
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
776
|
-
export const NegativeMinSharePriceError = NegativeInputError;
|
|
777
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
778
|
-
export const NegativeBorrowSharesError = NegativeInputError;
|
|
779
|
-
/** @deprecated Use {@link NegativeInputError}. */
|
|
780
|
-
export const NegativeMaxRepaySharePriceError = NegativeInputError;
|
|
781
|
-
/**
|
|
782
|
-
* Typed errors thrown while encoding supported Bundler3 actions.
|
|
783
|
-
*
|
|
784
|
-
* @remarks
|
|
785
|
-
* Import these classes through `@morpho-org/morpho-sdk` when handling
|
|
786
|
-
* failures from `BundlerAction`.
|
|
787
|
-
*/
|
|
788
|
-
export var BundlerErrors;
|
|
789
|
-
(function (BundlerErrors) {
|
|
790
|
-
/**
|
|
791
|
-
* Thrown when an action that requires an offchain signature is encoded before
|
|
792
|
-
* the signature has been attached.
|
|
793
|
-
*
|
|
794
|
-
* @example
|
|
795
|
-
* ```ts
|
|
796
|
-
* import { BundlerErrors } from "@morpho-org/morpho-sdk";
|
|
797
|
-
*
|
|
798
|
-
* if (error instanceof BundlerErrors.MissingSignature) {
|
|
799
|
-
* // Attach the missing permit or Permit2 signature, then encode again.
|
|
800
|
-
* }
|
|
801
|
-
* ```
|
|
802
|
-
*/
|
|
803
|
-
class MissingSignature extends Error {
|
|
804
|
-
constructor() {
|
|
805
|
-
super("missing signature");
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
BundlerErrors.MissingSignature = MissingSignature;
|
|
809
|
-
/**
|
|
810
|
-
* Thrown when an action is unsupported on the requested chain.
|
|
811
|
-
*
|
|
812
|
-
* @example
|
|
813
|
-
* ```ts
|
|
814
|
-
* import { BundlerErrors } from "@morpho-org/morpho-sdk";
|
|
815
|
-
*
|
|
816
|
-
* if (error instanceof BundlerErrors.UnexpectedAction) {
|
|
817
|
-
* // Remove or replace the action for the selected chain.
|
|
818
|
-
* }
|
|
819
|
-
* ```
|
|
820
|
-
*/
|
|
821
|
-
class UnexpectedAction extends Error {
|
|
822
|
-
/**
|
|
823
|
-
* @param type - Unsupported Bundler3 action discriminator or name.
|
|
824
|
-
* @param chainId - Chain where the action was requested.
|
|
825
|
-
*/
|
|
826
|
-
constructor(type, chainId) {
|
|
827
|
-
super(`unexpected action "${type}" on chain "${chainId}"`);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
BundlerErrors.UnexpectedAction = UnexpectedAction;
|
|
831
|
-
/**
|
|
832
|
-
* Thrown when a Morpho authorization signature names a forbidden `authorized` account
|
|
833
|
-
* (for example Bundler3 itself), which would grant operator rights to an unintended address.
|
|
834
|
-
*
|
|
835
|
-
* @example
|
|
836
|
-
* ```ts
|
|
837
|
-
* import { BundlerErrors } from "@morpho-org/morpho-sdk";
|
|
838
|
-
*
|
|
839
|
-
* if (error instanceof BundlerErrors.UnexpectedSignature) {
|
|
840
|
-
* // Re-sign the authorization targeting GeneralAdapter1.
|
|
841
|
-
* }
|
|
842
|
-
* ```
|
|
843
|
-
*/
|
|
844
|
-
class UnexpectedSignature extends Error {
|
|
845
|
-
/**
|
|
846
|
-
* @param authorized - The forbidden `authorized` address carried by the signature.
|
|
847
|
-
*/
|
|
848
|
-
constructor(authorized) {
|
|
849
|
-
super(`unexpected signature authorizing "${authorized}"`);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
BundlerErrors.UnexpectedSignature = UnexpectedSignature;
|
|
853
|
-
/**
|
|
854
|
-
* Thrown when a skippable Blue Public Allocator call would leave a usable
|
|
855
|
-
* token allowance behind after the allocator call reverts.
|
|
856
|
-
*
|
|
857
|
-
* @example
|
|
858
|
-
* ```ts
|
|
859
|
-
* import { BundlerErrors } from "@morpho-org/morpho-sdk";
|
|
860
|
-
*
|
|
861
|
-
* if (error instanceof BundlerErrors.SkippableAllocatorPenalty) {
|
|
862
|
-
* // Rebuild the allocator call with skipRevert set to false.
|
|
863
|
-
* }
|
|
864
|
-
* ```
|
|
865
|
-
*/
|
|
866
|
-
class SkippableAllocatorPenalty extends Error {
|
|
867
|
-
penaltyAssets;
|
|
868
|
-
/**
|
|
869
|
-
* @param penaltyAssets - Exact token amount approved to the allocator.
|
|
870
|
-
*/
|
|
871
|
-
constructor(penaltyAssets) {
|
|
872
|
-
super(`Blue Public Allocator calls with penalty assets cannot skip reverts. Rebuild with skipRevert false for penalty amount "${penaltyAssets}".`);
|
|
873
|
-
this.penaltyAssets = penaltyAssets;
|
|
874
|
-
this.name = "SkippableAllocatorPenalty";
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
BundlerErrors.SkippableAllocatorPenalty = SkippableAllocatorPenalty;
|
|
878
|
-
})(BundlerErrors || (BundlerErrors = {}));
|
|
879
750
|
/**
|
|
880
751
|
* Thrown when `buildTx` receives more than one requirement signature of the same kind.
|
|
881
752
|
*
|
|
@@ -921,6 +792,17 @@ export class UnexpectedRequirementSignatureError extends Error {
|
|
|
921
792
|
super(`Received a ${kind} signature that this operation does not consume. Remove it from the buildTx signatures array.`);
|
|
922
793
|
}
|
|
923
794
|
}
|
|
795
|
+
/** Thrown when `buildTx` receives a requirement signature whose action type is not supported. */
|
|
796
|
+
export class UnsupportedRequirementSignatureError extends Error {
|
|
797
|
+
type;
|
|
798
|
+
/**
|
|
799
|
+
* @param type - The unsupported signature action type.
|
|
800
|
+
*/
|
|
801
|
+
constructor(type) {
|
|
802
|
+
super(`Received a requirement signature with unsupported action type "${type}". Re-run getRequirements() and sign the current requirements.`);
|
|
803
|
+
this.type = type;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
924
806
|
/** Thrown when a viem client's account address does not match the address required by the call. */
|
|
925
807
|
export class AddressMismatchError extends Error {
|
|
926
808
|
constructor(clientAddress, argsAddress) {
|
|
@@ -955,7 +837,6 @@ export class ApprovalAmountLessThanSpendAmountError extends Error {
|
|
|
955
837
|
export class UnsupportedErc20ApprovalSpenderError extends Error {
|
|
956
838
|
constructor(params) {
|
|
957
839
|
const supported = (params.supportedSpenders ?? [
|
|
958
|
-
params.generalAdapter1,
|
|
959
840
|
params.permit2,
|
|
960
841
|
params.midnight,
|
|
961
842
|
params.midnightBundles,
|
|
@@ -1015,12 +896,6 @@ export class DepositSpenderMismatchError extends Error {
|
|
|
1015
896
|
super(`Deposit spender "${depositSpender}" does not match requirement signature spender "${signatureSpender}"`);
|
|
1016
897
|
}
|
|
1017
898
|
}
|
|
1018
|
-
/** Thrown when a `permit2` requirement signature is missing the `expiration` field. */
|
|
1019
|
-
export class Permit2ExpirationMissingError extends Error {
|
|
1020
|
-
constructor() {
|
|
1021
|
-
super('Requirement signature with action.type === "permit2" must include args.expiration. Re-sign using the permit2 flow.');
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
899
|
/** Thrown when a vault deposit uses `nativeAmount` but the vault asset is not the chain's wNative. */
|
|
1025
900
|
export class NativeAmountOnNonWNativeVaultError extends Error {
|
|
1026
901
|
constructor(vaultAsset, wNative) {
|
|
@@ -1045,8 +920,6 @@ export class NativeAmountOnNonWNativeAssetError extends Error {
|
|
|
1045
920
|
super(`Cannot use nativeAmount: asset ${asset} is not the wrapped native token ${wNative}`);
|
|
1046
921
|
}
|
|
1047
922
|
}
|
|
1048
|
-
/** @deprecated Use {@link NativeAmountOnNonWNativeAssetError}. */
|
|
1049
|
-
export const NativeAmountOnNonWNativeCollateralError = NativeAmountOnNonWNativeAssetError;
|
|
1050
923
|
/** Thrown when a borrow exceeds the LLTV-buffered safe maximum for the position. */
|
|
1051
924
|
export class BorrowExceedsSafeLtvError extends Error {
|
|
1052
925
|
constructor(borrowAmount, maxSafeBorrow) {
|
|
@@ -1071,16 +944,6 @@ export class AccrualPositionUserMismatchError extends Error {
|
|
|
1071
944
|
super(`Accrual position user ${positionUser} does not match expected user ${expectedUser}`);
|
|
1072
945
|
}
|
|
1073
946
|
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Thrown when a reallocation has no withdrawals.
|
|
1076
|
-
*
|
|
1077
|
-
* @deprecated Vault V1 PublicAllocator support will be removed in the next major.
|
|
1078
|
-
*/
|
|
1079
|
-
export class EmptyReallocationWithdrawalsError extends Error {
|
|
1080
|
-
constructor(vault) {
|
|
1081
|
-
super(`Reallocation withdrawals list cannot be empty for vault: ${vault}`);
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
947
|
/** Thrown when a Public Allocator source references the target Blue market. */
|
|
1085
948
|
export class ReallocationWithdrawalOnTargetMarketError extends Error {
|
|
1086
949
|
constructor(vault, marketId) {
|
|
@@ -1094,33 +957,15 @@ export class ReallocationWithdrawalOnTargetMarketError extends Error {
|
|
|
1094
957
|
*
|
|
1095
958
|
* @example
|
|
1096
959
|
* ```ts
|
|
1097
|
-
* import {
|
|
1098
|
-
*
|
|
1099
|
-
* const error = new InvalidReallocationShapeError();
|
|
1100
|
-
* ```
|
|
1101
|
-
*/
|
|
1102
|
-
export class InvalidReallocationShapeError extends Error {
|
|
1103
|
-
constructor() {
|
|
1104
|
-
super("Reallocation entry is not a valid Vault V2 reallocation. High-level Blue writes accept only VaultV2BlueReallocation entries (e.g. from getVaultV2BlueReallocations()); compose Vault V1 reallocations via low-level Bundler3 actions.");
|
|
1105
|
-
this.name = "InvalidReallocationShapeError";
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Thrown when one reallocation plan contains both Vault V1 and Vault V2 entries.
|
|
1110
|
-
*
|
|
1111
|
-
* @deprecated Vault V1/V2 mixed-plan support will be removed in the next major. Use Vault V2
|
|
1112
|
-
* reallocations.
|
|
1113
|
-
* @example
|
|
1114
|
-
* ```ts
|
|
1115
|
-
* import { MixedReallocationVersionsError } from "@morpho-org/morpho-sdk";
|
|
960
|
+
* import { InvalidVaultV2BlueReallocationShapeError } from "@morpho-org/morpho-sdk";
|
|
1116
961
|
*
|
|
1117
|
-
* const error = new
|
|
962
|
+
* const error = new InvalidVaultV2BlueReallocationShapeError();
|
|
1118
963
|
* ```
|
|
1119
964
|
*/
|
|
1120
|
-
export class
|
|
965
|
+
export class InvalidVaultV2BlueReallocationShapeError extends Error {
|
|
1121
966
|
constructor() {
|
|
1122
|
-
super("Reallocation
|
|
1123
|
-
this.name = "
|
|
967
|
+
super("Reallocation entry is not a valid Vault V2 reallocation. High-level Blue writes accept only VaultV2BlueReallocation entries (e.g. from getVaultV2BlueReallocations()). Use morpho-sdk v5 if Vault V1 reallocations are required.");
|
|
968
|
+
this.name = "InvalidVaultV2BlueReallocationShapeError";
|
|
1124
969
|
}
|
|
1125
970
|
}
|
|
1126
971
|
/**
|
|
@@ -1216,26 +1061,6 @@ export class InconsistentReallocationPenaltyError extends Error {
|
|
|
1216
1061
|
this.name = "InconsistentReallocationPenaltyError";
|
|
1217
1062
|
}
|
|
1218
1063
|
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Thrown when reallocation withdrawals within a vault are not strictly sorted by market id.
|
|
1221
|
-
*
|
|
1222
|
-
* @deprecated Vault V1 PublicAllocator support will be removed in the next major.
|
|
1223
|
-
*/
|
|
1224
|
-
export class UnsortedReallocationWithdrawalsError extends Error {
|
|
1225
|
-
constructor(vault, marketId) {
|
|
1226
|
-
super(`Reallocation withdrawals must be strictly sorted by market ID for vault ${vault}. Market ${marketId} is out of order.`);
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* Thrown when a market repay in assets mode has `transferAmount !== amount + nativeAmount` — the
|
|
1231
|
-
* pre-resolved ERC-20 pull plus the wrapped native must equal the assets repaid, so the bundle
|
|
1232
|
-
* neither strands over-pulled loan tokens on `GeneralAdapter1` nor under-funds the repay.
|
|
1233
|
-
*/
|
|
1234
|
-
export class TransferAmountNotEqualToAssetsError extends Error {
|
|
1235
|
-
constructor(params) {
|
|
1236
|
-
super(`Transfer amount ${params.transferAmount} is not equal to repay assets ${params.assets} for market: ${params.market}. In assets mode, transferAmount must equal amount + nativeAmount.`);
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
1064
|
/** Thrown when a market repay specifies both `assets` and `shares` as non-zero (modes are mutually exclusive). */
|
|
1240
1065
|
export class MutuallyExclusiveRepayAmountsError extends Error {
|
|
1241
1066
|
constructor(market) {
|
|
@@ -1254,12 +1079,6 @@ export class WithdrawMakesPositionUnhealthyError extends Error {
|
|
|
1254
1079
|
super(`Withdrawing ${params.withdrawAmount} collateral would make position unhealthy. Max safe borrow after withdrawal: ${params.maxSafeBorrow}. Actual Borrow assets: ${params.borrowAssets}.`);
|
|
1255
1080
|
}
|
|
1256
1081
|
}
|
|
1257
|
-
/** Thrown when a share-amount conversion would divide by zero (the market has no shares of the relevant kind). */
|
|
1258
|
-
export class ShareDivideByZeroError extends Error {
|
|
1259
|
-
constructor(market) {
|
|
1260
|
-
super(`Share divide by zero error for market: ${market}`);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
1082
|
/** Thrown when a repay amount in assets exceeds the borrower's outstanding debt. */
|
|
1264
1083
|
export class RepayExceedsDebtError extends Error {
|
|
1265
1084
|
constructor(params) {
|
|
@@ -1279,31 +1098,7 @@ export class RepaySharesExceedDebtError extends Error {
|
|
|
1279
1098
|
}
|
|
1280
1099
|
}
|
|
1281
1100
|
/**
|
|
1282
|
-
* Thrown when
|
|
1283
|
-
*
|
|
1284
|
-
* @deprecated Vault V1 PublicAllocator support will be removed in the next major.
|
|
1285
|
-
*/
|
|
1286
|
-
export class MissingPublicAllocatorConfigError extends Error {
|
|
1287
|
-
constructor(vault) {
|
|
1288
|
-
super(`Vault ${vault} has no public allocator configured but was selected for reallocation`);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
/**
|
|
1292
|
-
* Thrown when a reallocation attempts to use a disabled vault market.
|
|
1293
|
-
*
|
|
1294
|
-
* @deprecated Vault V1 PublicAllocator support will be removed in the next major.
|
|
1295
|
-
*/
|
|
1296
|
-
export class DisabledReallocationMarketError extends Error {
|
|
1297
|
-
vault;
|
|
1298
|
-
marketId;
|
|
1299
|
-
constructor(vault, marketId) {
|
|
1300
|
-
super(`Vault ${vault} has disabled market ${marketId}. Remove it from reallocations or re-enable the market before reallocating.`);
|
|
1301
|
-
this.vault = vault;
|
|
1302
|
-
this.marketId = marketId;
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
/**
|
|
1306
|
-
* Thrown when shared liquidity selected by a Vault V1 or Vault V2 reallocation planner cannot
|
|
1101
|
+
* Thrown when shared liquidity selected by a Vault V2 reallocation planner cannot
|
|
1307
1102
|
* cover the operation's absolute shortfall on the target market — the resulting
|
|
1308
1103
|
* `morphoBorrow` or `morphoWithdraw` would still revert onchain.
|
|
1309
1104
|
*
|
|
@@ -1338,42 +1133,6 @@ export class UnknownReallocationVaultError extends UnknownDataError {
|
|
|
1338
1133
|
this.vault = vault;
|
|
1339
1134
|
}
|
|
1340
1135
|
}
|
|
1341
|
-
/**
|
|
1342
|
-
* Thrown when reallocation state does not contain a requested vault-market config.
|
|
1343
|
-
*
|
|
1344
|
-
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major.
|
|
1345
|
-
*/
|
|
1346
|
-
export class UnknownReallocationVaultMarketConfigError extends UnknownDataError {
|
|
1347
|
-
vault;
|
|
1348
|
-
marketId;
|
|
1349
|
-
/**
|
|
1350
|
-
* @param vault - Vault address for the missing config.
|
|
1351
|
-
* @param marketId - Market id for the missing config.
|
|
1352
|
-
*/
|
|
1353
|
-
constructor(vault, marketId) {
|
|
1354
|
-
super(`unknown reallocation config for vault "${vault}" on market "${marketId}"`);
|
|
1355
|
-
this.vault = vault;
|
|
1356
|
-
this.marketId = marketId;
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
/**
|
|
1360
|
-
* Thrown when reallocation state does not contain a requested market position.
|
|
1361
|
-
*
|
|
1362
|
-
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major.
|
|
1363
|
-
*/
|
|
1364
|
-
export class UnknownReallocationPositionError extends UnknownDataError {
|
|
1365
|
-
user;
|
|
1366
|
-
marketId;
|
|
1367
|
-
/**
|
|
1368
|
-
* @param user - Position owner address.
|
|
1369
|
-
* @param marketId - Market id for the missing position.
|
|
1370
|
-
*/
|
|
1371
|
-
constructor(user, marketId) {
|
|
1372
|
-
super(`unknown reallocation position of "${user}" on market "${marketId}"`);
|
|
1373
|
-
this.user = user;
|
|
1374
|
-
this.marketId = marketId;
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
1136
|
/** Thrown when Vault V2 reallocation state does not contain a requested allocation id. */
|
|
1378
1137
|
export class UnknownReallocationAllocationError extends UnknownDataError {
|
|
1379
1138
|
vault;
|
|
@@ -1583,11 +1342,11 @@ export class WithdrawSharesExceedSupplyError extends Error {
|
|
|
1583
1342
|
}
|
|
1584
1343
|
}
|
|
1585
1344
|
/**
|
|
1586
|
-
* Thrown when a Vault
|
|
1345
|
+
* Thrown when a Vault V2 reallocation planner receives a withdraw `amount` greater
|
|
1587
1346
|
* than the target market's current `totalSupplyAssets` — the post-withdraw
|
|
1588
1347
|
* supply would be negative, making the on-chain `morphoWithdraw` revert
|
|
1589
1348
|
* regardless of any reallocation. Caught here so callers do not pay
|
|
1590
|
-
*
|
|
1349
|
+
* allocator penalties on an unreachable operation.
|
|
1591
1350
|
*/
|
|
1592
1351
|
export class ReallocationWithdrawExceedsMarketSupplyError extends Error {
|
|
1593
1352
|
params;
|
|
@@ -1614,81 +1373,3 @@ export class RefinanceTokenMismatchError extends Error {
|
|
|
1614
1373
|
super(`Refinance source market ${sourceMarket} and target market ${targetMarket} must share the same loanToken and collateralToken.`);
|
|
1615
1374
|
}
|
|
1616
1375
|
}
|
|
1617
|
-
/**
|
|
1618
|
-
* Thrown when a refinance specifies both `borrowAssets` and `borrowShares` as non-zero (modes are mutually exclusive).
|
|
1619
|
-
*
|
|
1620
|
-
* @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
|
|
1621
|
-
* partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
|
|
1622
|
-
* compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
|
|
1623
|
-
*/
|
|
1624
|
-
export class BorrowAmountAndSharesExclusiveError extends Error {
|
|
1625
|
-
constructor(market) {
|
|
1626
|
-
super(`Exactly one of borrowAssets or borrowShares must be non-zero for market: ${market}. Both were provided.`);
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
/**
|
|
1630
|
-
* Thrown when a refinance's `collateralAmount` exceeds the source position's available collateral.
|
|
1631
|
-
*
|
|
1632
|
-
* @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
|
|
1633
|
-
* partial collateral inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
|
|
1634
|
-
* compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
|
|
1635
|
-
*/
|
|
1636
|
-
export class RefinanceExceedsCollateralError extends Error {
|
|
1637
|
-
market;
|
|
1638
|
-
requested;
|
|
1639
|
-
available;
|
|
1640
|
-
constructor(params) {
|
|
1641
|
-
super(`Refinance collateral amount ${params.requested} exceeds available collateral ${params.available} for market: ${params.market}`);
|
|
1642
|
-
this.market = params.market;
|
|
1643
|
-
this.requested = params.requested;
|
|
1644
|
-
this.available = params.available;
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
/**
|
|
1648
|
-
* Thrown when a refinance's `borrowShares` exceeds the source position's outstanding borrow shares.
|
|
1649
|
-
*
|
|
1650
|
-
* @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
|
|
1651
|
-
* partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
|
|
1652
|
-
* compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
|
|
1653
|
-
*/
|
|
1654
|
-
export class RefinanceExceedsBorrowSharesError extends Error {
|
|
1655
|
-
market;
|
|
1656
|
-
requested;
|
|
1657
|
-
available;
|
|
1658
|
-
constructor(params) {
|
|
1659
|
-
super(`Refinance borrow shares ${params.requested} exceed outstanding borrow shares ${params.available} for market: ${params.market}`);
|
|
1660
|
-
this.market = params.market;
|
|
1661
|
-
this.requested = params.requested;
|
|
1662
|
-
this.available = params.available;
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
/**
|
|
1666
|
-
* Thrown when a refinance's `borrowAssets` exceeds the source position's outstanding debt assets.
|
|
1667
|
-
*
|
|
1668
|
-
* @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
|
|
1669
|
-
* partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
|
|
1670
|
-
* compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
|
|
1671
|
-
*/
|
|
1672
|
-
export class RefinanceExceedsBorrowAssetsError extends Error {
|
|
1673
|
-
market;
|
|
1674
|
-
requested;
|
|
1675
|
-
available;
|
|
1676
|
-
constructor(params) {
|
|
1677
|
-
super(`Refinance borrow assets ${params.requested} exceed outstanding debt assets ${params.available} for market: ${params.market}`);
|
|
1678
|
-
this.market = params.market;
|
|
1679
|
-
this.requested = params.requested;
|
|
1680
|
-
this.available = params.available;
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
/**
|
|
1684
|
-
* Thrown when a refinance in shares mode (`borrowShares > 0n`) omits the `borrowAssets` overshoot for the target borrow leg.
|
|
1685
|
-
*
|
|
1686
|
-
* @deprecated The BlueBundlesV1 refinance route migrates the full live position and no longer accepts
|
|
1687
|
-
* partial borrow inputs, so this error is never thrown by `morpho-sdk` v6. It remains exported as a
|
|
1688
|
-
* compatibility shim for consumers pattern-matching on the v5 surface and will be removed in the next major.
|
|
1689
|
-
*/
|
|
1690
|
-
export class RefinanceSharesMissingBorrowAssetsError extends Error {
|
|
1691
|
-
constructor(market) {
|
|
1692
|
-
super(`Refinance shares mode requires a positive borrowAssets overshoot for the target borrow leg (market: ${market}).`);
|
|
1693
|
-
}
|
|
1694
|
-
}
|