Added front end and work on db migrations and saving
This commit is contained in:
parent
f3230fc59e
commit
2d18153b1d
6 changed files with 841 additions and 578 deletions
62
lnbits/Pipfile
Normal file
62
lnbits/Pipfile
Normal 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"
|
||||
|
|
@ -2,5 +2,5 @@
|
|||
"name": "Gerty",
|
||||
"short_description": "Desktop bitcoin Assistant",
|
||||
"icon": "sentiment_satisfied",
|
||||
"contributors": ["arcbtc"]
|
||||
"contributors": ["arcbtc", "blackcoffeebtc"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,33 @@ async def create_gerty(wallet_id: str, data: Gerty) -> Gerty:
|
|||
gerty_id = urlsafe_short_hash()
|
||||
await db.execute(
|
||||
"""
|
||||
INSERT INTO gerty.gertys (id, name, wallet, lnbits_wallets, mempool_endpoint, sats_quote, exchange, onchain_stats, ln_stats)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
INSERT INTO gerty.gertys (
|
||||
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,
|
||||
|
|
@ -19,10 +44,25 @@ async def create_gerty(wallet_id: str, data: Gerty) -> Gerty:
|
|||
data.wallet,
|
||||
data.lnbits_wallets,
|
||||
data.mempool_endpoint,
|
||||
data.sats_quote,
|
||||
data.exchange,
|
||||
data.onchain_stats,
|
||||
data.ln_stats,
|
||||
data.show_lnbits_wallets_balance,
|
||||
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
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,25 @@ async def m001_initial(db):
|
|||
wallet TEXT NOT NULL,
|
||||
lnbits_wallets TEXT,
|
||||
mempool_endpoint TEXT,
|
||||
sats_quote BOOL,
|
||||
exchange TEXT,
|
||||
onchain_stats BOOL,
|
||||
ln_stats BOOL
|
||||
show_lnbits_wallets_balance 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
|
||||
);
|
||||
"""
|
||||
)
|
||||
|
|
@ -12,10 +12,26 @@ class Gerty(BaseModel):
|
|||
wallet: str
|
||||
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
|
||||
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
|
||||
onchain_stats: bool = Query(False) # Onchain stats
|
||||
ln_stats: bool = Query(False) # ln Sats
|
||||
show_lnbits_wallets_balance: bool = Query(False)
|
||||
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
|
||||
def from_row(cls, row: Row) -> "Gerty":
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{% extends "base.html" %} {% from "macros.jinja" import window_vars with context
|
||||
%} {% block page %}
|
||||
{% extends "base.html" %} {% from "macros.jinja" import window_vars with context %} {% block page %}
|
||||
<div class="row q-col-gutter-md">
|
||||
<div class="col-12 col-md-8 col-lg-7 q-gutter-y-md">
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<q-btn unelevated color="primary" @click="formDialog.show = true"
|
||||
>New Gerty</q-btn
|
||||
>New Gerty
|
||||
</q-btn
|
||||
>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
|
@ -51,7 +51,9 @@
|
|||
type="a"
|
||||
:href="props.row.gerty"
|
||||
target="_blank"
|
||||
><q-tooltip>Launch software Gerty</q-tooltip></q-btn>
|
||||
>
|
||||
<q-tooltip>Launch software Gerty</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
unelevated
|
||||
dense
|
||||
|
|
@ -61,7 +63,9 @@
|
|||
type="a"
|
||||
:href="props.row.gertyJson"
|
||||
target="_blank"
|
||||
><q-tooltip>Launch software Gerty</q-tooltip></q-btn>
|
||||
>
|
||||
<q-tooltip>Launch software Gerty</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
{{ (col.name == 'tip_options' && col.value ?
|
||||
|
|
@ -139,7 +143,9 @@
|
|||
hide-dropdown-icon
|
||||
new-value-mode="add-unique"
|
||||
label="Invoice keys of wallets to watch"
|
||||
><q-tooltip>Hit enter to add values</q-tooltip></q-select>
|
||||
>
|
||||
<q-tooltip>Hit enter to add values</q-tooltip>
|
||||
</q-select>
|
||||
<q-select
|
||||
filled
|
||||
dense
|
||||
|
|
@ -153,19 +159,136 @@
|
|||
dense
|
||||
v-model.trim="formDialog.data.mempool_endpoint"
|
||||
label="Mempool link"
|
||||
><q-tooltip>Used for getting onchain/ln stats</q-tooltip></q-input>
|
||||
>
|
||||
<q-tooltip>Used for getting onchain/ln stats</q-tooltip>
|
||||
</q-input>
|
||||
|
||||
<p>Use the toggles below to control what your Gerty will display</p>
|
||||
<q-expansion-item
|
||||
expand-separator
|
||||
icon="perm_identity"
|
||||
label="LNbits wallets"
|
||||
>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.sats_quote"
|
||||
v-model="formDialog.data.show_lnbits_wallets_balance"
|
||||
label="Show LNbits wallet balances"
|
||||
></q-toggle>
|
||||
</q-expansion-item>
|
||||
<q-expansion-item
|
||||
expand-separator
|
||||
icon="celebration"
|
||||
label="The Fun Stuff"
|
||||
>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_sats_quote"
|
||||
label="Satoshi Quotes"
|
||||
><q-tooltip>Gets random quotes from satoshi</q-tooltip></q-toggle>
|
||||
>
|
||||
<q-tooltip>Displays random quotes from Satoshi</q-tooltip>
|
||||
</q-toggle>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.onchain_stats"
|
||||
label="Onchain Statistics"
|
||||
><q-tooltip>Gets Onchain Statistics</q-tooltip></q-toggle>
|
||||
v-model="formDialog.data.show_pieter_wuille_facts"
|
||||
label="Pieter Wuille Facts"
|
||||
>
|
||||
<q-tooltip>Show accurate facts about Pieter Wuille</q-tooltip>
|
||||
</q-toggle>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.ln_stats"
|
||||
label="LN Statistics"
|
||||
><q-tooltip>Gets Lightning-Network Statistics</q-tooltip></q-toggle>
|
||||
v-model="formDialog.data.show_exchange_market_rate"
|
||||
label="Current dirty fiat to BTC price"
|
||||
></q-toggle>
|
||||
</q-expansion-item>
|
||||
<q-expansion-item
|
||||
expand-separator
|
||||
icon="link"
|
||||
label="Onchain Information"
|
||||
>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_onchain_difficulty_epoch_progress"
|
||||
label="Percent of current difficulty epoch complete"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_onchain_difficulty_retarget_date"
|
||||
label="Estimated retarget date"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_onchain_difficulty_blocks_remaining"
|
||||
label="Blocks until next difficulty adjustment"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_onchain_difficulty_epoch_time_remaining"
|
||||
label="Estimated time until next difficulty adjustment"
|
||||
></q-toggle>
|
||||
</q-expansion-item>
|
||||
<q-expansion-item
|
||||
expand-separator
|
||||
icon="psychology"
|
||||
label="The Mempool"
|
||||
>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_onchain_mempool_recommended_fees"
|
||||
label="Recommended fees"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_onchain_mempool_number_of_tx"
|
||||
label="Number of transactions in the mempool"
|
||||
></q-toggle>
|
||||
</q-expansion-item>
|
||||
|
||||
<q-expansion-item
|
||||
expand-separator
|
||||
icon="reorder"
|
||||
label="Mining Data"
|
||||
>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_mining_current_hash_rate"
|
||||
label="Current mining hashrate"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_mining_current_difficulty"
|
||||
label="Current mining difficulty"
|
||||
></q-toggle>
|
||||
</q-expansion-item>
|
||||
|
||||
<q-expansion-item
|
||||
expand-separator
|
||||
icon="bolt"
|
||||
label="Lightning Network"
|
||||
>
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_lightning_channel_count"
|
||||
label="Channel count"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_lightning_node_count"
|
||||
label="Number of nodes"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_lightning_tor_node_count"
|
||||
label="Number of Tor nodes"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_lightning_clearnet_nodes"
|
||||
label="Number of clearnet nodes"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_lightning_unannounced_nodes"
|
||||
label="Number of unannounced nodes"
|
||||
></q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="formDialog.data.show_lightning_average_channel_capacity"
|
||||
label="Average channel capacity"
|
||||
></q-toggle>
|
||||
</q-expansion-item>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn
|
||||
unelevated
|
||||
|
|
@ -173,7 +296,8 @@
|
|||
:disable="formDialog.data.wallet == null || formDialog.data.name == null"
|
||||
type="submit"
|
||||
class="q-mr-md"
|
||||
>Create Gerty</q-btn
|
||||
>Create Gerty
|
||||
</q-btn
|
||||
>
|
||||
<q-btn
|
||||
v-if="formDialog.data.id"
|
||||
|
|
@ -181,10 +305,12 @@
|
|||
color="primary"
|
||||
:disable="formDialog.data.wallet == null || formDialog.data.name == null"
|
||||
type="submit"
|
||||
>Update Gerty</q-btn
|
||||
>Update Gerty
|
||||
</q-btn
|
||||
>
|
||||
<q-btn v-close-popup flat color="grey" class="q-ml-auto"
|
||||
>Cancel</q-btn
|
||||
>Cancel
|
||||
</q-btn
|
||||
>
|
||||
</div>
|
||||
</q-form>
|
||||
|
|
@ -431,21 +557,25 @@
|
|||
},
|
||||
formDialog: {
|
||||
show: false,
|
||||
data: {sats_quote: false,
|
||||
data: {
|
||||
sats_quote: false,
|
||||
onchain_stats: false,
|
||||
ln_stats: false,
|
||||
lnbits_wallets: [],
|
||||
mempool_endpoint: "https://mempool.space"}
|
||||
mempool_endpoint: "https://mempool.space"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
closeFormDialog: function () {
|
||||
this.formDialog.data = {sats_quote: false,
|
||||
this.formDialog.data = {
|
||||
sats_quote: false,
|
||||
onchain_stats: false,
|
||||
ln_stats: false,
|
||||
lnbits_wallets: [],
|
||||
mempool_endpoint: "https://mempool.space"}
|
||||
mempool_endpoint: "https://mempool.space"
|
||||
}
|
||||
},
|
||||
getGertys: function () {
|
||||
var self = this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue