cardano-api: strip 'Fix #N:' audit-ticket prefixes from inline comments (was 50+ in main.py), drop hardening-pass changelog blocks from module docstring, rewrite README to drop deploy paths + marketing sections, keep tier/auth/TTL + policy IDs. cardano-checkout-py: drop TradeCraft lineage refs, swap chromaticcraft/tradecraft test fixtures for acme/globex, repository URL → git.sulkta.com.
69 lines
2.1 KiB
Python
69 lines
2.1 KiB
Python
"""cardano-checkout — merchant-side Cardano payment lifecycle in Python.
|
|
|
|
Zero-custody: the merchant brings a wallet xpub and an
|
|
:class:`~cardano_checkout.store.InvoiceStore` implementation. The SDK
|
|
owns the payment lifecycle — per-invoice receive-address bookkeeping,
|
|
Koios UTxO polling, confirm / underpay / overpay classification, and
|
|
time-windowed repricing against a consumer-supplied oracle.
|
|
|
|
Does NOT ship Cardano primitives. Address derivation, transaction
|
|
building, chain context, and native-script minting live in
|
|
`pycardano <https://github.com/Python-Cardano/pycardano>`_. See the
|
|
README for the pairing pattern and the CIP-25 v2 metadata-builder
|
|
snippet.
|
|
|
|
Quick start::
|
|
|
|
from cardano_checkout import Invoice, InvoiceStatus, InMemoryStore, InvoiceScheduler
|
|
|
|
store = InMemoryStore() # or your SQLAlchemy / asyncpg / sqlite adapter
|
|
|
|
async def my_price_fn(usd: float) -> int:
|
|
rate = await fetch_ada_usd_rate()
|
|
return int(round(usd / rate * 1_000_000))
|
|
|
|
scheduler = InvoiceScheduler(store=store, price_fn=my_price_fn)
|
|
await scheduler.start()
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
__version__ = "1.0.0-dev"
|
|
|
|
from cardano_checkout.invoice import Invoice, InvoiceStatus # noqa: F401
|
|
from cardano_checkout.store import InMemoryStore, InvoiceStore # noqa: F401
|
|
from cardano_checkout.monitor import ( # noqa: F401
|
|
CONFIRM_TOLERANCE,
|
|
DEFAULT_MAX_REPRICINGS,
|
|
DEFAULT_PAYMENT_WINDOW_MINUTES,
|
|
KOIOS_URL,
|
|
OVERPAY_THRESHOLD,
|
|
PriceFn,
|
|
check_address_utxos,
|
|
check_pending_invoices,
|
|
evaluate_utxos,
|
|
reprice_expired_invoices,
|
|
)
|
|
from cardano_checkout.scheduler import InvoiceScheduler # noqa: F401
|
|
|
|
__all__ = [
|
|
"__version__",
|
|
# Invoice lifecycle
|
|
"Invoice",
|
|
"InvoiceStatus",
|
|
# Persistence
|
|
"InvoiceStore",
|
|
"InMemoryStore",
|
|
# Monitor + scheduler
|
|
"PriceFn",
|
|
"InvoiceScheduler",
|
|
"check_address_utxos",
|
|
"check_pending_invoices",
|
|
"evaluate_utxos",
|
|
"reprice_expired_invoices",
|
|
"KOIOS_URL",
|
|
"CONFIRM_TOLERANCE",
|
|
"OVERPAY_THRESHOLD",
|
|
"DEFAULT_MAX_REPRICINGS",
|
|
"DEFAULT_PAYMENT_WINDOW_MINUTES",
|
|
]
|