From 069e9476d4578e04f54c228a28052c4a675d919f Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 12 Jul 2024 18:44:33 +0200 Subject: [PATCH] `StrikeWallet`: support USDT (#583) * Strike: add error message if currency is not present * small print * try USDT --- cashu/lightning/strike.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cashu/lightning/strike.py b/cashu/lightning/strike.py index 15a47aa..cf35cb4 100644 --- a/cashu/lightning/strike.py +++ b/cashu/lightning/strike.py @@ -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,