From 1951357355bb792c959ff9c54c3dcff032d9a38f Mon Sep 17 00:00:00 2001 From: Carlos Wu Fei Date: Sun, 8 Oct 2023 06:03:08 +0100 Subject: [PATCH] Fix wallet asset clean endpoint --- api/account/assets.py | 2 +- api/apis.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/account/assets.py b/api/account/assets.py index 8514ebb87..9ae284dcc 100644 --- a/api/account/assets.py +++ b/api/account/assets.py @@ -347,7 +347,7 @@ async def clean_balance_assets(self): assets = [] for item in data["balances"]: if item["asset"] not in ["USDT", "NFT", "BNB"] and float(item["free"]) > 0: - assets.append(item["free"]) + assets.append(item["asset"]) if len(assets) > 5: self.transfer_dust(assets) diff --git a/api/apis.py b/api/apis.py index a4063bc3c..b300fd276 100644 --- a/api/apis.py +++ b/api/apis.py @@ -1,3 +1,4 @@ +from typing import List import hashlib import hmac import os @@ -147,12 +148,12 @@ def get_isolated_balance_total(self): raise IsolateBalanceError("Hit symbol 24hr restriction or not available (requires transfer in)") return assets - def transfer_dust(self, assets): + def transfer_dust(self, assets: List[str]): """ Transform small balances to BNB """ - assets = ",".join(assets) - response = self.signed_request(url=self.dust_transfer_url, method="POST", payload={"asset": assets}) + list_assets = ",".join(assets) + response = self.signed_request(url=self.dust_transfer_url, method="POST", payload={"asset": list_assets}) return response class BinbotApi(BinanceApi):