com.binance.connector.client.impl.spot.Staking Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of binance-connector-java Show documentation
Show all versions of binance-connector-java Show documentation
lightweight connector to API
package com.binance.connector.client.impl.spot;
import java.util.Map;
import com.binance.connector.client.enums.HttpMethod;
import com.binance.connector.client.utils.ParameterChecker;
import com.binance.connector.client.utils.ProxyAuth;
import com.binance.connector.client.utils.RequestHandler;
import com.binance.connector.client.utils.signaturegenerator.HmacSignatureGenerator;
import com.binance.connector.client.utils.signaturegenerator.SignatureGenerator;
/**
* Staking Endpoints
* All endpoints under the
* Staking Endpoint
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class Staking {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public Staking(String baseUrl, String apiKey, String secretKey, boolean showLimitUsage, ProxyAuth proxy) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, new HmacSignatureGenerator(secretKey), proxy);
this.showLimitUsage = showLimitUsage;
}
public Staking(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage, ProxyAuth proxy) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, signatureGenerator, proxy);
this.showLimitUsage = showLimitUsage;
}
private final String SUB_ETH_STAKING = "/sapi/v2/eth-staking/eth/stake";
/**
* Stake ETH to get WBETH
*
*
* POST /sapi/v2/eth-staking/eth/stake
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* amount -- mandatory/decimal -- Amount in ETH, limit 4 decimals
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/staking/Subscribe-ETH-Staking
*/
public String subEthStaking(Map parameters) {
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, SUB_ETH_STAKING, parameters, HttpMethod.POST, showLimitUsage);
}
private final String REDEEM_ETH = "/sapi/v1/eth-staking/eth/redeem";
/**
* Redeem WBETH or BETH and get ETH
*
*
* POST /sapi/v1/eth-staking/eth/redeem
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* amount -- mandatory/decimal -- Amount in ETH, limit 4 decimals
* asset -- optional/string -- "BETH" or "WBETH", default "BETH"
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/staking/Redeem-ETH
*/
public String redeemEthStaking(Map parameters) {
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, REDEEM_ETH, parameters, HttpMethod.POST, showLimitUsage);
}
private final String ETH_STAKING_HISTORY = "/sapi/v1/eth-staking/eth/history/stakingHistory";
/**
* GET /sapi/v1/eth-staking/eth/history/stakingHistory
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 10, Max: 100
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/history/Get-ETH-staking-history
*/
public String ethStakingSubHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ETH_STAKING_REDEEM_HISTORY = "/sapi/v1/eth-staking/eth/history/redemptionHistory";
/**
* GET /sapi/v1/eth-staking/eth/history/redemptionHistory
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 10, Max: 100
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/history/Get-ETH-redemption-history
*/
public String ethStakingRedeemHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_REDEEM_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ETH_STAKING_REWARDS_HISTORY = "/sapi/v1/eth-staking/eth/history/rewardsHistory";
/**
* GET /sapi/v1/eth-staking/eth/history/rewardsHistory
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 10, Max: 100
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/history/Get-ETH-rewards-distribution-history
*/
public String ethStakingRewardsHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_REWARDS_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ETH_STAKING_QUOTA = "/sapi/v1/eth-staking/eth/quota";
/**
* GET /sapi/v1/eth-staking/eth/quota
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/account/Get-current-ETH-staking-quota
*/
public String ethStakingQuota(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_QUOTA, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ETH_STAKING_RATE_HISTORY = "/sapi/v1/eth-staking/eth/history/rateHistory";
/**
* GET /sapi/v1/eth-staking/eth/history/rateHistory
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 10, Max: 100
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/history/Get-BETH-Rate-History
*/
public String ethStakingRateHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_RATE_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ETH_STAKING_ACCOUNT = "/sapi/v2/eth-staking/account";
/**
* GET /sapi/v2/eth-staking/account
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/account/ETH-Staking-account
*/
public String ethStakingAccount(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_ACCOUNT, parameters, HttpMethod.GET, showLimitUsage);
}
private final String WRAP_WBETH = "/sapi/v1/eth-staking/wbeth/wrap";
/**
* POST /sapi/v1/eth-staking/wbeth/wrap
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* amount -- mandatory/decimal -- Amount in BETH, limit 4 decimals
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/staking/Wrap-BETH
*/
public String wrapEthStakingWbeth(Map parameters) {
ParameterChecker.checkRequiredParameter(parameters, "amount");
return requestHandler.sendSignedRequest(baseUrl, WRAP_WBETH, parameters, HttpMethod.POST, showLimitUsage);
}
private final String ETH_STAKING_WBETH_WRAP_HISTORY = "/sapi/v1/eth-staking/wbeth/history/wrapHistory";
/**
* GET /sapi/v1/eth-staking/wbeth/history/wrapHistory
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 10, Max: 100
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/history/Get-WBETH-wrap-history
*/
public String ethStakingWbethWrapHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_WBETH_WRAP_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ETH_STAKING_WBETH_UNWRAP_HISTORY = "/sapi/v1/eth-staking/wbeth/history/unwrapHistory";
/**
* GET /sapi/v1/eth-staking/wbeth/history/unwrapHistory
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 10, Max: 100
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/history/Get-WBETH-unwrap-history
*/
public String ethStakingWbethUnwrapHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_WBETH_UNWRAP_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
private final String ETH_STAKING_WBETH_REWARD_HISTORY = "/sapi/v1/eth-staking/eth/history/wbethRewardsHistory";
/**
* GET /sapi/v1/eth-staking/eth/history/wbethRewardsHistory
*
* @param
* parameters Map of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* startTime -- optional/long
* endTime -- optional/long
* current -- optional/long -- Currently querying page. Start from 1. Default:1
* size -- optional/long -- Default: 10, Max: 100
* recvWindow -- optional/long
* @return String
* @see
* https://developers.binance.com/docs/staking/history/Get-WBETH-rewards-history
*/
public String ethStakingWbethRewardHistory(Map parameters) {
return requestHandler.sendSignedRequest(baseUrl, ETH_STAKING_WBETH_REWARD_HISTORY, parameters, HttpMethod.GET, showLimitUsage);
}
}