Types
This page documents the TypeScript enums and types used in Smart Accounts Kit APIs.
Enums
CaveatType
Enum representing the caveat type.
| Value | String |
|---|---|
CaveatType.ApprovalRevocation | "approvalRevocation" |
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.
| Value | Description |
|---|---|
ExecutionMode.SingleDefault | Executes a single call and reverts on failure. |
ExecutionMode.SingleTry | Executes a single call and silently continues on failure. |
ExecutionMode.BatchDefault | Executes a batch of calls and reverts if any call fails. |
ExecutionMode.BatchTry | Executes a batch of calls and silently continues past failures. |
Implementation
Enum representing the MetaMask smart account implementation type.
| Value | Description |
|---|---|
Implementation.Hybrid | Supports both ECDSA and WebAuthn (passkey) signers. |
Implementation.MultiSig | Supports multiple ECDSA signers with threshold-based signing. |
Implementation.Stateless7702 | Uses EIP-7702 to upgrade an EOA to a smart account without deployment. |
ScopeType
Enum representing delegation scope types.
| Value | String |
|---|---|
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.
| Value | Seconds |
|---|---|
TransferWindow.Hourly | 3600 |
TransferWindow.Daily | 86400 |
TransferWindow.Weekly | 604800 |
TransferWindow.BiWeekly | 1209600 |
TransferWindow.Monthly | 2592000 |
TransferWindow.Quarterly | 7776000 |
TransferWindow.Yearly | 31536000 |
Types
AllowedCalldataBuilderConfig
Defines an expected calldata segment for a single function signature.
| Name | Type | Required | Description |
|---|---|---|---|
startIndex | number | Yes | The byte offset in the calldata (including the 4-byte selector) where the expected value starts. |
value | Hex | Yes | The expected hex-encoded calldata at that offset. |
Caveat
Represents a restriction or condition applied to a delegation.
| Name | Type | Required | Description |
|---|---|---|---|
enforcer | Hex | Yes | The contract address of the caveat enforcerCaveat enforcer A smart contract that enforces delegation rules by validating caveat conditions during redemption hooks.. |
terms | Hex | Yes | The terms of the caveatCaveat A restriction attached to a delegation that limits how delegated authority can be used. encoded as hex data. |
args | Hex | Yes | Additional arguments required by the caveat enforcer, encoded as hex data. |
CaveatBuilderConfig
Optional configuration for createCaveatBuilder.
| Name | Type | Required | Description |
|---|---|---|---|
allowInsecureUnrestrictedDelegation | boolean | No | Whether 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..
| Name | Type | Required | Description |
|---|---|---|---|
delegate | Hex | Yes | The address to which the delegation is being granted. |
delegator | Hex | Yes | The address that is granting the delegation. |
authority | Hex | Yes | The 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.. |
caveats | Caveat[] | Yes | An array of caveats that constrain the delegation. |
salt | Hex | Yes | The salt for generating the delegation hash. This helps prevent hash collisions when creating identical delegations. |
signature | Hex | Yes | The signature to validate the delegation. |
DelegationStruct
The onchain representation of a Delegation, used when ABI-encoding or interacting
directly with the Delegation FrameworkDelegation Framework A set of audited smart contracts that handle smart account creation, the delegation lifecycle, and caveat enforcement. contracts.
It has the same fields as Delegation, except salt is a bigint instead of a Hex string.
| Name | Type | Required | Description |
|---|---|---|---|
delegate | Hex | Yes | The address to which the delegation is being granted. |
delegator | Hex | Yes | The address that is granting the delegation. |
authority | Hex | Yes | The 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.. |
caveats | Caveat[] | Yes | An array of caveats that constrain the delegation. |
salt | bigint | Yes | The salt for generating the delegation hash. This helps prevent hash collisions when creating identical delegations. |
signature | Hex | Yes | The signature to validate the delegation. |