adding identifier...again

This commit is contained in:
Tiago vasconcelos 2021-12-01 11:06:56 +00:00
parent a7ceae86b4
commit e6ec560317
2 changed files with 5 additions and 4 deletions

View File

@ -32,7 +32,7 @@ async def lnurl_response(username: str, domain: str, request: Request):
callback=request.url_for("lnaddress.lnurl_callback", address_id=address.id),
min_sendable=1000,
max_sendable=1000000000,
metadata=await address.lnurlpay_metadata(),
metadata=await address.lnurlpay_metadata(domain=domain),
)
print("RESP", resp.dict())
return resp.dict()
@ -69,7 +69,7 @@ async def lnurl_callback(address_id, amount: int = Query(...)):
"out": False,
"amount": int(amount_received / 1000),
"description_hash": hashlib.sha256(
(await address.lnurlpay_metadata()).encode("utf-8")
(await address.lnurlpay_metadata(domain=domain.domain)).encode("utf-8")
).hexdigest(),
"extra": {"tag": f"Payment to {address.username}@{domain.domain}"},
},

View File

@ -49,8 +49,9 @@ class Addresses(BaseModel):
paid: bool
time: int
async def lnurlpay_metadata(self) -> LnurlPayMetadata:
async def lnurlpay_metadata(self, domain) -> LnurlPayMetadata:
text = f"Payment to {self.username}"
metadata = [["text/plain", text]]
identifier = f"{self.username}@{domain}"
metadata = [["text/plain", text], ["text/identifier"], identifier]
return LnurlPayMetadata(json.dumps(metadata))