mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-01-19 14:45:41 +01:00
get status
This commit is contained in:
parent
96c7decae7
commit
2cd6626ca1
@ -1,12 +1,12 @@
|
||||
# flake8: noqa
|
||||
|
||||
from .void import VoidWallet
|
||||
from .clightning import CLightningWallet
|
||||
from .lntxbot import LntxbotWallet
|
||||
from .opennode import OpenNodeWallet
|
||||
from .lnpay import LNPayWallet
|
||||
from .lnbits import LNbitsWallet
|
||||
from .lndrest import LndRestWallet
|
||||
from .spark import SparkWallet
|
||||
from .eclair import EclairWallet
|
||||
from .fake import FakeWallet
|
||||
from .lnbits import LNbitsWallet
|
||||
from .lndrest import LndRestWallet
|
||||
from .lnpay import LNPayWallet
|
||||
from .lntxbot import LntxbotWallet
|
||||
from .opennode import OpenNodeWallet
|
||||
from .spark import SparkWallet
|
||||
from .void import VoidWallet
|
||||
|
@ -1,21 +1,24 @@
|
||||
import trio
|
||||
import json
|
||||
import httpx
|
||||
import random
|
||||
import asyncio
|
||||
import base64
|
||||
import json
|
||||
import random
|
||||
import urllib.parse
|
||||
from os import getenv
|
||||
from typing import Optional, AsyncGenerator
|
||||
from trio_websocket import open_websocket_url
|
||||
from typing import AsyncGenerator, Optional
|
||||
|
||||
import httpx
|
||||
from websockets import connect
|
||||
|
||||
from .base import (
|
||||
StatusResponse,
|
||||
InvoiceResponse,
|
||||
PaymentResponse,
|
||||
PaymentStatus,
|
||||
StatusResponse,
|
||||
Unsupported,
|
||||
Wallet,
|
||||
)
|
||||
|
||||
|
||||
class EclairError(Exception):
|
||||
pass
|
||||
|
||||
@ -154,11 +157,11 @@ class EclairWallet(Wallet):
|
||||
|
||||
while True:
|
||||
try:
|
||||
async with open_websocket_url(ws_url, extra_headers=[('Authorization', self.auth["Authorization"])]) as ws:
|
||||
message = await ws.get_message()
|
||||
async with connect(ws_url, extra_headers=[('Authorization', self.auth["Authorization"])]) as ws:
|
||||
message = await ws.recv()
|
||||
print('Received message: %s' % message)
|
||||
|
||||
if "payment-received" in message["type"]:
|
||||
if "type" in message and "payment-received" in message.type:
|
||||
yield message["paymentHash"]
|
||||
|
||||
except OSError as ose:
|
||||
@ -166,4 +169,4 @@ class EclairWallet(Wallet):
|
||||
pass
|
||||
|
||||
print("lost connection to eclair's websocket, retrying in 5 seconds")
|
||||
await trio.sleep(5)
|
||||
await asyncio.sleep(5)
|
||||
|
Loading…
Reference in New Issue
Block a user