Merge pull request #429 from arcbtc/FastAPI

added lnaddresss for testing
This commit is contained in:
Arc
2021-11-24 08:56:13 +00:00
committed by GitHub
15 changed files with 2030 additions and 0 deletions
+10
View File
@@ -1,7 +1,10 @@
import asyncio
import datetime
from http import HTTPStatus
from fastapi import HTTPException
from starlette.requests import Request
from lnbits import bolt11
from .. import core_app
@@ -9,6 +12,13 @@ from ..crud import get_standalone_payment
from ..tasks import api_invoice_listeners
@core_app.get("/.well-known/lnurlp/{username}")
async def lnaddress(username: str, request: Request):
from lnbits.extensions.lnaddress.lnurl import lnurl_response
domain = request.client.host
return await lnurl_response(username, domain)
@core_app.get("/public/v1/payment/{payment_hash}")
async def api_public_payment_longpolling(payment_hash):
payment = await get_standalone_payment(payment_hash)