@morpho-org/morpho-sdk 5.5.0 → 5.7.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 +11 -7
- package/lib/cjs/abis.d.ts +15 -3
- package/lib/cjs/abis.js +15 -1
- package/lib/cjs/actions/blue/borrow.d.ts +21 -15
- package/lib/cjs/actions/blue/borrow.js +25 -18
- package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +1 -1
- package/lib/cjs/actions/blue/buildAssetFundingActions.js +1 -1
- package/lib/cjs/actions/blue/buildReallocationActions.d.ts +62 -19
- package/lib/cjs/actions/blue/buildReallocationActions.js +123 -27
- package/lib/cjs/actions/blue/refinance.d.ts +14 -7
- package/lib/cjs/actions/blue/refinance.js +18 -10
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +28 -19
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +39 -23
- package/lib/cjs/actions/blue/withdraw.d.ts +20 -13
- package/lib/cjs/actions/blue/withdraw.js +23 -18
- package/lib/cjs/actions/midnight/mempoolSubmitOffers.d.ts +2 -2
- package/lib/cjs/actions/midnight/mempoolSubmitOffers.js +2 -2
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +1 -1
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +1 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -1
- package/lib/cjs/blue/abis.d.ts +2 -0
- package/lib/cjs/blue/abis.js +33 -0
- package/lib/cjs/blue/addresses.d.ts +2 -0
- package/lib/cjs/blue/addresses.js +19 -0
- package/lib/cjs/blue/constants.d.ts +1 -0
- package/lib/cjs/blue/constants.js +13 -0
- package/lib/cjs/blue/entities.d.ts +2 -0
- package/lib/cjs/blue/entities.js +37 -0
- package/lib/cjs/blue/errors.d.ts +2 -0
- package/lib/cjs/blue/errors.js +29 -0
- package/lib/cjs/blue/fetch.d.ts +1 -0
- package/lib/cjs/blue/fetch.js +33 -0
- package/lib/cjs/blue/types.d.ts +2 -0
- package/lib/cjs/blue/types.js +2 -0
- package/lib/cjs/blue/utils.d.ts +3 -0
- package/lib/cjs/blue/utils.js +29 -0
- package/lib/cjs/bundler/actions.d.ts +122 -3
- package/lib/cjs/bundler/actions.js +216 -7
- package/lib/cjs/bundler/types.d.ts +20 -0
- package/lib/cjs/constants.d.ts +37 -3
- package/lib/cjs/constants.js +41 -1
- package/lib/cjs/entities/blue/blue.d.ts +362 -71
- package/lib/cjs/entities/blue/blue.js +286 -52
- package/lib/cjs/entities/index.d.ts +64 -4
- package/lib/cjs/entities/index.js +37 -22
- package/lib/cjs/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +40 -15
- package/lib/cjs/entities/{reallocationData.js → vaultV1ReallocationData.js} +29 -16
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +1 -1
- package/lib/cjs/entities/vaultV2/vaultV2.js +1 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +511 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +1300 -0
- package/lib/cjs/errors.d.ts +48 -3
- package/lib/cjs/errors.js +62 -1
- package/lib/cjs/fetch.d.ts +16 -1
- package/lib/cjs/fetch.js +24 -1
- package/lib/{esm/helpers/computeReallocations.d.ts → cjs/helpers/computeVaultV1Reallocations.d.ts} +14 -8
- package/lib/cjs/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +27 -13
- package/lib/cjs/helpers/constant.d.ts +5 -3
- package/lib/cjs/helpers/constant.js +6 -4
- package/lib/cjs/helpers/index.d.ts +2 -2
- package/lib/cjs/helpers/index.js +6 -3
- package/lib/cjs/helpers/validate.d.ts +32 -16
- package/lib/cjs/helpers/validate.js +142 -29
- package/lib/cjs/midnight/abis.d.ts +1 -0
- package/lib/cjs/midnight/abis.js +8 -0
- package/lib/cjs/midnight/constants.d.ts +1 -0
- package/lib/cjs/midnight/constants.js +19 -0
- package/lib/cjs/midnight/entities.d.ts +2 -0
- package/lib/cjs/midnight/entities.js +11 -0
- package/lib/cjs/midnight/errors.d.ts +1 -0
- package/lib/cjs/midnight/errors.js +24 -0
- package/lib/cjs/midnight/fetch.d.ts +1 -0
- package/lib/cjs/midnight/fetch.js +9 -0
- package/lib/cjs/midnight/types.d.ts +1 -0
- package/lib/cjs/midnight/types.js +2 -0
- package/lib/cjs/midnight/utils.d.ts +1 -0
- package/lib/cjs/midnight/utils.js +17 -0
- package/lib/cjs/types/action.d.ts +12 -0
- package/lib/cjs/types/error.d.ts +224 -5
- package/lib/cjs/types/error.js +269 -7
- package/lib/cjs/types/sharedLiquidity.d.ts +72 -8
- package/lib/cjs/types.d.ts +17 -2
- package/lib/cjs/utils.d.ts +31 -4
- package/lib/cjs/utils.js +44 -4
- package/lib/esm/abis.d.ts +15 -3
- package/lib/esm/abis.js +15 -3
- package/lib/esm/actions/blue/borrow.d.ts +21 -15
- package/lib/esm/actions/blue/borrow.js +26 -19
- package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +1 -1
- package/lib/esm/actions/blue/buildAssetFundingActions.js +1 -1
- package/lib/esm/actions/blue/buildReallocationActions.d.ts +62 -19
- package/lib/esm/actions/blue/buildReallocationActions.js +119 -25
- package/lib/esm/actions/blue/refinance.d.ts +14 -7
- package/lib/esm/actions/blue/refinance.js +19 -11
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +28 -19
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +40 -24
- package/lib/esm/actions/blue/withdraw.d.ts +20 -13
- package/lib/esm/actions/blue/withdraw.js +24 -19
- package/lib/esm/actions/midnight/mempoolSubmitOffers.d.ts +2 -2
- package/lib/esm/actions/midnight/mempoolSubmitOffers.js +2 -2
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +1 -1
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +1 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.js +2 -1
- package/lib/esm/blue/abis.d.ts +2 -0
- package/lib/esm/blue/abis.js +2 -0
- package/lib/esm/blue/addresses.d.ts +2 -0
- package/lib/esm/blue/addresses.js +1 -0
- package/lib/esm/blue/constants.d.ts +1 -0
- package/lib/esm/blue/constants.js +1 -0
- package/lib/esm/blue/entities.d.ts +2 -0
- package/lib/esm/blue/entities.js +1 -0
- package/lib/esm/blue/errors.d.ts +2 -0
- package/lib/esm/blue/errors.js +2 -0
- package/lib/esm/blue/fetch.d.ts +1 -0
- package/lib/esm/blue/fetch.js +1 -0
- package/lib/esm/blue/types.d.ts +2 -0
- package/lib/esm/blue/types.js +1 -0
- package/lib/esm/blue/utils.d.ts +3 -0
- package/lib/esm/blue/utils.js +2 -0
- package/lib/esm/bundler/actions.d.ts +122 -3
- package/lib/esm/bundler/actions.js +219 -10
- package/lib/esm/bundler/types.d.ts +20 -0
- package/lib/esm/constants.d.ts +37 -3
- package/lib/esm/constants.js +37 -3
- package/lib/esm/entities/blue/blue.d.ts +362 -71
- package/lib/esm/entities/blue/blue.js +289 -55
- package/lib/esm/entities/index.d.ts +64 -4
- package/lib/esm/entities/index.js +19 -3
- package/lib/esm/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +40 -15
- package/lib/esm/entities/{reallocationData.js → vaultV1ReallocationData.js} +32 -14
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +1 -1
- package/lib/esm/entities/vaultV2/vaultV2.js +1 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +511 -0
- package/lib/esm/entities/vaultV2BlueReallocationData.js +1296 -0
- package/lib/esm/errors.d.ts +48 -3
- package/lib/esm/errors.js +48 -3
- package/lib/esm/fetch.d.ts +16 -1
- package/lib/esm/fetch.js +16 -1
- package/lib/{cjs/helpers/computeReallocations.d.ts → esm/helpers/computeVaultV1Reallocations.d.ts} +14 -8
- package/lib/esm/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +25 -11
- package/lib/esm/helpers/constant.d.ts +5 -3
- package/lib/esm/helpers/constant.js +5 -3
- package/lib/esm/helpers/index.d.ts +2 -2
- package/lib/esm/helpers/index.js +2 -2
- package/lib/esm/helpers/validate.d.ts +32 -16
- package/lib/esm/helpers/validate.js +143 -32
- package/lib/esm/midnight/abis.d.ts +1 -0
- package/lib/esm/midnight/abis.js +1 -0
- package/lib/esm/midnight/constants.d.ts +1 -0
- package/lib/esm/midnight/constants.js +1 -0
- package/lib/esm/midnight/entities.d.ts +2 -0
- package/lib/esm/midnight/entities.js +1 -0
- package/lib/esm/midnight/errors.d.ts +1 -0
- package/lib/esm/midnight/errors.js +1 -0
- package/lib/esm/midnight/fetch.d.ts +1 -0
- package/lib/esm/midnight/fetch.js +1 -0
- package/lib/esm/midnight/types.d.ts +1 -0
- package/lib/esm/midnight/types.js +1 -0
- package/lib/esm/midnight/utils.d.ts +1 -0
- package/lib/esm/midnight/utils.js +1 -0
- package/lib/esm/types/action.d.ts +12 -0
- package/lib/esm/types/error.d.ts +224 -5
- package/lib/esm/types/error.js +253 -4
- package/lib/esm/types/sharedLiquidity.d.ts +72 -8
- package/lib/esm/types.d.ts +17 -2
- package/lib/esm/utils.d.ts +31 -4
- package/lib/esm/utils.js +31 -4
- package/package.json +23 -7
package/lib/esm/types/error.js
CHANGED
|
@@ -53,6 +53,28 @@ export class NonPositiveInputError extends Error {
|
|
|
53
53
|
this.name = "NonPositiveInputError";
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
/** Thrown when an integer input exceeds its protocol-defined maximum. */
|
|
57
|
+
export class InputExceedsMaxError extends Error {
|
|
58
|
+
/**
|
|
59
|
+
* @param params - Maximum-bound validation details.
|
|
60
|
+
* @param params.field - Public input field whose value is invalid.
|
|
61
|
+
* @param params.value - Supplied value.
|
|
62
|
+
* @param params.max - Largest accepted value.
|
|
63
|
+
*/
|
|
64
|
+
constructor(params) {
|
|
65
|
+
super(`Input "${params.field}" must be at most "${params.max}", got "${params.value}".`);
|
|
66
|
+
this.field = params.field;
|
|
67
|
+
this.value = params.value;
|
|
68
|
+
this.max = params.max;
|
|
69
|
+
this.name = "InputExceedsMaxError";
|
|
70
|
+
}
|
|
71
|
+
/** Public input field whose value is invalid. */
|
|
72
|
+
field;
|
|
73
|
+
/** Supplied value. */
|
|
74
|
+
value;
|
|
75
|
+
/** Largest accepted value. */
|
|
76
|
+
max;
|
|
77
|
+
}
|
|
56
78
|
/** Thrown when an in-kind redemption does not include any Morpho Blue market parameters. */
|
|
57
79
|
export class EmptyMarketParamsListError extends Error {
|
|
58
80
|
constructor() {
|
|
@@ -344,6 +366,31 @@ export var BundlerErrors;
|
|
|
344
366
|
}
|
|
345
367
|
}
|
|
346
368
|
BundlerErrors.UnexpectedSignature = UnexpectedSignature;
|
|
369
|
+
/**
|
|
370
|
+
* Thrown when a skippable Blue Public Allocator call would leave a usable
|
|
371
|
+
* token allowance behind after the allocator call reverts.
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```ts
|
|
375
|
+
* import { BundlerErrors } from "@morpho-org/morpho-sdk";
|
|
376
|
+
*
|
|
377
|
+
* if (error instanceof BundlerErrors.SkippableAllocatorPenalty) {
|
|
378
|
+
* // Rebuild the allocator call with skipRevert set to false.
|
|
379
|
+
* }
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
class SkippableAllocatorPenalty extends Error {
|
|
383
|
+
penaltyAssets;
|
|
384
|
+
/**
|
|
385
|
+
* @param penaltyAssets - Exact token amount approved to the allocator.
|
|
386
|
+
*/
|
|
387
|
+
constructor(penaltyAssets) {
|
|
388
|
+
super(`Blue Public Allocator calls with penalty assets cannot skip reverts. Rebuild with skipRevert false for penalty amount "${penaltyAssets}".`);
|
|
389
|
+
this.penaltyAssets = penaltyAssets;
|
|
390
|
+
this.name = "SkippableAllocatorPenalty";
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
BundlerErrors.SkippableAllocatorPenalty = SkippableAllocatorPenalty;
|
|
347
394
|
})(BundlerErrors || (BundlerErrors = {}));
|
|
348
395
|
/**
|
|
349
396
|
* Thrown when `buildTx` receives more than one requirement signature of the same kind.
|
|
@@ -546,12 +593,138 @@ export class EmptyReallocationWithdrawalsError extends Error {
|
|
|
546
593
|
super(`Reallocation withdrawals list cannot be empty for vault: ${vault}`);
|
|
547
594
|
}
|
|
548
595
|
}
|
|
549
|
-
/** Thrown when a
|
|
596
|
+
/** Thrown when a Public Allocator source references the target Blue market. */
|
|
550
597
|
export class ReallocationWithdrawalOnTargetMarketError extends Error {
|
|
551
598
|
constructor(vault, marketId) {
|
|
552
599
|
super(`Reallocation withdrawal cannot include the target market ${marketId} for vault ${vault}.`);
|
|
553
600
|
}
|
|
554
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* Thrown when a Public Allocator reallocation does not match exactly one V1 or
|
|
604
|
+
* V2 input shape.
|
|
605
|
+
*
|
|
606
|
+
* @example
|
|
607
|
+
* ```ts
|
|
608
|
+
* import { InvalidReallocationShapeError } from "@morpho-org/morpho-sdk";
|
|
609
|
+
*
|
|
610
|
+
* const error = new InvalidReallocationShapeError();
|
|
611
|
+
* ```
|
|
612
|
+
*/
|
|
613
|
+
export class InvalidReallocationShapeError extends Error {
|
|
614
|
+
constructor() {
|
|
615
|
+
super('Reallocation must contain either V1 "withdrawals" or V2 "from", but not both.');
|
|
616
|
+
this.name = "InvalidReallocationShapeError";
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Thrown when one reallocation plan contains both Vault V1 and Vault V2 entries.
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* ```ts
|
|
624
|
+
* import { MixedReallocationVersionsError } from "@morpho-org/morpho-sdk";
|
|
625
|
+
*
|
|
626
|
+
* const error = new MixedReallocationVersionsError();
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
629
|
+
export class MixedReallocationVersionsError extends Error {
|
|
630
|
+
constructor() {
|
|
631
|
+
super("Reallocation plans cannot mix Vault V1 and Vault V2 entries. Submit one version per transaction.");
|
|
632
|
+
this.name = "MixedReallocationVersionsError";
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Thrown when a Blue Public Allocator reallocation contains a malformed vault
|
|
637
|
+
* or adapter address.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```ts
|
|
641
|
+
* import { InvalidReallocationAddressError } from "@morpho-org/morpho-sdk";
|
|
642
|
+
*
|
|
643
|
+
* const error = new InvalidReallocationAddressError("to.adapter");
|
|
644
|
+
* if (error instanceof InvalidReallocationAddressError) {
|
|
645
|
+
* console.error(error.field);
|
|
646
|
+
* }
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
export class InvalidReallocationAddressError extends Error {
|
|
650
|
+
field;
|
|
651
|
+
/**
|
|
652
|
+
* @param field - Reallocation address field that is absent or malformed.
|
|
653
|
+
*/
|
|
654
|
+
constructor(field) {
|
|
655
|
+
super(`Reallocation "${field}" must be a valid address.`);
|
|
656
|
+
this.field = field;
|
|
657
|
+
this.name = "InvalidReallocationAddressError";
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Thrown when a Blue Public Allocator source is absent, incomplete, or has an
|
|
662
|
+
* unknown discriminator.
|
|
663
|
+
*
|
|
664
|
+
* @example
|
|
665
|
+
* ```ts
|
|
666
|
+
* import { InvalidReallocationSourceTypeError } from "@morpho-org/morpho-sdk";
|
|
667
|
+
*
|
|
668
|
+
* const error = new InvalidReallocationSourceTypeError("marketTypo");
|
|
669
|
+
* ```
|
|
670
|
+
*/
|
|
671
|
+
export class InvalidReallocationSourceTypeError extends Error {
|
|
672
|
+
sourceType;
|
|
673
|
+
missingField;
|
|
674
|
+
/**
|
|
675
|
+
* @param sourceType - Invalid runtime value received for `reallocation.from.type`,
|
|
676
|
+
* or `undefined` when the source or discriminator is absent.
|
|
677
|
+
* @param missingField - Required market-source field that is absent or malformed.
|
|
678
|
+
*/
|
|
679
|
+
constructor(sourceType, missingField) {
|
|
680
|
+
super(missingField == null
|
|
681
|
+
? sourceType === undefined
|
|
682
|
+
? 'Reallocation source must specify type "market" or "idle".'
|
|
683
|
+
: `Reallocation source type must be "market" or "idle", got "${sourceType}".`
|
|
684
|
+
: `Reallocation market source must include a valid "${missingField}".`);
|
|
685
|
+
this.sourceType = sourceType;
|
|
686
|
+
this.missingField = missingField;
|
|
687
|
+
this.name = "InvalidReallocationSourceTypeError";
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Thrown when one bundle assigns different penalty rates to the same Vault V2.
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* ```ts
|
|
695
|
+
* import { InconsistentReallocationPenaltyError } from "@morpho-org/morpho-sdk";
|
|
696
|
+
* import type { Address } from "viem";
|
|
697
|
+
*
|
|
698
|
+
* const vaultFixture =
|
|
699
|
+
* "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" satisfies Address;
|
|
700
|
+
* const error = new InconsistentReallocationPenaltyError({
|
|
701
|
+
* vault: vaultFixture,
|
|
702
|
+
* expected: 5n,
|
|
703
|
+
* actual: 11n,
|
|
704
|
+
* });
|
|
705
|
+
* ```
|
|
706
|
+
*/
|
|
707
|
+
export class InconsistentReallocationPenaltyError extends Error {
|
|
708
|
+
/** Vault whose configured penalty must be reused. */
|
|
709
|
+
vault;
|
|
710
|
+
/** Penalty rate established by the first matching bundle entry. */
|
|
711
|
+
expected;
|
|
712
|
+
/** Conflicting penalty rate supplied by a later bundle entry. */
|
|
713
|
+
actual;
|
|
714
|
+
/**
|
|
715
|
+
* @param params - Conflicting vault penalty details.
|
|
716
|
+
* @param params.vault - Vault whose configured penalty applies.
|
|
717
|
+
* @param params.expected - Penalty rate established by the first matching entry.
|
|
718
|
+
* @param params.actual - Conflicting penalty rate supplied by a later entry.
|
|
719
|
+
*/
|
|
720
|
+
constructor(params) {
|
|
721
|
+
super(`Penalty for vault "${params.vault}" must remain "${params.expected}" across the bundle, got "${params.actual}". Use the vault's configured penalty for every call.`);
|
|
722
|
+
this.vault = params.vault;
|
|
723
|
+
this.expected = params.expected;
|
|
724
|
+
this.actual = params.actual;
|
|
725
|
+
this.name = "InconsistentReallocationPenaltyError";
|
|
726
|
+
}
|
|
727
|
+
}
|
|
555
728
|
/** Thrown when reallocation withdrawals within a vault are not strictly sorted by market id. */
|
|
556
729
|
export class UnsortedReallocationWithdrawalsError extends Error {
|
|
557
730
|
constructor(vault, marketId) {
|
|
@@ -627,8 +800,8 @@ export class DisabledReallocationMarketError extends Error {
|
|
|
627
800
|
}
|
|
628
801
|
}
|
|
629
802
|
/**
|
|
630
|
-
* Thrown when shared liquidity selected by
|
|
631
|
-
* the operation's absolute shortfall on the target market — the resulting
|
|
803
|
+
* Thrown when shared liquidity selected by a Vault V1 or Vault V2 reallocation planner cannot
|
|
804
|
+
* cover the operation's absolute shortfall on the target market — the resulting
|
|
632
805
|
* `morphoBorrow` or `morphoWithdraw` would still revert onchain.
|
|
633
806
|
*
|
|
634
807
|
* Pattern-match on the class and inspect `params` to surface the gap to users.
|
|
@@ -690,6 +863,82 @@ export class UnknownReallocationPositionError extends UnknownDataError {
|
|
|
690
863
|
this.marketId = marketId;
|
|
691
864
|
}
|
|
692
865
|
}
|
|
866
|
+
/** Thrown when Vault V2 reallocation state does not contain a requested allocation id. */
|
|
867
|
+
export class UnknownReallocationAllocationError extends UnknownDataError {
|
|
868
|
+
vault;
|
|
869
|
+
id;
|
|
870
|
+
/**
|
|
871
|
+
* @param vault - Vault V2 address for the missing allocation.
|
|
872
|
+
* @param id - Missing Vault V2 allocation id.
|
|
873
|
+
*/
|
|
874
|
+
constructor(vault, id) {
|
|
875
|
+
super(`unknown reallocation allocation "${id}" for vault "${vault}"`);
|
|
876
|
+
this.vault = vault;
|
|
877
|
+
this.id = id;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
/** Thrown when Vault V2 reallocation state lacks the vault-wide allocator configuration. */
|
|
881
|
+
export class UnknownReallocationPublicAllocatorConfigError extends UnknownDataError {
|
|
882
|
+
vault;
|
|
883
|
+
/** @param vault - Vault V2 address with missing allocator configuration. */
|
|
884
|
+
constructor(vault) {
|
|
885
|
+
super(`unknown public allocator configuration for vault "${vault}"`);
|
|
886
|
+
this.vault = vault;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
/** Thrown when Vault V2 reallocation state lacks the fetched active-adapter set. */
|
|
890
|
+
export class UnknownReallocationActiveAdaptersError extends UnknownDataError {
|
|
891
|
+
vault;
|
|
892
|
+
/** @param vault - Vault V2 address with missing active-adapter state. */
|
|
893
|
+
constructor(vault) {
|
|
894
|
+
super(`unknown active adapters for reallocation vault "${vault}"`);
|
|
895
|
+
this.vault = vault;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
/** Thrown when Vault V2 reallocation state lacks an adapter-market allocator configuration. */
|
|
899
|
+
export class UnknownReallocationMarketPublicAllocatorConfigError extends UnknownDataError {
|
|
900
|
+
vault;
|
|
901
|
+
adapterMarketCapId;
|
|
902
|
+
/**
|
|
903
|
+
* @param vault - Vault V2 address for the missing configuration.
|
|
904
|
+
* @param adapterMarketCapId - Missing adapter-scoped market cap id.
|
|
905
|
+
*/
|
|
906
|
+
constructor(vault, adapterMarketCapId) {
|
|
907
|
+
super(`unknown public allocator configuration "${adapterMarketCapId}" for vault "${vault}"`);
|
|
908
|
+
this.vault = vault;
|
|
909
|
+
this.adapterMarketCapId = adapterMarketCapId;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
/** Thrown when Vault V2 reallocation state does not contain a requested adapter. */
|
|
913
|
+
export class UnknownReallocationAdapterError extends UnknownDataError {
|
|
914
|
+
vault;
|
|
915
|
+
adapter;
|
|
916
|
+
/**
|
|
917
|
+
* @param vault - Vault V2 address expected to own the adapter.
|
|
918
|
+
* @param adapter - Missing adapter address.
|
|
919
|
+
*/
|
|
920
|
+
constructor(vault, adapter) {
|
|
921
|
+
super(`unknown reallocation adapter "${adapter}" for vault "${vault}"`);
|
|
922
|
+
this.vault = vault;
|
|
923
|
+
this.adapter = adapter;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
/** Thrown when a simulated Vault V2 allocation transition would underflow. */
|
|
927
|
+
export class ReallocationAllocationUnderflowError extends Error {
|
|
928
|
+
params;
|
|
929
|
+
constructor(params) {
|
|
930
|
+
super(`Reallocation change "${params.change}" exceeds allocation "${params.allocation}" for id "${params.id}" on vault "${params.vault}". Refresh the reallocation data and recompute the plan.`);
|
|
931
|
+
this.params = params;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
/** Thrown when a simulated Vault V2 market withdrawal exceeds the adapter's supply shares. */
|
|
935
|
+
export class ReallocationAdapterSupplySharesUnderflowError extends Error {
|
|
936
|
+
params;
|
|
937
|
+
constructor(params) {
|
|
938
|
+
super(`Reallocation withdraw shares "${params.withdrawnShares}" exceed adapter supply shares "${params.supplyShares}" on market "${params.marketId}" for adapter "${params.adapter}". Refresh the reallocation data and recompute the plan.`);
|
|
939
|
+
this.params = params;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
693
942
|
/** Thrown when a Midnight amount exceeds the maximum offer-cap value accepted onchain. */
|
|
694
943
|
export class MidnightAmountExceedsMaxOfferCapError extends Error {
|
|
695
944
|
constructor(params) {
|
|
@@ -823,7 +1072,7 @@ export class WithdrawSharesExceedSupplyError extends Error {
|
|
|
823
1072
|
}
|
|
824
1073
|
}
|
|
825
1074
|
/**
|
|
826
|
-
* Thrown when
|
|
1075
|
+
* Thrown when a Vault V1 or Vault V2 reallocation planner receives a withdraw `amount` greater
|
|
827
1076
|
* than the target market's current `totalSupplyAssets` — the post-withdraw
|
|
828
1077
|
* supply would be negative, making the on-chain `morphoWithdraw` revert
|
|
829
1078
|
* regardless of any reallocation. Caught here so callers do not pay
|
|
@@ -13,16 +13,16 @@ export interface PublicAllocatorOptions {
|
|
|
13
13
|
readonly timestamp?: BigIntish;
|
|
14
14
|
/**
|
|
15
15
|
* Vaults to consider for reallocation. They must have enabled the PublicAllocator.
|
|
16
|
+
* Arrays, readonly arrays, sets, and other iterables are accepted.
|
|
16
17
|
* Defaults to all vaults present in the reallocation data.
|
|
17
18
|
*/
|
|
18
|
-
readonly reallocatableVaults?:
|
|
19
|
+
readonly reallocatableVaults?: Iterable<Address>;
|
|
19
20
|
/**
|
|
20
21
|
* The maximum utilization each source market may reach when withdrawing
|
|
21
22
|
* shared liquidity, scaled by WAD.
|
|
22
23
|
*
|
|
23
|
-
* @deprecated
|
|
24
|
-
*
|
|
25
|
-
* configurable in the next major. Per-market overrides are still honored for now.
|
|
24
|
+
* @deprecated Per-market source ceilings will be removed in the next major.
|
|
25
|
+
* Use `defaultMaxWithdrawalUtilization` to configure one ceiling for every source.
|
|
26
26
|
*/
|
|
27
27
|
readonly maxWithdrawalUtilization?: Readonly<Record<MarketId, bigint | undefined>>;
|
|
28
28
|
/**
|
|
@@ -30,12 +30,37 @@ export interface PublicAllocatorOptions {
|
|
|
30
30
|
* shared liquidity, scaled by WAD.
|
|
31
31
|
*
|
|
32
32
|
* @default 90% (900000000000000000n)
|
|
33
|
-
* @deprecated The source-market withdrawal ceiling is fixed at 90%
|
|
34
|
-
* ({@link DEFAULT_WITHDRAWAL_TARGET_UTILIZATION}) and will stop being
|
|
35
|
-
* configurable in the next major. Overrides are still honored for now.
|
|
36
33
|
*/
|
|
37
34
|
readonly defaultMaxWithdrawalUtilization?: bigint;
|
|
38
35
|
}
|
|
36
|
+
/** Options controlling Vault V2 BluePublicAllocator reallocation discovery. */
|
|
37
|
+
export interface VaultV2BluePublicAllocatorOptions {
|
|
38
|
+
/** Whether Vault V2 public allocator discovery is enabled. */
|
|
39
|
+
readonly enabled?: boolean;
|
|
40
|
+
/** Timestamp at which market and Vault V2 interest is evaluated. */
|
|
41
|
+
readonly timestamp?: BigIntish;
|
|
42
|
+
/**
|
|
43
|
+
* Vault V2 addresses to consider. Arrays, readonly arrays, sets, and other
|
|
44
|
+
* iterables are accepted. Defaults to every vault in the reallocation data.
|
|
45
|
+
*/
|
|
46
|
+
readonly reallocatableVaults?: Iterable<Address>;
|
|
47
|
+
/**
|
|
48
|
+
* Maximum utilization source markets may reach during friendly discovery,
|
|
49
|
+
* scaled by WAD. The amount-aware planner falls back to 100% only when the
|
|
50
|
+
* friendly phase cannot cover the operation's absolute shortfall.
|
|
51
|
+
*
|
|
52
|
+
* @default 90% (900000000000000000n)
|
|
53
|
+
*/
|
|
54
|
+
readonly maxWithdrawalUtilization?: bigint;
|
|
55
|
+
/**
|
|
56
|
+
* Maximum proportional vault-asset penalty accepted for each
|
|
57
|
+
* BluePublicAllocator call, scaled by WAD. Vaults with a higher configured
|
|
58
|
+
* penalty are ignored. Must not exceed WAD (100%).
|
|
59
|
+
*
|
|
60
|
+
* @default 0n
|
|
61
|
+
*/
|
|
62
|
+
readonly maxPenalty?: bigint;
|
|
63
|
+
}
|
|
39
64
|
/**
|
|
40
65
|
* A computed source-market withdrawal before it is grouped by vault.
|
|
41
66
|
*/
|
|
@@ -60,13 +85,52 @@ export interface ReallocationWithdrawal {
|
|
|
60
85
|
* Maps 1:1 to a `PublicAllocator.reallocateTo()` call.
|
|
61
86
|
* Withdraws from source markets and supplies to the target market.
|
|
62
87
|
*/
|
|
63
|
-
export interface
|
|
88
|
+
export interface VaultV1Reallocation {
|
|
64
89
|
readonly vault: Address;
|
|
65
90
|
/** Fee in native token (ETH) paid to the PublicAllocator for this vault. */
|
|
66
91
|
readonly fee: bigint;
|
|
67
92
|
/** Source markets to withdraw from before supplying to the target market. */
|
|
68
93
|
readonly withdrawals: readonly ReallocationWithdrawal[];
|
|
69
94
|
}
|
|
95
|
+
/** Source of a Vault V2 BluePublicAllocator reallocation. */
|
|
96
|
+
export type VaultV2BlueReallocationSource = {
|
|
97
|
+
/** Reallocate from a Morpho Blue market. */
|
|
98
|
+
readonly type: "market";
|
|
99
|
+
/** Vault V2 adapter supplying the source market. */
|
|
100
|
+
readonly adapter: Address;
|
|
101
|
+
/** Source market parameters. */
|
|
102
|
+
readonly marketParams: MarketParams;
|
|
103
|
+
} | {
|
|
104
|
+
/** Allocate from vault idle liquidity without a synthetic market. */
|
|
105
|
+
readonly type: "idle";
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* One Blue Public Allocator contract call performed before a Blue action.
|
|
109
|
+
*
|
|
110
|
+
* The target market parameters are derived from the enclosing Blue action.
|
|
111
|
+
*/
|
|
112
|
+
export interface VaultV2BlueReallocation {
|
|
113
|
+
/** Vault whose liquidity is moved. */
|
|
114
|
+
readonly vault: Address;
|
|
115
|
+
/** Liquidity source. */
|
|
116
|
+
readonly from: VaultV2BlueReallocationSource;
|
|
117
|
+
/** Target Vault V2 adapter; the target market comes from the enclosing action. */
|
|
118
|
+
readonly to: {
|
|
119
|
+
readonly adapter: Address;
|
|
120
|
+
};
|
|
121
|
+
/** Asset amount, which must fit in `uint128`. */
|
|
122
|
+
readonly assets: bigint;
|
|
123
|
+
/** Vault-configured WAD-scaled penalty rate passed to the allocator. */
|
|
124
|
+
readonly penalty: bigint;
|
|
125
|
+
}
|
|
126
|
+
/** A homogeneous Blue action plan containing only Vault V1 or only Vault V2 reallocations. */
|
|
127
|
+
export type BlueReallocationPlan = Iterable<VaultV1Reallocation> | Iterable<VaultV2BlueReallocation>;
|
|
128
|
+
/**
|
|
129
|
+
* Deprecated name for a Vault V1 reallocation.
|
|
130
|
+
*
|
|
131
|
+
* @deprecated Use {@link VaultV1Reallocation} instead.
|
|
132
|
+
*/
|
|
133
|
+
export type VaultReallocation = VaultV1Reallocation;
|
|
70
134
|
/**
|
|
71
135
|
* Options for computing vault reallocations via the public allocator.
|
|
72
136
|
*
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams
|
|
2
|
-
|
|
1
|
+
export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams as BlueInputMarketParams,
|
|
2
|
+
/** @deprecated Use `BlueInputMarketParams` or the raw `/blue/types` subpath. */
|
|
3
|
+
InputMarketParams, IPermit2Allowance, Loadable, MarketId as BlueMarketId,
|
|
4
|
+
/** @deprecated Use `BlueMarketId` or the raw `/blue/types` subpath. */
|
|
5
|
+
MarketId, MaxBorrowOptions as BlueMaxBorrowOptions,
|
|
6
|
+
/** @deprecated Use `BlueMaxBorrowOptions` or the raw `/blue/types` subpath. */
|
|
7
|
+
MaxBorrowOptions, MaxPositionCapacities as BlueMaxPositionCapacities,
|
|
8
|
+
/** @deprecated Use `BlueMaxPositionCapacities` or the raw `/blue/types` subpath. */
|
|
9
|
+
MaxPositionCapacities, MaxWithdrawCollateralOptions as BlueMaxWithdrawCollateralOptions,
|
|
10
|
+
/** @deprecated Use `BlueMaxWithdrawCollateralOptions` or the raw `/blue/types` subpath. */
|
|
11
|
+
MaxWithdrawCollateralOptions, Pending, Permit2Allowance, } from "@morpho-org/blue-sdk";
|
|
12
|
+
export type { AuthorizationArgs as BlueAuthorizationTypedDataArgs, DaiPermitArgs, DeploylessFetchParameters as BlueDeploylessFetchParameters,
|
|
13
|
+
/** @deprecated Use `BlueDeploylessFetchParameters` or the raw `/blue/types` subpath. */
|
|
14
|
+
DeploylessFetchParameters, FetchParameters as BlueFetchParameters,
|
|
15
|
+
/** @deprecated Use `BlueFetchParameters` or the raw `/blue/types` subpath. */
|
|
16
|
+
FetchParameters, InputAllocation as BlueInputAllocation, MetaMorphoCall as BlueMetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs as PermitTypedDataArgs, } from "@morpho-org/blue-sdk-viem";
|
|
17
|
+
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
18
|
export type { ChainMetadata } from "@morpho-org/morpho-ts";
|
|
4
19
|
export * from "./types/index.js";
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { AdaptiveCurveIrmLib
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib,
|
|
3
|
+
/** @deprecated Use BlueAdaptiveCurveIrmLib or the raw protocol subpath. */
|
|
4
|
+
AdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry as blueDefaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils,
|
|
5
|
+
/** @deprecated Use BlueMarketUtils or the raw protocol subpath. */
|
|
6
|
+
MarketUtils, MathLib, SharesMath as BlueSharesMath,
|
|
7
|
+
/** @deprecated Use BlueSharesMath or the raw protocol subpath. */
|
|
8
|
+
SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
9
|
+
export { decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData,
|
|
10
|
+
/** @deprecated Use getBlueAuthorizationTypedData or the raw protocol subpath. */
|
|
11
|
+
getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
12
|
+
export { EcrecoverRatifierUtils as MidnightEcrecoverRatifierUtils,
|
|
13
|
+
/** @deprecated Use MidnightEcrecoverRatifierUtils or the raw protocol subpath. */
|
|
14
|
+
EcrecoverRatifierUtils, eip712Digest, GroupUtils as MidnightGroupUtils,
|
|
15
|
+
/** @deprecated Use MidnightGroupUtils or the raw protocol subpath. */
|
|
16
|
+
GroupUtils, MarketUtils as MidnightMarketUtils, OfferChainUtils as MidnightOfferChainUtils, OfferUtils as MidnightOfferUtils,
|
|
17
|
+
/** @deprecated Use MidnightOfferUtils or the raw protocol subpath. */
|
|
18
|
+
OfferUtils, Payload as MidnightPayload,
|
|
19
|
+
/** @deprecated Use MidnightPayload or the raw protocol subpath. */
|
|
20
|
+
Payload, PositionUtils as MidnightPositionUtils, RatifierUtils as MidnightRatifierUtils,
|
|
21
|
+
/** @deprecated Use MidnightRatifierUtils or the raw protocol subpath. */
|
|
22
|
+
RatifierUtils, SetterRatifierUtils as MidnightSetterRatifierUtils,
|
|
23
|
+
/** @deprecated Use MidnightSetterRatifierUtils or the raw protocol subpath. */
|
|
24
|
+
SetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib,
|
|
25
|
+
/** @deprecated Use MidnightTakeAmountsLib or the raw protocol subpath. */
|
|
26
|
+
TakeAmountsLib, TickLib as MidnightTickLib,
|
|
27
|
+
/** @deprecated Use MidnightTickLib or the raw protocol subpath. */
|
|
28
|
+
TickLib, TreeUtils as MidnightTreeUtils,
|
|
29
|
+
/** @deprecated Use MidnightTreeUtils or the raw protocol subpath. */
|
|
30
|
+
TreeUtils, } from "@morpho-org/midnight-sdk";
|
|
5
31
|
export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDottedKeys, WithId, WithIndex, } from "@morpho-org/morpho-ts";
|
|
6
32
|
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
|
|
7
|
-
export { computeReallocations } from "./helpers/
|
|
33
|
+
export { computeReallocations, computeVaultV1Reallocations, } from "./helpers/computeVaultV1Reallocations.js";
|
|
8
34
|
export { addTransactionMetadata } from "./helpers/metadata.js";
|
|
35
|
+
export { type PreviewVaultV2InKindRedeemParams, previewVaultV2InKindRedeem, type VaultV2InKindRedeemMarketPreview, } from "./helpers/previewVaultV2InKindRedeem.js";
|
|
9
36
|
export { computeMaxRepaySharePrice, computeMinBorrowSharePrice, } from "./helpers/slippage.js";
|
|
10
37
|
export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
|
package/lib/esm/utils.js
CHANGED
|
@@ -1,8 +1,35 @@
|
|
|
1
|
-
export { AdaptiveCurveIrmLib
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib,
|
|
2
|
+
/** @deprecated Use BlueAdaptiveCurveIrmLib or the raw protocol subpath. */
|
|
3
|
+
AdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry as blueDefaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils,
|
|
4
|
+
/** @deprecated Use BlueMarketUtils or the raw protocol subpath. */
|
|
5
|
+
MarketUtils, MathLib, SharesMath as BlueSharesMath,
|
|
6
|
+
/** @deprecated Use BlueSharesMath or the raw protocol subpath. */
|
|
7
|
+
SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
8
|
+
export { decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData,
|
|
9
|
+
/** @deprecated Use getBlueAuthorizationTypedData or the raw protocol subpath. */
|
|
10
|
+
getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
11
|
+
export { EcrecoverRatifierUtils as MidnightEcrecoverRatifierUtils,
|
|
12
|
+
/** @deprecated Use MidnightEcrecoverRatifierUtils or the raw protocol subpath. */
|
|
13
|
+
EcrecoverRatifierUtils, eip712Digest, GroupUtils as MidnightGroupUtils,
|
|
14
|
+
/** @deprecated Use MidnightGroupUtils or the raw protocol subpath. */
|
|
15
|
+
GroupUtils, MarketUtils as MidnightMarketUtils, OfferChainUtils as MidnightOfferChainUtils, OfferUtils as MidnightOfferUtils,
|
|
16
|
+
/** @deprecated Use MidnightOfferUtils or the raw protocol subpath. */
|
|
17
|
+
OfferUtils, Payload as MidnightPayload,
|
|
18
|
+
/** @deprecated Use MidnightPayload or the raw protocol subpath. */
|
|
19
|
+
Payload, PositionUtils as MidnightPositionUtils, RatifierUtils as MidnightRatifierUtils,
|
|
20
|
+
/** @deprecated Use MidnightRatifierUtils or the raw protocol subpath. */
|
|
21
|
+
RatifierUtils, SetterRatifierUtils as MidnightSetterRatifierUtils,
|
|
22
|
+
/** @deprecated Use MidnightSetterRatifierUtils or the raw protocol subpath. */
|
|
23
|
+
SetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib,
|
|
24
|
+
/** @deprecated Use MidnightTakeAmountsLib or the raw protocol subpath. */
|
|
25
|
+
TakeAmountsLib, TickLib as MidnightTickLib,
|
|
26
|
+
/** @deprecated Use MidnightTickLib or the raw protocol subpath. */
|
|
27
|
+
TickLib, TreeUtils as MidnightTreeUtils,
|
|
28
|
+
/** @deprecated Use MidnightTreeUtils or the raw protocol subpath. */
|
|
29
|
+
TreeUtils, } from "@morpho-org/midnight-sdk";
|
|
4
30
|
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
|
|
5
|
-
export { computeReallocations } from "./helpers/
|
|
31
|
+
export { computeReallocations, computeVaultV1Reallocations, } from "./helpers/computeVaultV1Reallocations.js";
|
|
6
32
|
export { addTransactionMetadata } from "./helpers/metadata.js";
|
|
33
|
+
export { previewVaultV2InKindRedeem, } from "./helpers/previewVaultV2InKindRedeem.js";
|
|
7
34
|
export { computeMaxRepaySharePrice, computeMinBorrowSharePrice, } from "./helpers/slippage.js";
|
|
8
35
|
export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
|
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": "5.
|
|
4
|
+
"version": "5.7.0",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Foulks-Plb <https://x.com/FoulkPlb>"
|
|
@@ -45,6 +45,11 @@
|
|
|
45
45
|
"import": "./lib/esm/augment/*.js",
|
|
46
46
|
"require": "./lib/cjs/augment/*.js"
|
|
47
47
|
},
|
|
48
|
+
"./blue/*": {
|
|
49
|
+
"types": "./lib/esm/blue/*.d.ts",
|
|
50
|
+
"import": "./lib/esm/blue/*.js",
|
|
51
|
+
"require": "./lib/cjs/blue/*.js"
|
|
52
|
+
},
|
|
48
53
|
"./bundler": {
|
|
49
54
|
"types": "./lib/esm/bundler/index.d.ts",
|
|
50
55
|
"import": "./lib/esm/bundler/index.js",
|
|
@@ -80,6 +85,11 @@
|
|
|
80
85
|
"import": "./lib/esm/midnight-api.js",
|
|
81
86
|
"require": "./lib/cjs/midnight-api.js"
|
|
82
87
|
},
|
|
88
|
+
"./midnight/*": {
|
|
89
|
+
"types": "./lib/esm/midnight/*.d.ts",
|
|
90
|
+
"import": "./lib/esm/midnight/*.js",
|
|
91
|
+
"require": "./lib/cjs/midnight/*.js"
|
|
92
|
+
},
|
|
83
93
|
"./types": {
|
|
84
94
|
"types": "./lib/esm/types.d.ts",
|
|
85
95
|
"import": "./lib/esm/types.js",
|
|
@@ -105,6 +115,9 @@
|
|
|
105
115
|
"augment/*": [
|
|
106
116
|
"lib/esm/augment/*.d.ts"
|
|
107
117
|
],
|
|
118
|
+
"blue/*": [
|
|
119
|
+
"lib/esm/blue/*.d.ts"
|
|
120
|
+
],
|
|
108
121
|
"bundler": [
|
|
109
122
|
"lib/esm/bundler/index.d.ts"
|
|
110
123
|
],
|
|
@@ -126,6 +139,9 @@
|
|
|
126
139
|
"midnight-api": [
|
|
127
140
|
"lib/esm/midnight-api.d.ts"
|
|
128
141
|
],
|
|
142
|
+
"midnight/*": [
|
|
143
|
+
"lib/esm/midnight/*.d.ts"
|
|
144
|
+
],
|
|
129
145
|
"types": [
|
|
130
146
|
"lib/esm/types.d.ts"
|
|
131
147
|
],
|
|
@@ -145,10 +161,10 @@
|
|
|
145
161
|
],
|
|
146
162
|
"dependencies": {
|
|
147
163
|
"zod": "^4.4.3",
|
|
148
|
-
"@morpho-org/blue-sdk": "^6.
|
|
149
|
-
"@morpho-org/blue-sdk-viem": "^5.
|
|
150
|
-
"@morpho-org/
|
|
151
|
-
"@morpho-org/
|
|
164
|
+
"@morpho-org/blue-sdk": "^6.6.0",
|
|
165
|
+
"@morpho-org/blue-sdk-viem": "^5.4.0",
|
|
166
|
+
"@morpho-org/midnight-sdk": "^1.3.0",
|
|
167
|
+
"@morpho-org/morpho-ts": "^2.10.0"
|
|
152
168
|
},
|
|
153
169
|
"peerDependencies": {
|
|
154
170
|
"viem": "^2.0.0"
|
|
@@ -159,14 +175,14 @@
|
|
|
159
175
|
"typescript": "^7.0.2",
|
|
160
176
|
"viem": "^2.55.10",
|
|
161
177
|
"vitest": "^4.1.10",
|
|
162
|
-
"@morpho-org/test": "^2.
|
|
178
|
+
"@morpho-org/test": "^2.9.0"
|
|
163
179
|
},
|
|
164
180
|
"scripts": {
|
|
165
181
|
"prepublish": "$npm_execpath build",
|
|
166
182
|
"build": "tsc --noEmit && $npm_execpath build:cjs && $npm_execpath build:esm",
|
|
167
183
|
"build:cjs": "tsc --build tsconfig.build.cjs.json && echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json",
|
|
168
184
|
"build:esm": "tsc --build tsconfig.build.esm.json && echo '{\"type\":\"module\"}' > lib/esm/package.json",
|
|
169
|
-
"test": "vitest --root ../.. --project morpho-sdk"
|
|
185
|
+
"test": "vitest --root ../.. --project morpho-sdk --project morpho-sdk-fork"
|
|
170
186
|
},
|
|
171
187
|
"types": "./lib/esm/index.d.ts"
|
|
172
188
|
}
|