mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-23 06:35:23 +01:00
chore: remove wait
option for LntxbotWallet
This commit is contained in:
parent
9382381144
commit
7996c48b70
4 changed files with 7 additions and 9 deletions
|
@ -30,7 +30,7 @@ class Wallet(ABC):
|
|||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_invoice_status(self, payment_hash: str, wait: bool = True) -> TxStatus:
|
||||
def get_invoice_status(self, payment_hash: str) -> TxStatus:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
@ -41,8 +41,8 @@ class LndWallet(Wallet):
|
|||
)
|
||||
return PaymentResponse(r, not r.ok)
|
||||
|
||||
def get_invoice_status(self, payment_hash: str, wait: bool = True) -> TxStatus:
|
||||
r = get(url=f"{self.endpoint}/v1/invoice/{payment_hash}", headers=self.auth_read, verify=False,)
|
||||
def get_invoice_status(self, payment_hash: str) -> TxStatus:
|
||||
r = get(url=f"{self.endpoint}/v1/invoice/{payment_hash}", headers=self.auth_read, verify=False)
|
||||
|
||||
if not r.ok or "settled" not in r.json():
|
||||
return TxStatus(r, None)
|
||||
|
|
|
@ -44,7 +44,6 @@ class LNPayWallet(Wallet):
|
|||
return TxStatus(r, None)
|
||||
|
||||
statuses = {0: None, 1: True, -1: False}
|
||||
|
||||
return TxStatus(r, statuses[r.json()["settled"]])
|
||||
|
||||
def get_payment_status(self, payment_hash: str) -> TxStatus:
|
||||
|
@ -54,5 +53,4 @@ class LNPayWallet(Wallet):
|
|||
return TxStatus(r, None)
|
||||
|
||||
statuses = {0: None, 1: True, -1: False}
|
||||
|
||||
return TxStatus(r, statuses[r.json()["settled"]])
|
||||
|
|
|
@ -34,9 +34,8 @@ class LntxbotWallet(Wallet):
|
|||
|
||||
return PaymentResponse(r, failed, fee_msat)
|
||||
|
||||
def get_invoice_status(self, payment_hash: str, wait: bool = True) -> TxStatus:
|
||||
wait = "true" if wait else "false"
|
||||
r = post(url=f"{self.endpoint}/invoicestatus/{payment_hash}?wait={wait}", headers=self.auth_invoice)
|
||||
def get_invoice_status(self, payment_hash: str) -> TxStatus:
|
||||
r = post(url=f"{self.endpoint}/invoicestatus/{payment_hash}?wait=false", headers=self.auth_invoice)
|
||||
|
||||
if not r.ok:
|
||||
return TxStatus(r, None)
|
||||
|
@ -57,4 +56,5 @@ class LntxbotWallet(Wallet):
|
|||
if not r.ok or "error" in r.json():
|
||||
return TxStatus(r, None)
|
||||
|
||||
return TxStatus(r, {"complete": True, "failed": False, "unknown": None}[r.json().get("status", "unknown")])
|
||||
statuses = {"complete": True, "failed": False, "unknown": None}
|
||||
return TxStatus(r, statuses[r.json().get("status", "unknown")])
|
||||
|
|
Loading…
Add table
Reference in a new issue