Skip to main content
function useCreateEvmSmartAccount(): {
  createEvmSmartAccount: (options?: CreateEvmSmartAccountOptions) => Promise<`0x${string}`>;
};
A hook for creating a EVM Smart Account for the current user. This function will throw an error if the user already has a Smart Account. If the user does not have an EOA account, one will be created automatically as the owner.

Returns

{
  createEvmSmartAccount: (options?: CreateEvmSmartAccountOptions) => Promise<`0x${string}`>;
}
An object containing the createSmartAccount function.

createEvmSmartAccount()

createEvmSmartAccount: (options?: CreateEvmSmartAccountOptions) => Promise<`0x${string}`>;

Parameters

ParameterType
options?CreateEvmSmartAccountOptions

Returns

Promise<`0x${string}`>

Example

import { useCreateEvmSmartAccount } from '@coinbase/cdp-hooks';

function MyComponent() {
  const { createEvmSmartAccount } = useCreateEvmSmartAccount();

  const handleCreateAccount = async () => {
    try {
      const account = await createEvmSmartAccount({
        enableSpendPermissions: true
      });
      console.log('EVM Smart Account created:', account);
    } catch (error) {
      console.error('Failed to create EVM Smart Account:', error);
    }
  };

  return <button onClick={handleCreateAccount}>Create EVM Smart Account</button>;
}