forked from Rockachopa/Timmy-time-dashboard
Lightning Backend Interface: - Abstract LightningBackend with pluggable implementations - MockBackend for development (auto-settle invoices) - LndBackend stub with gRPC integration path documented - Backend factory for runtime selection via LIGHTNING_BACKEND env Intelligent Swarm Routing: - CapabilityManifest for agent skill declarations - Task scoring based on keywords + capabilities + bid price - RoutingDecision audit logging to SQLite - Agent stats tracking (wins, consideration rate) Sovereignty Audit: - Comprehensive audit report (docs/SOVEREIGNTY_AUDIT.md) - 9.2/10 sovereignty score - Documented all external dependencies and local alternatives Substrate-Agnostic Agent Interface: - TimAgent abstract base class - Perception/Action/Memory/Communication types - OllamaAdapter implementation - Foundation for future embodiment (robot, VR) Tests: - 36 new tests for Lightning and routing - 472 total tests passing - Maintained 0 warning policy
27 lines
905 B
Python
27 lines
905 B
Python
"""Lightning Network payment backend interface.
|
|
|
|
This module provides a pluggable interface for Lightning Network operations,
|
|
allowing seamless switching between mock (development) and real LND backends.
|
|
|
|
Usage:
|
|
from lightning import get_backend, Invoice
|
|
|
|
backend = get_backend() # Uses LIGHTNING_BACKEND env var
|
|
invoice = backend.create_invoice(amount_sats=100, memo="API access")
|
|
paid = backend.check_payment(invoice.payment_hash)
|
|
|
|
Configuration:
|
|
LIGHTNING_BACKEND=mock # Default, for development
|
|
LIGHTNING_BACKEND=lnd # Real LND via gRPC
|
|
|
|
# LND-specific settings (when backend=lnd)
|
|
LND_GRPC_HOST=localhost:10009
|
|
LND_TLS_CERT_PATH=/path/to/tls.cert
|
|
LND_MACAROON_PATH=/path/to/admin.macaroon
|
|
"""
|
|
|
|
from lightning.base import Invoice, LightningBackend
|
|
from lightning.factory import get_backend
|
|
|
|
__all__ = ["Invoice", "LightningBackend", "get_backend"]
|