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

36 lines
623 B
Python
Raw Normal View History

2020-12-01 19:54:16 +00:00
from sqlite3 import Row
from typing import NamedTuple
2021-04-04 13:28:46 +01:00
2020-12-01 19:54:16 +00:00
class Wallets(NamedTuple):
id: str
user: str
masterpub: str
title: str
address_no: int
balance: int
2021-03-31 23:49:36 +01:00
2020-12-01 19:54:16 +00:00
@classmethod
def from_row(cls, row: Row) -> "Wallets":
return cls(**dict(row))
2021-03-31 23:49:36 +01:00
2020-12-01 19:54:16 +00:00
class Mempool(NamedTuple):
user: str
endpoint: str
2021-04-04 13:28:46 +01:00
2020-12-01 19:54:16 +00:00
@classmethod
def from_row(cls, row: Row) -> "Mempool":
return cls(**dict(row))
2021-04-04 13:28:46 +01:00
class Addresses(NamedTuple):
2021-04-04 13:17:24 +01:00
id: str
address: str
wallet: str
amount: int
@classmethod
def from_row(cls, row: Row) -> "Addresses":
2021-04-04 13:28:46 +01:00
return cls(**dict(row))