fix: use satspay for onchain payments (#56)

* use satspay
* safeguard satspay
* add fasttrack and 0conf
This commit is contained in:
dni ⚡ 2026-06-05 12:12:08 +02:00 • committed by GitHub
commit 99b43ff851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 170 additions and 177 deletions

View file

@ -62,16 +62,27 @@ async def fetch_watchonly_wallet(api_key: str, wallet_id: str) -> dict[str, Any]
return resp.json()
async def fetch_onchain_address(api_key: str, wallet_id: str) -> dict[str, Any]:
async def get_satspay_charge(api_key: str, charge_id: str) -> dict[str, Any]:
async with httpx.AsyncClient() as client:
resp = await client.get(
url=f"http://{settings.host}:{settings.port}/watchonly/api/v1/address/{wallet_id}",
url=f"http://{settings.host}:{settings.port}/satspay/api/v1/charge/{charge_id}",
headers={"X-API-KEY": api_key},
)
resp.raise_for_status()
return resp.json()
async def create_satspay_charge(api_key: str, data: dict) -> dict[str, Any]:
async with httpx.AsyncClient() as client:
resp = await client.post(
url=f"http://{settings.host}:{settings.port}/satspay/api/v1/charge",
headers={"X-API-KEY": api_key},
json=data,
)
resp.raise_for_status()
return resp.json()
async def set_ticket_paid(ticket: Ticket) -> Ticket:
if ticket.paid:
return ticket