get status
This commit is contained in:
parent
96c7decae7
commit
2cd6626ca1
2 changed files with 21 additions and 18 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
|
|
||||||
from .void import VoidWallet
|
|
||||||
from .clightning import CLightningWallet
|
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 .eclair import EclairWallet
|
||||||
from .fake import FakeWallet
|
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 asyncio
|
||||||
import json
|
|
||||||
import httpx
|
|
||||||
import random
|
|
||||||
import base64
|
import base64
|
||||||
|
import json
|
||||||
|
import random
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from os import getenv
|
from os import getenv
|
||||||
from typing import Optional, AsyncGenerator
|
from typing import AsyncGenerator, Optional
|
||||||
from trio_websocket import open_websocket_url
|
|
||||||
|
import httpx
|
||||||
|
from websockets import connect
|
||||||
|
|
||||||
from .base import (
|
from .base import (
|
||||||
StatusResponse,
|
|
||||||
InvoiceResponse,
|
InvoiceResponse,
|
||||||
PaymentResponse,
|
PaymentResponse,
|
||||||
PaymentStatus,
|
PaymentStatus,
|
||||||
|
StatusResponse,
|
||||||
|
Unsupported,
|
||||||
Wallet,
|
Wallet,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class EclairError(Exception):
|
class EclairError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -154,11 +157,11 @@ class EclairWallet(Wallet):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
async with open_websocket_url(ws_url, extra_headers=[('Authorization', self.auth["Authorization"])]) as ws:
|
async with connect(ws_url, extra_headers=[('Authorization', self.auth["Authorization"])]) as ws:
|
||||||
message = await ws.get_message()
|
message = await ws.recv()
|
||||||
print('Received message: %s' % message)
|
print('Received message: %s' % message)
|
||||||
|
|
||||||
if "payment-received" in message["type"]:
|
if "type" in message and "payment-received" in message.type:
|
||||||
yield message["paymentHash"]
|
yield message["paymentHash"]
|
||||||
|
|
||||||
except OSError as ose:
|
except OSError as ose:
|
||||||
|
|
@ -166,4 +169,4 @@ class EclairWallet(Wallet):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
print("lost connection to eclair's websocket, retrying in 5 seconds")
|
print("lost connection to eclair's websocket, retrying in 5 seconds")
|
||||||
await trio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue