Skip to main content
Defined in: actions/evm/types.ts:326

Type Declaration

getUserOperation()

Gets a user operation by its hash.

Parameters

options
Omit<GetUserOperationOptions, "smartAccount"> Parameters for getting the user operation.

Returns

Promise<UserOperation> A promise that resolves to the user operation.

Example

quoteSwap()

Creates a swap quote without executing the transaction. This is useful when you need to get swap details before executing the swap. The taker is automatically set to the smart account’s address.

Parameters

options
SmartAccountQuoteSwapOptions Configuration options for creating the swap quote.

Returns

Promise<SmartAccountQuoteSwapResult> A promise that resolves to the swap quote or a response indicating that liquidity is unavailable.

Example

sendUserOperation()

Sends a user operation.

Parameters

options
Omit<SendUserOperationOptions<unknown[]>, "smartAccount"> Parameters for sending the user operation.

Returns

Promise<SendUserOperationReturnType> A promise that resolves to an object containing the smart account address, the user operation hash, and the status of the user operation.

Example

signTypedData()

Signs a typed data message.

Parameters

options
Omit<SignTypedDataOptions, "address"> & { network: KnownEvmNetworks; } Configuration options for signing the typed data.

Returns

Promise<Hex> A promise that resolves to the signature.

Example

swap()

Executes a token swap on the specified network via a user operation. This method handles all the steps required for a swap, including Permit2 signatures if needed. The taker is automatically set to the smart account’s address.

Parameters

options
SmartAccountSwapOptions Configuration options for the swap.

Returns

Promise<SmartAccountSwapResult> A promise that resolves to the user operation result.

Throws

If liquidity is not available when using inline options.

Examples

transfer()

Transfer an amount of a token from an account to another account.

Parameters

options
SmartAccountTransferOptions The options for the transfer.

Returns

Promise<SendUserOperationReturnType> The user operation result.

Examples

Using parseUnits to specify USDC amount
Transfer ETH
Using a contract address
Transfer to another account

useSpendPermission()

Uses a spend permission to execute a transaction via user operation. This allows the smart account to spend tokens that have been approved via a spend permission.

Parameters

options
UseSpendPermissionOptions Configuration options for using the spend permission.

Returns

Promise<SendUserOperationReturnType> A promise that resolves to the user operation result.

Throws

If the network doesn’t support spend permissions via CDP API.

Example

waitForUserOperation()

Waits for a user operation to complete or fail.

Parameters

options
Omit<WaitForUserOperationOptions, "smartAccountAddress"> Parameters for waiting for the user operation.

Returns

Promise<WaitForUserOperationReturnType> A promise that resolves to the transaction receipt.

Example