import { useCreateEvmSmartAccount } from '@coinbase/cdp-hooks';
function MyComponent() {
const { createEvmSmartAccount } = useCreateEvmSmartAccount();
const handleCreateAccount = async () => {
try {
// Create with a new EOA owner
const account = await createEvmSmartAccount({
enableSpendPermissions: true
});
console.log('EVM Smart Account created:', account);
// Or create with a specific owner
const accountWithOwner = await createEvmSmartAccount({
owner: '0x1234...',
enableSpendPermissions: false
});
} catch (error) {
console.error('Failed to create EVM Smart Account:', error);
}
};
return <button onClick={handleCreateAccount}>Create EVM Smart Account</button>;
}