add status() method to wallets to be used in initial check.

This commit is contained in:
fiatjaf
2020-10-12 22:30:19 -03:00
parent d5d85d16e6
commit b5a07c7ae7
12 changed files with 160 additions and 30 deletions
+9 -5
View File
@@ -2,6 +2,11 @@ from abc import ABC, abstractmethod
from typing import NamedTuple, Optional, AsyncGenerator
class StatusResponse(NamedTuple):
error_message: Optional[str]
balance_msat: int
class InvoiceResponse(NamedTuple):
ok: bool
checking_id: Optional[str] = None # payment_hash, rpc_id
@@ -25,6 +30,10 @@ class PaymentStatus(NamedTuple):
class Wallet(ABC):
@abstractmethod
def status() -> StatusResponse:
pass
@abstractmethod
def create_invoice(
self, amount: int, memo: Optional[str] = None, description_hash: Optional[bytes] = None
@@ -45,11 +54,6 @@ class Wallet(ABC):
@abstractmethod
def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
"""
this is an async function, but here it is noted without the 'async'
prefix because mypy has a bug identifying the signature of abstract
methods.
"""
pass