lnurlp: support for floating point fiat values

This commit is contained in:
callebtc
2022-06-10 15:35:35 +02:00
parent 77fbea25af
commit b7008495b8
4 changed files with 16 additions and 11 deletions
+7 -4
View File
@@ -11,8 +11,8 @@ from pydantic import BaseModel
class CreatePayLinkData(BaseModel):
description: str
min: int = Query(0.01, ge=0.01)
max: int = Query(0.01, ge=0.01)
min: float = Query(1, ge=0.01)
max: float = Query(1, ge=0.01)
currency: str = Query(None)
comment_chars: int = Query(0, ge=0, lt=800)
webhook_url: str = Query(None)
@@ -24,7 +24,7 @@ class PayLink(BaseModel):
id: int
wallet: str
description: str
min: int
min: float
served_meta: int
served_pr: int
webhook_url: Optional[str]
@@ -32,11 +32,14 @@ class PayLink(BaseModel):
success_url: Optional[str]
currency: Optional[str]
comment_chars: int
max: int
max: float
@classmethod
def from_row(cls, row: Row) -> "PayLink":
data = dict(row)
if data["currency"]:
data["min"] /= 100
data["max"] /= 100
return cls(**data)
def lnurl(self, req: Request) -> str: