handle USDT fees (#829)

This commit is contained in:
callebtc
2025-11-19 12:48:52 +01:00
committed by GitHub
parent 37446fbeea
commit 651b511293

View File

@@ -99,6 +99,7 @@ class StrikeWallet(LightningBackend):
unit: Unit, unit: Unit,
) -> int: ) -> int:
fee_str = strike_quote.totalFee.amount fee_str = strike_quote.totalFee.amount
fee: int = 0
if strike_quote.totalFee.currency == self.currency_map[Unit.sat]: if strike_quote.totalFee.currency == self.currency_map[Unit.sat]:
if unit == Unit.sat: if unit == Unit.sat:
fee = int(float(fee_str) * 1e8) fee = int(float(fee_str) * 1e8)
@@ -107,8 +108,13 @@ class StrikeWallet(LightningBackend):
elif strike_quote.totalFee.currency in [ elif strike_quote.totalFee.currency in [
self.currency_map[Unit.usd], self.currency_map[Unit.usd],
self.currency_map[Unit.eur], self.currency_map[Unit.eur],
USDT,
]: ]:
fee = int(float(fee_str) * 100) fee = int(float(fee_str) * 100)
else:
raise Exception(
f"Unexpected currency {strike_quote.totalFee.currency} in fee"
)
return fee return fee
def __init__(self, unit: Unit, **kwargs): def __init__(self, unit: Unit, **kwargs):
@@ -154,7 +160,7 @@ class StrikeWallet(LightningBackend):
balance=Amount.from_float(float(balance["total"]), self.unit), balance=Amount.from_float(float(balance["total"]), self.unit),
) )
# if no the unit is USD but no USD balance was found, we try USDT # if the unit is USD but no USD balance was found, we try USDT
if self.unit == Unit.usd: if self.unit == Unit.usd:
for balance in data: for balance in data:
if balance["currency"] == USDT: if balance["currency"] == USDT: