knowm / XChange

XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.
http://knowm.org/open-source/xchange/
MIT License
3.82k stars 1.93k forks source link

Binance withdrawal exception on succesful service call #4190

Open aligokalppeker opened 3 years ago

aligokalppeker commented 3 years ago

Hi,

I am testing Binance withdrawal API. It successfully withdraws XRP from the wallet and triggers the transfer. But service response code can not be parsed correctly(maybe it is changed/updated). So it throws an exception on parsing the response of the service :

Exception in thread "main" org.knowm.xchange.exceptions.ExchangeException: null (HTTP status code: 0) at org.knowm.xchange.binance.BinanceErrorAdapter.adapt(BinanceErrorAdapter.java:49) at org.knowm.xchange.binance.service.BinanceAccountService.withdrawFunds(BinanceAccountService.java:168) at org.knowm.xchange.binance.service.BinanceAccountService.withdrawFunds(BinanceAccountService.java:138) at com.xxx.yyy.MarketOperationsTest.testWithdraw(MarketOperationsTest.java:51) at com.xxx.yyy.MarketOperationsTest.main(MarketOperationsTest.java:34) Caused by: org.knowm.xchange.binance.dto.BinanceException: null (HTTP status code: 0) at org.knowm.xchange.binance.service.BinanceAccountServiceRaw.checkApiResponse(BinanceAccountServiceRaw.java:213) at org.knowm.xchange.binance.service.BinanceAccountServiceRaw.withdraw(BinanceAccountServiceRaw.java:70) at org.knowm.xchange.binance.service.BinanceAccountServiceRaw.withdraw(BinanceAccountServiceRaw.java:48) at org.knowm.xchange.binance.service.BinanceAccountService.withdrawFunds(BinanceAccountService.java:160) ... 3 more

I am testing this code on the dev branch(5.0.10-SNAPSHOT).

pvyhnal-generalbytes commented 2 years ago

Happens to us too

DEBUG si.mazi.rescu.HttpTemplate - Executing POST request at https://api.binance.com/sapi/v1/capital/withdraw/apply?signature=xxx  body coin=XRP&address=rXXX&amount=21.609905&name=xxx&timestamp=1633699394875
DEBUG si.mazi.rescu.HttpTemplate - Http call returned 200; response body:
{"id":"9c7662xxxxxxxxxc8bd"}

ERROR batm.master.exchange.Binance - Binance (https://api.binance.com/) exchange withdrawal failed
org.knowm.xchange.exceptions.ExchangeException: null (HTTP status code: 0)
        at org.knowm.xchange.binance.BinanceErrorAdapter.adapt(BinanceErrorAdapter.java:49)
        at org.knowm.xchange.binance.service.BinanceAccountService.withdrawFunds(BinanceAccountService.java:132)

Seems to be introduced in f9e8ae29802e80bb8a2f188b37ab790bf1d55a06 where checkApiResponse is used only in withdrawal call.