mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-28 21:02:31 +02:00
Merge pull request #389 from arcbtc/FastAPI
restored create invoice api endpoint
This commit is contained in:
@@ -115,17 +115,17 @@ class CLightningWallet(Wallet):
|
|||||||
raise KeyError("supplied an invalid checking_id")
|
raise KeyError("supplied an invalid checking_id")
|
||||||
|
|
||||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||||
stream = await asyncio.open_unix_connection(self.rpc)
|
reader, writer = await asyncio.open_unix_connection(self.rpc)
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
call = json.dumps(
|
call = json.dumps(
|
||||||
{"method": "waitanyinvoice", "id": 0, "params": [self.last_pay_index]}
|
{"method": "waitanyinvoice", "id": 0, "params": [self.last_pay_index]}
|
||||||
)
|
)
|
||||||
|
writer.write(call.encode("utf-8"))
|
||||||
|
await writer.drain()
|
||||||
|
|
||||||
await stream.send_all(call.encode("utf-8"))
|
data = await reader.read(100)
|
||||||
|
|
||||||
data = await stream.receive_some()
|
|
||||||
paid = json.loads(data.decode("ascii"))
|
paid = json.loads(data.decode("ascii"))
|
||||||
|
|
||||||
paid = self.ln.waitanyinvoice(self.last_pay_index)
|
paid = self.ln.waitanyinvoice(self.last_pay_index)
|
||||||
|
Reference in New Issue
Block a user