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

19 lines
632 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
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-09-26 10:30:48 +01:00
lnbits_wallets: str = Query(None) # Wallets to keep an eye on, {"wallet-id": "wallet-read-key, etc"}
2022-09-26 19:30:40 +01:00
mempool_endpoint: str = Query(None) # Mempool endpoint to use
2022-09-23 14:38:55 +01:00
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":
return cls(**dict(row))