forked from lnbits/lnurldevice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
52 lines (40 loc) · 1.03 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import json
from typing import List, Optional, Union
from lnurl.types import LnurlPayMetadata
from pydantic import BaseModel, Json
class LnurldeviceExtra(BaseModel):
description: str = ""
amount: float = 0.0
duration: int = 0
pin: int = 0
comment: Optional[bool] = False
variable: Optional[bool] = False
lnurl: Optional[str]
class CreateLnurldevice(BaseModel):
title: str
wallet: str
currency: str
device: str
profit: float
extra: Optional[Union[List[LnurldeviceExtra], str]]
class Lnurldevice(BaseModel):
id: str
key: str
title: str
wallet: str
profit: float
currency: str
device: str
extra: Optional[Union[Json[List[LnurldeviceExtra]], str]]
@property
def lnurlpay_metadata(self) -> LnurlPayMetadata:
return LnurlPayMetadata(json.dumps([["text/plain", self.title]]))
class LnurldevicePayment(BaseModel):
id: str
deviceid: str
payhash: str
payload: str
pin: int
sats: int
class Lnurlencode(BaseModel):
url: str