> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useEnableSpendPermissions

```ts theme={null}
function useEnableSpendPermissions(): UseEnableSpendPermissionsReturnType;
```

Hook that provides a wrapped function to retroactively enable spend permissions on an existing EVM Smart Account.
This hook auto-resolves the smart account from the current authenticated user and surfaces both pre-polling and on-chain errors via the `error` return value.

## Returns

[`UseEnableSpendPermissionsReturnType`](/sdks/cdp-sdks-v2/frontend/@coinbase/cdp-hooks/Type-Aliases/UseEnableSpendPermissionsReturnType)

## Example

```tsx lines theme={null}
function EnableSpendPermissions() {
  const { enableSpendPermissions, data, error, status } = useEnableSpendPermissions();

  const handleEnableSpendPermissions = async () => {
    try {
      const result = await enableSpendPermissions({
        network: "base-sepolia",
        // evmSmartAccount: "0x..." // optional — auto-resolved from current user
      });
      console.log("User Operation Hash:", result.userOperationHash);
    } catch (error) {
      console.error("Failed to enable spend permissions:", error);
    }
  };

  return (
    <div>
      {status === "pending" && <p>Enabling spend permissions...</p>}
      {status === "success" && data && (
        <div>
          <p>Spend permissions enabled!</p>
          <p>Transaction Hash: {data.transactionHash}</p>
        </div>
      )}
      {status === "error" && <p>Error: {error?.message}</p>}
      <button onClick={handleEnableSpendPermissions}>
        Enable Spend Permissions
      </button>
    </div>
  );
}
```
