---
name: cdp-smart-accounts
description: Creates ERC-4337 smart accounts, prepares and sends user operations with optional paymaster sponsorship. Requires an EOA owner.
---

# cdp-smart-accounts

Smart account lifecycle: create, user operations, paymaster.

## Create

1. Ensure a funded EOA owner exists (create via `/cdp-accounts-create` if needed).
2. ```
   cdp evm smart-accounts create 'owners:=["<ownerAddress>"]' name=<name>
   ```
   `owners` is a string array of addresses, NOT objects.
3. Verify:
   ```
   cdp evm smart-accounts get <address>
   cdp evm smart-accounts by-name <name>
   ```

## Send via user operation

Smart accounts cannot use the encode→sign→send pipeline. Use user operations instead.

### Prepare and send (one step)

```
cdp evm smart-accounts user-operations prepare-and-send <smartAddress> \
  network=base-sepolia \
  'calls:=[{"to":"<recipient>","value":"10000000000000","data":"0x"}]'
```
Returns `.userOpHash`. Poll until complete:
```
cdp evm smart-accounts user-operations get <smartAddress> <userOpHash>
```

### With paymaster (gas sponsorship)

Add `paymasterUrl`:
```
cdp evm smart-accounts user-operations prepare-and-send <smartAddress> \
  network=base-sepolia \
  'calls:=[{"to":"<recipient>","value":"10000000000000","data":"0x"}]' \
  paymasterUrl=https://paymaster.cdp.coinbase.com
```

Note: paymaster covers gas only, not call value. For calls with non-zero value, fund the smart account directly first.

### Prepare then send (two steps)

1. Prepare:
   ```
   cdp evm smart-accounts user-operations create <smartAddress> \
     network=base-sepolia 'calls:=[{"to":"<to>","value":"0","data":"0x"}]'
   ```
2. Send:
   ```
   cdp evm smart-accounts user-operations send <smartAddress> <userOpHash>
   ```

## Verify

After user op completes, check recipient balance:
```
cdp evm token-balances get base-sepolia <recipient>
```

## Notes

- Smart account addresses are deterministic from the owner address.
- Owner EOA must be funded on testnet for non-paymaster operations.
- `value` in calls is in wei as a string.
