Started move of gerty api calls into helpers.py
This commit is contained in:
parent
f828e4a641
commit
1280d3ba74
3 changed files with 9 additions and 8 deletions
|
|
@ -9,10 +9,8 @@ from lnbits.tasks import catch_everything_and_restart
|
|||
|
||||
db = Database("ext_gerty")
|
||||
|
||||
|
||||
gerty_ext: APIRouter = APIRouter(prefix="/gerty", tags=["Gerty"])
|
||||
|
||||
|
||||
def gerty_renderer():
|
||||
return template_renderer(["lnbits/extensions/gerty/templates"])
|
||||
|
||||
|
|
|
|||
7
lnbits/extensions/gerty/helpers.py
Normal file
7
lnbits/extensions/gerty/helpers.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import httpx
|
||||
|
||||
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")
|
||||
return r.json()
|
||||
|
|
@ -20,6 +20,8 @@ from lnbits.core.views.api import api_payment, api_wallet
|
|||
from lnbits.decorators import WalletTypeInfo, get_key_type, require_admin_key
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
from .helpers import *
|
||||
|
||||
from . import gerty_ext
|
||||
from .crud import create_gerty, update_gerty, delete_gerty, get_gerty, get_gertys
|
||||
from .models import Gerty
|
||||
|
|
@ -391,12 +393,6 @@ async def get_block_height(gerty):
|
|||
|
||||
return r.json()
|
||||
|
||||
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")
|
||||
return r.json()
|
||||
|
||||
|
||||
async def get_mempool_stat(stat_slug: str, gerty):
|
||||
text = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue