StrikeWallet: support USDT (#583)

* Strike: add error message if currency is not present

* small print

* try USDT
This commit is contained in:
callebtc
2024-07-12 18:44:33 +02:00
committed by GitHub
parent c52a4c26fb
commit 069e9476d4

View File

@@ -16,6 +16,8 @@ from .base import (
StatusResponse,
)
USDT = "USDT"
class StrikeWallet(LightningBackend):
"""https://docs.strike.me/api/"""
@@ -67,6 +69,23 @@ class StrikeWallet(LightningBackend):
).amount,
)
# if no the unit is USD but no USD balance was found, we try USDT
if self.unit == Unit.usd:
for balance in data:
if balance["currency"] == USDT:
self.currency = USDT
return StatusResponse(
error_message=None,
balance=Amount.from_float(
float(balance["total"]), self.unit
).amount,
)
return StatusResponse(
error_message=f"Could not find balance for currency {self.currency}",
balance=0,
)
async def create_invoice(
self,
amount: Amount,