@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION-v5-to-v6.md +199 -34
- package/README.md +23 -15
- package/lib/cjs/abis.d.ts +3 -2829
- package/lib/cjs/abis.js +1 -1938
- package/lib/cjs/actions/blue/borrow.d.ts +3 -2
- package/lib/cjs/actions/blue/borrow.js +3 -2
- package/lib/cjs/actions/blue/common.js +6 -35
- package/lib/cjs/actions/blue/refinance.d.ts +2 -2
- package/lib/cjs/actions/blue/refinance.js +2 -2
- package/lib/cjs/actions/blue/repay.d.ts +1 -1
- package/lib/cjs/actions/blue/repay.js +1 -1
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/cjs/actions/blue/supply.d.ts +2 -2
- package/lib/cjs/actions/blue/supply.js +4 -9
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
- package/lib/cjs/actions/blue/withdraw.js +3 -3
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
- package/lib/cjs/actions/bundles/common.d.ts +38 -4
- package/lib/cjs/actions/bundles/common.js +91 -35
- package/lib/cjs/actions/index.d.ts +0 -1
- package/lib/cjs/actions/index.js +0 -1
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +17 -26
- package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/blue/index.js +0 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +24 -25
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -38
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/encode/index.js +0 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/cjs/actions/requirements/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/index.js +0 -1
- package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV1/deposit.js +1 -2
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV2/deposit.js +1 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/cjs/augment.d.ts +0 -1
- package/lib/cjs/augment.js +0 -1
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +1 -5
- package/lib/cjs/blue/entities.d.ts +2 -2
- package/lib/cjs/blue/entities.js +1 -2
- package/lib/cjs/blue/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +2 -1
- package/lib/cjs/blue/fetch.d.ts +1 -1
- package/lib/cjs/blue/fetch.js +1 -2
- package/lib/cjs/blue/types.d.ts +2 -4
- package/lib/cjs/blue/utils.d.ts +1 -3
- package/lib/cjs/blue/utils.js +1 -3
- package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
- package/lib/cjs/client/morphoViemExtension.js +1 -1
- package/lib/cjs/constants.d.ts +3 -37
- package/lib/cjs/constants.js +1 -39
- package/lib/cjs/entities/blue/blue.d.ts +38 -264
- package/lib/cjs/entities/blue/blue.js +2 -203
- package/lib/cjs/entities/index.d.ts +3 -60
- package/lib/cjs/entities/index.js +1 -20
- package/lib/cjs/entities/midnight/midnight.js +20 -24
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +19 -14
- package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +1 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +18 -6
- package/lib/cjs/entities/vaultV1/vaultV1.js +25 -8
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/cjs/entities/vaultV2/vaultV2.js +249 -23
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +50 -34
- package/lib/cjs/errors.d.ts +2 -46
- package/lib/cjs/errors.js +2 -46
- package/lib/cjs/fetch.d.ts +1 -15
- package/lib/cjs/fetch.js +1 -16
- package/lib/cjs/helpers/constant.d.ts +0 -2
- package/lib/cjs/helpers/constant.js +0 -2
- package/lib/cjs/helpers/index.d.ts +4 -3
- package/lib/cjs/helpers/index.js +10 -9
- package/lib/cjs/helpers/metadata.d.ts +3 -5
- package/lib/cjs/helpers/metadata.js +4 -6
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/cjs/helpers/slippage.d.ts +34 -90
- package/lib/cjs/helpers/slippage.js +52 -137
- package/lib/cjs/helpers/utilization.d.ts +12 -10
- package/lib/cjs/helpers/utilization.js +27 -12
- package/lib/cjs/helpers/validate.d.ts +66 -32
- package/lib/cjs/helpers/validate.js +84 -57
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
- package/lib/cjs/types/action.d.ts +102 -68
- package/lib/cjs/types/action.js +11 -4
- package/lib/cjs/types/error.d.ts +332 -385
- package/lib/cjs/types/error.js +369 -412
- package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
- package/lib/cjs/types.d.ts +2 -18
- package/lib/cjs/utils.d.ts +8 -35
- package/lib/cjs/utils.js +11 -36
- package/lib/esm/abis.d.ts +3 -2829
- package/lib/esm/abis.js +3 -1935
- package/lib/esm/actions/blue/borrow.d.ts +3 -2
- package/lib/esm/actions/blue/borrow.js +3 -2
- package/lib/esm/actions/blue/common.js +8 -37
- package/lib/esm/actions/blue/refinance.d.ts +2 -2
- package/lib/esm/actions/blue/refinance.js +2 -2
- package/lib/esm/actions/blue/repay.d.ts +1 -1
- package/lib/esm/actions/blue/repay.js +1 -1
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/esm/actions/blue/supply.d.ts +2 -2
- package/lib/esm/actions/blue/supply.js +6 -11
- package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/supplyCollateral.js +2 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/esm/actions/blue/withdraw.d.ts +3 -3
- package/lib/esm/actions/blue/withdraw.js +3 -3
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
- package/lib/esm/actions/bundles/common.d.ts +38 -4
- package/lib/esm/actions/bundles/common.js +91 -36
- package/lib/esm/actions/index.d.ts +0 -1
- package/lib/esm/actions/index.js +0 -1
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +20 -29
- package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
- package/lib/esm/actions/requirements/blue/index.js +0 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +25 -26
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -39
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
- package/lib/esm/actions/requirements/encode/index.js +0 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/esm/actions/requirements/index.d.ts +0 -1
- package/lib/esm/actions/requirements/index.js +0 -1
- package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV1/deposit.js +1 -2
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV2/deposit.js +1 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/esm/augment.d.ts +0 -1
- package/lib/esm/augment.js +0 -1
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/entities.d.ts +2 -2
- package/lib/esm/blue/entities.js +1 -1
- package/lib/esm/blue/errors.d.ts +1 -1
- package/lib/esm/blue/errors.js +1 -1
- package/lib/esm/blue/fetch.d.ts +1 -1
- package/lib/esm/blue/fetch.js +1 -1
- package/lib/esm/blue/types.d.ts +2 -4
- package/lib/esm/blue/utils.d.ts +1 -3
- package/lib/esm/blue/utils.js +1 -3
- package/lib/esm/client/morphoViemExtension.d.ts +1 -1
- package/lib/esm/client/morphoViemExtension.js +1 -1
- package/lib/esm/constants.d.ts +3 -37
- package/lib/esm/constants.js +3 -37
- package/lib/esm/entities/blue/blue.d.ts +38 -264
- package/lib/esm/entities/blue/blue.js +5 -206
- package/lib/esm/entities/index.d.ts +3 -60
- package/lib/esm/entities/index.js +1 -16
- package/lib/esm/entities/midnight/midnight.js +20 -24
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +20 -15
- package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/esm/entities/requirements/index.d.ts +1 -0
- package/lib/esm/entities/requirements/index.js +1 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +18 -6
- package/lib/esm/entities/vaultV1/vaultV1.js +29 -12
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/esm/entities/vaultV2/vaultV2.js +256 -30
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.js +48 -32
- package/lib/esm/errors.d.ts +2 -46
- package/lib/esm/errors.js +2 -46
- package/lib/esm/fetch.d.ts +1 -15
- package/lib/esm/fetch.js +1 -15
- package/lib/esm/helpers/constant.d.ts +0 -2
- package/lib/esm/helpers/constant.js +0 -2
- package/lib/esm/helpers/index.d.ts +4 -3
- package/lib/esm/helpers/index.js +4 -3
- package/lib/esm/helpers/metadata.d.ts +3 -5
- package/lib/esm/helpers/metadata.js +4 -6
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/esm/helpers/slippage.d.ts +34 -90
- package/lib/esm/helpers/slippage.js +52 -134
- package/lib/esm/helpers/utilization.d.ts +12 -10
- package/lib/esm/helpers/utilization.js +26 -11
- package/lib/esm/helpers/validate.d.ts +66 -32
- package/lib/esm/helpers/validate.js +83 -57
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +1 -3
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
- package/lib/esm/types/action.d.ts +102 -68
- package/lib/esm/types/action.js +12 -5
- package/lib/esm/types/error.d.ts +332 -385
- package/lib/esm/types/error.js +355 -392
- package/lib/esm/types/sharedLiquidity.d.ts +1 -117
- package/lib/esm/types.d.ts +2 -18
- package/lib/esm/utils.d.ts +8 -35
- package/lib/esm/utils.js +7 -34
- package/package.json +7 -15
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -83
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -151
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -50
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
- package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -43
- package/lib/cjs/actions/signatures/index.d.ts +0 -3
- package/lib/cjs/actions/signatures/index.js +0 -19
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
- package/lib/cjs/bundler/actions.d.ts +0 -797
- package/lib/cjs/bundler/actions.js +0 -1371
- package/lib/cjs/bundler/index.d.ts +0 -2
- package/lib/cjs/bundler/index.js +0 -18
- package/lib/cjs/bundler/types.d.ts +0 -235
- package/lib/cjs/bundler/types.js +0 -2
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/cjs/entities/vaultV1ReallocationData.js +0 -542
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -243
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -79
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -147
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -46
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
- package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -39
- package/lib/esm/actions/signatures/index.d.ts +0 -3
- package/lib/esm/actions/signatures/index.js +0 -3
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -5
- package/lib/esm/bundler/actions.d.ts +0 -797
- package/lib/esm/bundler/actions.js +0 -1368
- package/lib/esm/bundler/index.d.ts +0 -2
- package/lib/esm/bundler/index.js +0 -2
- package/lib/esm/bundler/types.d.ts +0 -235
- package/lib/esm/bundler/types.js +0 -1
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/esm/entities/vaultV1ReallocationData.js +0 -544
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -239
- /package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
- /package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { InputMarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
-
import type { Address, Hex, WalletClient } from "viem";
|
|
2
|
+
import type { Address, Hex, TypedDataDefinition, WalletClient } from "viem";
|
|
3
3
|
import type { Deallocation } from "./deallocation.js";
|
|
4
|
+
/**
|
|
5
|
+
* Serves as the common discriminated action-metadata base shared by both
|
|
6
|
+
* {@link TransactionAction} (actions that carry encoded calldata) and
|
|
7
|
+
* {@link SignatureRequirementAction} (signature requirements whose metadata is
|
|
8
|
+
* exposed before any calldata exists). Each concrete action narrows
|
|
9
|
+
* {@link BaseAction} on its literal `type` tag and carries an
|
|
10
|
+
* operation-specific `args` record surfaced for tracing.
|
|
11
|
+
*
|
|
12
|
+
* @typeParam TType - Literal discriminator identifying the action.
|
|
13
|
+
* @typeParam TArgs - The action's argument record.
|
|
14
|
+
*/
|
|
4
15
|
export interface BaseAction<TType extends string = string, TArgs extends Record<string, unknown> = Record<string, unknown>> {
|
|
5
16
|
readonly type: TType;
|
|
6
17
|
readonly args: TArgs;
|
|
@@ -77,14 +88,22 @@ export interface VaultV2InKindRedeemAction extends BaseAction<"vaultV2InKindRede
|
|
|
77
88
|
readonly deadline: bigint;
|
|
78
89
|
}> {
|
|
79
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Metadata for a Vault V2 force withdrawal through VaultExitBundlesV1.
|
|
93
|
+
*
|
|
94
|
+
* `exitAssets` is penalty-inclusive: the assets actually delivered are
|
|
95
|
+
* `assetsToWithdraw + floor((exitAssets - assetsToWithdraw) * WAD / (WAD + penalty))`, minus the
|
|
96
|
+
* referral fee.
|
|
97
|
+
*/
|
|
80
98
|
export interface VaultV2ForceWithdrawAction extends BaseAction<"vaultV2ForceWithdraw", {
|
|
81
|
-
vault: Address;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
onBehalf: Address;
|
|
99
|
+
readonly vault: Address;
|
|
100
|
+
readonly adapter: Address;
|
|
101
|
+
readonly exitAssets: bigint;
|
|
102
|
+
readonly minSharePriceE27: bigint;
|
|
103
|
+
readonly referralFeePct: bigint;
|
|
104
|
+
readonly referralFeeRecipient: Address;
|
|
105
|
+
readonly onBehalf: Address;
|
|
106
|
+
readonly deadline: bigint;
|
|
88
107
|
}> {
|
|
89
108
|
}
|
|
90
109
|
export interface VaultV2ForceRedeemAction extends BaseAction<"vaultV2ForceRedeem", {
|
|
@@ -379,28 +398,25 @@ export interface MidnightCancelOfferAction extends BaseAction<"midnightCancelOff
|
|
|
379
398
|
readonly onBehalf: Address;
|
|
380
399
|
}> {
|
|
381
400
|
}
|
|
382
|
-
/**
|
|
401
|
+
/**
|
|
402
|
+
* Enumerates every action a {@link Transaction} can describe across the VaultV1,
|
|
403
|
+
* VaultV2, Blue, and Midnight flows. The `type` tag discriminates the union so
|
|
404
|
+
* consumers can `switch` exhaustively on it.
|
|
405
|
+
*/
|
|
383
406
|
export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2InKindRedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1InKindRedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueWithdrawAction | BlueRefinanceAction | BlueAuthorizationAction | MidnightAuthorizationAction | SetterRatifierRatifyRootAction | MidnightTakeLendAction | MidnightTakeBorrowAction | MidnightSupplyCollateralTakeBorrowAction | MidnightSupplyCollateralAction | MempoolSubmitOffersAction | MidnightRedeemAction | MidnightRepayWithdrawCollateralAction | MidnightCancelOfferAction;
|
|
407
|
+
/**
|
|
408
|
+
* Describes a single, immutable, deep-frozen transaction to submit on-chain:
|
|
409
|
+
* the target `to`, native `value`, encoded call `data`, and the originating
|
|
410
|
+
* {@link BaseAction} for tracing. Every action builder returns one.
|
|
411
|
+
*
|
|
412
|
+
* @typeParam TAction - The action that produced this transaction.
|
|
413
|
+
*/
|
|
384
414
|
export interface Transaction<TAction extends BaseAction = TransactionAction> {
|
|
385
415
|
readonly to: Address;
|
|
386
416
|
readonly value: bigint;
|
|
387
417
|
readonly data: Hex;
|
|
388
418
|
readonly action: TAction;
|
|
389
419
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Enforces that at least one deposit amount source is provided.
|
|
392
|
-
*
|
|
393
|
-
* - `amount` alone: standard ERC20 deposit.
|
|
394
|
-
* - `nativeAmount` alone: pure native-wrap deposit (vault asset must be wNative).
|
|
395
|
-
* - Both: mixed deposit (ERC20 transfer + native wrap).
|
|
396
|
-
*/
|
|
397
|
-
export type DepositAmountArgs = {
|
|
398
|
-
amount: bigint;
|
|
399
|
-
nativeAmount?: bigint;
|
|
400
|
-
} | {
|
|
401
|
-
nativeAmount: bigint;
|
|
402
|
-
amount?: bigint;
|
|
403
|
-
};
|
|
404
420
|
/** Mutually exclusive ERC-20 or native funding accepted by fixed bundles entrypoints. */
|
|
405
421
|
export type BundlesFundingArgs = {
|
|
406
422
|
readonly amount: bigint;
|
|
@@ -413,7 +429,7 @@ export type BundlesFundingArgs = {
|
|
|
413
429
|
export interface BundlesTokenRequirementsOptions {
|
|
414
430
|
/** Prefer ERC-2612 when the funded token exposes a compatible nonce. */
|
|
415
431
|
readonly useSimplePermit?: boolean;
|
|
416
|
-
/** Explicit unused Permit2 SignatureTransfer unordered nonce. */
|
|
432
|
+
/** Explicit unused Permit2 SignatureTransfer unordered nonce; defaults to the lowest unused nonce. */
|
|
417
433
|
readonly permit2Nonce?: bigint;
|
|
418
434
|
}
|
|
419
435
|
/** Mutually exclusive source amount accepted by a Vault V1 to Vault V2 migration. */
|
|
@@ -424,6 +440,12 @@ export type VaultV1MigrateToV2AmountArgs = {
|
|
|
424
440
|
readonly assets: bigint;
|
|
425
441
|
readonly shares?: never;
|
|
426
442
|
};
|
|
443
|
+
/**
|
|
444
|
+
* Holds the pre-resolved arguments for an ERC-2612 `permit`: the signed approval
|
|
445
|
+
* of `amount` of `asset` from `owner` to the permitted spender, bounded by the
|
|
446
|
+
* `deadline` timestamp and consuming the given `nonce`. The associated
|
|
447
|
+
* {@link PermitAction} identifies the permitted fixed-bundle contract.
|
|
448
|
+
*/
|
|
427
449
|
export interface PermitArgs {
|
|
428
450
|
readonly owner: Address;
|
|
429
451
|
readonly nonce: bigint;
|
|
@@ -432,19 +454,10 @@ export interface PermitArgs {
|
|
|
432
454
|
readonly amount: bigint;
|
|
433
455
|
readonly deadline: bigint;
|
|
434
456
|
}
|
|
435
|
-
export interface Permit2Args {
|
|
436
|
-
readonly owner: Address;
|
|
437
|
-
readonly nonce: bigint;
|
|
438
|
-
readonly asset: Address;
|
|
439
|
-
readonly signature: Hex;
|
|
440
|
-
readonly amount: bigint;
|
|
441
|
-
readonly deadline: bigint;
|
|
442
|
-
readonly expiration: bigint;
|
|
443
|
-
}
|
|
444
457
|
/**
|
|
445
458
|
* Signed Morpho Blue authorization payload produced when an integrator opts into offchain
|
|
446
|
-
* signatures (`supportSignature: true`).
|
|
447
|
-
*
|
|
459
|
+
* signatures (`supportSignature: true`). BlueBundlesV1 encodes it into its
|
|
460
|
+
* signed-authorization struct.
|
|
448
461
|
*/
|
|
449
462
|
export interface AuthorizationSignatureArgs {
|
|
450
463
|
/** Account granting the authorization (the position owner). */
|
|
@@ -467,6 +480,8 @@ export interface MidnightOfferRootSignatureArgs {
|
|
|
467
480
|
readonly signature: Hex;
|
|
468
481
|
readonly payload: Hex;
|
|
469
482
|
}
|
|
483
|
+
/** EIP-712 payload carried by a signable requirement action. */
|
|
484
|
+
export type RequirementTypedData = TypedDataDefinition<Record<string, unknown>, string>;
|
|
470
485
|
export interface PermitAction extends BaseAction<"permit", {
|
|
471
486
|
readonly spender: Address;
|
|
472
487
|
readonly amount: bigint;
|
|
@@ -474,13 +489,13 @@ export interface PermitAction extends BaseAction<"permit", {
|
|
|
474
489
|
/** Permit nonce captured by a prepared requirement, when available. */
|
|
475
490
|
readonly nonce?: bigint;
|
|
476
491
|
}> {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
492
|
+
/**
|
|
493
|
+
* EIP-712 payload `sign()` signs for this permit, exposed so it can be inspected or displayed
|
|
494
|
+
* before signing. Required on {@link Requirement.action}; optional here only so hand-built action
|
|
495
|
+
* metadata (e.g. test fixtures) need not supply it. The payload is deep-frozen and `sign()` signs
|
|
496
|
+
* this exact payload.
|
|
497
|
+
*/
|
|
498
|
+
readonly typedData?: RequirementTypedData;
|
|
484
499
|
}
|
|
485
500
|
/** Signable Permit2 SignatureTransfer requirement for a fixed bundles token pull. */
|
|
486
501
|
export interface Permit2SignatureTransferAction extends BaseAction<"permit2SignatureTransfer", {
|
|
@@ -489,16 +504,19 @@ export interface Permit2SignatureTransferAction extends BaseAction<"permit2Signa
|
|
|
489
504
|
readonly nonce: bigint;
|
|
490
505
|
readonly deadline: bigint;
|
|
491
506
|
}> {
|
|
507
|
+
/** EIP-712 payload to sign for this Permit2 SignatureTransfer. See {@link PermitAction.typedData}. */
|
|
508
|
+
readonly typedData?: RequirementTypedData;
|
|
492
509
|
}
|
|
493
510
|
/**
|
|
494
|
-
* Signable Morpho authorization requirement
|
|
495
|
-
* GeneralAdapter1 for Bundler3 flows or BlueBundlesV1 for direct Blue writes.
|
|
511
|
+
* Signable Morpho authorization requirement for direct BlueBundlesV1 writes.
|
|
496
512
|
*/
|
|
497
513
|
export interface AuthorizationAction extends BaseAction<"authorization", {
|
|
498
514
|
authorized: Address;
|
|
499
515
|
isAuthorized: boolean;
|
|
500
516
|
deadline: bigint;
|
|
501
517
|
}> {
|
|
518
|
+
/** EIP-712 payload to sign for this Morpho authorization. See {@link PermitAction.typedData}. */
|
|
519
|
+
readonly typedData?: RequirementTypedData;
|
|
502
520
|
}
|
|
503
521
|
/** Metadata for a Midnight offer-root signature request. */
|
|
504
522
|
export interface MidnightOfferRootSignatureAction extends BaseAction<"midnightOfferRootSignature", {
|
|
@@ -506,29 +524,33 @@ export interface MidnightOfferRootSignatureAction extends BaseAction<"midnightOf
|
|
|
506
524
|
readonly ratifier: Address;
|
|
507
525
|
readonly offers: number;
|
|
508
526
|
}> {
|
|
527
|
+
/**
|
|
528
|
+
* EIP-712 offer-tree payload `sign()` signs for this Midnight ratification, exposed so it can be
|
|
529
|
+
* inspected or displayed before signing. See {@link PermitAction.typedData}.
|
|
530
|
+
*
|
|
531
|
+
* A bare signature over this payload is not enough to build the submit-offers transaction:
|
|
532
|
+
* `sign()` also derives the ratification payload (`MidnightOfferRootSignature.args.payload`) that
|
|
533
|
+
* `buildTx()` submits to the mempool.
|
|
534
|
+
*/
|
|
535
|
+
readonly typedData?: RequirementTypedData;
|
|
509
536
|
}
|
|
510
537
|
/** Action metadata supported by signature requirements. */
|
|
511
|
-
export type SignatureRequirementAction = PermitAction |
|
|
538
|
+
export type SignatureRequirementAction = PermitAction | Permit2SignatureTransferAction | AuthorizationAction | MidnightOfferRootSignatureAction;
|
|
512
539
|
/** Argument payloads returned by signature requirements. */
|
|
513
|
-
export type RequirementSignatureArgs = PermitArgs |
|
|
540
|
+
export type RequirementSignatureArgs = PermitArgs | AuthorizationSignatureArgs | MidnightOfferRootSignatureArgs;
|
|
514
541
|
/** A signed ERC-2612 permit requirement. */
|
|
515
542
|
export interface Erc2612RequirementSignature {
|
|
516
543
|
readonly args: Readonly<PermitArgs>;
|
|
517
544
|
readonly action: PermitAction;
|
|
518
545
|
}
|
|
519
|
-
/** A signed
|
|
520
|
-
export
|
|
521
|
-
readonly args: Readonly<Permit2Args>;
|
|
522
|
-
readonly action: Permit2Action;
|
|
523
|
-
}
|
|
524
|
-
/** A signed ERC-2612 permit or Permit2 AllowanceTransfer requirement. */
|
|
525
|
-
export type PermitRequirementSignature = Erc2612RequirementSignature | Permit2AllowanceRequirementSignature;
|
|
546
|
+
/** A signed ERC-2612 permit requirement accepted by vault-share bundle calls. */
|
|
547
|
+
export type PermitRequirementSignature = Erc2612RequirementSignature;
|
|
526
548
|
/** A signed Permit2 SignatureTransfer requirement used by fixed bundles contracts. */
|
|
527
549
|
export interface Permit2SignatureTransferRequirementSignature {
|
|
528
550
|
readonly args: Readonly<PermitArgs>;
|
|
529
551
|
readonly action: Permit2SignatureTransferAction;
|
|
530
552
|
}
|
|
531
|
-
/** A signed Morpho authorization consumed by
|
|
553
|
+
/** A signed Morpho authorization consumed by a direct BlueBundlesV1 call. */
|
|
532
554
|
export interface AuthorizationRequirementSignature {
|
|
533
555
|
readonly args: AuthorizationSignatureArgs;
|
|
534
556
|
readonly action: AuthorizationAction;
|
|
@@ -540,7 +562,7 @@ export interface MidnightOfferRootSignature {
|
|
|
540
562
|
}
|
|
541
563
|
/**
|
|
542
564
|
* The deep-frozen output of `Requirement.sign()`. Discriminated on `action.type`:
|
|
543
|
-
* `"permit"`
|
|
565
|
+
* `"permit"` carries token-approval args, `"permit2SignatureTransfer"` carries a
|
|
544
566
|
* bundles SignatureTransfer, `"authorization"` carries the signed Morpho authorization,
|
|
545
567
|
* and Midnight adds `"midnightOfferRootSignature"`.
|
|
546
568
|
*/
|
|
@@ -551,31 +573,42 @@ export type RequirementSignature<TAction extends SignatureRequirementAction | un
|
|
|
551
573
|
type RequirementResult<TSignatureOrAction extends RequirementSignature | SignatureRequirementAction, TArgs extends RequirementSignatureArgs | undefined> = TSignatureOrAction extends SignatureRequirementAction ? RequirementSignature<TSignatureOrAction, Extract<TArgs, RequirementSignatureArgs>> : Extract<TSignatureOrAction, RequirementSignature>;
|
|
552
574
|
/**
|
|
553
575
|
* A signable approval / authorization requirement. `sign()` returns the matching
|
|
554
|
-
* {@link RequirementSignature}; `action` describes the requirement without signing
|
|
576
|
+
* {@link RequirementSignature}; `action` describes the requirement without signing and carries the
|
|
577
|
+
* EIP-712 `typedData` payload so an integrator can inspect or display it before signing.
|
|
555
578
|
*
|
|
556
579
|
* Generic over the signature it produces so permit encoders narrow to
|
|
557
580
|
* {@link PermitRequirementSignature} and the authorization encoder to
|
|
558
581
|
* {@link AuthorizationRequirementSignature}; the two-parameter form is kept for
|
|
559
582
|
* Midnight action requirements that are parameterized by action and args.
|
|
583
|
+
*
|
|
584
|
+
* @example
|
|
585
|
+
* ```ts
|
|
586
|
+
* const requirement = (await output.getRequirements()).find(isRequirementSignature);
|
|
587
|
+
* if (requirement == null) return; // nothing to sign (only on-chain approvals, or none)
|
|
588
|
+
*
|
|
589
|
+
* const typedData = requirement.action.typedData; // exact EIP-712 payload `sign()` will sign
|
|
590
|
+
* const signed = await requirement.sign(walletClient, owner);
|
|
591
|
+
* const tx = output.buildTx([signed]); // Midnight outputs take the single signature instead
|
|
592
|
+
* ```
|
|
560
593
|
*/
|
|
561
594
|
export interface Requirement<TSignatureOrAction extends RequirementSignature | SignatureRequirementAction = RequirementSignature, TArgs extends RequirementSignatureArgs | undefined = undefined> {
|
|
562
|
-
|
|
563
|
-
|
|
595
|
+
/** Signs `action.typedData` with `client`, verifies the signature recovers `userAddress`, and returns the signed requirement. */
|
|
596
|
+
readonly sign: (client: WalletClient, userAddress: Address) => Promise<RequirementResult<TSignatureOrAction, TArgs>>;
|
|
597
|
+
/** Requirement metadata; `typedData` is always populated on SDK-built requirements. */
|
|
598
|
+
readonly action: RequirementResult<TSignatureOrAction, TArgs>["action"] & {
|
|
599
|
+
readonly typedData: RequirementTypedData;
|
|
600
|
+
};
|
|
564
601
|
}
|
|
565
|
-
/** Bundler3 token signature requirement. */
|
|
566
|
-
export type Bundler3TokenSignatureRequirement = Requirement<PermitRequirementSignature>;
|
|
567
602
|
/** ERC-2612 or Permit2 SignatureTransfer requirement consumed by a fixed bundles contract. */
|
|
568
603
|
export type BundlesTokenSignatureRequirement = Requirement<BundlesTokenRequirementSignature>;
|
|
569
604
|
/** Midnight Ecrecover offer-root signature requirement. */
|
|
570
605
|
export type MidnightOfferRootRequirement = Requirement<MidnightOfferRootSignatureAction, MidnightOfferRootSignatureArgs>;
|
|
571
606
|
/** Any token signature requirement supported by an SDK transaction route. */
|
|
572
|
-
export type TokenSignatureRequirement =
|
|
573
|
-
/** Bundler3 token signature result. */
|
|
574
|
-
export type Bundler3TokenRequirementSignature = PermitRequirementSignature;
|
|
607
|
+
export type TokenSignatureRequirement = BundlesTokenSignatureRequirement;
|
|
575
608
|
/** Token signature result consumed by a fixed bundles contract. */
|
|
576
609
|
export type BundlesTokenRequirementSignature = Erc2612RequirementSignature | Permit2SignatureTransferRequirementSignature;
|
|
577
610
|
/** Any token signature result supported by an SDK transaction route. */
|
|
578
|
-
export type TokenRequirementSignature =
|
|
611
|
+
export type TokenRequirementSignature = BundlesTokenRequirementSignature;
|
|
579
612
|
/** Any signature result returned by an action-output signature requirement. */
|
|
580
613
|
export type AnyRequirementSignature = TokenRequirementSignature | AuthorizationRequirementSignature | MidnightOfferRootSignature;
|
|
581
614
|
/** Any signature requirement returned by an entity action output. */
|
|
@@ -607,10 +640,10 @@ export declare function isRequirementSignature<T extends RequirementSignature =
|
|
|
607
640
|
export declare function isRequirementSignature(requirement: CallRequirement | Requirement | undefined): requirement is Requirement;
|
|
608
641
|
export declare function isRequirementSignature(requirement: ActionRequirement | undefined): requirement is SignatureRequirement;
|
|
609
642
|
/**
|
|
610
|
-
* Narrows a {@link RequirementSignature} to
|
|
643
|
+
* Narrows a {@link RequirementSignature} to an ERC-2612 permit signature.
|
|
611
644
|
*
|
|
612
645
|
* @param signature - The signed requirement to test.
|
|
613
|
-
* @returns `true` when `signature.action.type` is `"permit"
|
|
646
|
+
* @returns `true` when `signature.action.type` is `"permit"`.
|
|
614
647
|
*/
|
|
615
648
|
export declare function isPermitSignature(signature: RequirementSignature): signature is PermitRequirementSignature;
|
|
616
649
|
/**
|
|
@@ -646,7 +679,7 @@ export declare function isAuthorizationSignature(signature: RequirementSignature
|
|
|
646
679
|
export declare function isMidnightOfferRootSignature(signature: RequirementSignature): signature is MidnightOfferRootSignature;
|
|
647
680
|
/** The typed requirement-signature slots a transaction builder consumes, split from a `buildTx` array. */
|
|
648
681
|
export interface SelectedRequirementSignatures {
|
|
649
|
-
/** The single ERC-2612
|
|
682
|
+
/** The single ERC-2612 signature, when present. */
|
|
650
683
|
readonly permit?: PermitRequirementSignature;
|
|
651
684
|
/** The single Permit2 SignatureTransfer signature, when present. */
|
|
652
685
|
readonly permit2SignatureTransfer?: Permit2SignatureTransferRequirementSignature;
|
|
@@ -666,12 +699,13 @@ export interface SelectedRequirementSignatures {
|
|
|
666
699
|
*
|
|
667
700
|
* @param signatures - The signatures passed to `buildTx`.
|
|
668
701
|
* @param accepts - Which signature kinds this operation consumes.
|
|
669
|
-
* @param accepts.permit - Whether an ERC-2612
|
|
702
|
+
* @param accepts.permit - Whether an ERC-2612 signature is consumed.
|
|
670
703
|
* @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
|
|
671
704
|
* @param accepts.authorization - Whether a Morpho authorization signature is consumed.
|
|
672
705
|
* @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
|
|
673
706
|
* @returns The accepted signature in each typed slot, when present.
|
|
674
707
|
* @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
|
|
708
|
+
* @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
|
|
675
709
|
* @throws {UnexpectedRequirementSignatureError} when a signature of a kind the operation does not consume is present.
|
|
676
710
|
* @example
|
|
677
711
|
* ```ts
|
package/lib/cjs/types/action.js
CHANGED
|
@@ -42,13 +42,13 @@ function isRequirementSignature(requirement) {
|
|
|
42
42
|
typeof requirement.sign === "function");
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Narrows a {@link RequirementSignature} to
|
|
45
|
+
* Narrows a {@link RequirementSignature} to an ERC-2612 permit signature.
|
|
46
46
|
*
|
|
47
47
|
* @param signature - The signed requirement to test.
|
|
48
|
-
* @returns `true` when `signature.action.type` is `"permit"
|
|
48
|
+
* @returns `true` when `signature.action.type` is `"permit"`.
|
|
49
49
|
*/
|
|
50
50
|
function isPermitSignature(signature) {
|
|
51
|
-
return
|
|
51
|
+
return signature.action.type === "permit";
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Narrows a {@link RequirementSignature} to a Permit2 SignatureTransfer result.
|
|
@@ -98,12 +98,13 @@ function isMidnightOfferRootSignature(signature) {
|
|
|
98
98
|
*
|
|
99
99
|
* @param signatures - The signatures passed to `buildTx`.
|
|
100
100
|
* @param accepts - Which signature kinds this operation consumes.
|
|
101
|
-
* @param accepts.permit - Whether an ERC-2612
|
|
101
|
+
* @param accepts.permit - Whether an ERC-2612 signature is consumed.
|
|
102
102
|
* @param accepts.permit2SignatureTransfer - Whether a Permit2 SignatureTransfer is consumed.
|
|
103
103
|
* @param accepts.authorization - Whether a Morpho authorization signature is consumed.
|
|
104
104
|
* @param accepts.midnightOfferRoot - Whether a Midnight offer-root signature is consumed.
|
|
105
105
|
* @returns The accepted signature in each typed slot, when present.
|
|
106
106
|
* @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
|
|
107
|
+
* @throws {UnsupportedRequirementSignatureError} when a signature has an unsupported action type.
|
|
107
108
|
* @throws {UnexpectedRequirementSignatureError} when a signature of a kind the operation does not consume is present.
|
|
108
109
|
* @example
|
|
109
110
|
* ```ts
|
|
@@ -122,6 +123,12 @@ function selectRequirementSignatures(signatures, accepts) {
|
|
|
122
123
|
const permit2Transfers = signatures.filter(isPermit2SignatureTransferSignature);
|
|
123
124
|
const authorizations = signatures.filter(isAuthorizationSignature);
|
|
124
125
|
const midnightOfferRoots = signatures.filter(isMidnightOfferRootSignature);
|
|
126
|
+
const unsupported = signatures.find((signature) => !isPermitSignature(signature) &&
|
|
127
|
+
!isPermit2SignatureTransferSignature(signature) &&
|
|
128
|
+
!isAuthorizationSignature(signature) &&
|
|
129
|
+
!isMidnightOfferRootSignature(signature));
|
|
130
|
+
if (unsupported != null)
|
|
131
|
+
throw new error_js_1.UnsupportedRequirementSignatureError(unsupported.action.type);
|
|
125
132
|
if (!accepts.permit && permits.length > 0)
|
|
126
133
|
throw new error_js_1.UnexpectedRequirementSignatureError("permit");
|
|
127
134
|
if (!accepts.permit2SignatureTransfer && permit2Transfers.length > 0)
|