Added front end and work on db migrations and saving

This commit is contained in:
Black Coffee 2022-09-28 15:05:37 +01:00
parent f3230fc59e
commit 2d18153b1d
6 changed files with 841 additions and 578 deletions

62
lnbits/Pipfile Normal file
View file

@ -0,0 +1,62 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
aiofiles = "==0.8.0"
anyio = "==3.6.1"
asyncio = "==3.4.3"
attrs = "==21.4.0"
bech32 = "==1.2.0"
bitstring = "==3.1.9"
cerberus = "==1.3.4"
certifi = "==2022.6.15"
cffi = "==1.15.0"
click = "==8.1.3"
ecdsa = "==0.18.0"
embit = "==0.5.0"
environs = "==9.5.0"
fastapi = "==0.79.0"
h11 = "==0.12.0"
httpcore = "==0.15.0"
httptools = "==0.4.0"
httpx = "==0.23.0"
idna = "==3.3"
jinja2 = "==3.0.1"
lnurl = "==0.3.6"
loguru = "==0.6.0"
markupsafe = "==2.1.1"
marshmallow = "==3.17.0"
outcome = "==1.2.0"
psycopg2-binary = "==2.9.3"
pycparser = "==2.21"
pycryptodomex = "==3.15.0"
pydantic = "==1.9.1"
pyngrok = "==5.1.0"
pyparsing = "==3.0.9"
pypng = "==0.20220715.0"
pyqrcode = "==1.2.1"
pyscss = "==1.4.0"
python-dotenv = "==0.20.0"
pyyaml = "==6.0"
represent = "==1.6.0.post0"
rfc3986 = "==1.5.0"
secp256k1 = "==0.14.0"
shortuuid = "==1.0.9"
six = "==1.16.0"
sniffio = "==1.2.0"
sqlalchemy-aio = "==0.17.0"
sqlalchemy = "==1.3.23"
sse-starlette = "==0.10.3"
starlette = "==0.19.1"
typing-extensions = "==4.3.0"
uvicorn = "==0.18.2"
uvloop = "==0.16.0"
watchfiles = "==0.16.0"
websockets = "==10.3"
[dev-packages]
[requires]
python_version = "3.9"

View file

@ -2,5 +2,5 @@
"name": "Gerty", "name": "Gerty",
"short_description": "Desktop bitcoin Assistant", "short_description": "Desktop bitcoin Assistant",
"icon": "sentiment_satisfied", "icon": "sentiment_satisfied",
"contributors": ["arcbtc"] "contributors": ["arcbtc", "blackcoffeebtc"]
} }

View file

@ -10,8 +10,33 @@ async def create_gerty(wallet_id: str, data: Gerty) -> Gerty:
gerty_id = urlsafe_short_hash() gerty_id = urlsafe_short_hash()
await db.execute( await db.execute(
""" """
INSERT INTO gerty.gertys (id, name, wallet, lnbits_wallets, mempool_endpoint, sats_quote, exchange, onchain_stats, ln_stats) INSERT INTO gerty.gertys (
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) id,
name,
wallet,
lnbits_wallets,
mempool_endpoint,
exchange,
show_lnbits_wallets_balance,
show_sats_quote,
show_pieter_wuille_facts,
show_exchange_market_rate,
show_onchain_difficulty_epoch_progress,
show_onchain_difficulty_retarget_date,
show_onchain_difficulty_blocks_remaining,
show_onchain_difficulty_epoch_time_remaining,
show_onchain_mempool_recommended_fees,
show_onchain_mempool_number_of_tx,
show_mining_current_hash_rate,
show_mining_current_difficulty,
show_lightning_channel_count,
show_lightning_node_count,
show_lightning_tor_node_count,
show_lightning_clearnet_nodes,
show_lightning_unannounced_nodes,
show_lightning_average_channel_capacity
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
gerty_id, gerty_id,
@ -19,10 +44,25 @@ async def create_gerty(wallet_id: str, data: Gerty) -> Gerty:
data.wallet, data.wallet,
data.lnbits_wallets, data.lnbits_wallets,
data.mempool_endpoint, data.mempool_endpoint,
data.sats_quote,
data.exchange, data.exchange,
data.onchain_stats, data.show_lnbits_wallets_balance,
data.ln_stats, data.show_sats_quote,
data.show_pieter_wuille_facts,
data.show_exchange_market_rate,
data.show_onchain_difficulty_epoch_progress,
data.show_onchain_difficulty_retarget_date,
data.show_onchain_difficulty_blocks_remaining,
data.show_onchain_difficulty_epoch_time_remaining,
data.show_onchain_mempool_recommended_fees,
data.show_onchain_mempool_number_of_tx,
data.show_mining_current_hash_rate,
data.show_mining_current_difficulty,
data.show_lightning_channel_count,
data.show_lightning_node_count,
data.show_lightning_tor_node_count,
data.show_lightning_clearnet_nodes,
data.show_lightning_unannounced_nodes,
data.show_lightning_average_channel_capacity
), ),
) )

View file

@ -10,10 +10,25 @@ async def m001_initial(db):
wallet TEXT NOT NULL, wallet TEXT NOT NULL,
lnbits_wallets TEXT, lnbits_wallets TEXT,
mempool_endpoint TEXT, mempool_endpoint TEXT,
sats_quote BOOL,
exchange TEXT, exchange TEXT,
onchain_stats BOOL, show_lnbits_wallets_balance BOOL,
ln_stats BOOL show_sats_quote BOOL,
show_pieter_wuille_facts BOOL,
show_exchange_market_rate BOOL,
show_onchain_difficulty_epoch_progress BOOL,
show_onchain_difficulty_retarget_date BOOL,
show_onchain_difficulty_blocks_remaining BOOL,
show_onchain_difficulty_epoch_time_remaining BOOL,
show_onchain_mempool_recommended_fees BOOL,
show_onchain_mempool_number_of_tx BOOL,
show_mining_current_hash_rate BOOL,
show_mining_current_difficulty BOOL,
show_lightning_channel_count BOOL,
show_lightning_node_count BOOL,
show_lightning_tor_node_count BOOL,
show_lightning_clearnet_nodes BOOL,
show_lightning_unannounced_nodes BOOL,
show_lightning_average_channel_capacity BOOL
); );
""" """
) )

View file

@ -12,10 +12,26 @@ class Gerty(BaseModel):
wallet: str wallet: str
lnbits_wallets: str = Query(None) # Wallets to keep an eye on, {"wallet-id": "wallet-read-key, etc"} 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 mempool_endpoint: str = Query(None) # Mempool endpoint to use
sats_quote: bool = Query(False) # Fetch Satoshi quotes
exchange: str = Query(None) # BTC <-> Fiat exchange rate to pull ie "USD", in 0.0001 and sats exchange: str = Query(None) # BTC <-> Fiat exchange rate to pull ie "USD", in 0.0001 and sats
onchain_stats: bool = Query(False) # Onchain stats show_lnbits_wallets_balance: bool = Query(False)
ln_stats: bool = Query(False) # ln Sats show_sats_quote: bool = Query(False)
show_pieter_wuille_facts: bool = Query(False)
show_exchange_market_rate: bool = Query(False)
show_onchain_difficulty_epoch_progress: bool = Query(False)
show_onchain_difficulty_retarget_date: bool = Query(False)
show_onchain_difficulty_blocks_remaining: bool = Query(False)
show_onchain_difficulty_epoch_time_remaining: bool = Query(False)
show_onchain_mempool_recommended_fees: bool = Query(False)
show_onchain_mempool_number_of_tx: bool = Query(False)
show_mining_current_hash_rate: bool = Query(False)
show_mining_current_difficulty: bool = Query(False)
show_lightning_channel_count: bool = Query(False)
show_lightning_node_count: bool = Query(False)
show_lightning_tor_node_count: bool = Query(False)
show_lightning_clearnet_nodes: bool = Query(False)
show_lightning_unannounced_nodes: bool = Query(False)
show_lightning_average_channel_capacity: bool = Query(False)
@classmethod @classmethod
def from_row(cls, row: Row) -> "Gerty": def from_row(cls, row: Row) -> "Gerty":

File diff suppressed because it is too large Load diff