remove the need for nostrclient
This commit is contained in:
parent
642cad9ed8
commit
bf6659bbbd
6 changed files with 29 additions and 45 deletions
|
|
@ -23,6 +23,7 @@ LNURL is a range of lightning-network standards that allow us to use lightning-n
|
|||
|
||||
2. Use the shareable link or view the LNURLp you just created\
|
||||

|
||||
|
||||
- you can now open your LNURLp and copy the LNURL, get the shareable link or print it\
|
||||

|
||||
|
||||
|
|
|
|||
15
__init__.py
15
__init__.py
|
|
@ -9,16 +9,13 @@ from lnbits.helpers import template_renderer
|
|||
from lnbits.tasks import catch_everything_and_restart
|
||||
from loguru import logger
|
||||
|
||||
try:
|
||||
from ..nostrclient.nostr.event import Event
|
||||
from ..nostrclient.nostr.key import PrivateKey, PublicKey
|
||||
|
||||
nostrclient_present = True
|
||||
nostr_privatekey = PrivateKey()
|
||||
nostr_publickey: PublicKey = nostr_privatekey.public_key
|
||||
logger.debug(f"LNURLP Zaps Nostr pubkey: {nostr_publickey.hex()}")
|
||||
except ImportError:
|
||||
nostrclient_present = False
|
||||
from .nostr.event import Event
|
||||
from .nostr.key import PrivateKey, PublicKey
|
||||
|
||||
nostr_privatekey = PrivateKey()
|
||||
nostr_publickey: PublicKey = nostr_privatekey.public_key
|
||||
logger.debug(f"LNURLP Zaps Nostr pubkey: {nostr_publickey.hex()}")
|
||||
|
||||
db = Database("ext_lnurlp")
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,5 @@
|
|||
"name": "LNURLp",
|
||||
"short_description": "Make reusable LNURL pay links",
|
||||
"tile": "/lnurlp/static/image/lnurl-pay.png",
|
||||
"contributors": [
|
||||
"arcbtc",
|
||||
"eillarra",
|
||||
"fiatjaf"
|
||||
]
|
||||
"contributors": ["arcbtc", "eillarra", "fiatjaf", "callebtc"]
|
||||
}
|
||||
|
|
|
|||
9
lnurl.py
9
lnurl.py
|
|
@ -12,13 +12,9 @@ from .crud import increment_pay_link, get_pay_link, get_address_data
|
|||
from loguru import logger
|
||||
from urllib.parse import urlparse
|
||||
import json
|
||||
from . import nostrclient_present, nostr_publickey
|
||||
from . import nostr_publickey
|
||||
|
||||
if nostrclient_present:
|
||||
try:
|
||||
from ..nostrclient.nostr.key import PrivateKey, PublicKey
|
||||
except ImportError:
|
||||
nostrclient_present = False
|
||||
from ..nostrclient.nostr.key import PrivateKey, PublicKey
|
||||
|
||||
|
||||
@lnurlp_ext.get(
|
||||
|
|
@ -151,7 +147,6 @@ async def api_lnurl_response(request: Request, link_id, lnaddress=False):
|
|||
if link.comment_chars > 0:
|
||||
params["commentAllowed"] = link.comment_chars
|
||||
|
||||
if nostrclient_present:
|
||||
params["allowsNostr"] = True
|
||||
params["nostrPubkey"] = nostr_publickey.hex()
|
||||
return params
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
{
|
||||
"repos": [
|
||||
{
|
||||
|
|
|
|||
20
tasks.py
20
tasks.py
|
|
@ -12,16 +12,12 @@ from websocket import WebSocketApp
|
|||
from lnbits.settings import settings
|
||||
from .crud import get_pay_link
|
||||
from threading import Thread
|
||||
from . import nostrclient_present, nostr_privatekey
|
||||
from . import nostr_privatekey
|
||||
from typing import List
|
||||
import time
|
||||
|
||||
if nostrclient_present:
|
||||
try:
|
||||
from ..nostrclient.nostr.event import Event
|
||||
from ..nostrclient.nostr.key import PrivateKey, PublicKey
|
||||
except ImportError:
|
||||
nostrclient_present = False
|
||||
from .nostr.event import Event
|
||||
from .nostr.key import PrivateKey, PublicKey
|
||||
|
||||
|
||||
async def wait_for_paid_invoices():
|
||||
|
|
@ -77,7 +73,7 @@ async def on_invoice_paid(payment: Payment):
|
|||
|
||||
# NIP-57
|
||||
nostr = payment.extra.get("nostr")
|
||||
if nostrclient_present and nostr:
|
||||
if nostr:
|
||||
|
||||
event_json = json.loads(nostr)
|
||||
|
||||
|
|
@ -117,10 +113,10 @@ async def on_invoice_paid(payment: Payment):
|
|||
# list of all threads for these websockets
|
||||
wsts: List[Thread] = []
|
||||
|
||||
# send zap via nostrclient
|
||||
ws, wst = send_zap(f"ws://localhost:{settings.port}/nostrclient/api/v1/relay")
|
||||
wss += [ws]
|
||||
wsts += [wst]
|
||||
# # send zap via nostrclient
|
||||
# ws, wst = send_zap(f"ws://localhost:{settings.port}/nostrclient/api/v1/relay")
|
||||
# wss += [ws]
|
||||
# wsts += [wst]
|
||||
|
||||
# send zap receipt to relays in zap request
|
||||
relays = get_tag(event_json, "relays")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue