> ## Documentation Index
> Fetch the complete documentation index at: https://daehan-base.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# atomic

> Ensures batched transactions are executed atomically and contiguously

export const Button = ({children, disabled, variant = "primary", size = "medium", iconName, roundedFull = false, className = '', fullWidth = false, onClick = undefined}) => {
  const variantStyles = {
    primary: 'bg-blue text-black border border-blue hover:bg-blue-80 active:bg-[#06318E] dark:text-white',
    secondary: 'bg-white border border-white text-palette-foreground hover:bg-zinc-15 active:bg-zinc-30',
    outlined: 'bg-transparent text-white border border-white hover:bg-white hover:text-black active:bg-[#E3E7E9]'
  };
  const sizeStyles = {
    medium: 'text-md px-4 py-2 gap-3',
    large: 'text-lg px-6 py-4 gap-5'
  };
  const sizeIconRatio = {
    medium: '0.75rem',
    large: '1rem'
  };
  const classes = ['text-md px-4 py-2 whitespace-nowrap', 'flex items-center justify-center', 'disabled:opacity-40 disabled:pointer-events-none', 'transition-all', variantStyles[variant], sizeStyles[size], roundedFull ? 'rounded-full' : 'rounded-lg', fullWidth ? 'w-full' : 'w-auto', className];
  const buttonClasses = classes.filter(Boolean).join(' ');
  const iconSize = sizeIconRatio[size];
  return <button type="button" disabled={disabled} className={buttonClasses} onClick={onClick}>
      <span>{children}</span>
      {iconName && <Icon name={iconName} width={iconSize} height={iconSize} color="currentColor" />}
    </button>;
};

export const BaseBanner = ({content = null, id, dismissable = true}) => {
  const LOCAL_STORAGE_KEY_PREFIX = 'cb-docs-banner';
  const [isVisible, setIsVisible] = useState(false);
  const onDismiss = () => {
    localStorage.setItem(`${LOCAL_STORAGE_KEY_PREFIX}-${id}`, 'false');
    setIsVisible(false);
  };
  useEffect(() => {
    const storedValue = localStorage.getItem(`${LOCAL_STORAGE_KEY_PREFIX}-${id}`);
    setIsVisible(storedValue !== 'false');
  }, []);
  if (!isVisible) {
    return null;
  }
  return <div className="fixed bottom-0 left-0 right-0 bg-white py-8 px-4 lg:px-12 z-50 text-black dark:bg-black dark:text-white border-t dark:border-gray-95">
      <div className="flex items-center max-w-8xl mx-auto">
        {typeof content === 'function' ? content({
    onDismiss
  }) : content}
        {dismissable && <button onClick={onDismiss} className="flex-shrink-0 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors" aria-label="Dismiss banner">
          ✕
        </button>}
      </div>
    </div>;
};

Defined in [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792)

<Info>
  The atomic capability specifies how wallets execute batches of transactions, providing guarantees for atomic transaction execution. When supported, all transactions in a batch must succeed together or fail together.
</Info>

## Parameters

<ParamField body="supported" type="string" required>
  The atomic capability status for the current chain and account.

  **Possible values:**

  * `"supported"`: Wallet will execute all calls atomically and contiguously
  * `"ready"`: Wallet can upgrade to atomic execution pending user approval
  * `"unsupported"`: No atomicity or contiguity guarantees
</ParamField>

## Returns

<ResponseField name="atomic" type="object">
  The atomic capability configuration for the specified chain.

  <Expandable title="Atomic capability properties">
    <ResponseField name="supported" type="string">
      Indicates the level of atomic execution support available.
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Usage

<RequestExample>
  ```typescript Check Capability Support theme={null}
  const capabilities = await provider.request({
    method: 'wallet_getCapabilities',
    params: ['0xd46e8dd67c5d32be8058bb8eb970870f07244567']
  });

  console.log(capabilities["0x2105"].atomic);
  ```

  ```typescript Send Atomic Transactions theme={null}
  const result = await provider.request({
    method: "wallet_sendCalls",
    params: [{
      version: "1.0",
      chainId: "0x2105",
      from: "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
      atomicRequired: true,
      calls: [
        {
          to: "0x1234567890123456789012345678901234567890",
          value: "0x0",
          data: "0xa9059cbb000000000000000000000000..."
        }
      ]
    }]
  });
  ```
</RequestExample>

<ResponseExample>
  ```json Capability Response (Supported) theme={null}
  {
    "0x2105": {
      "atomic": {
        "supported": "supported"
      }
    }
  }
  ```

  ```json Capability Response (Ready for Upgrade) theme={null}
  {
    "0x2105": {
      "atomic": {
        "supported": "ready"
      }
    }
  }
  ```

  ```json Capability Response (Unsupported) theme={null}
  {
    "0x2105": {
      "atomic": {
        "supported": "unsupported"
      }
    }
  }
  ```
</ResponseExample>

## Error Handling

| Code | Message                        | Description                                                         |
| ---- | ------------------------------ | ------------------------------------------------------------------- |
| 4100 | Atomic execution not supported | Wallet does not support atomic transaction execution                |
| 5700 | Atomic capability required     | Transaction requires atomic execution but wallet doesn't support it |
| 5750 | Atomic upgrade rejected        | User rejected the upgrade to atomic execution capability            |

## Use Cases

### DeFi Operations

Atomic execution is crucial for DeFi operations where multiple steps must complete together:

```typescript theme={null}
// Swap tokens atomically
const swapCalls = await provider.request({
  method: "wallet_sendCalls",
  params: [{
    version: "1.0",
    chainId: "0x2105",
    from: userAddress,
    atomicRequired: true,
    calls: [
      // 1. Approve token spend
      {
        to: tokenAddress,
        value: "0x0",
        data: approveCallData
      },
      // 2. Execute swap
      {
        to: swapContractAddress,
        value: "0x0",
        data: swapCallData
      },
      // 3. Claim rewards (if applicable)
      {
        to: rewardsContractAddress,
        value: "0x0",
        data: claimCallData
      }
    ]
  }]
});
```

### NFT Minting with Payment

```typescript theme={null}
// Mint NFT and pay fees atomically
const mintCalls = await provider.request({
  method: "wallet_sendCalls",
  params: [{
    version: "1.0",
    chainId: "0x2105",
    from: userAddress,
    atomicRequired: true,
    calls: [
      // 1. Pay minting fee
      {
        to: paymentAddress,
        value: "0x16345785d8a0000", // 0.1 ETH
        data: "0x"
      },
      // 2. Mint NFT
      {
        to: nftContractAddress,
        value: "0x0",
        data: mintCallData
      }
    ]
  }]
});
```

## Error Handling

Handle atomic capability errors appropriately:

```typescript theme={null}
async function executeAtomicTransaction(calls) {
  try {
    // Check atomic capability first
    const capabilities = await provider.request({
      method: 'wallet_getCapabilities',
      params: [userAddress]
    });
    
    const atomicCapability = capabilities["0x2105"]?.atomic;
    
    if (!atomicCapability || atomicCapability === "unsupported") {
      throw new Error("Atomic execution not supported");
    }
    
    // Execute atomic transaction
    const result = await provider.request({
      method: "wallet_sendCalls",
      params: [{
        version: "1.0",
        chainId: "0x2105",
        from: userAddress,
        atomicRequired: true,
        calls
      }]
    });
    
    return result;
    
  } catch (error) {
    if (error.code === 4100) {
      console.error("Atomic execution not supported by wallet");
      // Fallback to sequential execution
      return executeSequentialTransaction(calls);
    } else {
      console.error("Atomic transaction failed:", error);
      throw error;
    }
  }
}
```

## Relationship with EIP-7702

The atomic capability works with EIP-7702 to enable EOA (Externally Owned Accounts) to upgrade to smart accounts that support atomic transaction execution:

```typescript theme={null}
// Check if wallet can upgrade to atomic execution  
const capabilities = await provider.request({
  method: 'wallet_getCapabilities',
  params: [eoaAddress]
});

if (capabilities["0x2105"].atomic === "ready") {
  console.log("Wallet can upgrade to support atomic execution with user approval");
}
```

## Best Practices

1. **Check Capabilities First**: Always verify atomic support before requiring it
2. **Provide Fallbacks**: Implement sequential execution as a fallback when atomic isn't available
3. **Use for Related Operations**: Only require atomicity for operations that must succeed together
4. **Clear Error Messages**: Provide helpful error messages when atomic execution fails

<Warning>
  The atomic capability is chain-specific. Always check support for the specific chain you're targeting.
</Warning>

<Info>
  Apps should first check wallet capabilities using `wallet_getCapabilities` before sending requests requiring atomic execution.
</Info>

<BaseBanner
  id="privacy-policy"
  dismissable={false}
  content={({ onDismiss }) => (
<div className="flex items-center">
  <div className="mr-2">
    We're updating the Base Privacy Policy, effective July 25, 2025, to reflect an expansion of Base services. Please review the updated policy here:{" "}
    <a
      href="https://docs.base.org/privacy-policy-2025"
      target="_blank"
      className="whitespace-nowrap"
    >
      Base Privacy Policy
    </a>. By continuing to use Base services, you confirm that you have read and understand the updated policy.
  </div>
  <Button onClick={onDismiss}>I Acknowledge</Button>
</div>
)}
/>
