Laid out mempool.space fees page
This commit is contained in:
parent
9efe15a699
commit
f828e4a641
16 changed files with 42 additions and 64 deletions
|
|
@ -5,7 +5,7 @@ import json
|
|||
import time
|
||||
from http import HTTPStatus
|
||||
from io import BytesIO
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
from typing import Dict, Optional, Tuple, Union
|
||||
from urllib.parse import ParseResult, parse_qs, urlencode, urlparse, urlunparse
|
||||
|
||||
import httpx
|
||||
|
|
@ -17,7 +17,7 @@ from loguru import logger
|
|||
from pydantic import BaseModel
|
||||
from pydantic.fields import Field
|
||||
from sse_starlette.sse import EventSourceResponse
|
||||
from starlette.responses import HTMLResponse, StreamingResponse
|
||||
from starlette.responses import StreamingResponse
|
||||
|
||||
from lnbits import bolt11, lnurl
|
||||
from lnbits.core.models import Payment, Wallet
|
||||
|
|
@ -34,7 +34,6 @@ from lnbits.utils.exchange_rates import (
|
|||
fiat_amount_as_satoshis,
|
||||
satoshis_amount_as_fiat,
|
||||
)
|
||||
|
||||
from .. import core_app, db
|
||||
from ..crud import (
|
||||
create_payment,
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ from lnbits.settings import (
|
|||
LNBITS_SITE_TITLE,
|
||||
SERVICE_FEE,
|
||||
)
|
||||
|
||||
from ...helpers import get_valid_extensions
|
||||
from ..crud import (
|
||||
create_account,
|
||||
create_wallet,
|
||||
|
|
@ -34,6 +32,7 @@ from ..crud import (
|
|||
update_user_extension,
|
||||
)
|
||||
from ..services import pay_invoice, redeem_lnurl_withdraw
|
||||
from ...helpers import get_valid_extensions
|
||||
|
||||
core_html_routes: APIRouter = APIRouter(tags=["Core NON-API Website Routes"])
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@ from urllib.parse import urlparse
|
|||
from fastapi import HTTPException
|
||||
from loguru import logger
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import HTMLResponse
|
||||
|
||||
from lnbits import bolt11
|
||||
|
||||
from .. import core_app
|
||||
from ..crud import get_standalone_payment
|
||||
from ..tasks import api_invoice_listeners
|
||||
|
|
|
|||
|
|
@ -395,14 +395,7 @@ async def get_mempool_recommended_fees(gerty):
|
|||
if isinstance(gerty.mempool_endpoint, str):
|
||||
async with httpx.AsyncClient() as client:
|
||||
r = await client.get(gerty.mempool_endpoint + "/api/v1/fees/recommended")
|
||||
logger.debug('fees')
|
||||
logger.debug(r)
|
||||
return {
|
||||
# "high": r.fastestFee,
|
||||
# "medium": r.halfHourFee,
|
||||
# "low": r.hourFee,
|
||||
# "none": r.economyFee,
|
||||
}
|
||||
return r.json()
|
||||
|
||||
|
||||
async def get_mempool_stat(stat_slug: str, gerty):
|
||||
|
|
@ -420,8 +413,41 @@ async def get_mempool_stat(stat_slug: str, gerty):
|
|||
elif (
|
||||
stat_slug == "mempool_recommended_fees"
|
||||
):
|
||||
y_offset = 60
|
||||
fees = await get_mempool_recommended_fees(gerty)
|
||||
logger.debug(fees)
|
||||
pos_y = 80 + y_offset
|
||||
text.append(get_text_item_dict("mempool.space", 40, 160, pos_y))
|
||||
pos_y = 180 + y_offset
|
||||
text.append(get_text_item_dict("Recommended Tx Fees", 20, 240, pos_y))
|
||||
|
||||
pos_y = 280 + y_offset
|
||||
text.append(get_text_item_dict("{0}".format("No Priority"), 15, 30, pos_y))
|
||||
text.append(get_text_item_dict("{0}".format("Low Priority"), 15, 235, pos_y))
|
||||
text.append(get_text_item_dict("{0}".format("Medium Priority"), 15, 460, pos_y))
|
||||
text.append(get_text_item_dict("{0}".format("High Priority"), 15, 750, pos_y))
|
||||
|
||||
pos_y = 340 + y_offset
|
||||
font_size = 15
|
||||
fee_append = "/vB"
|
||||
fee_rate = fees["economyFee"]
|
||||
text.append(get_text_item_dict(
|
||||
"{0} {1}{2}".format(format_number(fee_rate), ("sat" if fee_rate == 1 else "sats"), fee_append), font_size,
|
||||
30, pos_y))
|
||||
|
||||
fee_rate = fees["hourFee"]
|
||||
text.append(get_text_item_dict(
|
||||
"{0} {1}{2}".format(format_number(fee_rate), ("sat" if fee_rate == 1 else "sats"), fee_append), font_size,
|
||||
235, pos_y))
|
||||
|
||||
fee_rate = fees["halfHourFee"]
|
||||
text.append(get_text_item_dict(
|
||||
"{0} {1}{2}".format(format_number(fee_rate), ("sat" if fee_rate == 1 else "sats"), fee_append), font_size,
|
||||
460, pos_y))
|
||||
|
||||
fee_rate = fees["fastestFee"]
|
||||
text.append(get_text_item_dict(
|
||||
"{0} {1}{2}".format(format_number(fee_rate), ("sat" if fee_rate == 1 else "sats"), fee_append), font_size,
|
||||
750, pos_y))
|
||||
return text
|
||||
|
||||
def get_date_suffix(dayNumber):
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
import asyncio
|
||||
from typing import Tuple
|
||||
|
||||
import pytest_asyncio
|
||||
from httpx import AsyncClient
|
||||
|
||||
from lnbits.app import create_app
|
||||
from lnbits.commands import migrate_databases
|
||||
from lnbits.core.crud import create_account, create_wallet, get_wallet
|
||||
from lnbits.core.models import BalanceCheck, Payment, User, Wallet
|
||||
from lnbits.core.crud import create_account, create_wallet
|
||||
from lnbits.core.views.api import CreateInvoiceData, api_payments_create_invoice
|
||||
from lnbits.db import Database
|
||||
from lnbits.settings import HOST, PORT
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
import hashlib
|
||||
from binascii import hexlify
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from lnbits import bolt11
|
||||
from lnbits.core.crud import get_wallet
|
||||
from lnbits.core.views.api import (
|
||||
CreateInvoiceData,
|
||||
api_payment,
|
||||
api_payments_create_invoice,
|
||||
)
|
||||
from lnbits.settings import wallet_class
|
||||
|
||||
from ...helpers import get_random_invoice_data, is_regtest
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from tests.conftest import client
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from lnbits.core.crud import get_wallet
|
||||
|
||||
|
||||
# check if the client is working
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import json
|
||||
import secrets
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from lnbits.core.crud import create_account, create_wallet
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import secrets
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from lnbits.core.crud import get_wallet
|
||||
from lnbits.extensions.bleskomat.crud import get_bleskomat_lnurl
|
||||
|
|
@ -10,8 +9,6 @@ from lnbits.extensions.bleskomat.helpers import (
|
|||
query_to_signing_payload,
|
||||
)
|
||||
from lnbits.settings import HOST, PORT
|
||||
from tests.conftest import client
|
||||
from tests.extensions.bleskomat.conftest import bleskomat, lnurl
|
||||
from tests.helpers import credit_wallet, is_regtest
|
||||
from tests.mocks import WALLET
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,9 @@
|
|||
import asyncio
|
||||
import json
|
||||
import secrets
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from lnbits.core.crud import create_account, create_wallet, get_wallet
|
||||
from lnbits.extensions.boltz.boltz import create_reverse_swap, create_swap
|
||||
from lnbits.extensions.boltz.boltz import create_reverse_swap
|
||||
from lnbits.extensions.boltz.models import (
|
||||
CreateReverseSubmarineSwap,
|
||||
CreateSubmarineSwap,
|
||||
)
|
||||
from tests.mocks import WALLET
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="session")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from tests.helpers import is_fake, is_regtest
|
||||
from tests.helpers import is_fake
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -1,17 +1,10 @@
|
|||
import asyncio
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from lnbits.extensions.boltz.boltz import create_reverse_swap, create_swap
|
||||
from lnbits.extensions.boltz.crud import (
|
||||
create_reverse_submarine_swap,
|
||||
create_submarine_swap,
|
||||
get_reverse_submarine_swap,
|
||||
get_submarine_swap,
|
||||
)
|
||||
from tests.extensions.boltz.conftest import reverse_swap
|
||||
from tests.helpers import is_fake, is_regtest
|
||||
from tests.helpers import is_fake
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from lnbits.core.crud import create_account, create_wallet
|
||||
|
|
|
|||
|
|
@ -1,12 +1,4 @@
|
|||
import pytest
|
||||
import pytest_asyncio
|
||||
from loguru import logger
|
||||
|
||||
from lnbits.core.crud import get_wallet
|
||||
from tests.conftest import adminkey_headers_from, client, invoice
|
||||
from tests.extensions.invoices.conftest import accounting_invoice, invoices_wallet
|
||||
from tests.helpers import credit_wallet
|
||||
from tests.mocks import WALLET
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ from lnbits import bolt11
|
|||
from lnbits.settings import WALLET
|
||||
from lnbits.wallets.base import PaymentResponse, PaymentStatus, StatusResponse
|
||||
from lnbits.wallets.fake import FakeWallet
|
||||
|
||||
from .helpers import get_random_string, is_fake
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue