From 726fe31b072531770555e81b222ba60c497ee1b7 Mon Sep 17 00:00:00 2001 From: Daan Ravesteijn Date: Mon, 4 Jan 2021 15:39:53 +0100 Subject: [PATCH 01/12] 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 02/12] 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) From 4dce0394206b0ed758c9e2e5dbf39e80397fbd38 Mon Sep 17 00:00:00 2001 From: Amin Date: Mon, 3 May 2021 17:23:08 +0430 Subject: [PATCH 03/12] fixed build issue in pom --- pom.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 863f5c234..56ec4af19 100755 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,9 @@ + 11 + UTF-8 + UTF-8 2.4.0 @@ -52,9 +55,10 @@ org.apache.maven.plugins maven-compiler-plugin + 3.7.0 - 1.8 - 1.8 + ${java.version} + ${java.version} From 338a121180c6db1709e0b2a10676fc00e33e1154 Mon Sep 17 00:00:00 2001 From: Amin Date: Mon, 3 May 2021 22:07:01 +0430 Subject: [PATCH 04/12] add package option to pom --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 56ec4af19..1c6b16522 100755 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ 11 + true UTF-8 UTF-8 2.4.0 From 3d2c8a83c4554c7eaf7c64b25d6e84381e70f0d9 Mon Sep 17 00:00:00 2001 From: amin rezazade Date: Tue, 4 May 2021 13:34:03 +0430 Subject: [PATCH 05/12] attached source files to artifact --- pom.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pom.xml b/pom.xml index 1c6b16522..85ff54caf 100755 --- a/pom.xml +++ b/pom.xml @@ -62,6 +62,20 @@ ${java.version} + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + verify + + jar-no-fork + + + + From bbd4daec3ecbd7220d131e9eb899d14f350fd88f Mon Sep 17 00:00:00 2001 From: rezazadeh93 Date: Fri, 20 Aug 2021 17:35:17 +0430 Subject: [PATCH 06/12] update Deposit Address method to support networks --- .../binance/api/client/BinanceApiAsyncRestClient.java | 7 +++++++ .../com/binance/api/client/BinanceApiRestClient.java | 9 +++++++++ .../api/client/impl/BinanceApiAsyncRestClientImpl.java | 6 ++++++ .../api/client/impl/BinanceApiRestClientImpl.java | 6 ++++++ .../com/binance/api/client/impl/BinanceApiService.java | 6 +++++- 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index d0e3b1c01..6c99b6982 100755 --- a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java @@ -287,6 +287,13 @@ public interface BinanceApiAsyncRestClient { */ void getDepositAddress(String asset, BinanceApiCallback callback); + /** + * Fetch deposit address. + * + * @param callback the callback that handles the response and returns the deposit address + */ + void getDepositAddress(String asset, String network, BinanceApiCallback callback); + // User stream endpoints /** diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index ebe0b9667..6aea53e60 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -307,6 +307,15 @@ public interface BinanceApiRestClient { */ DepositAddress getDepositAddress(String asset); + + /** + * Fetch deposit address supported network. + * @param asset coin property + * @param network network property + * @return deposit address for given network and asset + */ + DepositAddress getDepositAddress(String asset, String network); + // User stream endpoints /** 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..20d164833 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java @@ -232,6 +232,12 @@ public void getDepositAddress(String asset, BinanceApiCallback c .enqueue(new BinanceApiCallbackAdapter<>(callback)); } + @Override + public void getDepositAddress(String asset, String network, BinanceApiCallback callback) { + binanceApiService.getDepositAddress(asset, network, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) + .enqueue(new BinanceApiCallbackAdapter<>(callback)); + } + // User stream endpoints @Override 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 c80c7a06d..5268c6986 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -262,6 +262,12 @@ public DepositAddress getDepositAddress(String asset) { System.currentTimeMillis())); } + @Override + public DepositAddress getDepositAddress(String asset, String network) { + return executeSync(binanceApiService.getDepositAddress(asset, network, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, + System.currentTimeMillis())); + } + // User stream endpoints @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 5825f9844..da8dc6228 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -166,9 +166,13 @@ Call withdraw(@Query("asset") String asset, @Query("address") St Call getWithdrawHistory(@Query("asset") String asset, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) - @GET("/wapi/v3/depositAddress.html") + @GET("/sapi/v1/capital/deposit/address") Call getDepositAddress(@Query("asset") String asset, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); + @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) + @GET("/sapi/v1/capital/deposit/address") + Call getDepositAddress(@Query("asset") String asset, @Query("network") String network, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); + @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @POST("/sapi/v1/asset/dust") Call dustTransfer(@Query("asset") List asset, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); From 8a9085a54344848258808386ddd936c85046abc7 Mon Sep 17 00:00:00 2001 From: rezazadeh93 Date: Fri, 20 Aug 2021 17:58:02 +0430 Subject: [PATCH 07/12] refactor deposit address to fixing bugs --- .../binance/api/client/BinanceApiAsyncRestClient.java | 7 ------- .../com/binance/api/client/BinanceApiRestClient.java | 8 -------- .../api/client/impl/BinanceApiAsyncRestClientImpl.java | 6 ------ .../api/client/impl/BinanceApiRestClientImpl.java | 6 ------ .../com/binance/api/client/impl/BinanceApiService.java | 10 +++------- .../binance/api/examples/AccountEndpointsExample.java | 2 +- 6 files changed, 4 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index 6c99b6982..e7edf24ce 100755 --- a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java @@ -280,13 +280,6 @@ public interface BinanceApiAsyncRestClient { */ void getWithdrawHistory(String asset, BinanceApiCallback callback); - /** - * Fetch deposit address. - * - * @param callback the callback that handles the response and returns the deposit address - */ - void getDepositAddress(String asset, BinanceApiCallback callback); - /** * Fetch deposit address. * diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index 6aea53e60..aa32f45ce 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -300,14 +300,6 @@ public interface BinanceApiRestClient { */ List getSubAccountTransfers(); - /** - * Fetch deposit address. - * - * @return deposit address for a given asset. - */ - DepositAddress getDepositAddress(String asset); - - /** * Fetch deposit address supported network. * @param asset coin property 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 20d164833..ff350b161 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java @@ -226,12 +226,6 @@ public void getWithdrawHistory(String asset, BinanceApiCallback .enqueue(new BinanceApiCallbackAdapter<>(callback)); } - @Override - public void getDepositAddress(String asset, BinanceApiCallback callback) { - binanceApiService.getDepositAddress(asset, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) - .enqueue(new BinanceApiCallbackAdapter<>(callback)); - } - @Override public void getDepositAddress(String asset, String network, BinanceApiCallback callback) { binanceApiService.getDepositAddress(asset, network, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) 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 5268c6986..6d74f0434 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -256,12 +256,6 @@ public List getSubAccountTransfers() { return executeSync(binanceApiService.getSubAccountTransfers(System.currentTimeMillis())); } - @Override - public DepositAddress getDepositAddress(String asset) { - return executeSync(binanceApiService.getDepositAddress(asset, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, - System.currentTimeMillis())); - } - @Override public DepositAddress getDepositAddress(String asset, String network) { return executeSync(binanceApiService.getDepositAddress(asset, network, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, 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 da8dc6228..e81537d51 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -152,8 +152,8 @@ Call> getMyTrades(@Query("symbol") String symbol, @Query("limit") In @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @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, + @POST("/sapi/v1/capital/withdraw/apply") + Call withdraw(@Query("coin") 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); @@ -167,11 +167,7 @@ Call withdraw(@Query("asset") String asset, @Query("address") St @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @GET("/sapi/v1/capital/deposit/address") - Call getDepositAddress(@Query("asset") String asset, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); - - @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) - @GET("/sapi/v1/capital/deposit/address") - Call getDepositAddress(@Query("asset") String asset, @Query("network") String network, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); + Call getDepositAddress(@Query("coin") String asset, @Query("network") String network, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @POST("/sapi/v1/asset/dust") diff --git a/src/test/java/com/binance/api/examples/AccountEndpointsExample.java b/src/test/java/com/binance/api/examples/AccountEndpointsExample.java index 72fc68c3d..9875e19f6 100755 --- a/src/test/java/com/binance/api/examples/AccountEndpointsExample.java +++ b/src/test/java/com/binance/api/examples/AccountEndpointsExample.java @@ -32,7 +32,7 @@ public static void main(String[] args) { System.out.println(client.getDepositHistory("ETH")); // Get deposit address - System.out.println(client.getDepositAddress("ETH")); + System.out.println(client.getDepositAddress("ETH", null)); // Withdraw client.withdraw("ETH", "0x123", "0.1", null, null); From 32a62bfa5cfa446d71c88bf3c6f8524af2cbcb86 Mon Sep 17 00:00:00 2001 From: rezazadeh93 Date: Fri, 20 Aug 2021 19:03:54 +0430 Subject: [PATCH 08/12] update withdraw method to supports new arguments --- .../com/binance/api/client/BinanceApiAsyncRestClient.java | 3 ++- .../java/com/binance/api/client/BinanceApiRestClient.java | 5 +++-- .../api/client/impl/BinanceApiAsyncRestClientImpl.java | 6 ++++-- .../binance/api/client/impl/BinanceApiRestClientImpl.java | 6 ++++-- .../java/com/binance/api/client/impl/BinanceApiService.java | 5 ++++- .../com/binance/api/examples/AccountEndpointsExample.java | 2 +- .../binance/api/examples/AccountEndpointsExampleAsync.java | 2 +- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index e7edf24ce..71528d972 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 coin, String clientOrderId, String network, String address, String addressTag, + String amount, Boolean feeFlag, String name, BinanceApiCallback callback); /** * Fetch account deposit history. diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index aa32f45ce..f07a6ee41 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -265,13 +265,14 @@ public interface BinanceApiRestClient { * * Enable Withdrawals option has to be active in the API settings. * - * @param asset asset symbol to withdraw + * @param coin asset symbol to withdraw * @param address address to withdraw to * @param amount amount to withdraw * @param name description/alias of the address * @param addressTag Secondary address identifier for coins like XRP,XMR etc. */ - WithdrawResult withdraw(String asset, String address, String amount, String name, String addressTag); + WithdrawResult withdraw(String coin, String clientOrderId, String network, String address, String amount, + String name, String addressTag, Boolean feeFlag); /** * Conver a list of assets to BNB 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 ff350b161..f67b1b2f0 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 coin, String clientOrderId, String network, String address, String addressTag, + String amount, Boolean feeFlag, String name, BinanceApiCallback callback) { + binanceApiService.withdraw(coin, clientOrderId, network, address, addressTag, amount, feeFlag, name, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } 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 6d74f0434..b75c81cf8 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -229,8 +229,10 @@ public List getMyTrades(String symbol, Long fromId) { } @Override - public WithdrawResult withdraw(String asset, String address, String amount, String name, String addressTag) { - return executeSync(binanceApiService.withdraw(asset, address, amount, name, addressTag, + public WithdrawResult withdraw(String coin, String clientOrderId, String network, String address, String amount, + String name, String addressTag, Boolean feeFlag) { + return executeSync(binanceApiService.withdraw(coin, clientOrderId, network, address, + addressTag, amount, feeFlag, name, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } 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 e81537d51..125ebfed1 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -153,7 +153,10 @@ Call> getMyTrades(@Query("symbol") String symbol, @Query("limit") In @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @POST("/sapi/v1/capital/withdraw/apply") - Call withdraw(@Query("coin") String asset, @Query("address") String address, @Query("amount") String amount, @Query("name") String name, @Query("addressTag") String addressTag, + Call withdraw(@Query("coin") String coin,@Query("withdrawOrderId") String clientOrderId, + @Query("network") String network, @Query("address") String address, + @Query("addressTag") String addressTag, @Query("amount") String amount, + @Query("transactionFeeFlag") Boolean feeFlag, @Query("name") String name, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); diff --git a/src/test/java/com/binance/api/examples/AccountEndpointsExample.java b/src/test/java/com/binance/api/examples/AccountEndpointsExample.java index 9875e19f6..485943b05 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", null)); // Withdraw - client.withdraw("ETH", "0x123", "0.1", null, null); + client.withdraw("ETH", null, "ERC20", "0x123", "0.1", null, null, false); } } diff --git a/src/test/java/com/binance/api/examples/AccountEndpointsExampleAsync.java b/src/test/java/com/binance/api/examples/AccountEndpointsExampleAsync.java index 5ede0526b..0e52c9fa8 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", null, "ERC20", "0x123", null, "0.1", false, null, response -> {}); } } From 14f98a9c042f6ad90731c1c403475b19db7ed54e Mon Sep 17 00:00:00 2001 From: rezazadeh93 Date: Fri, 20 Aug 2021 19:49:46 +0430 Subject: [PATCH 09/12] update withdraw and deposit histories to support all new arguments --- .../api/client/BinanceApiAsyncRestClient.java | 21 +++++++++++++-- .../api/client/BinanceApiRestClient.java | 21 +++++++++++++-- .../impl/BinanceApiAsyncRestClientImpl.java | 27 ++++++++++++++++--- .../client/impl/BinanceApiRestClientImpl.java | 26 +++++++++++++----- .../api/client/impl/BinanceApiService.java | 14 +++++++--- 5 files changed, 91 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index 71528d972..a99113838 100755 --- a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java @@ -272,14 +272,31 @@ void withdraw(String coin, String clientOrderId, String network, String address, * * @param callback the callback that handles the response and returns the deposit history */ - void getDepositHistory(String asset, BinanceApiCallback callback); + void getDepositHistory(String coin, BinanceApiCallback callback); + + + /** + * Fetch account deposit history. + * + * @param callback the callback that handles the response and returns the deposit history + */ + void getDepositHistory(String coin, int status, Long startTime, Long endTime, + int offset, int limit, BinanceApiCallback callback); + + /** + * Fetch account withdraw history. + * + * @param callback the callback that handles the response and returns the withdraw history + */ + void getWithdrawHistory(String coin, BinanceApiCallback callback); /** * Fetch account withdraw history. * * @param callback the callback that handles the response and returns the withdraw history */ - void getWithdrawHistory(String asset, BinanceApiCallback callback); + void getWithdrawHistory(String coin, int status, Long startTime, Long endTime, + int offset, int limit, BinanceApiCallback callback); /** * Fetch deposit address. diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index f07a6ee41..a19e57975 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -11,6 +11,7 @@ import com.binance.api.client.domain.market.OrderBook; import com.binance.api.client.domain.market.TickerPrice; import com.binance.api.client.domain.market.TickerStatistics; +import retrofit2.http.Query; import java.util.List; @@ -285,14 +286,30 @@ WithdrawResult withdraw(String coin, String clientOrderId, String network, Strin * * @return deposit history, containing a list of deposits */ - DepositHistory getDepositHistory(String asset); + DepositHistory getDepositHistory(String coin); + + /** + * Fetch account deposit history. + * + * @return deposit history, containing a list of deposits + */ + DepositHistory getDepositHistory(String coin, int status, Long startTime, Long endTime, + int offset, int limit); + + /** + * Fetch account withdraw history. + * + * @return withdraw history, containing a list of withdrawals + */ + WithdrawHistory getWithdrawHistory(String coin); /** * Fetch account withdraw history. * * @return withdraw history, containing a list of withdrawals */ - WithdrawHistory getWithdrawHistory(String asset); + WithdrawHistory getWithdrawHistory(String coin, int status, Long startTime, Long endTime, + int offset, int limit); /** * Fetch sub-account transfer 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 f67b1b2f0..794a859a3 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java @@ -216,15 +216,34 @@ public void withdraw(String coin, String clientOrderId, String network, String a .enqueue(new BinanceApiCallbackAdapter<>(callback)); } + + @Override + public void getDepositHistory(String coin, BinanceApiCallback callback) { + binanceApiService.getDepositHistory(coin, 0, null, null, 0, 1000, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) + .enqueue(new BinanceApiCallbackAdapter<>(callback)); + } + @Override - public void getDepositHistory(String asset, BinanceApiCallback callback) { - binanceApiService.getDepositHistory(asset, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) + public void getDepositHistory(String coin, int status, Long startTime, Long endTime, + int offset, int limit, BinanceApiCallback callback) { + binanceApiService.getDepositHistory(coin, status, startTime, endTime, offset, limit, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } @Override - public void getWithdrawHistory(String asset, BinanceApiCallback callback) { - binanceApiService.getWithdrawHistory(asset, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) + public void getWithdrawHistory(String coin, BinanceApiCallback callback) { + binanceApiService.getWithdrawHistory(coin, 0, null, null, 0, 1000, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) + .enqueue(new BinanceApiCallbackAdapter<>(callback)); + } + + @Override + public void getWithdrawHistory(String coin, int status, Long startTime, Long endTime, + int offset, int limit, BinanceApiCallback callback) { + binanceApiService.getWithdrawHistory(coin, status, startTime, endTime, offset, limit, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } 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 b75c81cf8..264e8a6a0 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -242,15 +242,29 @@ public DustTransferResponse dustTranfer(List asset) { } @Override - public DepositHistory getDepositHistory(String asset) { - return executeSync(binanceApiService.getDepositHistory(asset, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, - System.currentTimeMillis())); + public DepositHistory getDepositHistory(String coin) { + return executeSync(binanceApiService.getDepositHistory(coin, 0, null, null, 0, 1000, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } @Override - public WithdrawHistory getWithdrawHistory(String asset) { - return executeSync(binanceApiService.getWithdrawHistory(asset, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, - System.currentTimeMillis())); + public DepositHistory getDepositHistory(String coin, int status, Long startTime, Long endTime, + int offset, int limit) { + return executeSync(binanceApiService.getDepositHistory(coin, status, startTime, endTime, offset, limit, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); + } + + @Override + public WithdrawHistory getWithdrawHistory(String coin) { + return executeSync(binanceApiService.getWithdrawHistory(coin, 0, null, null, 0, 1000, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); + } + + @Override + public WithdrawHistory getWithdrawHistory(String coin, int status, Long startTime, Long endTime, + int offset, int limit) { + return executeSync(binanceApiService.getWithdrawHistory(coin, status, startTime, endTime, offset, limit, + BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } @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 125ebfed1..ba5ed6d7f 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -161,12 +161,18 @@ Call withdraw(@Query("coin") String coin,@Query("withdrawOrderId @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) - @GET("/wapi/v3/depositHistory.html") - Call getDepositHistory(@Query("asset") String asset, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); + @GET("/sapi/v1/capital/deposit/hisrec") + Call getDepositHistory(@Query("coin") String coin, @Query("status") int status, + @Query("startTime") Long startTime, @Query("endTime") Long endTime, + @Query("offset") int offset, @Query("limit") int limit, + @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) - @GET("/wapi/v3/withdrawHistory.html") - Call getWithdrawHistory(@Query("asset") String asset, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); + @GET("/sapi/v1/capital/withdraw/history") + Call getWithdrawHistory(@Query("coin") String coin, @Query("status") int status, + @Query("startTime") Long startTime, @Query("endTime") Long endTime, + @Query("offset") int offset, @Query("limit") int limit, + @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @GET("/sapi/v1/capital/deposit/address") From 7935a7350c639739da6e48378a30ce8c0314478f Mon Sep 17 00:00:00 2001 From: rezazadeh93 Date: Sun, 5 Sep 2021 16:08:06 +0430 Subject: [PATCH 10/12] Fixed Withdraw & Deposit history Responses Bug #391 --- .../api/client/BinanceApiAsyncRestClient.java | 19 +++++-------------- .../api/client/BinanceApiRestClient.java | 19 ++++++------------- .../impl/BinanceApiAsyncRestClientImpl.java | 19 +++++-------------- .../client/impl/BinanceApiRestClientImpl.java | 8 ++++---- .../api/client/impl/BinanceApiService.java | 4 ++-- 5 files changed, 22 insertions(+), 47 deletions(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index a99113838..65b307c29 100755 --- a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java @@ -1,15 +1,6 @@ package com.binance.api.client; -import com.binance.api.client.domain.account.Account; -import com.binance.api.client.domain.account.DepositAddress; -import com.binance.api.client.domain.account.DepositHistory; -import com.binance.api.client.domain.account.NewOrder; -import com.binance.api.client.domain.account.NewOrderResponse; -import com.binance.api.client.domain.account.Order; -import com.binance.api.client.domain.account.Trade; -import com.binance.api.client.domain.account.TradeHistoryItem; -import com.binance.api.client.domain.account.WithdrawHistory; -import com.binance.api.client.domain.account.WithdrawResult; +import com.binance.api.client.domain.account.*; import com.binance.api.client.domain.account.request.AllOrdersRequest; import com.binance.api.client.domain.account.request.CancelOrderRequest; import com.binance.api.client.domain.account.request.CancelOrderResponse; @@ -272,7 +263,7 @@ void withdraw(String coin, String clientOrderId, String network, String address, * * @param callback the callback that handles the response and returns the deposit history */ - void getDepositHistory(String coin, BinanceApiCallback callback); + void getDepositHistory(String coin, BinanceApiCallback> callback); /** @@ -281,14 +272,14 @@ void withdraw(String coin, String clientOrderId, String network, String address, * @param callback the callback that handles the response and returns the deposit history */ void getDepositHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit, BinanceApiCallback callback); + int offset, int limit, BinanceApiCallback> callback); /** * Fetch account withdraw history. * * @param callback the callback that handles the response and returns the withdraw history */ - void getWithdrawHistory(String coin, BinanceApiCallback callback); + void getWithdrawHistory(String coin, BinanceApiCallback> callback); /** * Fetch account withdraw history. @@ -296,7 +287,7 @@ void getDepositHistory(String coin, int status, Long startTime, Long endTime, * @param callback the callback that handles the response and returns the withdraw history */ void getWithdrawHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit, BinanceApiCallback callback); + int offset, int limit, BinanceApiCallback> callback); /** * Fetch deposit address. diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index a19e57975..258344eb8 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -2,16 +2,9 @@ import com.binance.api.client.domain.account.*; import com.binance.api.client.domain.account.request.*; -import com.binance.api.client.domain.general.ExchangeInfo; import com.binance.api.client.domain.general.Asset; -import com.binance.api.client.domain.market.AggTrade; -import com.binance.api.client.domain.market.BookTicker; -import com.binance.api.client.domain.market.Candlestick; -import com.binance.api.client.domain.market.CandlestickInterval; -import com.binance.api.client.domain.market.OrderBook; -import com.binance.api.client.domain.market.TickerPrice; -import com.binance.api.client.domain.market.TickerStatistics; -import retrofit2.http.Query; +import com.binance.api.client.domain.general.ExchangeInfo; +import com.binance.api.client.domain.market.*; import java.util.List; @@ -286,14 +279,14 @@ WithdrawResult withdraw(String coin, String clientOrderId, String network, Strin * * @return deposit history, containing a list of deposits */ - DepositHistory getDepositHistory(String coin); + List getDepositHistory(String coin); /** * Fetch account deposit history. * * @return deposit history, containing a list of deposits */ - DepositHistory getDepositHistory(String coin, int status, Long startTime, Long endTime, + List getDepositHistory(String coin, int status, Long startTime, Long endTime, int offset, int limit); /** @@ -301,14 +294,14 @@ DepositHistory getDepositHistory(String coin, int status, Long startTime, Long e * * @return withdraw history, containing a list of withdrawals */ - WithdrawHistory getWithdrawHistory(String coin); + List getWithdrawHistory(String coin); /** * Fetch account withdraw history. * * @return withdraw history, containing a list of withdrawals */ - WithdrawHistory getWithdrawHistory(String coin, int status, Long startTime, Long endTime, + List getWithdrawHistory(String coin, int status, Long startTime, Long endTime, int offset, int limit); /** 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 794a859a3..25484fe70 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java @@ -4,16 +4,7 @@ import com.binance.api.client.BinanceApiCallback; import com.binance.api.client.config.BinanceApiConfig; import com.binance.api.client.constant.BinanceApiConstants; -import com.binance.api.client.domain.account.Account; -import com.binance.api.client.domain.account.DepositAddress; -import com.binance.api.client.domain.account.DepositHistory; -import com.binance.api.client.domain.account.NewOrder; -import com.binance.api.client.domain.account.NewOrderResponse; -import com.binance.api.client.domain.account.Order; -import com.binance.api.client.domain.account.Trade; -import com.binance.api.client.domain.account.TradeHistoryItem; -import com.binance.api.client.domain.account.WithdrawHistory; -import com.binance.api.client.domain.account.WithdrawResult; +import com.binance.api.client.domain.account.*; import com.binance.api.client.domain.account.request.AllOrdersRequest; import com.binance.api.client.domain.account.request.CancelOrderRequest; import com.binance.api.client.domain.account.request.CancelOrderResponse; @@ -218,7 +209,7 @@ public void withdraw(String coin, String clientOrderId, String network, String a @Override - public void getDepositHistory(String coin, BinanceApiCallback callback) { + public void getDepositHistory(String coin, BinanceApiCallback> callback) { binanceApiService.getDepositHistory(coin, 0, null, null, 0, 1000, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); @@ -226,14 +217,14 @@ public void getDepositHistory(String coin, BinanceApiCallback ca @Override public void getDepositHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit, BinanceApiCallback callback) { + int offset, int limit, BinanceApiCallback> callback) { binanceApiService.getDepositHistory(coin, status, startTime, endTime, offset, limit, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } @Override - public void getWithdrawHistory(String coin, BinanceApiCallback callback) { + public void getWithdrawHistory(String coin, BinanceApiCallback> callback) { binanceApiService.getWithdrawHistory(coin, 0, null, null, 0, 1000, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); @@ -241,7 +232,7 @@ public void getWithdrawHistory(String coin, BinanceApiCallback @Override public void getWithdrawHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit, BinanceApiCallback callback) { + int offset, int limit, BinanceApiCallback> callback) { binanceApiService.getWithdrawHistory(coin, status, startTime, endTime, offset, limit, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); 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 264e8a6a0..69403e076 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -242,26 +242,26 @@ public DustTransferResponse dustTranfer(List asset) { } @Override - public DepositHistory getDepositHistory(String coin) { + public List getDepositHistory(String coin) { return executeSync(binanceApiService.getDepositHistory(coin, 0, null, null, 0, 1000, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } @Override - public DepositHistory getDepositHistory(String coin, int status, Long startTime, Long endTime, + public List getDepositHistory(String coin, int status, Long startTime, Long endTime, int offset, int limit) { return executeSync(binanceApiService.getDepositHistory(coin, status, startTime, endTime, offset, limit, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } @Override - public WithdrawHistory getWithdrawHistory(String coin) { + public List getWithdrawHistory(String coin) { return executeSync(binanceApiService.getWithdrawHistory(coin, 0, null, null, 0, 1000, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } @Override - public WithdrawHistory getWithdrawHistory(String coin, int status, Long startTime, Long endTime, + public List getWithdrawHistory(String coin, int status, Long startTime, Long endTime, int offset, int limit) { return executeSync(binanceApiService.getWithdrawHistory(coin, status, startTime, endTime, offset, limit, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); 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 ba5ed6d7f..621886125 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -162,14 +162,14 @@ Call withdraw(@Query("coin") String coin,@Query("withdrawOrderId @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @GET("/sapi/v1/capital/deposit/hisrec") - Call getDepositHistory(@Query("coin") String coin, @Query("status") int status, + Call> getDepositHistory(@Query("coin") String coin, @Query("status") int status, @Query("startTime") Long startTime, @Query("endTime") Long endTime, @Query("offset") int offset, @Query("limit") int limit, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @GET("/sapi/v1/capital/withdraw/history") - Call getWithdrawHistory(@Query("coin") String coin, @Query("status") int status, + Call> getWithdrawHistory(@Query("coin") String coin, @Query("status") int status, @Query("startTime") Long startTime, @Query("endTime") Long endTime, @Query("offset") int offset, @Query("limit") int limit, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); From da68260b9b55927d2de64b6645c7e8c8637d51eb Mon Sep 17 00:00:00 2001 From: Daan Ravesteijn Date: Mon, 28 Mar 2022 23:26:44 +0200 Subject: [PATCH 11/12] Made all non-mandatory fields default 'null', added withdrawOrderId --- .../api/client/BinanceApiAsyncRestClient.java | 8 ++++---- .../binance/api/client/BinanceApiRestClient.java | 4 ++-- .../client/impl/BinanceApiAsyncRestClientImpl.java | 14 +++++++------- .../api/client/impl/BinanceApiRestClientImpl.java | 10 +++++----- .../binance/api/client/impl/BinanceApiService.java | 9 +++++---- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index 65b307c29..2d6f37d98 100755 --- a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java @@ -271,8 +271,8 @@ void withdraw(String coin, String clientOrderId, String network, String address, * * @param callback the callback that handles the response and returns the deposit history */ - void getDepositHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit, BinanceApiCallback> callback); + void getDepositHistory(String coin, Integer status, Long startTime, Long endTime, + Integer offset, Integer limit, BinanceApiCallback> callback); /** * Fetch account withdraw history. @@ -286,8 +286,8 @@ void getDepositHistory(String coin, int status, Long startTime, Long endTime, * * @param callback the callback that handles the response and returns the withdraw history */ - void getWithdrawHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit, BinanceApiCallback> callback); + void getWithdrawHistory(String coin, String withdrawOrderId, Integer status, Long startTime, Long endTime, + Integer offset, Integer limit, BinanceApiCallback> callback); /** * Fetch deposit address. diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index 258344eb8..b4a794ee7 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -301,8 +301,8 @@ List getDepositHistory(String coin, int status, Long startTime, Long en * * @return withdraw history, containing a list of withdrawals */ - List getWithdrawHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit); + List getWithdrawHistory(String coin, String withdrawOrderId, Integer status, Long startTime, Long endTime, + Integer offset, Integer limit); /** * Fetch sub-account transfer 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 25484fe70..10eadbf68 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java @@ -210,14 +210,14 @@ public void withdraw(String coin, String clientOrderId, String network, String a @Override public void getDepositHistory(String coin, BinanceApiCallback> callback) { - binanceApiService.getDepositHistory(coin, 0, null, null, 0, 1000, + binanceApiService.getDepositHistory(coin, null, null, null, null, 1000, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } @Override - public void getDepositHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit, BinanceApiCallback> callback) { + public void getDepositHistory(String coin, Integer status, Long startTime, Long endTime, + Integer offset, Integer limit, BinanceApiCallback> callback) { binanceApiService.getDepositHistory(coin, status, startTime, endTime, offset, limit, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); @@ -225,15 +225,15 @@ public void getDepositHistory(String coin, int status, Long startTime, Long endT @Override public void getWithdrawHistory(String coin, BinanceApiCallback> callback) { - binanceApiService.getWithdrawHistory(coin, 0, null, null, 0, 1000, + binanceApiService.getWithdrawHistory(coin, null, null, null, null, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } @Override - public void getWithdrawHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit, BinanceApiCallback> callback) { - binanceApiService.getWithdrawHistory(coin, status, startTime, endTime, offset, limit, + public void getWithdrawHistory(String coin, String withdrawOrderId, Integer status, Long startTime, Long endTime, + Integer offset, Integer limit, BinanceApiCallback> callback) { + binanceApiService.getWithdrawHistory(coin, withdrawOrderId, status, startTime, endTime, offset, limit, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } 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 69403e076..ea1ace419 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -243,7 +243,7 @@ public DustTransferResponse dustTranfer(List asset) { @Override public List getDepositHistory(String coin) { - return executeSync(binanceApiService.getDepositHistory(coin, 0, null, null, 0, 1000, + return executeSync(binanceApiService.getDepositHistory(coin, null, null, null, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } @@ -256,14 +256,14 @@ public List getDepositHistory(String coin, int status, Long startTime, @Override public List getWithdrawHistory(String coin) { - return executeSync(binanceApiService.getWithdrawHistory(coin, 0, null, null, 0, 1000, + return executeSync(binanceApiService.getWithdrawHistory(coin, null, null, null, null, null, null, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } @Override - public List getWithdrawHistory(String coin, int status, Long startTime, Long endTime, - int offset, int limit) { - return executeSync(binanceApiService.getWithdrawHistory(coin, status, startTime, endTime, offset, limit, + public List getWithdrawHistory(String coin, String withdrawOrderId, Integer status, Long startTime, Long endTime, + Integer offset, Integer limit) { + return executeSync(binanceApiService.getWithdrawHistory(coin, withdrawOrderId, status, startTime, endTime, offset, limit, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } 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 621886125..29df45076 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -162,16 +162,17 @@ Call withdraw(@Query("coin") String coin,@Query("withdrawOrderId @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @GET("/sapi/v1/capital/deposit/hisrec") - Call> getDepositHistory(@Query("coin") String coin, @Query("status") int status, + Call> getDepositHistory(@Query("coin") String coin, @Query("status") Integer status, @Query("startTime") Long startTime, @Query("endTime") Long endTime, - @Query("offset") int offset, @Query("limit") int limit, + @Query("offset") Integer offset, @Query("limit") Integer limit, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @GET("/sapi/v1/capital/withdraw/history") - Call> getWithdrawHistory(@Query("coin") String coin, @Query("status") int status, + Call> getWithdrawHistory(@Query("coin") String coin, @Query("status") String withdrawOrderId, + @Query("status") Integer status, @Query("startTime") Long startTime, @Query("endTime") Long endTime, - @Query("offset") int offset, @Query("limit") int limit, + @Query("offset") Integer offset, @Query("limit") Integer limit, @Query("recvWindow") Long recvWindow, @Query("timestamp") Long timestamp); @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) From cd9272838da8dc535c19ac1b08f5dc8d23f719eb Mon Sep 17 00:00:00 2001 From: Daan Ravesteijn Date: Fri, 15 Apr 2022 09:29:21 +0200 Subject: [PATCH 12/12] Add javadoc and rename parameters equal to binance api doc --- .../api/client/BinanceApiAsyncRestClient.java | 29 +++++++++++++++---- .../api/client/BinanceApiRestClient.java | 26 ++++++++++++++--- .../impl/BinanceApiAsyncRestClientImpl.java | 6 ++-- .../client/impl/BinanceApiRestClientImpl.java | 8 ++--- .../api/client/impl/BinanceApiService.java | 2 +- 5 files changed, 54 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java index 2d6f37d98..80a2e06b0 100755 --- a/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java @@ -249,18 +249,23 @@ public interface BinanceApiAsyncRestClient { * * Enable Withdrawals option has to be active in the API settings. * - * @param asset asset symbol to withdraw + * @param coin asset symbol to withdraw + * @param withdrawOrderId client id for withdraw + * @param network the network to use for the withdrawal * @param address address to withdraw to - * @param amount amount to withdraw - * @param name description/alias of the address * @param addressTag Secondary address identifier for coins like XRP,XMR etc. + * @param amount amount to withdraw + * @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. + * @param name Description of the address. Space in name should be encoded into %20. + * @param callback the callback that handles the response with a list of trades */ - void withdraw(String coin, String clientOrderId, String network, String address, String addressTag, - String amount, Boolean feeFlag, String name, BinanceApiCallback callback); + void withdraw(String coin, String withdrawOrderId, String network, String address, String addressTag, + String amount, Boolean transactionFeeFlag, String name, BinanceApiCallback callback); /** * Fetch account deposit history. * + * @param coin the asset to get the history for * @param callback the callback that handles the response and returns the deposit history */ void getDepositHistory(String coin, BinanceApiCallback> callback); @@ -269,6 +274,12 @@ void withdraw(String coin, String clientOrderId, String network, String address, /** * Fetch account deposit history. * + * @param coin the asset to get the history for + * @param status 0(0:pending,6: credited but cannot withdraw, 1:success) + * @param startTime Default: 90 days from current timestamp + * @param endTime Default: present timestamp + * @param offset Default:0 + * @param limit Default:1000, Max:1000 * @param callback the callback that handles the response and returns the deposit history */ void getDepositHistory(String coin, Integer status, Long startTime, Long endTime, @@ -277,6 +288,7 @@ void getDepositHistory(String coin, Integer status, Long startTime, Long endTime /** * Fetch account withdraw history. * + * @param coin the asset to get the history for * @param callback the callback that handles the response and returns the withdraw history */ void getWithdrawHistory(String coin, BinanceApiCallback> callback); @@ -284,6 +296,13 @@ void getDepositHistory(String coin, Integer status, Long startTime, Long endTime /** * Fetch account withdraw history. * + * @param coin the asset to get the history for + * @param withdrawOrderId client id for withdraw + * @param status 0(0:Email Sent,1:Cancelled 2:Awaiting Approval 3:Rejected 4:Processing 5:Failure 6:Completed) + * @param startTime Default: 90 days from current timestamp + * @param endTime Default: present timestamp + * @param offset Default:0 + * @param limit Default:1000, Max:1000 * @param callback the callback that handles the response and returns the withdraw history */ void getWithdrawHistory(String coin, String withdrawOrderId, Integer status, Long startTime, Long endTime, diff --git a/src/main/java/com/binance/api/client/BinanceApiRestClient.java b/src/main/java/com/binance/api/client/BinanceApiRestClient.java index b4a794ee7..4abb3b7c2 100755 --- a/src/main/java/com/binance/api/client/BinanceApiRestClient.java +++ b/src/main/java/com/binance/api/client/BinanceApiRestClient.java @@ -260,13 +260,16 @@ public interface BinanceApiRestClient { * Enable Withdrawals option has to be active in the API settings. * * @param coin asset symbol to withdraw + * @param withdrawOrderId client id for withdraw + * @param network the network to use for the withdrawal * @param address address to withdraw to - * @param amount amount to withdraw - * @param name description/alias of the address * @param addressTag Secondary address identifier for coins like XRP,XMR etc. + * @param amount amount to withdraw + * @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. + * @param name Description of the address. Space in name should be encoded into %20. */ - WithdrawResult withdraw(String coin, String clientOrderId, String network, String address, String amount, - String name, String addressTag, Boolean feeFlag); + WithdrawResult withdraw(String coin, String withdrawOrderId, String network, String address, String amount, + String name, String addressTag, Boolean transactionFeeFlag); /** * Conver a list of assets to BNB @@ -277,6 +280,7 @@ WithdrawResult withdraw(String coin, String clientOrderId, String network, Strin /** * Fetch account deposit history. * + * @param coin the asset to get the history for * @return deposit history, containing a list of deposits */ List getDepositHistory(String coin); @@ -284,6 +288,12 @@ WithdrawResult withdraw(String coin, String clientOrderId, String network, Strin /** * Fetch account deposit history. * + * @param coin the asset to get the history for + * @param status 0(0:pending,6: credited but cannot withdraw, 1:success) + * @param startTime Default: 90 days from current timestamp + * @param endTime Default: present timestamp + * @param offset Default:0 + * @param limit Default:1000, Max:1000 * @return deposit history, containing a list of deposits */ List getDepositHistory(String coin, int status, Long startTime, Long endTime, @@ -292,6 +302,7 @@ List getDepositHistory(String coin, int status, Long startTime, Long en /** * Fetch account withdraw history. * + * @param coin the asset to get the history for * @return withdraw history, containing a list of withdrawals */ List getWithdrawHistory(String coin); @@ -299,6 +310,13 @@ List getDepositHistory(String coin, int status, Long startTime, Long en /** * Fetch account withdraw history. * + * @param coin the asset to get the history for + * @param withdrawOrderId client id for withdraw + * @param status 0(0:Email Sent,1:Cancelled 2:Awaiting Approval 3:Rejected 4:Processing 5:Failure 6:Completed) + * @param startTime Default: 90 days from current timestamp + * @param endTime Default: present timestamp + * @param offset Default:0 + * @param limit Default:1000, Max:1000 * @return withdraw history, containing a list of withdrawals */ List getWithdrawHistory(String coin, String withdrawOrderId, Integer status, Long startTime, Long endTime, 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 10eadbf68..26dcbaa6b 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiAsyncRestClientImpl.java @@ -200,9 +200,9 @@ public void getMyTrades(String symbol, BinanceApiCallback> callback) } @Override - public void withdraw(String coin, String clientOrderId, String network, String address, String addressTag, - String amount, Boolean feeFlag, String name, BinanceApiCallback callback) { - binanceApiService.withdraw(coin, clientOrderId, network, address, addressTag, amount, feeFlag, name, + public void withdraw(String coin, String withdrawOrderId, String network, String address, String addressTag, + String amount, Boolean transactionFeeFlag, String name, BinanceApiCallback callback) { + binanceApiService.withdraw(coin, withdrawOrderId, network, address, addressTag, amount, transactionFeeFlag, name, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis()) .enqueue(new BinanceApiCallbackAdapter<>(callback)); } 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 ea1ace419..1c7d3558a 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiRestClientImpl.java @@ -229,10 +229,10 @@ public List getMyTrades(String symbol, Long fromId) { } @Override - public WithdrawResult withdraw(String coin, String clientOrderId, String network, String address, String amount, - String name, String addressTag, Boolean feeFlag) { - return executeSync(binanceApiService.withdraw(coin, clientOrderId, network, address, - addressTag, amount, feeFlag, name, + public WithdrawResult withdraw(String coin, String withdrawOrderId, String network, String address, String amount, + String name, String addressTag, Boolean transactionFeeFlag) { + return executeSync(binanceApiService.withdraw(coin, withdrawOrderId, network, address, + addressTag, amount, transactionFeeFlag, name, BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())); } 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 29df45076..c303cdfa1 100755 --- a/src/main/java/com/binance/api/client/impl/BinanceApiService.java +++ b/src/main/java/com/binance/api/client/impl/BinanceApiService.java @@ -153,7 +153,7 @@ Call> getMyTrades(@Query("symbol") String symbol, @Query("limit") In @Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER) @POST("/sapi/v1/capital/withdraw/apply") - Call withdraw(@Query("coin") String coin,@Query("withdrawOrderId") String clientOrderId, + Call withdraw(@Query("coin") String coin,@Query("withdrawOrderId") String withdrawOrderId, @Query("network") String network, @Query("address") String address, @Query("addressTag") String addressTag, @Query("amount") String amount, @Query("transactionFeeFlag") Boolean feeFlag, @Query("name") String name,