Metadata-Version: 2.4
Name: m2m-sentinel
Version: 1.0.4
Summary: Python client SDK for M2M Sentinel Web3 Pre-Transaction Risk Decision API
Home-page: https://m2msentinel.vercel.app
Author: M2M Sentinel
Author-email: contact@m2msentinel.vercel.app
Project-URL: Documentation, https://m2msentinel.vercel.app/docs.html
Project-URL: Source, https://github.com/m2msentinel/m2m-sentinel
Project-URL: OpenAPI, https://m2msentinel.vercel.app/openapi.json
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Security
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: project-url
Dynamic: requires-python
Dynamic: summary

# M2M Sentinel Python SDK

Official Python client for the **M2M Sentinel Web3 Pre-Transaction Risk Decision API** on Base (Coinbase L2).

## Installation

```bash
pip install m2m-sentinel
```

Or install from source:

```bash
pip install git+https://github.com/m2msentinel/m2m-sentinel.git#subdirectory=public/sdk/python
```

## Quick Start

```python
from m2m_sentinel import M2MSentinelClient

# Initialize client (uses API key in x-api-key header)
client = M2MSentinelClient(api_key="sk_starter_...")

# Perform pre-transaction audit of a smart contract address
audit_result = client.audit_contract("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913")
print("Security Rating:", audit_result["audit"]["securityRating"])
print("Score:", audit_result["audit"]["securityScore"])

# Get live gas fees on Base
gas = client.get_gas_fees()
print(f"Gas Price: {gas['gasPrice']['gwei']} Gwei")

# Check token prices with provenance
price = client.get_token_price("WETH")
print(f"WETH Price: ${price['token']['priceUsd']}")
```

## Free Tier Signup (Wallet Verified)

```python
# 1. Create a free-tier challenge
challenge = client.create_free_challenge(user_wallet="0xYourWallet")

# 2. Sign challenge['intent']['messageToSign'] with your wallet (personal_sign)
signature = "0x..."  # Signature from personal_sign

# 3. Claim your free-tier key (100 credits/day, wallet verified)
claimed = client.claim_free_tier(intent_id=challenge['intent']['id'], signature=signature)
print("Your API Key:", claimed["apiKey"])
```

## Response Handling & Provenance

Every response from M2M Sentinel includes source provenance and trust levels. Unbacked verdicts return `UNVERIFIED` with a `None` score rather than fabricated data.

* `PaymentRequiredError` (402): HTTP 402 challenge returned when x402 payment is required.
* `RateLimitedError` (429): Burst rate limit exceeded. Check `retry_after`.
* `DataSourceUnavailableError` (503): Upstream data source is down; no fake data generated.

## Documentation & Specs

* Website: [https://m2msentinel.vercel.app](https://m2msentinel.vercel.app)
* Interactive Docs: [https://m2msentinel.vercel.app/docs.html](https://m2msentinel.vercel.app/docs.html)
* OpenAPI Spec: [https://m2msentinel.vercel.app/openapi.json](https://m2msentinel.vercel.app/openapi.json)
