mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-25 15:10:41 +01:00
32 lines
603 B
Python
32 lines
603 B
Python
from sqlite3 import Row
|
|
from typing import NamedTuple, Optional
|
|
|
|
|
|
class Donation(NamedTuple):
|
|
id: str
|
|
name: str
|
|
cur_code: str
|
|
sats: int
|
|
amount: float
|
|
service: int
|
|
posted: bool
|
|
|
|
@classmethod
|
|
def from_row(cls, row: Row) -> "Donation":
|
|
return cls(**dict(row))
|
|
|
|
|
|
class Service(NamedTuple):
|
|
id: int
|
|
twitchuser: str
|
|
client_id: str
|
|
client_secret: str
|
|
wallet: str
|
|
onchain: str
|
|
servicename: str
|
|
authenticated: bool
|
|
token: Optional[int]
|
|
|
|
@classmethod
|
|
def from_row(cls, row: Row) -> "Service":
|
|
return cls(**dict(row))
|