@morpho-org/morpho-sdk 6.1.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/lib/cjs/blue/errors.d.ts +1 -1
  2. package/lib/cjs/blue/errors.js +2 -1
  3. package/lib/cjs/constants.d.ts +1 -1
  4. package/lib/cjs/constants.js +2 -1
  5. package/lib/cjs/entities/blue/blue.d.ts +14 -2
  6. package/lib/cjs/entities/blue/blue.js +7 -1
  7. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +1 -0
  8. package/lib/cjs/entities/vaultV1/vaultV1.js +1 -0
  9. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +34 -9
  10. package/lib/cjs/entities/vaultV2BlueReallocationData.js +167 -47
  11. package/lib/cjs/errors.d.ts +1 -1
  12. package/lib/cjs/errors.js +3 -2
  13. package/lib/cjs/helpers/constant.d.ts +8 -0
  14. package/lib/cjs/helpers/constant.js +10 -1
  15. package/lib/cjs/helpers/encodeDeallocation.d.ts +1 -0
  16. package/lib/cjs/helpers/encodeDeallocation.js +1 -0
  17. package/lib/cjs/helpers/index.d.ts +1 -1
  18. package/lib/cjs/helpers/index.js +2 -1
  19. package/lib/cjs/helpers/metadata.d.ts +13 -0
  20. package/lib/cjs/helpers/metadata.js +13 -0
  21. package/lib/cjs/helpers/utilization.d.ts +13 -0
  22. package/lib/cjs/helpers/utilization.js +19 -1
  23. package/lib/cjs/helpers/validate.d.ts +0 -2
  24. package/lib/cjs/helpers/validate.js +2 -3
  25. package/lib/cjs/types/data.d.ts +3 -0
  26. package/lib/cjs/types/entity.d.ts +3 -0
  27. package/lib/cjs/types/metadata.d.ts +6 -0
  28. package/lib/cjs/types/sharedLiquidity.d.ts +19 -1
  29. package/lib/esm/blue/errors.d.ts +1 -1
  30. package/lib/esm/blue/errors.js +1 -1
  31. package/lib/esm/constants.d.ts +1 -1
  32. package/lib/esm/constants.js +1 -1
  33. package/lib/esm/entities/blue/blue.d.ts +14 -2
  34. package/lib/esm/entities/blue/blue.js +7 -1
  35. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +1 -0
  36. package/lib/esm/entities/vaultV1/vaultV1.js +1 -0
  37. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +34 -9
  38. package/lib/esm/entities/vaultV2BlueReallocationData.js +168 -48
  39. package/lib/esm/errors.d.ts +1 -1
  40. package/lib/esm/errors.js +1 -1
  41. package/lib/esm/helpers/constant.d.ts +8 -0
  42. package/lib/esm/helpers/constant.js +9 -0
  43. package/lib/esm/helpers/encodeDeallocation.d.ts +1 -0
  44. package/lib/esm/helpers/encodeDeallocation.js +1 -0
  45. package/lib/esm/helpers/index.d.ts +1 -1
  46. package/lib/esm/helpers/index.js +1 -1
  47. package/lib/esm/helpers/metadata.d.ts +13 -0
  48. package/lib/esm/helpers/metadata.js +13 -0
  49. package/lib/esm/helpers/utilization.d.ts +13 -0
  50. package/lib/esm/helpers/utilization.js +18 -1
  51. package/lib/esm/helpers/validate.d.ts +0 -2
  52. package/lib/esm/helpers/validate.js +1 -1
  53. package/lib/esm/types/data.d.ts +3 -0
  54. package/lib/esm/types/entity.d.ts +3 -0
  55. package/lib/esm/types/metadata.d.ts +6 -0
  56. package/lib/esm/types/sharedLiquidity.d.ts +19 -1
  57. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
1
  export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
- export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MarketParamsIdMismatchError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedPermitDomainExtensionsError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
3
+ exports.UnsupportedPermitDomainExtensionsError = exports.MarketParamsIdMismatchError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
4
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
6
6
  Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return blue_sdk_1.DivisionByZeroError; } });
@@ -29,4 +29,5 @@ Object.defineProperty(exports, "InvalidNumberError", { enumerable: true, get: fu
29
29
  Object.defineProperty(exports, "InvalidPermitDomainChainIdError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainChainIdError; } });
30
30
  Object.defineProperty(exports, "InvalidPermitDomainVerifyingContractError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainVerifyingContractError; } });
31
31
  Object.defineProperty(exports, "isUnknownOfFactoryError", { enumerable: true, get: function () { return blue_sdk_viem_1.isUnknownOfFactoryError; } });
32
+ Object.defineProperty(exports, "MarketParamsIdMismatchError", { enumerable: true, get: function () { return blue_sdk_viem_1.MarketParamsIdMismatchError; } });
32
33
  Object.defineProperty(exports, "UnsupportedPermitDomainExtensionsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnsupportedPermitDomainExtensionsError; } });
@@ -1,4 +1,4 @@
1
1
  export { DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId as isBlueMarketId, LIQUIDATION_CURSOR as BLUE_LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR as BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType as BlueTransactionType, } from "@morpho-org/blue-sdk";
2
2
  export { CBP as MIDNIGHT_CBP, COLLATERAL_PARAMS_TYPEHASH as MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING as MIDNIGHT_DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH as MIDNIGHT_EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH as MIDNIGHT_MARKET_TYPEHASH, MAX_COLLATERALS as MIDNIGHT_MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER as MIDNIGHT_MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE as MIDNIGHT_MAX_CONTINUOUS_FEE, MAX_OFFER_CAP as MIDNIGHT_MAX_OFFER_CAP, MAX_SETTLEMENT_FEES as MIDNIGHT_MAX_SETTLEMENT_FEES, MAX_TICK as MIDNIGHT_MAX_TICK, MAX_TREE_HEIGHT as MIDNIGHT_MAX_TREE_HEIGHT, OFFER_TYPEHASH as MIDNIGHT_OFFER_TYPEHASH, PRICE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH, PRICE_ROUNDING_STEP as MIDNIGHT_PRICE_ROUNDING_STEP, RATE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH, SETTLEMENT_FEE_BREAKPOINTS as MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF as MIDNIGHT_TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
3
3
  export { BLUE_API_BASE_URL, BLUE_API_GRAPHQL_URL, ChainId, ChainUtils, DOCS_BASE_URL, MORPHO_DOMAIN, REWARDS_BASE_URL, ZERO_ADDRESS, } from "@morpho-org/morpho-ts";
4
- export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, } from "./helpers/constant.js";
4
+ export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, } from "./helpers/constant.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_REALLOCATION_PENALTY = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_MAX_REALLOCATION_PENALTY = exports.DEFAULT_LLTV_BUFFER = exports.APPROVE_ONLY_ONCE_TOKENS = exports.ZERO_ADDRESS = exports.REWARDS_BASE_URL = exports.MORPHO_DOMAIN = exports.DOCS_BASE_URL = exports.ChainUtils = exports.ChainId = exports.BLUE_API_GRAPHQL_URL = exports.BLUE_API_BASE_URL = exports.MIDNIGHT_TIME_TO_MAX_LIF = exports.MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS = exports.MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH = exports.MIDNIGHT_PRICE_ROUNDING_STEP = exports.MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH = exports.MIDNIGHT_OFFER_TYPEHASH = exports.MIDNIGHT_MAX_TREE_HEIGHT = exports.MIDNIGHT_MAX_TICK = exports.MIDNIGHT_MAX_SETTLEMENT_FEES = exports.MIDNIGHT_MAX_OFFER_CAP = exports.MIDNIGHT_MAX_CONTINUOUS_FEE = exports.MIDNIGHT_MAX_COLLATERALS_PER_BORROWER = exports.MIDNIGHT_MAX_COLLATERALS = exports.MIDNIGHT_MARKET_TYPEHASH = exports.MIDNIGHT_EIP712_DOMAIN_TYPEHASH = exports.MIDNIGHT_DEFAULT_TICK_SPACING = exports.MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH = exports.MIDNIGHT_CBP = exports.BlueTransactionType = exports.SECONDS_PER_YEAR = exports.ORACLE_PRICE_SCALE = exports.BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR = exports.BLUE_LIQUIDATION_CURSOR = exports.isBlueMarketId = exports.ERC20_ALLOWANCE_RECIPIENTS = exports.EIP_712_FIELDS = exports.DEFAULT_SLIPPAGE_TOLERANCE = void 0;
3
+ exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_REALLOCATION_PENALTY = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_MAX_REALLOCATION_PENALTY = exports.DEFAULT_LLTV_BUFFER = exports.DEFAULT_CAP_ACCRUAL_BUFFER = exports.APPROVE_ONLY_ONCE_TOKENS = exports.ZERO_ADDRESS = exports.REWARDS_BASE_URL = exports.MORPHO_DOMAIN = exports.DOCS_BASE_URL = exports.ChainUtils = exports.ChainId = exports.BLUE_API_GRAPHQL_URL = exports.BLUE_API_BASE_URL = exports.MIDNIGHT_TIME_TO_MAX_LIF = exports.MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS = exports.MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH = exports.MIDNIGHT_PRICE_ROUNDING_STEP = exports.MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH = exports.MIDNIGHT_OFFER_TYPEHASH = exports.MIDNIGHT_MAX_TREE_HEIGHT = exports.MIDNIGHT_MAX_TICK = exports.MIDNIGHT_MAX_SETTLEMENT_FEES = exports.MIDNIGHT_MAX_OFFER_CAP = exports.MIDNIGHT_MAX_CONTINUOUS_FEE = exports.MIDNIGHT_MAX_COLLATERALS_PER_BORROWER = exports.MIDNIGHT_MAX_COLLATERALS = exports.MIDNIGHT_MARKET_TYPEHASH = exports.MIDNIGHT_EIP712_DOMAIN_TYPEHASH = exports.MIDNIGHT_DEFAULT_TICK_SPACING = exports.MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH = exports.MIDNIGHT_CBP = exports.BlueTransactionType = exports.SECONDS_PER_YEAR = exports.ORACLE_PRICE_SCALE = exports.BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR = exports.BLUE_LIQUIDATION_CURSOR = exports.isBlueMarketId = exports.ERC20_ALLOWANCE_RECIPIENTS = exports.EIP_712_FIELDS = exports.DEFAULT_SLIPPAGE_TOLERANCE = void 0;
4
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "DEFAULT_SLIPPAGE_TOLERANCE", { enumerable: true, get: function () { return blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE; } });
6
6
  Object.defineProperty(exports, "EIP_712_FIELDS", { enumerable: true, get: function () { return blue_sdk_1.EIP_712_FIELDS; } });
@@ -41,6 +41,7 @@ Object.defineProperty(exports, "REWARDS_BASE_URL", { enumerable: true, get: func
41
41
  Object.defineProperty(exports, "ZERO_ADDRESS", { enumerable: true, get: function () { return morpho_ts_1.ZERO_ADDRESS; } });
42
42
  var constant_js_1 = require("./helpers/constant.js");
43
43
  Object.defineProperty(exports, "APPROVE_ONLY_ONCE_TOKENS", { enumerable: true, get: function () { return constant_js_1.APPROVE_ONLY_ONCE_TOKENS; } });
44
+ Object.defineProperty(exports, "DEFAULT_CAP_ACCRUAL_BUFFER", { enumerable: true, get: function () { return constant_js_1.DEFAULT_CAP_ACCRUAL_BUFFER; } });
44
45
  Object.defineProperty(exports, "DEFAULT_LLTV_BUFFER", { enumerable: true, get: function () { return constant_js_1.DEFAULT_LLTV_BUFFER; } });
45
46
  Object.defineProperty(exports, "DEFAULT_MAX_REALLOCATION_PENALTY", { enumerable: true, get: function () { return constant_js_1.DEFAULT_MAX_REALLOCATION_PENALTY; } });
46
47
  Object.defineProperty(exports, "DEFAULT_SUPPLY_TARGET_UTILIZATION", { enumerable: true, get: function () { return constant_js_1.DEFAULT_SUPPLY_TARGET_UTILIZATION; } });
@@ -814,13 +814,19 @@ export interface BlueActions {
814
814
  }) => Promise<VaultV2BlueReallocationData>;
815
815
  /**
816
816
  * Computes Vault V2 BluePublicAllocator reallocations for this market.
817
+ * Market/vault state and returned post-state stay at `options.timestamp`;
818
+ * only target-market cap checks reserve interest on the vault's existing
819
+ * allocation through `timestamp + capAccrualBuffer` (two hours by default;
820
+ * `0n` disables it). For market-source reallocations the source position's
821
+ * interest is also reserved on cap ids shared with the target, and reserves
822
+ * persist across every leg of a plan.
817
823
  *
818
824
  * @param params.reallocationData - State returned by {@link getVaultV2BlueReallocationData}.
819
825
  * @param params.options - Optional allocator discovery controls and operation to support.
820
826
  * @returns Action-ready reallocations and their post-simulation state.
821
827
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
822
828
  * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
823
- * @throws {NegativeInputError} when a utilization or penalty limit is negative.
829
+ * @throws {NegativeInputError} when the cap-accrual buffer, utilization, or penalty limit is negative.
824
830
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
825
831
  * @throws {NonPositiveInputError} when an enabled operation amount is not positive.
826
832
  * @throws {UnknownReallocationMarketError} when a required market is absent.
@@ -1026,13 +1032,19 @@ export declare class MorphoBlue implements BlueActions {
1026
1032
  }): Promise<VaultV2BlueReallocationData>;
1027
1033
  /**
1028
1034
  * Computes Vault V2 BluePublicAllocator reallocations for this market.
1035
+ * Market/vault state and returned post-state stay at `options.timestamp`;
1036
+ * only target-market cap checks reserve interest on the vault's existing
1037
+ * allocation through `timestamp + capAccrualBuffer` (two hours by default;
1038
+ * `0n` disables it). For market-source reallocations the source position's
1039
+ * interest is also reserved on cap ids shared with the target, and reserves
1040
+ * persist across every leg of a plan.
1029
1041
  *
1030
1042
  * @param params.reallocationData - State returned by {@link getVaultV2BlueReallocationData}.
1031
1043
  * @param params.options - Optional allocator discovery controls and operation to support.
1032
1044
  * @returns Action-ready reallocations and their post-simulation state.
1033
1045
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
1034
1046
  * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
1035
- * @throws {NegativeInputError} when a utilization or penalty limit is negative.
1047
+ * @throws {NegativeInputError} when the cap-accrual buffer, utilization, or penalty limit is negative.
1036
1048
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
1037
1049
  * @throws {NonPositiveInputError} when an enabled operation amount is not positive.
1038
1050
  * @throws {UnknownReallocationMarketError} when a required market is absent.
@@ -733,13 +733,19 @@ class MorphoBlue {
733
733
  }
734
734
  /**
735
735
  * Computes Vault V2 BluePublicAllocator reallocations for this market.
736
+ * Market/vault state and returned post-state stay at `options.timestamp`;
737
+ * only target-market cap checks reserve interest on the vault's existing
738
+ * allocation through `timestamp + capAccrualBuffer` (two hours by default;
739
+ * `0n` disables it). For market-source reallocations the source position's
740
+ * interest is also reserved on cap ids shared with the target, and reserves
741
+ * persist across every leg of a plan.
736
742
  *
737
743
  * @param params.reallocationData - State returned by {@link getVaultV2BlueReallocationData}.
738
744
  * @param params.options - Optional allocator discovery controls and operation to support.
739
745
  * @returns Action-ready reallocations and their post-simulation state.
740
746
  * @throws {ChainIdMismatchError} when `reallocationData` belongs to another chain.
741
747
  * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
742
- * @throws {NegativeInputError} when a utilization or penalty limit is negative.
748
+ * @throws {NegativeInputError} when the cap-accrual buffer, utilization, or penalty limit is negative.
743
749
  * @throws {InputExceedsMaxError} when a utilization or penalty limit exceeds WAD.
744
750
  * @throws {NonPositiveInputError} when an enabled operation amount is not positive.
745
751
  * @throws {UnknownReallocationMarketError} when a required market is absent.
@@ -34,6 +34,7 @@ const getVaultBundlesSharesRequirements = async (viemClient, params) => {
34
34
  throw new index_js_3.ExpiredDeadlineError(params.deadline, now);
35
35
  }
36
36
  const spender = (0, morpho_ts_1.getChainAddress)(params.chainId, "bundles.vaultBundlesV1");
37
+ // The allowance is trusted as returned by the RPC. See THREAT_MODEL.md, RPC.
37
38
  const allowance = await (0, actions_1.readContract)(viemClient, {
38
39
  address: params.vaultData.address,
39
40
  abi: viem_1.erc20Abi,
@@ -340,6 +340,7 @@ class MorphoVaultV1 {
340
340
  abi: blue_sdk_viem_1.metaMorphoAbi,
341
341
  functionName: "MORPHO",
342
342
  },
343
+ // feeRecipient() is trusted as returned by the RPC. See THREAT_MODEL.md, RPC.
343
344
  {
344
345
  address: blue,
345
346
  abi: blue_sdk_viem_1.blueAbi,
@@ -363,9 +363,15 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
363
363
  * utilization defaults to 90% and is configurable through
364
364
  * `options.maxWithdrawalUtilization`. Vaults whose configured penalty exceeds
365
365
  * `options.maxPenalty` are ignored. By default, only zero-penalty vaults are
366
- * considered. Targets with no remaining supply or allocator capacity are skipped before
367
- * projecting source interest. The adapter's minimum share minting requirement, supply-share
368
- * limits, and target absolute or zero relative caps are checked against a one-asset deposit.
366
+ * considered. Market/vault state and the returned post-state stay at
367
+ * `timestamp`; only target-market cap checks reserve interest the vault's
368
+ * existing allocation would accrue through `timestamp + capAccrualBuffer`
369
+ * (two hours by default; `0n` disables it). For market-source reallocations
370
+ * the source position's interest is also reserved on cap ids shared with the
371
+ * target, and reserves persist across every leg of a plan. Targets with no remaining supply
372
+ * or allocator capacity are skipped before projecting source interest. The
373
+ * adapter's minimum share minting requirement, supply-share limits, and target
374
+ * absolute or zero relative caps are checked against a one-asset deposit.
369
375
  * Shared cap IDs that a source withdrawal can reduce remain eligible, as do deposits whose
370
376
  * allocation does not increase after rounding.
371
377
  *
@@ -377,9 +383,15 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
377
383
  *
378
384
  * @param marketId - Target Blue market id.
379
385
  * @param options - Optional discovery controls and operation to support.
386
+ * Market/vault state and returned post-state stay at `timestamp`; only
387
+ * target-market cap checks reserve interest on the vault's existing allocation
388
+ * through `timestamp + capAccrualBuffer` (two hours by default; `0n` disables).
389
+ * For market-source reallocations the source position's interest is also
390
+ * reserved on cap ids shared with the target, and reserves persist across
391
+ * every leg of a plan.
380
392
  * @returns Flat action-ready reallocations and their post-simulation state.
381
393
  * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
382
- * @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
394
+ * @throws {NegativeInputError} when `capAccrualBuffer`, `maxWithdrawalUtilization`, or `maxPenalty` is negative.
383
395
  * @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
384
396
  * @throws {NonPositiveInputError} when the operation amount is not positive and planning is enabled.
385
397
  * @throws {UnknownReallocationMarketError} when a required market is absent.
@@ -431,12 +443,19 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
431
443
  private computeVaultV2BlueReallocationsAtUtilizationInPlace;
432
444
  /**
433
445
  * Sums friendly Vault V2 shared liquidity available to a target market.
446
+ * Market/vault state and returned post-state stay at `timestamp`; only
447
+ * target-market cap checks reserve interest on the vault's existing allocation
448
+ * through `timestamp + capAccrualBuffer` (two hours by default; `0n` disables).
449
+ * For market-source reallocations the source position's interest is also
450
+ * reserved on cap ids shared with the target, and reserves persist across
451
+ * every leg of a plan.
434
452
  *
435
453
  * @param marketId - Target Blue market id.
436
- * @param options - Optional timestamp, enable flag, vault allowlist, source utilization ceiling, and maximum penalty.
454
+ * @param options - Optional timestamp, cap-accrual buffer, enable flag, vault
455
+ * allowlist, source utilization ceiling, and maximum penalty.
437
456
  * @returns Reallocatable market and idle assets, or `0n` when none are available; rounding-only shared-cap fits may be conservatively omitted.
438
457
  * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
439
- * @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
458
+ * @throws {NegativeInputError} when `capAccrualBuffer`, `maxWithdrawalUtilization`, or `maxPenalty` is negative.
440
459
  * @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
441
460
  * @throws {UnknownReallocationMarketError} when a required market is absent.
442
461
  * @throws {UnknownReallocationVaultError} when configured vault state is absent.
@@ -470,14 +489,20 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
470
489
  getPublicReallocationLiquidity(marketId: MarketId, options?: VaultV2BluePublicAllocatorOptions): bigint;
471
490
  /**
472
491
  * Computes borrow liquidity to a target utilization, including friendly
473
- * Vault V2 public reallocations.
492
+ * Vault V2 public reallocations. Market/vault state and returned post-state
493
+ * stay at `timestamp`; only target-market cap checks reserve interest on the
494
+ * vault's existing allocation through `timestamp + capAccrualBuffer` (two
495
+ * hours by default; `0n` disables). For market-source reallocations the
496
+ * source position's interest is also reserved on cap ids shared with the
497
+ * target, and reserves persist across every leg of a plan.
474
498
  *
475
499
  * @param marketId - Target Blue market id.
476
500
  * @param utilization - Desired utilization, scaled by WAD. Defaults to 90%.
477
- * @param options - Optional timestamp, enable flag, vault allowlist, source utilization ceiling, and maximum penalty.
501
+ * @param options - Optional timestamp, cap-accrual buffer, enable flag, vault
502
+ * allowlist, source utilization ceiling, and maximum penalty.
478
503
  * @returns Borrowable assets while remaining at or below `utilization`; rounding-only shared-cap fits may be conservatively omitted.
479
504
  * @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
480
- * @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
505
+ * @throws {NegativeInputError} when `capAccrualBuffer`, `maxWithdrawalUtilization`, or `maxPenalty` is negative.
481
506
  * @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
482
507
  * @throws {UnknownReallocationMarketError} when a required market is absent.
483
508
  * @throws {UnknownReallocationVaultError} when configured vault state is absent.