diff --git a/lnbits/extensions/gerty/crud.py b/lnbits/extensions/gerty/crud.py index 3850737f..1b179d50 100644 --- a/lnbits/extensions/gerty/crud.py +++ b/lnbits/extensions/gerty/crud.py @@ -15,19 +15,21 @@ async def create_gerty(wallet_id: str, data: Gerty) -> Gerty: name, wallet, utc_offset, + type, lnbits_wallets, mempool_endpoint, exchange, display_preferences, refresh_time ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) """, ( gerty_id, data.name, data.wallet, data.utc_offset, + data.type, data.lnbits_wallets, data.mempool_endpoint, data.exchange, diff --git a/lnbits/extensions/gerty/helpers.py b/lnbits/extensions/gerty/helpers.py index 4852fb58..991381b5 100644 --- a/lnbits/extensions/gerty/helpers.py +++ b/lnbits/extensions/gerty/helpers.py @@ -7,13 +7,13 @@ from loguru import logger from .number_prefixer import * -def get_percent_difference(current, previous, precision=4): +def get_percent_difference(current, previous, precision=3): difference = (current - previous) / current * 100 return "{0}{1}%".format("+" if difference > 0 else "", round(difference, precision)) # A helper function get a nicely formated dict for the text -def get_text_item_dict(text: str, font_size: int, x_pos: int = None, y_pos: int = None): +def get_text_item_dict(text: str, font_size: int, x_pos: int = None, y_pos: int = None, gerty_type: str = 'Gerty'): # Get line size by font size line_width = 20 if font_size <= 12: @@ -25,6 +25,21 @@ def get_text_item_dict(text: str, font_size: int, x_pos: int = None, y_pos: int elif font_size <= 40: line_width = 25 + # Get font sizes for Gerty mini + if(gerty_type.lower() == 'mini gerty'): + if font_size <= 12: + font_size = 1 + if font_size <= 15: + font_size = 1 + elif font_size <= 20: + font_size = 2 + elif font_size <= 40: + font_size = 2 + else: + font_size = 5 + + + # wrap the text wrapper = textwrap.TextWrapper(width=line_width) word_list = wrapper.wrap(text=text) @@ -68,18 +83,18 @@ async def get_mining_dashboard(gerty): hashrateOneWeekAgo = data["hashrates"][6]["avgHashrate"] text = [] - text.append(get_text_item_dict("Current mining hashrate", 12)) + text.append(get_text_item_dict(text="Current mining hashrate", font_size=12,gerty_type=gerty.type)) text.append( get_text_item_dict( - "{0}hash".format(si_format(hashrateNow, 6, True, " ")), 20 + text="{0}hash".format(si_format(hashrateNow, 6, True, " ")), font_size=20,gerty_type=gerty.type ) ) text.append( get_text_item_dict( - "{0} vs 7 days ago".format( + text="{0} vs 7 days ago".format( get_percent_difference(hashrateNow, hashrateOneWeekAgo, 3) ), - 12, + font_size=12,gerty_type=gerty.type ) ) areas.append(text) @@ -91,27 +106,27 @@ async def get_mining_dashboard(gerty): # timeAvg text = [] progress = "{0}%".format(round(r.json()["progressPercent"], 2)) - text.append(get_text_item_dict("Progress through current epoch", 12)) - text.append(get_text_item_dict(progress, 60)) + text.append(get_text_item_dict(text="Progress through current epoch", font_size=12,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=progress, font_size=60,gerty_type=gerty.type)) areas.append(text) # difficulty adjustment text = [] stat = r.json()["remainingTime"] - text.append(get_text_item_dict("Time to next difficulty adjustment", 12)) - text.append(get_text_item_dict(get_time_remaining(stat / 1000, 3), 12)) + text.append(get_text_item_dict(text="Time to next difficulty adjustment", font_size=12,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=get_time_remaining(stat / 1000, 3), font_size=12,gerty_type=gerty.type)) areas.append(text) # difficultyChange text = [] difficultyChange = round(r.json()["difficultyChange"], 2) - text.append(get_text_item_dict("Estimated difficulty change", 12)) + text.append(get_text_item_dict(text="Estimated difficulty change", font_size=12,gerty_type=gerty.type)) text.append( get_text_item_dict( - "{0}{1}%".format( + text="{0}{1}%".format( "+" if difficultyChange > 0 else "", round(difficultyChange, 2) ), - 60, + font_size=60,gerty_type=gerty.type ) ) areas.append(text) @@ -142,49 +157,49 @@ async def get_lightning_stats(gerty): areas = [] text = [] - text.append(get_text_item_dict("Channel Count", 12)) - text.append(get_text_item_dict(format_number(data["latest"]["channel_count"]), 20)) + text.append(get_text_item_dict(text="Channel Count", font_size=12, gerty_type=gerty.type)) + text.append(get_text_item_dict(text=format_number(data["latest"]["channel_count"]), font_size=20, gerty_type=gerty.type)) difference = get_percent_difference( current=data["latest"]["channel_count"], previous=data["previous"]["channel_count"], ) - text.append(get_text_item_dict("{0} in last 7 days".format(difference), 12)) + text.append(get_text_item_dict(text="{0} in last 7 days".format(difference), font_size=12, gerty_type=gerty.type)) areas.append(text) text = [] - text.append(get_text_item_dict("Number of Nodes", 12)) - text.append(get_text_item_dict(format_number(data["latest"]["node_count"]), 20)) + text.append(get_text_item_dict(text="Number of Nodes", font_size=12,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=format_number(data["latest"]["node_count"]), font_size=20,gerty_type=gerty.type)) difference = get_percent_difference( current=data["latest"]["node_count"], previous=data["previous"]["node_count"] ) - text.append(get_text_item_dict("{0} in last 7 days".format(difference), 12)) + text.append(get_text_item_dict(text="{0} in last 7 days".format(difference), font_size=12,gerty_type=gerty.type)) areas.append(text) text = [] - text.append(get_text_item_dict("Total Capacity", 12)) + text.append(get_text_item_dict(text="Total Capacity", font_size=12,gerty_type=gerty.type)) avg_capacity = float(data["latest"]["total_capacity"]) / float(100000000) text.append( - get_text_item_dict("{0} BTC".format(format_number(avg_capacity, 2)), 20) + get_text_item_dict(text="{0} BTC".format(format_number(avg_capacity, 2)), font_size=20,gerty_type=gerty.type) ) difference = get_percent_difference( current=data["latest"]["total_capacity"], previous=data["previous"]["total_capacity"], ) - text.append(get_text_item_dict("{0} in last 7 days".format(difference), 12)) + text.append(get_text_item_dict(text="{0} in last 7 days".format(difference), font_size=12,gerty_type=gerty.type)) areas.append(text) text = [] - text.append(get_text_item_dict("Average Channel Capacity", 12)) + text.append(get_text_item_dict(text="Average Channel Capacity", font_size=12,gerty_type=gerty.type)) text.append( get_text_item_dict( - "{0} sats".format(format_number(data["latest"]["avg_capacity"])), 20 + text="{0} sats".format(format_number(data["latest"]["avg_capacity"])), font_size=20,gerty_type=gerty.type ) ) difference = get_percent_difference( current=data["latest"]["avg_capacity"], previous=data["previous"]["avg_capacity"], ) - text.append(get_text_item_dict("{0} in last 7 days".format(difference), 12)) + text.append(get_text_item_dict(text="{0} in last 7 days".format(difference), font_size=12, gerty_type=gerty.type)) areas.append(text) return areas @@ -247,17 +262,17 @@ async def get_mining_stat(stat_slug: str, gerty): stat = await api_get_mining_stat(stat_slug, gerty) logger.debug(stat) current = "{0}hash".format(si_format(stat['current'], 6, True, " ")) - text.append(get_text_item_dict("Current Mining Hashrate", 20)) - text.append(get_text_item_dict(current, 40)) + text.append(get_text_item_dict(text="Current Mining Hashrate", font_size=20,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=current, font_size=40,gerty_type=gerty.type)) # compare vs previous time period difference = get_percent_difference(current=stat['current'], previous=stat['1w']) - text.append(get_text_item_dict("{0} in last 7 days".format(difference), 12)) + text.append(get_text_item_dict(text="{0} in last 7 days".format(difference), font_size=12,gerty_type=gerty.type)) elif stat_slug == "mining_current_difficulty": stat = await api_get_mining_stat(stat_slug, gerty) - text.append(get_text_item_dict("Current Mining Difficulty", 20)) - text.append(get_text_item_dict(format_number(stat['current']), 40)) + text.append(get_text_item_dict(text="Current Mining Difficulty", font_size=20,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=format_number(stat['current']), font_size=40,gerty_type=gerty.type)) difference = get_percent_difference(current=stat['current'], previous=stat['previous']) - text.append(get_text_item_dict("{0} since last adjustment".format(difference), 12)) + text.append(get_text_item_dict(text="{0} since last adjustment".format(difference), font_size=12,gerty_type=gerty.type)) # text.append(get_text_item_dict("Required threshold for mining proof-of-work", 12)) return text diff --git a/lnbits/extensions/gerty/migrations.py b/lnbits/extensions/gerty/migrations.py index e98fc4f2..b283ee56 100644 --- a/lnbits/extensions/gerty/migrations.py +++ b/lnbits/extensions/gerty/migrations.py @@ -23,3 +23,9 @@ async def m002_add_utc_offset_col(db): support for UTC offset """ await db.execute("ALTER TABLE gerty.gertys ADD COLUMN utc_offset INT;") + +async def m003_add_gerty_model_col(db): + """ + support for Gerty model col + """ + await db.execute("ALTER TABLE gerty.gertys ADD COLUMN type TEXT;") \ No newline at end of file diff --git a/lnbits/extensions/gerty/models.py b/lnbits/extensions/gerty/models.py index 855a30c9..44704f82 100644 --- a/lnbits/extensions/gerty/models.py +++ b/lnbits/extensions/gerty/models.py @@ -11,6 +11,7 @@ class Gerty(BaseModel): wallet: str refresh_time: int = Query(None) utc_offset: int = Query(None) + type: str lnbits_wallets: str = Query( None ) # Wallets to keep an eye on, {"wallet-id": "wallet-read-key, etc"} diff --git a/lnbits/extensions/gerty/templates/gerty/index.html b/lnbits/extensions/gerty/templates/gerty/index.html index 55e67a2d..db3dd7e6 100644 --- a/lnbits/extensions/gerty/templates/gerty/index.html +++ b/lnbits/extensions/gerty/templates/gerty/index.html @@ -127,6 +127,14 @@ label="Name" placeholder="Son of Gerty" > + Use the toggles below to control what your Gerty will display

+ - - Displays random quotes from Satoshi - - - + + + Displays random quotes from Satoshi + + @@ -583,6 +599,7 @@ show: false, data: { utc_offset: 0, + type: 'Gerty', display_preferences: { dashboard: true, fun_satoshi_quotes: true, @@ -596,6 +613,7 @@ onchain_difficulty_retarget_date: true, onchain_difficulty_blocks_remaining: true, onchain_difficulty_epoch_time_remaining: true, + onchain_block_height: true, mempool_tx_count: true, mining_current_hash_rate: true, mining_current_difficulty: true, @@ -619,6 +637,7 @@ lnbits_wallets: [], mempool_endpoint: "https://mempool.space", refresh_time: 300, + type: 'Gerty', display_preferences: {}, } }, @@ -641,6 +660,7 @@ console.log('gerty.display_preferences', gerty.display_preferences) this.formDialog.data.id = gerty.id this.formDialog.data.name = gerty.name + this.formDialog.data.type = gerty.type this.formDialog.data.wallet = gerty.wallet this.formDialog.data.utc_offset = gerty.utc_offset this.formDialog.data.lnbits_wallets = JSON.parse(gerty.lnbits_wallets) @@ -669,6 +689,7 @@ name: this.formDialog.data.name, wallet: this.formDialog.data.wallet, utc_offset: this.formDialog.data.utc_offset, + type: this.formDialog.data.type, lnbits_wallets: JSON.stringify(this.formDialog.data.lnbits_wallets), exchange: this.formDialog.data.exchange, mempool_endpoint: this.formDialog.data.mempool_endpoint, @@ -697,6 +718,7 @@ updateGerty: function (wallet, data) { var self = this data.utc_offset = this.formDialog.data.utc_offset + data.type = this.formDialog.data.type data.lnbits_wallets = JSON.stringify(this.formDialog.data.lnbits_wallets) data.display_preferences = JSON.stringify(this.formDialog.data.display_preferences) LNbits.api @@ -744,12 +766,30 @@ LNbits.utils.exportCSV(this.gertysTable.columns, this.gertys) } }, + computed: { + isMiniGerty() { + return (this.formDialog.data.type == 'Mini Gerty') + } + }, created: function () { if (this.g.user.wallets.length) { this.getGertys() } }, watch: { + 'formDialog.data.type': { + handler(value) { + if (value == 'Mini Gerty') { + this.formDialog.data.display_preferences.dashboard = false; + this.formDialog.data.display_preferences.dashboard_onchain = false; + this.formDialog.data.display_preferences.dashboard_mining = false; + this.formDialog.data.display_preferences.lightning_dashboard = false; + this.formDialog.data.display_preferences.fun_satoshi_quotes = false; + this.formDialog.data.display_preferences.mempool_recommended_fees = false; + this.formDialog.data.display_preferences.onchain = false; + } + } + }, toggleStates: { handler(toggleStatesValue) { // Switch all the toggles in each section to the relevant state diff --git a/lnbits/extensions/gerty/views_api.py b/lnbits/extensions/gerty/views_api.py index 2eea366c..43c6e29a 100644 --- a/lnbits/extensions/gerty/views_api.py +++ b/lnbits/extensions/gerty/views_api.py @@ -177,15 +177,20 @@ async def get_screen_data(screen_num: int, screens_list: dict, gerty): wallets = await get_lnbits_wallet_balances(gerty) text = [] for wallet in wallets: - text.append(get_text_item_dict("{0}'s Wallet".format(wallet['name']), 20)) - text.append(get_text_item_dict("{0} sats".format(format_number(wallet['balance'])), 40)) + text.append(get_text_item_dict(text="{0}'s Wallet".format(wallet['name']), font_size=20,gerty_type=gerty.type)) + text.append(get_text_item_dict(text="{0} sats".format(format_number(wallet['balance'])), font_size=40,gerty_type=gerty.type)) areas.append(text) elif screen_slug == "fun_satoshi_quotes": - areas.append(await get_satoshi_quotes()) + areas.append(await get_satoshi_quotes(gerty)) elif screen_slug == "fun_exchange_market_rate": areas.append(await get_exchange_rate(gerty)) elif screen_slug == "onchain_difficulty_epoch_progress": areas.append(await get_onchain_stat(screen_slug, gerty)) + elif screen_slug == "onchain_block_height": + logger.debug("iam block height") + text = [] + text.append(get_text_item_dict(text=format_number(await get_block_height(gerty)), font_size=80, gerty_type=gerty.type)) + areas.append(text) elif screen_slug == "onchain_difficulty_retarget_date": areas.append(await get_onchain_stat(screen_slug, gerty)) elif screen_slug == "onchain_difficulty_blocks_remaining": @@ -223,34 +228,34 @@ async def get_dashboard(gerty): # XC rate text = [] amount = await satoshis_amount_as_fiat(100000000, gerty.exchange) - text.append(get_text_item_dict(format_number(amount), 40)) - text.append(get_text_item_dict("BTC{0} price".format(gerty.exchange), 15)) + text.append(get_text_item_dict(text=format_number(amount), font_size=40,gerty_type=gerty.type)) + text.append(get_text_item_dict(text="BTC{0} price".format(gerty.exchange), font_size=15,gerty_type=gerty.type)) areas.append(text) # balance text = [] wallets = await get_lnbits_wallet_balances(gerty) text = [] for wallet in wallets: - text.append(get_text_item_dict("{0}".format(wallet["name"]), 15)) + text.append(get_text_item_dict(text="{0}".format(wallet["name"]), font_size=15,gerty_type=gerty.type)) text.append( - get_text_item_dict("{0} sats".format(format_number(wallet["balance"])), 20) + get_text_item_dict(text="{0} sats".format(format_number(wallet["balance"])), font_size=20,gerty_type=gerty.type) ) areas.append(text) # Mempool fees text = [] - text.append(get_text_item_dict(format_number(await get_block_height(gerty)), 40)) - text.append(get_text_item_dict("Current block height", 15)) + text.append(get_text_item_dict(text=format_number(await get_block_height(gerty)), font_size=40,gerty_type=gerty.type)) + text.append(get_text_item_dict(text="Current block height", font_size=15,gerty_type=gerty.type)) areas.append(text) # difficulty adjustment time text = [] text.append( get_text_item_dict( - await get_time_remaining_next_difficulty_adjustment(gerty), 15 + text=await get_time_remaining_next_difficulty_adjustment(gerty), font_size=15,gerty_type=gerty.type ) ) - text.append(get_text_item_dict("until next difficulty adjustment", 12)) + text.append(get_text_item_dict(text="until next difficulty adjustment", font_size=12,gerty_type=gerty.type)) areas.append(text) return areas @@ -276,21 +281,21 @@ async def get_lnbits_wallet_balances(gerty): async def get_placeholder_text(): return [ - get_text_item_dict("Some placeholder text", 15, 10, 50), - get_text_item_dict("Some placeholder text", 15, 10, 50), + get_text_item_dict(text="Some placeholder text", x_pos=15, y_pos=10, font_size=50,gerty_type=gerty.type), + get_text_item_dict(text="Some placeholder text", x_pos=15, y_pos=10, font_size=50,gerty_type=gerty.type), ] -async def get_satoshi_quotes(): +async def get_satoshi_quotes(gerty): # Get Satoshi quotes text = [] quote = await api_gerty_satoshi() if quote: if quote["text"]: - text.append(get_text_item_dict(quote["text"], 15)) + text.append(get_text_item_dict(text=quote["text"], font_size=15,gerty_type=gerty.type)) if quote["date"]: text.append( - get_text_item_dict("Satoshi Nakamoto - {0}".format(quote["date"]), 15) + get_text_item_dict(text="Satoshi Nakamoto - {0}".format(quote["date"]), font_size=15,gerty_type=gerty.type) ) return text @@ -305,10 +310,10 @@ async def get_exchange_rate(gerty): price = format_number(amount) text.append( get_text_item_dict( - "Current {0}/BTC price".format(gerty.exchange), 15 + text="Current {0}/BTC price".format(gerty.exchange), font_size=15,gerty_type=gerty.type ) ) - text.append(get_text_item_dict(price, 80)) + text.append(get_text_item_dict(text=price, font_size=80,gerty_type=gerty.type)) except: pass return text @@ -320,26 +325,27 @@ async def get_onchain_stat(stat_slug: str, gerty): stat_slug == "onchain_difficulty_retarget_date" or stat_slug == "onchain_difficulty_blocks_remaining" or stat_slug == "onchain_difficulty_epoch_time_remaining" + ): async with httpx.AsyncClient() as client: r = await client.get(gerty.mempool_endpoint + "/api/v1/difficulty-adjustment") if stat_slug == "onchain_difficulty_epoch_progress": stat = round(r.json()['progressPercent']) - text.append(get_text_item_dict("Progress through current difficulty epoch", 15)) - text.append(get_text_item_dict("{0}%".format(stat), 80)) + text.append(get_text_item_dict(text="Progress through current difficulty epoch", font_size=15,gerty_type=gerty.type)) + text.append(get_text_item_dict(text="{0}%".format(stat), font_size=80,gerty_type=gerty.type)) elif stat_slug == "onchain_difficulty_retarget_date": stat = r.json()['estimatedRetargetDate'] dt = datetime.fromtimestamp(stat / 1000).strftime("%e %b %Y at %H:%M") - text.append(get_text_item_dict("Estimated date of next difficulty adjustment", 15)) - text.append(get_text_item_dict(dt, 40)) + text.append(get_text_item_dict(text="Date of next difficulty adjustment", font_size=15,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=dt, font_size=40,gerty_type=gerty.type)) elif stat_slug == "onchain_difficulty_blocks_remaining": stat = r.json()['remainingBlocks'] - text.append(get_text_item_dict("Blocks remaining until next difficulty adjustment", 15)) - text.append(get_text_item_dict("{0}".format(format_number(stat)), 80)) + text.append(get_text_item_dict(text="Blocks until next difficulty adjustment", font_size=15,gerty_type=gerty.type)) + text.append(get_text_item_dict(text="{0}".format(format_number(stat)), font_size=80,gerty_type=gerty.type)) elif stat_slug == "onchain_difficulty_epoch_time_remaining": stat = r.json()['remainingTime'] - text.append(get_text_item_dict("Blocks remaining until next difficulty adjustment", 15)) - text.append(get_text_item_dict(get_time_remaining(stat / 1000, 4), 20)) + text.append(get_text_item_dict(text="Time until next difficulty adjustment", font_size=15,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=get_time_remaining(stat / 1000, 4), font_size=20,gerty_type=gerty.type)) return text async def get_onchain_dashboard(gerty): @@ -351,27 +357,27 @@ async def get_onchain_dashboard(gerty): ) text = [] stat = round(r.json()["progressPercent"]) - text.append(get_text_item_dict("Progress through epoch", 12)) - text.append(get_text_item_dict("{0}%".format(stat), 60)) + text.append(get_text_item_dict(text="Progress through epoch", font_size=12,gerty_type=gerty.type)) + text.append(get_text_item_dict(text="{0}%".format(stat), font_size=60,gerty_type=gerty.type)) areas.append(text) text = [] stat = r.json()["estimatedRetargetDate"] dt = datetime.fromtimestamp(stat / 1000).strftime("%e %b %Y at %H:%M") - text.append(get_text_item_dict("Date of next adjustment", 12)) - text.append(get_text_item_dict(dt, 20)) + text.append(get_text_item_dict(text="Date of next adjustment", font_size=12,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=dt, font_size=20,gerty_type=gerty.type)) areas.append(text) text = [] stat = r.json()["remainingBlocks"] - text.append(get_text_item_dict("Blocks until adjustment", 12)) - text.append(get_text_item_dict("{0}".format(format_number(stat)), 60)) + text.append(get_text_item_dict(text="Blocks until adjustment", font_size=12,gerty_type=gerty.type)) + text.append(get_text_item_dict(text="{0}".format(format_number(stat)), font_size=60,gerty_type=gerty.type)) areas.append(text) text = [] stat = r.json()["remainingTime"] - text.append(get_text_item_dict("Time until adjustment", 12)) - text.append(get_text_item_dict(get_time_remaining(stat / 1000, 4), 20)) + text.append(get_text_item_dict(text="Time until adjustment", font_size=12,gerty_type=gerty.type)) + text.append(get_text_item_dict(text=get_time_remaining(stat / 1000, 4), font_size=20,gerty_type=gerty.type)) areas.append(text) return areas @@ -404,30 +410,30 @@ async def get_mempool_stat(stat_slug: str, gerty): 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("Transactions in the mempool", 15)) + text.append(get_text_item_dict(text="Transactions in the mempool", font_size=15,gerty_type=gerty.type)) text.append( - get_text_item_dict("{0}".format(format_number(stat)), 80) + get_text_item_dict(text="{0}".format(format_number(stat)), font_size=80,gerty_type=gerty.type) ) elif stat_slug == "mempool_recommended_fees": y_offset = 60 fees = await get_mempool_recommended_fees(gerty) pos_y = 80 + y_offset - text.append(get_text_item_dict("mempool.space", 40, 160, pos_y)) + text.append(get_text_item_dict("mempool.space", 40, 160, pos_y, gerty.type)) pos_y = 180 + y_offset - text.append(get_text_item_dict("Recommended Tx Fees", 20, 240, pos_y)) + text.append(get_text_item_dict("Recommended Tx Fees", 20, 240, pos_y, gerty.type)) pos_y = 280 + y_offset text.append( - get_text_item_dict("{0}".format("None"), 15, 30, pos_y) + get_text_item_dict("{0}".format("None"), 15, 30, pos_y, gerty.type) ) text.append( - get_text_item_dict("{0}".format("Low"), 15, 235, pos_y) + get_text_item_dict("{0}".format("Low"), 15, 235, pos_y, gerty.type) ) text.append( - get_text_item_dict("{0}".format("Medium"), 15, 460, pos_y) + get_text_item_dict("{0}".format("Medium"), 15, 460, pos_y, gerty.type) ) text.append( - get_text_item_dict("{0}".format("High"), 15, 750, pos_y) + get_text_item_dict("{0}".format("High"), 15, 750, pos_y, gerty.type) ) pos_y = 340 + y_offset @@ -436,56 +442,60 @@ async def get_mempool_stat(stat_slug: str, gerty): fee_rate = fees["economyFee"] text.append( get_text_item_dict( - "{0} {1}{2}".format( + text="{0} {1}{2}".format( format_number(fee_rate), ("sat" if fee_rate == 1 else "sats"), fee_append, ), - font_size, - 30, - pos_y, + font_size=font_size, + x_pos=30, + y_pos=pos_y, + gerty_type=gerty.type ) ) fee_rate = fees["hourFee"] text.append( get_text_item_dict( - "{0} {1}{2}".format( + text="{0} {1}{2}".format( format_number(fee_rate), ("sat" if fee_rate == 1 else "sats"), fee_append, ), - font_size, - 235, - pos_y, + font_size=font_size, + x_pos=235, + y_pos=pos_y, + gerty_type=gerty.type ) ) fee_rate = fees["halfHourFee"] text.append( get_text_item_dict( - "{0} {1}{2}".format( + text="{0} {1}{2}".format( format_number(fee_rate), ("sat" if fee_rate == 1 else "sats"), fee_append, ), - font_size, - 460, - pos_y, + font_size=font_size, + x_pos=460, + y_pos=pos_y, + gerty_type=gerty.type ) ) fee_rate = fees["fastestFee"] text.append( get_text_item_dict( - "{0} {1}{2}".format( + text="{0} {1}{2}".format( format_number(fee_rate), ("sat" if fee_rate == 1 else "sats"), fee_append, ), - font_size, - 750, - pos_y, + font_size=font_size, + x_pos=750, + y_pos=pos_y, + gerty_type=gerty.type ) ) return text