@morpho-org/morpho-sdk 9.4.0 → 9.6.0-next.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 (97) hide show
  1. package/MIGRATION-v5-to-v6.md +7 -0
  2. package/MIGRATION-v7-to-v8.md +7 -0
  3. package/MIGRATION-v8-to-v9.md +7 -0
  4. package/README.md +6 -4
  5. package/lib/cjs/abis.d.ts +1 -1
  6. package/lib/cjs/abis.js +5 -1
  7. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -0
  8. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +4 -1
  9. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +4 -1
  10. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -1
  11. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
  12. package/lib/cjs/blue/abis.d.ts +1 -1
  13. package/lib/cjs/blue/abis.js +5 -1
  14. package/lib/cjs/blue/entities.d.ts +4 -4
  15. package/lib/cjs/blue/entities.js +3 -1
  16. package/lib/cjs/blue/errors.d.ts +2 -2
  17. package/lib/cjs/blue/errors.js +5 -1
  18. package/lib/cjs/blue/fetch.d.ts +2 -2
  19. package/lib/cjs/blue/fetch.js +3 -1
  20. package/lib/cjs/blue/utils.d.ts +1 -1
  21. package/lib/cjs/blue/utils.js +2 -1
  22. package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
  23. package/lib/cjs/client/morphoViemExtension.js +1 -1
  24. package/lib/cjs/entities/blue/blue.d.ts +7 -21
  25. package/lib/cjs/entities/blue/blue.js +4 -22
  26. package/lib/cjs/entities/index.d.ts +4 -4
  27. package/lib/cjs/entities/index.js +3 -1
  28. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +21 -26
  29. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +42 -80
  30. package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.d.ts +6 -3
  31. package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.js +2 -2
  32. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +5 -11
  33. package/lib/cjs/entities/vaultV1/vaultV1.js +3 -11
  34. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +37 -18
  35. package/lib/cjs/entities/vaultV2/vaultV2.js +36 -12
  36. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -3
  37. package/lib/cjs/entities/vaultV2BlueReallocationData.js +49 -7
  38. package/lib/cjs/errors.d.ts +4 -4
  39. package/lib/cjs/errors.js +7 -5
  40. package/lib/cjs/fetch.d.ts +2 -2
  41. package/lib/cjs/fetch.js +3 -1
  42. package/lib/cjs/helpers/deadShares.js +2 -0
  43. package/lib/cjs/midnight/errors.d.ts +2 -1
  44. package/lib/cjs/midnight/errors.js +5 -4
  45. package/lib/cjs/types/action.d.ts +11 -4
  46. package/lib/cjs/types/action.js +1 -0
  47. package/lib/cjs/types/error.d.ts +8 -2
  48. package/lib/cjs/types/error.js +8 -2
  49. package/lib/cjs/utils.d.ts +2 -2
  50. package/lib/cjs/utils.js +4 -2
  51. package/lib/esm/abis.d.ts +1 -1
  52. package/lib/esm/abis.js +1 -1
  53. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -0
  54. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -1
  55. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +4 -1
  56. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -1
  57. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
  58. package/lib/esm/blue/abis.d.ts +1 -1
  59. package/lib/esm/blue/abis.js +1 -1
  60. package/lib/esm/blue/entities.d.ts +4 -4
  61. package/lib/esm/blue/entities.js +2 -2
  62. package/lib/esm/blue/errors.d.ts +2 -2
  63. package/lib/esm/blue/errors.js +2 -2
  64. package/lib/esm/blue/fetch.d.ts +2 -2
  65. package/lib/esm/blue/fetch.js +2 -2
  66. package/lib/esm/blue/utils.d.ts +1 -1
  67. package/lib/esm/blue/utils.js +1 -1
  68. package/lib/esm/client/morphoViemExtension.d.ts +1 -1
  69. package/lib/esm/client/morphoViemExtension.js +1 -1
  70. package/lib/esm/entities/blue/blue.d.ts +7 -21
  71. package/lib/esm/entities/blue/blue.js +4 -22
  72. package/lib/esm/entities/index.d.ts +4 -4
  73. package/lib/esm/entities/index.js +2 -2
  74. package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +21 -26
  75. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +44 -82
  76. package/lib/esm/entities/requirements/getUnusedPermit2Nonce.d.ts +6 -3
  77. package/lib/esm/entities/requirements/getUnusedPermit2Nonce.js +2 -2
  78. package/lib/esm/entities/vaultV1/vaultV1.d.ts +5 -11
  79. package/lib/esm/entities/vaultV1/vaultV1.js +4 -12
  80. package/lib/esm/entities/vaultV2/vaultV2.d.ts +37 -18
  81. package/lib/esm/entities/vaultV2/vaultV2.js +37 -13
  82. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -3
  83. package/lib/esm/entities/vaultV2BlueReallocationData.js +49 -7
  84. package/lib/esm/errors.d.ts +4 -4
  85. package/lib/esm/errors.js +4 -4
  86. package/lib/esm/fetch.d.ts +2 -2
  87. package/lib/esm/fetch.js +2 -2
  88. package/lib/esm/helpers/deadShares.js +3 -1
  89. package/lib/esm/midnight/errors.d.ts +2 -1
  90. package/lib/esm/midnight/errors.js +2 -1
  91. package/lib/esm/types/action.d.ts +11 -4
  92. package/lib/esm/types/action.js +1 -0
  93. package/lib/esm/types/error.d.ts +8 -2
  94. package/lib/esm/types/error.js +8 -2
  95. package/lib/esm/utils.d.ts +2 -2
  96. package/lib/esm/utils.js +2 -2
  97. package/package.json +6 -6
@@ -6,6 +6,7 @@ export type BundlesTokenRequirementsState = {
6
6
  /** Current allowance of the funding token for `spender`. */
7
7
  readonly allowance: bigint;
8
8
  } | {
9
+ /** @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals. */
9
10
  readonly type: "permit2SignatureTransfer";
10
11
  readonly permit2Allowance: bigint;
11
12
  readonly permit2Nonce: bigint;
@@ -51,6 +51,9 @@ interface EncodeErc20PermitParams {
51
51
  * @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
52
52
  * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
53
53
  * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
54
+ * @throws {InvalidPermitDomainChainIdError} when the EIP-5267 domain names another chain.
55
+ * @throws {InvalidPermitDomainVerifyingContractError} when the EIP-5267 domain names another token.
56
+ * @throws {UnsupportedPermitDomainExtensionsError} when the EIP-5267 domain has extensions.
54
57
  * @throws {MissingPermitDomainNameError} when the token exposes neither `name()` nor
55
58
  * `eip712Domain()`, so its permit domain is unknown.
56
59
  * @throws {viem.BaseError} when the `eth_chainId` request or a token metadata read fails at the
@@ -67,7 +70,7 @@ interface EncodeErc20PermitParams {
67
70
  *
68
71
  * const client = createWalletClient({ chain: mainnet, transport: http() });
69
72
  * const requirement = await encodeErc20Permit(client, {
70
- * token: USDC, // Must implement standard ERC-2612. DAI is routed through Permit2 by requirement helpers.
73
+ * token: USDC, // Must implement standard ERC-2612. DAI falls back to a direct ERC-20 approval in requirement helpers.
71
74
  * owner,
72
75
  * spender: blueBundlesV1,
73
76
  * amount: 1_000_000n,
@@ -41,6 +41,9 @@ import { validateClientChainId } from "../validateClientChainId.js";
41
41
  * @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
42
42
  * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
43
43
  * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
44
+ * @throws {InvalidPermitDomainChainIdError} when the EIP-5267 domain names another chain.
45
+ * @throws {InvalidPermitDomainVerifyingContractError} when the EIP-5267 domain names another token.
46
+ * @throws {UnsupportedPermitDomainExtensionsError} when the EIP-5267 domain has extensions.
44
47
  * @throws {MissingPermitDomainNameError} when the token exposes neither `name()` nor
45
48
  * `eip712Domain()`, so its permit domain is unknown.
46
49
  * @throws {viem.BaseError} when the `eth_chainId` request or a token metadata read fails at the
@@ -57,7 +60,7 @@ import { validateClientChainId } from "../validateClientChainId.js";
57
60
  *
58
61
  * const client = createWalletClient({ chain: mainnet, transport: http() });
59
62
  * const requirement = await encodeErc20Permit(client, {
60
- * token: USDC, // Must implement standard ERC-2612. DAI is routed through Permit2 by requirement helpers.
63
+ * token: USDC, // Must implement standard ERC-2612. DAI falls back to a direct ERC-20 approval in requirement helpers.
61
64
  * owner,
62
65
  * spender: blueBundlesV1,
63
66
  * amount: 1_000_000n,
@@ -1,6 +1,9 @@
1
1
  import type { Address } from "@morpho-org/blue-sdk";
2
2
  import { type Permit2SignatureTransferRequirementSignature, type Requirement } from "../../../types/index.js";
3
- /** Parameters for {@link encodeErc20Permit2SignatureTransfer}. */
3
+ /**
4
+ * Parameters for {@link encodeErc20Permit2SignatureTransfer}.
5
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
6
+ */
4
7
  export interface EncodeErc20Permit2SignatureTransferParams {
5
8
  /** ERC-20 token pulled through Permit2. */
6
9
  readonly token: Address;
@@ -62,5 +65,6 @@ export interface EncodeErc20Permit2SignatureTransferParams {
62
65
  * });
63
66
  * // requirement satisfies Requirement<Permit2SignatureTransferRequirementSignature>
64
67
  * ```
68
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
65
69
  */
66
70
  export declare const encodeErc20Permit2SignatureTransfer: (params: EncodeErc20Permit2SignatureTransferParams) => Requirement<Permit2SignatureTransferRequirementSignature>;
@@ -50,6 +50,7 @@ import { ExpiredDeadlineError, InputExceedsMaxError, NonPositiveInputError, } fr
50
50
  * });
51
51
  * // requirement satisfies Requirement<Permit2SignatureTransferRequirementSignature>
52
52
  * ```
53
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
53
54
  */
54
55
  export const encodeErc20Permit2SignatureTransfer = (params) => {
55
56
  const { token, spender, amount, chainId, nonce, deadline } = params;
@@ -1,5 +1,5 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, midnightAdapterAbi, midnightAdapterFactoryAbi, midnightAdapterPriceRatifierV1Abi, midnightAdapterRateRatifierV1Abi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  preLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
@@ -1,5 +1,5 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, midnightAdapterAbi, midnightAdapterFactoryAbi, midnightAdapterPriceRatifierV1Abi, midnightAdapterRateRatifierV1Abi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  preLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
@@ -1,10 +1,10 @@
1
- export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
1
+ export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MidnightAdapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  IPreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
6
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
5
+ IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MidnightAdapter, IVaultV2MidnightAdapterAccrualMarket, IVaultV2MidnightAdapterCollateralParams, IVaultV2MidnightAdapterMarket, IVaultV2MidnightAdapterMarketData, IVaultV2MidnightAdapterMarketState, IVaultV2MidnightAdapterPosition, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, VaultV2MidnightAdapterAccrualMarket, VaultV2MidnightAdapterMarketData, } from "@morpho-org/blue-sdk";
6
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MidnightAdapter, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
7
7
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
8
8
  PreLiquidationParams,
9
9
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
10
- PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
10
+ PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MidnightAdapter, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1,5 +1,5 @@
1
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
1
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MidnightAdapter, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  PreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
5
+ PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MidnightAdapter, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1,4 +1,4 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, InvalidPositionAccrualStateError, InvalidPositionLossFactorError, InvalidVaultV2MidnightAdapterMarketsError, 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, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnresolvedBlockNumberError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,4 +1,4 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, InvalidPositionAccrualStateError, InvalidPositionLossFactorError, InvalidVaultV2MidnightAdapterMarketsError, 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, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnresolvedBlockNumberError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,5 +1,5 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MidnightAdapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  fetchPreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
5
+ fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MidnightAdapter, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -1,5 +1,5 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MidnightAdapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  fetchPreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
5
+ fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MidnightAdapter, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -3,5 +3,5 @@ export { AdaptiveCurveIrmLib, CapacityLimitReason,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  defaultPreLiquidationParamsRegistry,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
- getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
6
+ getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2MidnightAdapterUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
7
7
  export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -2,5 +2,5 @@ export { AdaptiveCurveIrmLib, CapacityLimitReason,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  defaultPreLiquidationParamsRegistry,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
5
+ getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2MidnightAdapterUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
6
6
  export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -12,7 +12,7 @@ import type { Metadata, MorphoClientType } from "../types/index.js";
12
12
  * @param _options.metadata - Optional analytics metadata applied to every transaction the
13
13
  * `morpho` namespace builds.
14
14
  * @param _options.supportSignature - Whether the integrator can collect EIP-712 signatures for
15
- * ERC-2612, Permit2 SignatureTransfer, and Morpho authorization.
15
+ * ERC-2612 and Morpho authorization.
16
16
  * Defaults to `false` (standalone approvals and authorization calls only).
17
17
  * @param _options.supportDeployless - Whether entity fetchers may use deployless multicall.
18
18
  * @returns A viem extension function — `client.extend(morphoViemExtension(...))` adds
@@ -46,7 +46,7 @@ function createMorphoNamespace(viemClient, options) {
46
46
  * @param _options.metadata - Optional analytics metadata applied to every transaction the
47
47
  * `morpho` namespace builds.
48
48
  * @param _options.supportSignature - Whether the integrator can collect EIP-712 signatures for
49
- * ERC-2612, Permit2 SignatureTransfer, and Morpho authorization.
49
+ * ERC-2612 and Morpho authorization.
50
50
  * Defaults to `false` (standalone approvals and authorization calls only).
51
51
  * @param _options.supportDeployless - Whether entity fetchers may use deployless multicall.
52
52
  * @returns A viem extension function — `client.extend(morphoViemExtension(...))` adds
@@ -18,9 +18,9 @@ type VaultV2BlueReallocationsParams = {
18
18
  };
19
19
  /** Options for resolving token-backed BlueBundlesV1 approval or signature prerequisites. */
20
20
  export interface BlueTokenRequirementsParams {
21
- /** Prefer ERC-2612 when the funded token exposes a compatible nonce. */
21
+ /** Prefer ERC-2612 when the funded token exposes a compatible nonce; defaults to true when signatures are supported. */
22
22
  readonly useSimplePermit?: boolean;
23
- /** Explicit unused Permit2 SignatureTransfer unordered nonce; defaults to the lowest unused nonce. */
23
+ /** @deprecated Ignored. The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals. */
24
24
  readonly permit2Nonce?: bigint;
25
25
  }
26
26
  /**
@@ -95,8 +95,6 @@ export interface BlueActions {
95
95
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
96
96
  * @throws {InputExceedsMaxError} when the referral fee is at least WAD.
97
97
  * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
98
- * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
99
- * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
100
98
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
101
99
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
102
100
  * @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
@@ -144,10 +142,9 @@ export interface BlueActions {
144
142
  /**
145
143
  * Prepares a direct BlueBundlesV1 loan-asset supply.
146
144
  *
147
- * `getRequirements()` first checks that BlueBundlesV1, Blue and, for ERC-20 funding with
148
- * signatures enabled, Permit2 hold code at their registered addresses, then reads the loan-token
149
- * allowance and selected ERC-2612 or Permit2 nonce state. Direct approvals and ERC-2612 name
150
- * BlueBundlesV1 as spender; Permit2 keeps its ERC-20 approval on canonical Permit2. Native
145
+ * `getRequirements()` first checks that BlueBundlesV1 and Blue hold code, then
146
+ * reads the loan-token allowance and selected ERC-2612 nonce state. Direct approvals and
147
+ * ERC-2612 name BlueBundlesV1 as spender. Native
151
148
  * funding is exclusive and skips token requirements (the code check still runs).
152
149
  * The referral fee is deducted from the gross `assets` supplied. This route exposes no
153
150
  * share-price bound or `slippageTolerance`.
@@ -166,14 +163,12 @@ export interface BlueActions {
166
163
  * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
167
164
  * @throws {ExpiredDeadlineError} when the deadline is not in the future at creation or requirement resolution.
168
165
  * @throws {NonPositiveInputError} when `assets` is not positive.
169
- * @throws {NegativeInputError} when native funding or the referral fee is negative, or from `getRequirements()` when an explicit `permit2Nonce` is negative.
166
+ * @throws {NegativeInputError} when native funding or the referral fee is negative.
170
167
  * @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
171
168
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
172
169
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
173
- * @throws {InputExceedsMaxError} when `assets` or `deadline` exceeds `uint256`, when the referral fee is at least WAD, or from `getRequirements()` when an explicit `permit2Nonce` exceeds `uint256`.
170
+ * @throws {InputExceedsMaxError} when `assets` or `deadline` exceeds `uint256`, when the referral fee is at least WAD.
174
171
  * @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
175
- * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
176
- * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
177
172
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
178
173
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when the route cannot consume a supplied signature.
179
174
  * @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
@@ -500,8 +495,6 @@ export interface BlueActions {
500
495
  * @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
501
496
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
502
497
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
503
- * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
504
- * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
505
498
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
506
499
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an authorization signature is supplied.
507
500
  * @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
@@ -675,8 +668,6 @@ export interface BlueActions {
675
668
  * @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
676
669
  * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
677
670
  * @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
678
- * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
679
- * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
680
671
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple signatures of one kind are supplied.
681
672
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an inactive leg cannot consume a supplied signature.
682
673
  * @throws {DepositOwnerMismatchError} from `buildTx()` when a signed owner differs from `userAddress`.
@@ -782,8 +773,6 @@ export interface BlueActions {
782
773
  * @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
783
774
  * @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
784
775
  * @throws {ReallocationLoanTokenMismatchError} when a source uses another loan token.
785
- * @throws {NoUnusedPermit2NonceError} from `getRequirements()` when every Permit2 nonce for the owner is consumed and none was passed explicitly.
786
- * @throws {Permit2SignatureTransferNonceAlreadyUsedError} from `getRequirements()` when the explicit Permit2 nonce is consumed.
787
776
  * @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple signatures of one kind are supplied.
788
777
  * @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an inactive leg cannot consume a supplied signature.
789
778
  * @throws {DepositOwnerMismatchError} from `buildTx()` when a signed owner differs from `userAddress`.
@@ -1051,9 +1040,6 @@ export declare class MorphoBlue implements BlueActions {
1051
1040
  * spender/authorized operator holds code, with one `eth_getCode` per distinct address
1052
1041
  * before any other requirement read. Blue write flows probe `eth_chainId` only after a target
1053
1042
  * has no code and report a chain mismatch when the RPC serves another chain.
1054
- *
1055
- * @param params.erc20Funding - Whether the flow resolves an ERC-20 funding leg, which
1056
- * may name canonical Permit2 when signatures are supported.
1057
1043
  */
1058
1044
  private assertWriteTargets;
1059
1045
  private getMaxLtv;
@@ -58,11 +58,8 @@ export class MorphoBlue {
58
58
  * spender/authorized operator holds code, with one `eth_getCode` per distinct address
59
59
  * before any other requirement read. Blue write flows probe `eth_chainId` only after a target
60
60
  * has no code and report a chain mismatch when the RPC serves another chain.
61
- *
62
- * @param params.erc20Funding - Whether the flow resolves an ERC-20 funding leg, which
63
- * may name canonical Permit2 when signatures are supported.
64
61
  */
65
- async assertWriteTargets(params) {
62
+ async assertWriteTargets() {
66
63
  const targets = [
67
64
  {
68
65
  role: "bundles.blueBundlesV1",
@@ -70,11 +67,6 @@ export class MorphoBlue {
70
67
  },
71
68
  { role: "blue", address: getChainAddress(this.chainId, "blue") },
72
69
  ];
73
- if (params?.erc20Funding && this.client.options.supportSignature) {
74
- const permit2 = getChainAddresses(this.chainId).permit2;
75
- if (permit2 != null)
76
- targets.push({ role: "permit2", address: permit2 });
77
- }
78
70
  await assertRegistryTargetsHaveCode(this.client.viemClient, this.chainId, targets);
79
71
  }
80
72
  getMaxLtv(marketParams = this.marketParams) {
@@ -95,7 +87,6 @@ export class MorphoBlue {
95
87
  supportSignature: this.client.options.supportSignature,
96
88
  supportDeployless: this.client.options.supportDeployless,
97
89
  useSimplePermit: params.useSimplePermit,
98
- permit2Nonce: params.permit2Nonce,
99
90
  now: params.now,
100
91
  });
101
92
  }
@@ -146,9 +137,7 @@ export class MorphoBlue {
146
137
  getRequirements: (requirementsParams) => {
147
138
  const now = Time.timestamp();
148
139
  this.validateDeadline(deadline, now);
149
- return this.assertWriteTargets({
150
- erc20Funding: nativeValue === 0n,
151
- }).then(() => {
140
+ return this.assertWriteTargets().then(() => {
152
141
  if (nativeValue > 0n)
153
142
  return [];
154
143
  return this.getTokenRequirements({
@@ -158,7 +147,6 @@ export class MorphoBlue {
158
147
  deadline,
159
148
  now,
160
149
  useSimplePermit: requirementsParams?.useSimplePermit,
161
- permit2Nonce: requirementsParams?.permit2Nonce,
162
150
  });
163
151
  });
164
152
  },
@@ -572,9 +560,7 @@ export class MorphoBlue {
572
560
  getRequirements: async (requirementsParams) => {
573
561
  const now = Time.timestamp();
574
562
  this.validateDeadline(deadline, now);
575
- await this.assertWriteTargets({
576
- erc20Funding: hasRepay && nativeValue === 0n,
577
- });
563
+ await this.assertWriteTargets();
578
564
  const [tokenRequirements, authorizationRequirements] = await Promise.all([
579
565
  hasRepay && nativeValue === 0n
580
566
  ? this.getTokenRequirements({
@@ -584,7 +570,6 @@ export class MorphoBlue {
584
570
  deadline,
585
571
  now,
586
572
  useSimplePermit: requirementsParams?.useSimplePermit,
587
- permit2Nonce: requirementsParams?.permit2Nonce,
588
573
  })
589
574
  : Promise.resolve([]),
590
575
  collateralAssets > 0n
@@ -683,9 +668,7 @@ export class MorphoBlue {
683
668
  getRequirements: async (requirementsParams) => {
684
669
  const now = Time.timestamp();
685
670
  this.validateDeadline(deadline, now);
686
- await this.assertWriteTargets({
687
- erc20Funding: collateralAssets > 0n && nativeValue === 0n,
688
- });
671
+ await this.assertWriteTargets();
689
672
  const [tokenRequirements, authorizationRequirements] = await Promise.all([
690
673
  collateralAssets > 0n && nativeValue === 0n
691
674
  ? this.getTokenRequirements({
@@ -695,7 +678,6 @@ export class MorphoBlue {
695
678
  deadline,
696
679
  now,
697
680
  useSimplePermit: requirementsParams?.useSimplePermit,
698
- permit2Nonce: requirementsParams?.permit2Nonce,
699
681
  })
700
682
  : Promise.resolve([]),
701
683
  borrowAssets > 0n
@@ -1,13 +1,13 @@
1
- export type { IAccrualPosition as IBlueAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket as IBlueMarket, IMarketParams as IBlueMarketParams, IPosition as IBluePosition,
1
+ export type { IAccrualPosition as IBlueAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MidnightAdapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket as IBlueMarket, IMarketParams as IBlueMarketParams, IPosition as IBluePosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  IPreLiquidationParams as IBluePreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- IPreLiquidationPosition as IBluePreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
6
- export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
5
+ IPreLiquidationPosition as IBluePreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MidnightAdapter, IVaultV2MidnightAdapterAccrualMarket, IVaultV2MidnightAdapterCollateralParams, IVaultV2MidnightAdapterMarket, IVaultV2MidnightAdapterMarketData, IVaultV2MidnightAdapterMarketState, IVaultV2MidnightAdapterPosition, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, VaultV2MidnightAdapterAccrualMarket, VaultV2MidnightAdapterMarketData, } from "@morpho-org/blue-sdk";
6
+ export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MidnightAdapter, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
7
7
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
8
8
  PreLiquidationParams as BluePreLiquidationParams,
9
9
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
10
- PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
10
+ PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MidnightAdapter, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
11
11
  export type { AnyTree as MidnightAnyTree, AnyTreeSnapshot as MidnightAnyTreeSnapshot, BuildOfferParams as MidnightBuildOfferParams, CollateralParams as MidnightCollateralParams, EcrecoverTreeCreateRequest as MidnightEcrecoverTreeCreateRequest, GroupInput as MidnightGroupInput, IAccrualPosition as IMidnightAccrualPosition, ICollateralParams as IMidnightCollateralParams, IGroup as IMidnightGroup, IMarket as IMidnightMarket, IMarketParams as IMidnightMarketParams, IOffer as IMidnightOffer, IPosition as IMidnightPosition, MarketInput as MidnightMarketInput, OfferStruct as MidnightOfferStruct, PriceRatifierV1TreeCreateRequest as MidnightPriceRatifierV1TreeCreateRequest, RateRatifierV1TreeCreateRequest as MidnightRateRatifierV1TreeCreateRequest, RatifierKind as MidnightRatifierKind, RatifierTreeInput as MidnightRatifierTreeInput, RatifierTypes as MidnightRatifierTypes, SetterTreeCreateRequest as MidnightSetterTreeCreateRequest, SettlementFeeCbps as MidnightSettlementFeeCbps, TreeCreateParams as MidnightTreeCreateParams, TreeCreateRequest as MidnightTreeCreateRequest, TreeData as MidnightTreeData, TreeDescriptor as MidnightTreeDescriptor, TreeEntry as MidnightTreeEntry, TreeInput as MidnightTreeInput, TreeLike as MidnightTreeLike, TreeMempoolValidateParams as MidnightTreeMempoolValidateParams, TreeMempoolValidateRatification as MidnightTreeMempoolValidateRatification, TreeProof as MidnightTreeProof, TreeSnapshot as MidnightTreeSnapshot, TypedRatifierTreeInput as MidnightTypedRatifierTreeInput, TypedTreeMempoolValidateParams as MidnightTypedTreeMempoolValidateParams, } from "@morpho-org/midnight-sdk";
12
12
  export { AccrualPosition as MidnightAccrualPosition, Group as MidnightGroup, Market as MidnightMarket, MarketParams as MidnightMarketParams, Offer as MidnightOffer, Position as MidnightPosition, Tree as MidnightTree, } from "@morpho-org/midnight-sdk";
13
13
  export type { BlueActions, BlueTokenRequirementsParams, } from "./blue/index.js";
@@ -1,8 +1,8 @@
1
- export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
1
+ export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MidnightAdapter, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market as BlueMarket, MarketParams as BlueMarketParams, Position as BluePosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  PreLiquidationParams as BluePreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
5
+ PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MidnightAdapter, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
6
6
  export { AccrualPosition as MidnightAccrualPosition, Group as MidnightGroup, Market as MidnightMarket, MarketParams as MidnightMarketParams, Offer as MidnightOffer, Position as MidnightPosition, Tree as MidnightTree, } from "@morpho-org/midnight-sdk";
7
7
  export { MorphoBlue } from "./blue/index.js";
8
8
  export { MorphoMidnight, } from "./midnight/index.js";
@@ -18,22 +18,19 @@ export interface GetBundlesTokenRequirementsParams {
18
18
  readonly supportSignature: boolean;
19
19
  /** Whether token metadata reads may use deployless aggregation. */
20
20
  readonly supportDeployless?: boolean;
21
- /** Prefer ERC-2612 when the token exposes a compatible nonce. */
21
+ /** Prefer ERC-2612 when the token exposes a compatible nonce; defaults to true when signatures are supported. */
22
22
  readonly useSimplePermit?: boolean;
23
- /** Explicit unused uint256 nonce; defaults to the lowest unused nonce found via getUnusedPermit2Nonce. */
23
+ /** @deprecated Ignored. The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals. */
24
24
  readonly permit2Nonce?: bigint;
25
25
  /** Timestamp the deadline is validated against; defaults to the current time. */
26
26
  readonly now?: bigint;
27
27
  }
28
28
  /**
29
- * Resolves direct approval, ERC-2612, or Permit2 SignatureTransfer prerequisites for
30
- * a registered fixed bundles contract.
29
+ * Resolves direct approval or ERC-2612 prerequisites for a registered fixed bundles contract.
31
30
  *
32
- * Returns no requirements when the direct bundles allowance covers the amount, even when
33
- * signatures are supported. Otherwise reads only the state required by the selected path.
34
- * Permit2 keeps the ERC-20 allowance on canonical Permit2 while the one-time signed transfer
35
- * names the bundles contract as spender. The resolver picks the lowest unused unordered nonce
36
- * by default; concurrent flows for the same owner should pass explicit nonces.
31
+ * Reads the direct allowance first for nonzero amounts. Only when it is insufficient does
32
+ * the selected signature path try ERC-2612 nonce and metadata reads. A permit is returned only
33
+ * when the token's DOMAIN_SEPARATOR matches the domain to be signed; otherwise use approval.
37
34
  *
38
35
  * @param viemClient - Connected viem client used for allowance and nonce reads.
39
36
  * @param params - Token requirement parameters.
@@ -44,37 +41,35 @@ export interface GetBundlesTokenRequirementsParams {
44
41
  * @param params.chainId - Target chain id; must match the client chain.
45
42
  * @param params.deadline - Final-call and signature deadline.
46
43
  * @param params.now - Timestamp the deadline is validated against; defaults to the current time.
47
- * @param params.supportSignature - Whether ERC-2612 or Permit2 signatures may be requested.
44
+ * @param params.supportSignature - Whether ERC-2612 signatures may be requested.
48
45
  * @param params.supportDeployless - Whether ERC-2612 metadata reads may use deployless calls.
49
- * @param params.useSimplePermit - Prefer ERC-2612 when `nonces()` succeeds and the token's permit
50
- * domain is known; a recognized `nonces()` revert or undecodable result, or a missing domain
51
- * (no `name()` and no EIP-5267 domain), falls back to Permit2 or classic approval. A malformed
46
+ * @param params.useSimplePermit - Defaults to true when signatures are supported. Prefer ERC-2612 when `nonces()` succeeds and the token's
47
+ * DOMAIN_SEPARATOR matches the signing domain. Missing, mismatched, or unsupported domains,
48
+ * or recognized nonce/separator reverts or undecodable results, fall back to classic approval. A malformed
52
49
  * `eip712Domain()` result rejects with `MalformedTokenMetadataError`.
53
- * @param params.permit2Nonce - Explicit unused uint256 nonce; defaults to the lowest unused nonce
54
- * found via {@link getUnusedPermit2Nonce}.
55
- * @returns Ordered deep-frozen approval transactions and/or signable token requirements.
50
+ * @param params.permit2Nonce - Deprecated and ignored.
51
+ * @returns Ordered deep-frozen approval transactions and/or signable token requirements;
52
+ * empty when the direct allowance already covers the amount, without probing permit support.
56
53
  * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId`,
57
54
  * another chain than `params.chainId`.
58
- * @throws {NegativeInputError} when `amount` or `permit2Nonce` is negative.
55
+ * @throws {NegativeInputError} when `amount` is negative.
59
56
  * @throws {NonPositiveInputError} when `deadline` is not positive.
60
57
  * @throws {ExpiredDeadlineError} when `deadline` is positive but not in the future.
61
58
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
62
59
  * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not the chain's registered
63
60
  * BlueBundlesV1 or VaultBundlesV1 deployment, including for a zero-amount request.
64
- * @throws {NoUnusedPermit2NonceError} when every Permit2 nonce for the owner is consumed and none
65
- * was passed explicitly.
66
- * @throws {Permit2SignatureTransferNonceAlreadyUsedError} when `permit2Nonce` is already consumed.
67
- * @throws {InputExceedsMaxError} when `amount`, `deadline`, or `permit2Nonce` exceeds uint256.
61
+ * @throws {InputExceedsMaxError} when `amount` or `deadline` exceeds uint256.
68
62
  * @throws {UnknownTokenError} when the token's `decimals()` reverts, has no code, returns
69
63
  * undecodable data, or is out of range.
70
64
  * @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
71
65
  * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
72
66
  * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
73
- * @throws {viem.BaseError} when a required allowance, Permit2 nonce-bitmap, ERC-2612 metadata,
74
- * or `eth_chainId` read fails. An ERC-2612 nonce probe falls back to Permit2 or classic approval
75
- * only when the token reverts or returns undecodable data; other read failures propagate. A
76
- * missing permit domain is handled internally and also falls back; this function does not
77
- * surface `MissingPermitDomainNameError`.
67
+ * @throws {viem.BaseError} when a required allowance, ERC-2612 metadata, DOMAIN_SEPARATOR,
68
+ * or `eth_chainId` read fails. Nonce and separator probes fall back to classic approval
69
+ * only when the token reverts or returns undecodable data; other read failures propagate.
70
+ * `MissingPermitDomainNameError`, `InvalidPermitDomainChainIdError`,
71
+ * `InvalidPermitDomainVerifyingContractError`, and `UnsupportedPermitDomainExtensionsError`
72
+ * are handled internally and fall back to approval.
78
73
  * @example
79
74
  * ```ts
80
75
  * import { addressesRegistry } from "@morpho-org/blue-sdk";