Skip to content

Commit

Permalink
Merge pull request #2 from ravesteijnd/rezazadeh93-update-wallet-endp…
Browse files Browse the repository at this point in the history
…oints

Rezazadeh93 update wallet endpoints
  • Loading branch information
rezazadeh93 authored Apr 15, 2022
2 parents 7935a73 + cd92728 commit 7ccae65
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<WithdrawResult> callback);
void withdraw(String coin, String withdrawOrderId, String network, String address, String addressTag,
String amount, Boolean transactionFeeFlag, String name, BinanceApiCallback<WithdrawResult> 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<List<Deposit>> callback);
Expand All @@ -269,25 +274,39 @@ 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, int status, Long startTime, Long endTime,
int offset, int limit, BinanceApiCallback<List<Deposit>> callback);
void getDepositHistory(String coin, Integer status, Long startTime, Long endTime,
Integer offset, Integer limit, BinanceApiCallback<List<Deposit>> callback);

/**
* 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<List<Withdraw>> callback);

/**
* 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, int status, Long startTime, Long endTime,
int offset, int limit, BinanceApiCallback<List<Withdraw>> callback);
void getWithdrawHistory(String coin, String withdrawOrderId, Integer status, Long startTime, Long endTime,
Integer offset, Integer limit, BinanceApiCallback<List<Withdraw>> callback);

/**
* Fetch deposit address.
Expand Down
30 changes: 24 additions & 6 deletions src/main/java/com/binance/api/client/BinanceApiRestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -277,13 +280,20 @@ 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<Deposit> getDepositHistory(String coin);

/**
* 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<Deposit> getDepositHistory(String coin, int status, Long startTime, Long endTime,
Expand All @@ -292,17 +302,25 @@ List<Deposit> 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<Withdraw> getWithdrawHistory(String coin);

/**
* 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<Withdraw> getWithdrawHistory(String coin, int status, Long startTime, Long endTime,
int offset, int limit);
List<Withdraw> getWithdrawHistory(String coin, String withdrawOrderId, Integer status, Long startTime, Long endTime,
Integer offset, Integer limit);

/**
* Fetch sub-account transfer history.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,40 +200,40 @@ public void getMyTrades(String symbol, BinanceApiCallback<List<Trade>> callback)
}

@Override
public void withdraw(String coin, String clientOrderId, String network, String address, String addressTag,
String amount, Boolean feeFlag, String name, BinanceApiCallback<WithdrawResult> 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<WithdrawResult> callback) {
binanceApiService.withdraw(coin, withdrawOrderId, network, address, addressTag, amount, transactionFeeFlag, name,
BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())
.enqueue(new BinanceApiCallbackAdapter<>(callback));
}


@Override
public void getDepositHistory(String coin, BinanceApiCallback<List<Deposit>> 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<List<Deposit>> callback) {
public void getDepositHistory(String coin, Integer status, Long startTime, Long endTime,
Integer offset, Integer limit, BinanceApiCallback<List<Deposit>> 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<List<Withdraw>> 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<List<Withdraw>> 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<List<Withdraw>> callback) {
binanceApiService.getWithdrawHistory(coin, withdrawOrderId, status, startTime, endTime, offset, limit,
BinanceApiConstants.DEFAULT_RECEIVING_WINDOW, System.currentTimeMillis())
.enqueue(new BinanceApiCallbackAdapter<>(callback));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ public List<Trade> 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()));
}

Expand All @@ -243,7 +243,7 @@ public DustTransferResponse dustTranfer(List<String> asset) {

@Override
public List<Deposit> 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()));
}

Expand All @@ -256,14 +256,14 @@ public List<Deposit> getDepositHistory(String coin, int status, Long startTime,

@Override
public List<Withdraw> 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<Withdraw> 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<Withdraw> 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()));
}

Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/binance/api/client/impl/BinanceApiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Call<List<Trade>> getMyTrades(@Query("symbol") String symbol, @Query("limit") In

@Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER)
@POST("/sapi/v1/capital/withdraw/apply")
Call<WithdrawResult> withdraw(@Query("coin") String coin,@Query("withdrawOrderId") String clientOrderId,
Call<WithdrawResult> 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,
Expand All @@ -162,16 +162,17 @@ Call<WithdrawResult> withdraw(@Query("coin") String coin,@Query("withdrawOrderId

@Headers(BinanceApiConstants.ENDPOINT_SECURITY_TYPE_SIGNED_HEADER)
@GET("/sapi/v1/capital/deposit/hisrec")
Call<List<Deposit>> getDepositHistory(@Query("coin") String coin, @Query("status") int status,
Call<List<Deposit>> 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<List<Withdraw>> getWithdrawHistory(@Query("coin") String coin, @Query("status") int status,
Call<List<Withdraw>> 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)
Expand Down

0 comments on commit 7ccae65

Please sign in to comment.