clean up (black, sort)
This commit is contained in:
parent
762f0ba404
commit
70885ce160
25 changed files with 85 additions and 138 deletions
|
|
@ -1,10 +1,7 @@
|
||||||
import asyncio
|
from fastapi import APIRouter
|
||||||
from fastapi import APIRouter, FastAPI
|
|
||||||
from fastapi.staticfiles import StaticFiles
|
|
||||||
from starlette.routing import Mount
|
|
||||||
from lnbits.db import Database
|
from lnbits.db import Database
|
||||||
from lnbits.helpers import template_renderer
|
from lnbits.helpers import template_renderer
|
||||||
from lnbits.tasks import catch_everything_and_restart
|
|
||||||
|
|
||||||
db = Database("ext_lndhub")
|
db = Database("ext_lndhub")
|
||||||
|
|
||||||
|
|
@ -15,7 +12,7 @@ def lndhub_renderer():
|
||||||
return template_renderer(["lnbits/extensions/lndhub/templates"])
|
return template_renderer(["lnbits/extensions/lndhub/templates"])
|
||||||
|
|
||||||
|
|
||||||
from .views_api import * # noqa
|
|
||||||
from .views import * # noqa
|
|
||||||
from .utils import * # noqa
|
|
||||||
from .decorators import * # noqa
|
from .decorators import * # noqa
|
||||||
|
from .utils import * # noqa
|
||||||
|
from .views import * # noqa
|
||||||
|
from .views_api import * # noqa
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
from functools import wraps
|
|
||||||
from fastapi.param_functions import Security
|
from fastapi.param_functions import Security
|
||||||
|
|
||||||
from fastapi.security.api_key import APIKeyHeader
|
from fastapi.security.api_key import APIKeyHeader
|
||||||
|
|
||||||
from lnbits.core.crud import get_wallet_for_key
|
|
||||||
from fastapi import Request, status
|
from fastapi import Request, status
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
from starlette.responses import HTMLResponse, JSONResponse
|
|
||||||
|
|
||||||
from lnbits.decorators import WalletTypeInfo, get_key_type # type: ignore
|
from lnbits.decorators import WalletTypeInfo, get_key_type # type: ignore
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from lnbits.decorators import check_user_exists
|
from lnbits.decorators import check_user_exists
|
||||||
from . import lndhub_ext, lndhub_renderer
|
from . import lndhub_ext, lndhub_renderer
|
||||||
from fastapi import FastAPI, Request
|
from fastapi import Request
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
from lnbits.core.models import User
|
from lnbits.core.models import User
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,8 @@ from .decorators import check_wallet, require_admin_key
|
||||||
from .utils import to_buffer, decoded_as_lndhub
|
from .utils import to_buffer, decoded_as_lndhub
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
from starlette.responses import HTMLResponse, JSONResponse # type: ignore
|
|
||||||
from starlette.requests import Request
|
|
||||||
from fastapi import Body
|
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
from fastapi.param_functions import Query
|
from fastapi.param_functions import Query
|
||||||
from fastapi.security import OAuth2PasswordBearer
|
|
||||||
|
|
||||||
|
|
||||||
@lndhub_ext.get("/ext/getinfo")
|
@lndhub_ext.get("/ext/getinfo")
|
||||||
|
|
@ -111,13 +107,11 @@ async def lndhub_payinvoice(
|
||||||
|
|
||||||
|
|
||||||
@lndhub_ext.get("/ext/balance")
|
@lndhub_ext.get("/ext/balance")
|
||||||
# @check_wallet()
|
|
||||||
async def lndhub_balance(wallet: WalletTypeInfo = Depends(check_wallet),):
|
async def lndhub_balance(wallet: WalletTypeInfo = Depends(check_wallet),):
|
||||||
return {"BTC": {"AvailableBalance": wallet.wallet.balance}}
|
return {"BTC": {"AvailableBalance": wallet.wallet.balance}}
|
||||||
|
|
||||||
|
|
||||||
@lndhub_ext.get("/ext/gettxs")
|
@lndhub_ext.get("/ext/gettxs")
|
||||||
# @check_wallet()
|
|
||||||
async def lndhub_gettxs(
|
async def lndhub_gettxs(
|
||||||
wallet: WalletTypeInfo = Depends(check_wallet), limit: int = Query(0, ge=0, lt=200)
|
wallet: WalletTypeInfo = Depends(check_wallet), limit: int = Query(0, ge=0, lt=200)
|
||||||
):
|
):
|
||||||
|
|
@ -208,7 +202,6 @@ async def lndhub_getbtc(wallet: WalletTypeInfo = Depends(check_wallet)):
|
||||||
|
|
||||||
|
|
||||||
@lndhub_ext.get("/ext/getpending")
|
@lndhub_ext.get("/ext/getpending")
|
||||||
# @check_wallet()
|
|
||||||
async def lndhub_getpending(wallet: WalletTypeInfo = Depends(check_wallet)):
|
async def lndhub_getpending(wallet: WalletTypeInfo = Depends(check_wallet)):
|
||||||
"pending onchain transactions"
|
"pending onchain transactions"
|
||||||
return []
|
return []
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
|
|
||||||
from lnbits.db import Database
|
from lnbits.db import Database
|
||||||
from lnbits.helpers import template_renderer
|
from lnbits.helpers import template_renderer
|
||||||
from lnbits.tasks import catch_everything_and_restart
|
|
||||||
|
|
||||||
db = Database("ext_tpos")
|
db = Database("ext_tpos")
|
||||||
|
|
||||||
tpos_ext: APIRouter = APIRouter(
|
tpos_ext: APIRouter = APIRouter(
|
||||||
prefix="/tpos",
|
prefix="/tpos",
|
||||||
tags=["TPoS"]
|
tags=["TPoS"]
|
||||||
# "tpos", __name__, static_folder="static", template_folder="templates"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from typing import List, Optional, Union
|
||||||
from lnbits.helpers import urlsafe_short_hash
|
from lnbits.helpers import urlsafe_short_hash
|
||||||
|
|
||||||
from . import db
|
from . import db
|
||||||
from .models import TPoS, CreateTposData
|
from .models import CreateTposData, TPoS
|
||||||
|
|
||||||
|
|
||||||
async def create_tpos(wallet_id: str, data: CreateTposData) -> TPoS:
|
async def create_tpos(wallet_id: str, data: CreateTposData) -> TPoS:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from sqlite3 import Row
|
from sqlite3 import Row
|
||||||
from fastapi.param_functions import Query
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,21 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
|
||||||
|
from fastapi import Request
|
||||||
|
from fastapi.params import Depends
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
from starlette.responses import HTMLResponse
|
from starlette.responses import HTMLResponse
|
||||||
|
|
||||||
from lnbits.core.models import User
|
from lnbits.core.models import User
|
||||||
from lnbits.core.crud import get_wallet
|
|
||||||
from lnbits.decorators import check_user_exists
|
from lnbits.decorators import check_user_exists
|
||||||
from http import HTTPStatus
|
|
||||||
|
|
||||||
from . import tpos_ext, tpos_renderer
|
from . import tpos_ext, tpos_renderer
|
||||||
from .crud import get_tpos
|
from .crud import get_tpos
|
||||||
from fastapi import FastAPI, Request
|
|
||||||
from fastapi.params import Depends
|
|
||||||
from fastapi.templating import Jinja2Templates
|
|
||||||
|
|
||||||
templates = Jinja2Templates(directory="templates")
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
|
|
||||||
@tpos_ext.get("/", response_class=HTMLResponse)
|
@tpos_ext.get("/", response_class=HTMLResponse)
|
||||||
# @validate_uuids(["usr"], required=True)
|
|
||||||
# @check_user_exists()
|
|
||||||
async def index(request: Request, user: User = Depends(check_user_exists)):
|
async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||||
return tpos_renderer().TemplateResponse(
|
return tpos_renderer().TemplateResponse(
|
||||||
"tpos/index.html", {"request": request, "user": user.dict()}
|
"tpos/index.html", {"request": request, "user": user.dict()}
|
||||||
|
|
@ -30,7 +29,6 @@ async def tpos(request: Request, tpos_id):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.NOT_FOUND, detail="TPoS does not exist."
|
status_code=HTTPStatus.NOT_FOUND, detail="TPoS does not exist."
|
||||||
)
|
)
|
||||||
# abort(HTTPStatus.NOT_FOUND, "TPoS does not exist.")
|
|
||||||
|
|
||||||
return tpos_renderer().TemplateResponse(
|
return tpos_renderer().TemplateResponse(
|
||||||
"tpos/tpos.html", {"request": request, "tpos": tpos}
|
"tpos/tpos.html", {"request": request, "tpos": tpos}
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,15 @@ from http import HTTPStatus
|
||||||
|
|
||||||
from fastapi import Query
|
from fastapi import Query
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
|
|
||||||
from pydantic import BaseModel
|
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
from starlette.requests import Request
|
|
||||||
from starlette.responses import HTMLResponse, JSONResponse # type: ignore
|
|
||||||
|
|
||||||
from lnbits.core.crud import get_user, get_wallet
|
from lnbits.core.crud import get_user, get_wallet
|
||||||
from lnbits.core.services import create_invoice, check_invoice_status
|
from lnbits.core.services import check_invoice_status, create_invoice
|
||||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||||
|
|
||||||
from . import tpos_ext
|
from . import tpos_ext
|
||||||
from .crud import create_tpos, get_tpos, get_tposs, delete_tpos
|
from .crud import create_tpos, delete_tpos, get_tpos, get_tposs
|
||||||
from .models import TPoS, CreateTposData
|
from .models import CreateTposData
|
||||||
|
|
||||||
|
|
||||||
@tpos_ext.get("/api/v1/tposs", status_code=HTTPStatus.OK)
|
@tpos_ext.get("/api/v1/tposs", status_code=HTTPStatus.OK)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
|
|
||||||
from lnbits.db import Database
|
from lnbits.db import Database
|
||||||
|
|
@ -10,7 +8,6 @@ db = Database("ext_usermanager")
|
||||||
usermanager_ext: APIRouter = APIRouter(
|
usermanager_ext: APIRouter = APIRouter(
|
||||||
prefix="/usermanager",
|
prefix="/usermanager",
|
||||||
tags=["usermanager"]
|
tags=["usermanager"]
|
||||||
# "usermanager", __name__, static_folder="static", template_folder="templates"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,5 +15,5 @@ def usermanager_renderer():
|
||||||
return template_renderer(["lnbits/extensions/usermanager/templates"])
|
return template_renderer(["lnbits/extensions/usermanager/templates"])
|
||||||
|
|
||||||
|
|
||||||
from .views_api import * # noqa
|
|
||||||
from .views import * # noqa
|
from .views import * # noqa
|
||||||
|
from .views_api import * # noqa
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,11 @@
|
||||||
from typing import Optional, List
|
from typing import List, Optional
|
||||||
|
|
||||||
|
from lnbits.core.crud import (create_account, create_wallet, delete_wallet,
|
||||||
|
get_payments, get_user)
|
||||||
from lnbits.core.models import Payment
|
from lnbits.core.models import Payment
|
||||||
from lnbits.core.crud import (
|
|
||||||
create_account,
|
|
||||||
get_user,
|
|
||||||
get_payments,
|
|
||||||
create_wallet,
|
|
||||||
delete_wallet,
|
|
||||||
)
|
|
||||||
|
|
||||||
from . import db
|
from . import db
|
||||||
from .models import Users, Wallets, CreateUserData
|
from .models import CreateUserData, Users, Wallets
|
||||||
|
|
||||||
|
|
||||||
### Users
|
### Users
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
from pydantic import BaseModel
|
|
||||||
from fastapi.param_functions import Query
|
|
||||||
from sqlite3 import Row
|
from sqlite3 import Row
|
||||||
|
|
||||||
|
from fastapi.param_functions import Query
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class CreateUserData(BaseModel):
|
class CreateUserData(BaseModel):
|
||||||
user_name: str = Query(...)
|
user_name: str = Query(...)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
from fastapi import FastAPI, Request
|
from fastapi import Request
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
from fastapi.templating import Jinja2Templates
|
|
||||||
from starlette.responses import HTMLResponse
|
from starlette.responses import HTMLResponse
|
||||||
|
|
||||||
from lnbits.core.models import User
|
from lnbits.core.models import User
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from starlette.exceptions import HTTPException
|
|
||||||
|
|
||||||
from fastapi import Query
|
from fastapi import Query
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
|
from starlette.exceptions import HTTPException
|
||||||
|
|
||||||
|
from lnbits.core import update_user_extension
|
||||||
from lnbits.core.crud import get_user
|
from lnbits.core.crud import get_user
|
||||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||||
|
|
||||||
from . import usermanager_ext
|
from . import usermanager_ext
|
||||||
from .models import CreateUserData
|
|
||||||
from .crud import (
|
from .crud import (
|
||||||
create_usermanager_user,
|
create_usermanager_user,
|
||||||
|
create_usermanager_wallet,
|
||||||
|
delete_usermanager_user,
|
||||||
|
delete_usermanager_wallet,
|
||||||
get_usermanager_user,
|
get_usermanager_user,
|
||||||
get_usermanager_users,
|
get_usermanager_users,
|
||||||
get_usermanager_wallet_transactions,
|
|
||||||
delete_usermanager_user,
|
|
||||||
create_usermanager_wallet,
|
|
||||||
get_usermanager_wallet,
|
|
||||||
get_usermanager_wallets,
|
|
||||||
get_usermanager_users_wallets,
|
get_usermanager_users_wallets,
|
||||||
delete_usermanager_wallet,
|
get_usermanager_wallet,
|
||||||
|
get_usermanager_wallet_transactions,
|
||||||
|
get_usermanager_wallets,
|
||||||
)
|
)
|
||||||
from lnbits.core import update_user_extension
|
from .models import CreateUserData
|
||||||
|
|
||||||
|
|
||||||
### Users
|
### Users
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
|
|
||||||
from lnbits.db import Database
|
from lnbits.db import Database
|
||||||
|
|
@ -15,5 +13,5 @@ def watchonly_renderer():
|
||||||
return template_renderer(["lnbits/extensions/watchonly/templates"])
|
return template_renderer(["lnbits/extensions/watchonly/templates"])
|
||||||
|
|
||||||
|
|
||||||
from .views_api import * # noqa
|
|
||||||
from .views import * # noqa
|
from .views import * # noqa
|
||||||
|
from .views_api import * # noqa
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from . import db
|
|
||||||
from .models import Wallets, Addresses, Mempool
|
|
||||||
|
|
||||||
from lnbits.helpers import urlsafe_short_hash
|
|
||||||
|
|
||||||
from embit.descriptor import Descriptor, Key # type: ignore
|
from embit.descriptor import Descriptor, Key # type: ignore
|
||||||
from embit.descriptor.arguments import AllowedDerivation # type: ignore
|
from embit.descriptor.arguments import AllowedDerivation # type: ignore
|
||||||
from embit.networks import NETWORKS # type: ignore
|
from embit.networks import NETWORKS # type: ignore
|
||||||
|
|
||||||
|
from lnbits.helpers import urlsafe_short_hash
|
||||||
|
|
||||||
|
from . import db
|
||||||
|
from .models import Addresses, Mempool, Wallets
|
||||||
|
|
||||||
##########################WALLETS####################
|
##########################WALLETS####################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from sqlite3 import Row
|
from sqlite3 import Row
|
||||||
|
|
||||||
from fastapi.param_functions import Query
|
from fastapi.param_functions import Query
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
from http import HTTPStatus
|
|
||||||
from starlette.exceptions import HTTPException
|
|
||||||
from starlette.responses import HTMLResponse
|
|
||||||
from starlette.requests import Request
|
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
from starlette.requests import Request
|
||||||
|
from starlette.responses import HTMLResponse
|
||||||
|
|
||||||
from lnbits.core.models import User
|
from lnbits.core.models import User
|
||||||
from lnbits.decorators import check_user_exists
|
from lnbits.decorators import check_user_exists
|
||||||
|
|
@ -11,7 +10,6 @@ from . import watchonly_ext, watchonly_renderer
|
||||||
|
|
||||||
# from .crud import get_payment
|
# from .crud import get_payment
|
||||||
|
|
||||||
from fastapi.templating import Jinja2Templates
|
|
||||||
|
|
||||||
templates = Jinja2Templates(directory="templates")
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,17 @@
|
||||||
import hashlib
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import httpx
|
|
||||||
import json
|
|
||||||
|
|
||||||
from lnbits.core.crud import get_user
|
|
||||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
|
||||||
|
|
||||||
from fastapi import Query
|
from fastapi import Query
|
||||||
from fastapi.params import Depends
|
from fastapi.params import Depends
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
from .models import CreateWallet
|
|
||||||
|
|
||||||
|
from lnbits.core.crud import get_user
|
||||||
|
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||||
from lnbits.extensions.watchonly import watchonly_ext
|
from lnbits.extensions.watchonly import watchonly_ext
|
||||||
from .crud import (
|
|
||||||
create_watch_wallet,
|
from .crud import (create_mempool, create_watch_wallet, delete_watch_wallet,
|
||||||
get_watch_wallet,
|
get_addresses, get_fresh_address, get_mempool,
|
||||||
get_watch_wallets,
|
get_watch_wallet, get_watch_wallets, update_mempool)
|
||||||
update_watch_wallet,
|
from .models import CreateWallet
|
||||||
delete_watch_wallet,
|
|
||||||
get_fresh_address,
|
|
||||||
get_addresses,
|
|
||||||
create_mempool,
|
|
||||||
update_mempool,
|
|
||||||
get_mempool,
|
|
||||||
)
|
|
||||||
|
|
||||||
###################WALLETS#############################
|
###################WALLETS#############################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,9 @@ def withdraw_renderer():
|
||||||
return template_renderer(["lnbits/extensions/withdraw/templates"])
|
return template_renderer(["lnbits/extensions/withdraw/templates"])
|
||||||
|
|
||||||
|
|
||||||
from .views_api import * # noqa
|
|
||||||
from .views import * # noqa
|
|
||||||
from .lnurl import * # noqa
|
from .lnurl import * # noqa
|
||||||
|
from .views import * # noqa
|
||||||
|
from .views_api import * # noqa
|
||||||
|
|
||||||
# @withdraw_ext.on_event("startup")
|
# @withdraw_ext.on_event("startup")
|
||||||
# def _do_it():
|
# def _do_it():
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Optional, Union
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from lnbits.helpers import urlsafe_short_hash
|
from lnbits.helpers import urlsafe_short_hash
|
||||||
|
|
||||||
from . import db
|
from . import db
|
||||||
from .models import WithdrawLink, HashCheck, CreateWithdrawData
|
from .models import CreateWithdrawData, HashCheck, WithdrawLink
|
||||||
|
|
||||||
|
|
||||||
async def create_withdraw_link(
|
async def create_withdraw_link(
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
from fastapi.param_functions import Query
|
|
||||||
from fastapi import HTTPException
|
|
||||||
import shortuuid # type: ignore
|
|
||||||
from http import HTTPStatus
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from http import HTTPStatus
|
||||||
|
|
||||||
|
import shortuuid # type: ignore
|
||||||
|
from fastapi import HTTPException
|
||||||
|
from fastapi.param_functions import Query
|
||||||
|
from starlette.requests import Request
|
||||||
|
|
||||||
from lnbits.core.services import pay_invoice
|
from lnbits.core.services import pay_invoice
|
||||||
from starlette.requests import Request
|
|
||||||
|
|
||||||
from . import withdraw_ext
|
from . import withdraw_ext
|
||||||
from .crud import get_withdraw_link_by_hash, update_withdraw_link
|
from .crud import get_withdraw_link_by_hash, update_withdraw_link
|
||||||
|
|
||||||
|
|
||||||
# FOR LNURLs WHICH ARE NOT UNIQUE
|
# FOR LNURLs WHICH ARE NOT UNIQUE
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
from starlette.requests import Request
|
|
||||||
from fastapi.param_functions import Query
|
|
||||||
from lnurl import Lnurl, LnurlWithdrawResponse, encode as lnurl_encode # type: ignore
|
|
||||||
from sqlite3 import Row
|
from sqlite3 import Row
|
||||||
from pydantic import BaseModel
|
|
||||||
import shortuuid # type: ignore
|
import shortuuid # type: ignore
|
||||||
|
from fastapi.param_functions import Query
|
||||||
|
from lnurl import Lnurl, LnurlWithdrawResponse
|
||||||
|
from lnurl import encode as lnurl_encode # type: ignore
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from starlette.requests import Request
|
||||||
|
|
||||||
|
|
||||||
class CreateWithdrawData(BaseModel):
|
class CreateWithdrawData(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import pyqrcode
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
import pyqrcode
|
||||||
|
from fastapi import Request
|
||||||
|
from fastapi.params import Depends
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
from starlette.exceptions import HTTPException
|
||||||
|
from starlette.responses import HTMLResponse, StreamingResponse
|
||||||
|
|
||||||
|
from lnbits.core.models import User
|
||||||
from lnbits.decorators import check_user_exists
|
from lnbits.decorators import check_user_exists
|
||||||
|
|
||||||
from . import withdraw_ext, withdraw_renderer
|
from . import withdraw_ext, withdraw_renderer
|
||||||
from .crud import get_withdraw_link, chunks
|
from .crud import chunks, get_withdraw_link
|
||||||
from fastapi import FastAPI, Request
|
|
||||||
from fastapi.params import Depends
|
|
||||||
from fastapi.templating import Jinja2Templates
|
|
||||||
|
|
||||||
from starlette.exceptions import HTTPException
|
|
||||||
from starlette.responses import HTMLResponse, StreamingResponse
|
|
||||||
from lnbits.core.models import User
|
|
||||||
|
|
||||||
templates = Jinja2Templates(directory="templates")
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,22 @@
|
||||||
from fastapi.params import Depends
|
|
||||||
from fastapi.param_functions import Query
|
|
||||||
from pydantic.main import BaseModel
|
|
||||||
|
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
|
from fastapi.param_functions import Query
|
||||||
|
from fastapi.params import Depends
|
||||||
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
|
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
from starlette.requests import Request
|
from starlette.requests import Request
|
||||||
from starlette.responses import HTMLResponse, JSONResponse # type: ignore
|
|
||||||
|
|
||||||
from lnbits.core.crud import get_user
|
from lnbits.core.crud import get_user
|
||||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||||
|
|
||||||
|
from . import withdraw_ext
|
||||||
|
from .crud import (create_withdraw_link,
|
||||||
|
delete_withdraw_link, get_hash_check, get_withdraw_link,
|
||||||
|
get_withdraw_links, update_withdraw_link)
|
||||||
from .models import CreateWithdrawData
|
from .models import CreateWithdrawData
|
||||||
|
|
||||||
# from fastapi import FastAPI, Query, Response
|
# from fastapi import FastAPI, Query, Response
|
||||||
|
|
||||||
from . import withdraw_ext
|
|
||||||
from .crud import (
|
|
||||||
create_withdraw_link,
|
|
||||||
get_withdraw_link,
|
|
||||||
get_withdraw_links,
|
|
||||||
update_withdraw_link,
|
|
||||||
delete_withdraw_link,
|
|
||||||
create_hash_check,
|
|
||||||
get_hash_check,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@withdraw_ext.get("/api/v1/links", status_code=HTTPStatus.OK)
|
@withdraw_ext.get("/api/v1/links", status_code=HTTPStatus.OK)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue