mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-25 07:07:48 +01:00
Added tx in mempool stat
This commit is contained in:
parent
9973e9dbbb
commit
f8ccb97d60
1 changed files with 15 additions and 1 deletions
|
@ -181,7 +181,7 @@ async def get_screen_text(screen_num: int, screens_list: dict, gerty):
|
|||
elif screen_slug == "mempool_recommended_fees":
|
||||
text = await get_placeholder_text()
|
||||
elif screen_slug == "mempool_tx_count":
|
||||
text = await get_placeholder_text()
|
||||
text = await get_mempool_stat(screen_slug, gerty)
|
||||
elif screen_slug == "mining_current_hash_rate":
|
||||
text = await get_placeholder_text()
|
||||
elif screen_slug == "mining_current_difficulty":
|
||||
|
@ -304,6 +304,20 @@ async def get_onchain_stat(stat_slug: str, gerty):
|
|||
text.append(get_text_item_dict("Blocks remaining until next difficulty adjustment", 16))
|
||||
return text
|
||||
|
||||
async def get_mempool_stat(stat_slug: str, gerty):
|
||||
text = []
|
||||
if isinstance(gerty.mempool_endpoint, str):
|
||||
async with httpx.AsyncClient() as client:
|
||||
if (
|
||||
stat_slug == "mempool_tx_count"
|
||||
):
|
||||
r = await client.get(gerty.mempool_endpoint + "/api/mempool")
|
||||
if stat_slug == "mempool_tx_count":
|
||||
stat = round(r.json()['count'])
|
||||
text.append(get_text_item_dict("{0}".format(format_number(stat)), 40))
|
||||
text.append(get_text_item_dict("Transactions in the mempool", 16))
|
||||
return text
|
||||
|
||||
def get_date_suffix(dayNumber):
|
||||
if 4 <= dayNumber <= 20 or 24 <= dayNumber <= 30:
|
||||
return "th"
|
||||
|
|
Loading…
Add table
Reference in a new issue