mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-01-01 07:54:29 +01:00
StrikeWallet: support USDT (#583)
* Strike: add error message if currency is not present * small print * try USDT
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user