# coincircuit

Official CoinCircuit Python SDK. Supports both synchronous and asynchronous usage.

## Install

```bash
pip install coincircuit
```

## Usage (Sync)

```python
from coincircuit import CoinCircuit

cc = CoinCircuit(api_key="api_live_...")

# Create a payment session
session = cc.payments.create(
    amount="10.00",
    currency="USD",
    asset="USDC",
    chain="base",
    customer={"email": "buyer@example.com"},
)

# List transactions
result = cc.transactions.list(page=1, size=20)
for tx in result.data:
    print(tx)

# Auto-paginate
for tx in cc.transactions.list_auto_paginate():
    print(tx)

# Settle x402 gasless payment
result = cc.x402.settle(
    scheme="eip3009",
    chain="base",
    asset="USDC",
    payload={
        "from": "0xSender...",
        "to": "0xDeposit...",
        "value": "1000000",
        "validAfter": "0",
        "validBefore": "1774055094",
        "nonce": "0xrandom32bytes...",
        "signature": "0xsigned...",
    },
)
```

## Usage (Async)

```python
from coincircuit import AsyncCoinCircuit

async with AsyncCoinCircuit(api_key="api_live_...") as cc:
    session = await cc.payments.create(
        amount="10.00",
        currency="USD",
    )
```

## Resources

| Resource | Methods |
|----------|---------|
| `cc.payments` | create, list, get, generate_deposit_address, estimate |
| `cc.x402` | settle, verify |
| `cc.invoices` | create, list, get |
| `cc.transactions` | list, get |
| `cc.payouts` | create, list, get, estimate_fees |
| `cc.balance` | get |
| `cc.blockchain` | get_supported_assets, get_confirmations, get_gas_fees |
| `cc.customers` | create, list, get |
| `cc.refunds` | create_for_session, create_for_invoice, list, get, estimate |
| `cc.settlements` | list, get |
| `cc.rates` | convert, list |
| `cc.payment_pages` | create, list, update, delete, sessions |
| `cc.bank_accounts` | create, list, get, update, delete, banks |
| `cc.crypto_addresses` | create, list, get, update, delete, validate |

## Links

- [API Reference](https://coincircuit.io/api-reference)
- [Dashboard](https://dashboard.coincircuit.io)

## License

MIT
