Metadata-Version: 2.4
Name: ctcc-x402
Version: 1.0.0
Summary: Deterministic smart-contract authority and control inspection for AI agents on Base Mainnet via x402 v2 micropayments ($0.01 USDC).
Author-email: "Cinque Port (Pavilion)" <hello@pspt.ltd>
License-Expression: MIT
Project-URL: Homepage, https://cinqueport.net/#ctcc
Project-URL: Documentation, https://cinqueport.net/openapi.json
Project-URL: Repository, https://github.com/jamesbjgates-web/ctcc-mcp
Keywords: x402,base,smart-contracts,token-security,ai-agents,defi
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: x402
Requires-Dist: x402>=0.1.0; extra == "x402"
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"

# ctcc-x402

> Deterministic smart-contract control and authority inspection for AI agents on **Base Mainnet (eip155:8453)**, micro-settled via the **x402 v2 protocol ($0.01 USDC)**.

Developed by [Cinque Port](https://cinqueport.net), the specialist international trade and evidential due-diligence division of **Pavilion (Stockport) Ltd** (`pspt.ltd`).

---

## Features
- **Deterministic Observations**: Raw contract bytecode presence, ERC-20 metadata, owner/admin addresses, pause state, and EIP-1967 proxy mechanisms.
- **Dual Engine**: High-performance synchronous (`CtccClient`) and asynchronous (`AsyncCtccClient`) interfaces.
- **Bot-Optimized Caching**: Built-in TTL in-memory caching to eliminate redundant on-chain payments in high-frequency trading loops.
- **Pydantic Validation**: Fully typed dataclasses for strict runtime validation.

---

## Installation
```bash
pip install ctcc-x402
```

---

## Quickstart

### 1. Synchronous Inspection
```python
from ctcc_x402 import check_token_control
import os

observations = check_token_control(
    "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    private_key=os.environ.get("EVM_PRIVATE_KEY")
)

print(f"Address: {observations.address}")
print(f"ERC-20 Symbol: {observations.observations.erc20.symbol}")
print(f"Owner: {observations.observations.control_authorities.owner_address}")
print(f"Paused: {observations.observations.pause_state.is_paused}")
```

### 2. High-Frequency Bot with Caching
```python
from ctcc_x402 import CtccClient
import os

client = CtccClient(
    private_key=os.environ.get("EVM_PRIVATE_KEY"),
    cache_ttl_seconds=300,  # 5-minute memory cache
    max_retries=3
)

# First query: settles $0.01 USDC
obs1 = client.check_token_control("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913")

# Second query within 5 minutes: zero-latency cache hit (zero payment)
obs2 = client.check_token_control("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913")
```

### 3. Asynchronous Inspection (LangGraph / Asyncio)
```python
from ctcc_x402 import AsyncCtccClient
import asyncio
import os

async def main():
    client = AsyncCtccClient(private_key=os.environ.get("EVM_PRIVATE_KEY"))
    try:
        obs = await client.check_token_control("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913")
        print("Bytecode size:", obs.observations.bytecode_bytes)
    finally:
        await client.close()

asyncio.run(main())
```

---

## Specification & Discovery
- **Protected Endpoint**: `POST https://cinqueport.net/check`
- **OpenAPI 3.1.0**: https://cinqueport.net/openapi.json
- **A2A Agent Card**: https://cinqueport.net/.well-known/agent.json
- **x402 Manifest**: https://cinqueport.net/.well-known/x402.json
- **LLMs Documentation**: https://cinqueport.net/llms.txt

---

## License
MIT © Pavilion (Stockport) Ltd.
