mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-19 18:14:19 +01:00
handle USDT fees (#829)
This commit is contained in:
@@ -99,6 +99,7 @@ class StrikeWallet(LightningBackend):
|
||||
unit: Unit,
|
||||
) -> int:
|
||||
fee_str = strike_quote.totalFee.amount
|
||||
fee: int = 0
|
||||
if strike_quote.totalFee.currency == self.currency_map[Unit.sat]:
|
||||
if unit == Unit.sat:
|
||||
fee = int(float(fee_str) * 1e8)
|
||||
@@ -107,8 +108,13 @@ class StrikeWallet(LightningBackend):
|
||||
elif strike_quote.totalFee.currency in [
|
||||
self.currency_map[Unit.usd],
|
||||
self.currency_map[Unit.eur],
|
||||
USDT,
|
||||
]:
|
||||
fee = int(float(fee_str) * 100)
|
||||
else:
|
||||
raise Exception(
|
||||
f"Unexpected currency {strike_quote.totalFee.currency} in fee"
|
||||
)
|
||||
return fee
|
||||
|
||||
def __init__(self, unit: Unit, **kwargs):
|
||||
@@ -154,7 +160,7 @@ class StrikeWallet(LightningBackend):
|
||||
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:
|
||||
for balance in data:
|
||||
if balance["currency"] == USDT:
|
||||
|
||||
Reference in New Issue
Block a user