lnbits-legend/lnbits/extensions/gerty/models.py

27 lines
713 B
Python
Raw Normal View History

2022-09-23 14:38:55 +01:00
from sqlite3 import Row
from typing import Optional
from fastapi import Query
from pydantic import BaseModel
2022-10-20 16:31:09 +01:00
2022-09-23 14:38:55 +01:00
class Gerty(BaseModel):
2022-09-26 10:30:48 +01:00
id: str = Query(None)
2022-09-23 14:38:55 +01:00
name: str
wallet: str
2022-09-29 15:08:01 +01:00
refresh_time: int = Query(None)
2022-10-20 16:58:14 +01:00
utc_offset: int = Query(None)
type: str
2022-10-20 16:31:09 +01:00
lnbits_wallets: str = Query(
None
) # Wallets to keep an eye on, {"wallet-id": "wallet-read-key, etc"}
mempool_endpoint: str = Query(None) # Mempool endpoint to use
exchange: str = Query(
None
) # BTC <-> Fiat exchange rate to pull ie "USD", in 0.0001 and sats
display_preferences: str = Query(None)
2022-09-23 14:38:55 +01:00
@classmethod
def from_row(cls, row: Row) -> "Gerty":
2022-10-20 16:31:09 +01:00
return cls(**dict(row))