From 726fe31b072531770555e81b222ba60c497ee1b7 Mon Sep 17 00:00:00 2001 From: Daan Ravesteijn Date: Mon, 4 Jan 2021 15:39:53 +0100 Subject: [PATCH 1/2] Added withdraw options withdrawOrderId, network, transactionFeeFlag to async --- .../com/binance/api/client/BinanceApiAsyncRestClient.java | 3 ++- .../api/client/impl/BinanceApiAsyncRestClientImpl.java | 6 ++++-- .../com/binance/api/examples/AccountEndpointsExample.java | 2 +- .../binance/api/examples/AccountEndpointsExampleAsync.java | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index d0e3b1c01..632860ac9 100755 --- a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java @@ -264,7 +264,8 @@ public interface BinanceApiAsyncRestClient { * @param name description/alias of the address * @param addressTag Secondary address identifier for coins like XRP,XMR etc. */ - void withdraw(String asset, String address, String amount, String name, String addressTag, BinanceApiCallback callback); + void withdraw(String asset, String address, String amount, String name, String addressTag, String withdrawOrderId, + String network, Boolean transactionFeeFlag, BinanceApiCallback callback); /** * Fetch account deposit history. diff --git a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java index e6ea387b9..9a7e11be0 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java @@ -209,8 +209,10 @@ public void getMyTrades(String symbol, BinanceApiCallback> callback) } @Override - public void withdraw(String asset, String address, String amount, String name, String addressTag, BinanceApiCallback callback) { - binanceApiService.withdraw(asset, address, amount, name, addressTag, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) + public void withdraw(String asset, String address, String amount, String name, String addressTag, String withdrawOrderId, + String network, Boolean transactionFeeFlag, BinanceApiCallback callback) { + binanceApiService.withdraw(asset, address, amount, name, addressTag, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, + System.currentTimeMillis(), withdrawOrderId, network, transactionFeeFlag) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } diff --git a/src/test/java/com/binance/api/examples/AccountEndpointsExample.java b/src/test/java/com/binance/api/examples/AccountEndpointsExample.java index 72fc68c3d..b012d5972 100755 --- a/src/test/java/com/binance/api/examples/AccountEndpointsExample.java +++ b/src/test/java/com/binance/api/examples/AccountEndpointsExample.java @@ -35,6 +35,6 @@ public static void main(String[] args) { System.out.println(client.getDepositAddress("ETH")); // Withdraw - client.withdraw("ETH", "0x123", "0.1", null, null); + client.withdraw("ETH", "0x123", "0.1", null, null, null, null, null); } } diff --git a/src/test/java/com/binance/api/examples/AccountEndpointsExampleAsync.java b/src/test/java/com/binance/api/examples/AccountEndpointsExampleAsync.java index 5ede0526b..33a9cb338 100755 --- a/src/test/java/com/binance/api/examples/AccountEndpointsExampleAsync.java +++ b/src/test/java/com/binance/api/examples/AccountEndpointsExampleAsync.java @@ -26,6 +26,6 @@ public static void main(String[] args) { client.getDepositHistory("ETH", response -> System.out.println(response)); // Withdraw (async) - client.withdraw("ETH", "0x123", "0.1", null, null, response -> {}); + client.withdraw("ETH", "0x123", "0.1", null, null, null, null, null, response -> {}); } } From c30872cdf757a26fbf41df6da85ca77ce07eb148 Mon Sep 17 00:00:00 2001 From: Daan Ravesteijn Date: Mon, 4 Jan 2021 15:30:40 +0100 Subject: [PATCH 2/2] Added withdraw options withdrawOrderId, network, transactionFeeFlag --- .../java/com/binance/api/client/BinanceApiRestClient.java | 5 ++++- .../binance/api/client/impl/BinanceApiRestClientImpl.java | 5 +++-- .../com/binance/api/client/impl/BinanceApiService.java | 7 +++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index f05cc0268..ef0ff8a61 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -249,8 +249,11 @@ public interface BinanceApiRestClient { * @param amount amount to withdraw * @param name description/alias of the address * @param addressTag Secondary address identifier for coins like XRP,XMR etc. + * @param withdrawOrderId client customize id for withdraw order + * @param network the transfer network + * @param transactionFeeFlag When making internal transfer, true for returning the fee to the destination account; false for returning the fee back to the departure account. Default false. */ - WithdrawResult withdraw(String asset, String address, String amount, String name, String addressTag); + WithdrawResult withdraw(String asset, String address, String amount, String name, String addressTag, String withdrawOrderId, String network, Boolean transactionFeeFlag); /** * Fetch account deposit history. diff --git a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java index c1cd07f62..2bde9d122 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -188,8 +188,9 @@ public List getMyTrades(String symbol) { } @Override - public WithdrawResult withdraw(String asset, String address, String amount, String name, String addressTag) { - return executeSync(binanceApiService.withdraw(asset, address, amount, name, addressTag, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); + public WithdrawResult withdraw(String asset, String address, String amount, String name, String addressTag, String withdrawOrderId, String network, Boolean transactionFeeFlag) { + return executeSync(binanceApiService.withdraw(asset, address, amount, name, addressTag, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, + System.currentTimeMillis(), withdrawOrderId, network, transactionFeeFlag)); } @Override diff --git a/src/main/java/com/binance/api/client/impl/BinanceApiService.java b/src/main/java/com/binance/api/client/impl/BinanceApiService.java index ede340457..18a85404d 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -129,8 +129,11 @@ Call> getMyTrades(@Query("symbol") String symbol, @Query("limit") In @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @POST("/wapi/v3/withdraw.html") - Call withdraw(@Query("asset") String asset, @Query("address") String address, @Query("amount") String amount, @Query("name") String name, @Query("addressTag") String addressTag, - @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); + Call withdraw(@Query("asset") String asset, @Query("address") String address, @Query("amount") String amount, + @Query("name") String name, @Query("addressTag") String addressTag, + @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp, + @Query("withdrawOrderId") String withdrawOrderId, @Query("network") String network, + @Query("transactionFeeFlag") Boolean transactionFeeFlag); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER)