diff --git a/lnbits/extensions/cashu/__init__.py b/lnbits/extensions/cashu/__init__.py index 440be092..7944e658 100644 --- a/lnbits/extensions/cashu/__init__.py +++ b/lnbits/extensions/cashu/__init__.py @@ -34,7 +34,7 @@ def cashu_renderer(): return template_renderer(["lnbits/extensions/cashu/templates"]) -from .tasks import wait_for_paid_invoices, startup_cashu_mint +from .tasks import startup_cashu_mint, wait_for_paid_invoices from .views import * # noqa from .views_api import * # noqa diff --git a/lnbits/extensions/cashu/crud.py b/lnbits/extensions/cashu/crud.py index 7ecf9b6a..cbeedc12 100644 --- a/lnbits/extensions/cashu/crud.py +++ b/lnbits/extensions/cashu/crud.py @@ -2,21 +2,19 @@ import os import random import time from binascii import hexlify, unhexlify -from typing import List, Optional, Union, Any +from typing import Any, List, Optional, Union +from cashu.core.base import MintKeyset from embit import bip32, bip39, ec, script from embit.networks import NETWORKS from loguru import logger +from lnbits.db import Connection, Database from lnbits.helpers import urlsafe_short_hash from . import db - from .models import Cashu, Pegs, Promises, Proof -from cashu.core.base import MintKeyset -from lnbits.db import Database, Connection - async def create_cashu( cashu_id: str, keyset_id: str, wallet_id: str, data: Cashu diff --git a/lnbits/extensions/cashu/tasks.py b/lnbits/extensions/cashu/tasks.py index dddd1ef1..40b521f0 100644 --- a/lnbits/extensions/cashu/tasks.py +++ b/lnbits/extensions/cashu/tasks.py @@ -1,14 +1,14 @@ import asyncio import json +from cashu.core.migrations import migrate_databases +from cashu.mint import migrations + from lnbits.core.models import Payment from lnbits.tasks import register_invoice_listener -from .crud import get_cashu - -from cashu.mint import migrations -from cashu.core.migrations import migrate_databases from . import db, ledger +from .crud import get_cashu async def startup_cashu_mint(): diff --git a/lnbits/extensions/cashu/templates/cashu/_cashu.html b/lnbits/extensions/cashu/templates/cashu/_cashu.html index 03457ac7..0c7c4338 100644 --- a/lnbits/extensions/cashu/templates/cashu/_cashu.html +++ b/lnbits/extensions/cashu/templates/cashu/_cashu.html @@ -7,7 +7,9 @@

Created by - arcbtc, vlad, calle.arcbtc, + vlad, + calle. diff --git a/lnbits/extensions/cashu/views_api.py b/lnbits/extensions/cashu/views_api.py index b271bccc..28857663 100644 --- a/lnbits/extensions/cashu/views_api.py +++ b/lnbits/extensions/cashu/views_api.py @@ -1,61 +1,51 @@ import json -from http import HTTPStatus -from typing import Union import math +from http import HTTPStatus from typing import Dict, List, Union import httpx -from fastapi import Query -from fastapi.params import Depends -from lnurl import decode as decode_lnurl -from loguru import logger -from secp256k1 import PublicKey -from starlette.exceptions import HTTPException -from lnbits import bolt11 - -from lnbits.core.crud import get_user -from lnbits.core.services import ( - check_transaction_status, - create_invoice, - fee_reserve, - pay_invoice, -) - -from lnbits.core.views.api import api_payment -from lnbits.decorators import WalletTypeInfo, get_key_type, require_admin_key -from lnbits.wallets.base import PaymentStatus -from lnbits.helpers import urlsafe_short_hash -from lnbits.core.crud import check_internal - -# --------- extension imports - -from . import cashu_ext -from .crud import ( - create_cashu, - delete_cashu, - get_cashu, - get_cashus, -) - -from .models import Cashu - -from . import ledger # -------- cashu imports from cashu.core.base import ( - Proof, BlindedSignature, CheckFeesRequest, CheckFeesResponse, CheckRequest, GetMeltResponse, GetMintResponse, + Invoice, MeltRequest, MintRequest, PostSplitResponse, + Proof, SplitRequest, - Invoice, ) +from fastapi import Query +from fastapi.params import Depends +from lnurl import decode as decode_lnurl +from loguru import logger +from secp256k1 import PublicKey +from starlette.exceptions import HTTPException + +from lnbits import bolt11 +from lnbits.core.crud import check_internal, get_user +from lnbits.core.services import ( + check_transaction_status, + create_invoice, + fee_reserve, + pay_invoice, +) +from lnbits.core.views.api import api_payment +from lnbits.decorators import WalletTypeInfo, get_key_type, require_admin_key +from lnbits.helpers import urlsafe_short_hash +from lnbits.wallets.base import PaymentStatus + +from . import cashu_ext, ledger +from .crud import create_cashu, delete_cashu, get_cashu, get_cashus +from .models import Cashu + +# --------- extension imports + LIGHTNING = False