Skip to main content

Types

This page documents the TypeScript enums and types used in Smart Accounts Kit APIs.

Enums

CaveatType

Enum representing the caveat type.

ValueString
CaveatType.AllowedCalldata"allowedCalldata"
CaveatType.AllowedMethods"allowedMethods"
CaveatType.AllowedTargets"allowedTargets"
CaveatType.ArgsEqualityCheck"argsEqualityCheck"
CaveatType.BlockNumber"blockNumber"
CaveatType.Deployed"deployed"
CaveatType.Erc1155BalanceChange"erc1155BalanceChange"
CaveatType.Erc20BalanceChange"erc20BalanceChange"
CaveatType.Erc20PeriodTransfer"erc20PeriodTransfer"
CaveatType.Erc20Streaming"erc20Streaming"
CaveatType.Erc20TransferAmount"erc20TransferAmount"
CaveatType.Erc721BalanceChange"erc721BalanceChange"
CaveatType.Erc721Transfer"erc721Transfer"
CaveatType.ExactCalldata"exactCalldata"
CaveatType.ExactCalldataBatch"exactCalldataBatch"
CaveatType.ExactExecution"exactExecution"
CaveatType.ExactExecutionBatch"exactExecutionBatch"
CaveatType.Id"id"
CaveatType.LimitedCalls"limitedCalls"
CaveatType.MultiTokenPeriod"multiTokenPeriod"
CaveatType.NativeBalanceChange"nativeBalanceChange"
CaveatType.NativeTokenPayment"nativeTokenPayment"
CaveatType.NativeTokenPeriodTransfer"nativeTokenPeriodTransfer"
CaveatType.NativeTokenStreaming"nativeTokenStreaming"
CaveatType.NativeTokenTransferAmount"nativeTokenTransferAmount"
CaveatType.Nonce"nonce"
CaveatType.OwnershipTransfer"ownershipTransfer"
CaveatType.Redeemer"redeemer"
CaveatType.SpecificActionERC20TransferBatch"specificActionERC20TransferBatch"
CaveatType.Timestamp"timestamp"
CaveatType.ValueLte"valueLte"

ExecutionMode

Enum specifying how delegated executions are processed when redeeming delegations.

ValueDescription
ExecutionMode.SingleDefaultExecutes a single call and reverts on failure.
ExecutionMode.SingleTryExecutes a single call and silently continues on failure.
ExecutionMode.BatchDefaultExecutes a batch of calls and reverts if any call fails.
ExecutionMode.BatchTryExecutes a batch of calls and silently continues past failures.

Implementation

Enum representing the MetaMask smart account implementation type.

ValueDescription
Implementation.HybridSupports both ECDSA and WebAuthn (passkey) signers.
Implementation.MultiSigSupports multiple ECDSA signers with threshold-based signing.
Implementation.Stateless7702Uses EIP-7702 to upgrade an EOA to a smart account without deployment.

ScopeType

Enum representing delegation scope types.

ValueString
ScopeType.Erc20TransferAmount"erc20TransferAmount"
ScopeType.Erc20Streaming"erc20Streaming"
ScopeType.Erc20PeriodTransfer"erc20PeriodTransfer"
ScopeType.NativeTokenTransferAmount"nativeTokenTransferAmount"
ScopeType.NativeTokenStreaming"nativeTokenStreaming"
ScopeType.NativeTokenPeriodTransfer"nativeTokenPeriodTransfer"
ScopeType.Erc721Transfer"erc721Transfer"
ScopeType.OwnershipTransfer"ownershipTransfer"
ScopeType.FunctionCall"functionCall"

TransferWindow

Enum representing predefined time intervals in seconds for transfer period durations.

ValueSeconds
TransferWindow.Hourly3600
TransferWindow.Daily86400
TransferWindow.Weekly604800
TransferWindow.BiWeekly1209600
TransferWindow.Monthly2592000
TransferWindow.Quarterly7776000
TransferWindow.Yearly31536000

Types

AllowedCalldataBuilderConfig

Defines an expected calldata segment for a single function signature.

NameTypeRequiredDescription
startIndexnumberYesThe byte offset in the calldata (including the 4-byte selector) where the expected value starts.
valueHexYesThe expected hex-encoded calldata at that offset.

Caveat

Represents a restriction or condition applied to a delegation.

NameTypeRequiredDescription
enforcerHexYesThe contract address of the caveat enforcerCaveat enforcer A smart contract that enforces delegation rules by validating caveat conditions during redemption hooks..
termsHexYesThe terms of the caveatCaveat A restriction attached to a delegation that limits how delegated authority can be used. encoded as hex data.
argsHexYesAdditional arguments required by the caveat enforcer, encoded as hex data.

CaveatBuilderConfig

Optional configuration for createCaveatBuilder.

NameTypeRequiredDescription
allowInsecureUnrestrictedDelegationbooleanNoWhether to allow unrestricted delegations with no caveatsCaveat A restriction attached to a delegation that limits how delegated authority can be used.. The default is false.

Delegation

Represents a delegation that grants permissions from a delegatorDelegator account The account that creates and signs a delegation to grant limited authority to another account. to a delegateDelegate account The account that receives delegated authority and can redeem a delegation under its constraints..

NameTypeRequiredDescription
delegateHexYesThe address to which the delegation is being granted.
delegatorHexYesThe address that is granting the delegation.
authorityHexYesThe parent delegation hash, or ROOT_AUTHORITY for creating root delegationsRoot delegation The first delegation in a chain, where an account delegates its own authority directly..
caveatsCaveat[]YesAn array of caveats that constrain the delegation.
saltHexYesThe salt for generating the delegation hash. This helps prevent hash collisions when creating identical delegations.
signatureHexYesThe signature to validate the delegation.

ExactCalldataBuilderConfig

Defines the exact calldata the delegateDelegate account The account that receives delegated authority and can redeem a delegation under its constraints. is allowed to call.

NameTypeRequiredDescription
calldataHexYesThe exact calldata the delegate is allowed to call.

ExecutionStruct

Represents a single execution to perform on behalf of a delegatorDelegator account The account that creates and signs a delegation to grant limited authority to another account..

NameTypeRequiredDescription
targetAddressYesAddress of the contract or recipient that the call is directed to.
valuebigintYesValue of native tokens to send along with the call in wei format.
callDataHexYesEncoded function data to be executed on the target address.

GetGrantedExecutionPermissionsResult

The return type of getGrantedExecutionPermissions. An array of PermissionResponse objects.

GetSupportedExecutionPermissionsResult

The return type of getSupportedExecutionPermissions. A Record<string, SupportedPermissionInfo> keyed by permission type.

PartialSignature

Represents a single signerSigner An account that can sign transactions for a smart account.'s contribution to a multisig aggregated signature.

NameTypeRequiredDescription
signerAddressYesThe address of the signer.
signatureHexYesThe signer's signature over the user operation.
typeSignatureTypeYesThe signature type to represent signature algorithm. Only supported value is ECDSA.

PermissionResponse

Represents a granted Advanced PermissionAdvanced Permissions Fine-grained, customizable transaction capabilities that dapps can request from MetaMask extension users..

NameTypeRequiredDescription
chainIdnumberYesThe chain ID for which the permission was granted.
fromAddressYesThe account address that granted the permission.
toHexYesThe account address that received the permission.
permissionPermissionTypesYesThe granted permission details.
rulesRecord<string, unknown>[]NoThe rules applied to the permission. For example, permission expiry.
contextHexYesThe permission context (encoded delegation list) used when redeeming the permission.
dependencies{ factory: Address, factoryData: Hex }[]YesFactory dependencies for account deployment.
delegationManagerAddressYesThe address of the Delegation ManagerDelegation Manager The component that validates and redeems delegations, including signature checks and caveat enforcer hooks. contract for the permission.

RequestExecutionPermissionsReturnType

The return type of requestExecutionPermissions. An array of PermissionResponse objects.

SmartAccountsEnvironment

An object containing the contract addresses required to interact with the Delegation FrameworkDelegation Framework A set of audited smart contracts that handle smart account creation, the delegation lifecycle, and caveat enforcement. on a specific chain.

NameTypeRequiredDescription
DelegationManagerHexYesThe address of the Delegation ManagerDelegation Manager The component that validates and redeems delegations, including signature checks and caveat enforcer hooks. contract.
EntryPointHexYesThe address of the ERC-4337 EntryPoint contract.
SimpleFactoryHexYesThe address of the factory contract for deploying MetaMask Smart AccountsMetaMask smart account A smart contract account that supports programmable behavior, delegated permissions, flexible signing options, and other advanced features..
implementationsRecord<string, Hex>YesA map of MetaMask smart account implementation types to their deployed addresses.
caveatEnforcersRecord<string, Hex>YesA map of caveat enforcer types to their deployed addresses.

SupportedPermissionInfo

Describes a supported Advanced PermissionAdvanced Permissions Fine-grained, customizable transaction capabilities that dapps can request from MetaMask extension users. type. Used in GetSupportedExecutionPermissionsResult.

NameTypeRequiredDescription
chainIdsnumber[]YesThe chain IDs on which the permission type is supported.
ruleTypesstring[]YesThe rule types supported for the permission type (for example, "expiry").

ValueLteBuilderConfig

NameTypeRequiredDescription
maxValuebigintYesThe maximum native token amount the delegateDelegate account The account that receives delegated authority and can redeem a delegation under its constraints. can transfer per call.