Staking
Installation
- Maven
- Gradle
pom.xml
<dependency>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<version>{{version}}</version>
</dependency>
build.gradle
implementation '{{groupId}}:{{artifactId}}:{{version}}'
Client instantiation
StakingClient client = new StakingClient(key, secret);
Features
Get products
- By Product type
- By Product type and asset
- Sync
- Async
try{
List<Product> res = client.getProducts(new ProductListParams(ProductType.STAKING)).sync();
}catch(ApiException e){
//...
}
client.getProducts(new ProductListParams(ProductType.STAKING)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<Product> res = client.getProducts(new ProductListParams(ProductType.STAKING, asset)).sync();
}catch(ApiException e){
//...
}
client.getProducts(new ProductListParams(ProductType.STAKING, asset)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get staking history
- Default
- Paginated
- Sync
- Async
try{
List<StakingRecord> res = client.getHistory(new HistoryParams(ProductType.STAKING, TransactionType.INTEREST, asset)).sync();
}catch(ApiException e){
//...
}
client.getHistory(new HistoryParams(ProductType.STAKING, TransactionType.INTEREST, asset)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<StakingRecord> res = client.getHistory(new HistoryParams(ProductType.STAKING, TransactionType.INTEREST, asset), FramedPaging(startTime, endTime, page, limit)).sync();
}catch(ApiException e){
//...
}
client.getHistory(new HistoryParams(ProductType.STAKING, TransactionType.INTEREST, asset), FramedPaging(startTime, endTime, page, limit)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get personal left quota of Staking product
- Sync
- Async
try{
LeftQuota res = client.getLeftQuota(new LeftQuotaParams(ProductType.STAKING, productId)).sync();
}catch(ApiException e){
//...
}
client.getLeftQuota(new LeftQuotaParams(ProductType.STAKING, productId)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get Staking product position.
- Staking
- Flexible DeFi
- Locked DeFi
- Sync
- Async
try{
List<ProductPosition> res = client.getPosition(new PositionParams(ProductType.STAKING)).sync();
}catch(ApiException e){
//...
}
client.getPosition(new PositionParams(ProductType.STAKING)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<ProductPosition> res = client.getPosition(new PositionParams(ProductType.F_DEFI)).sync();
}catch(ApiException e){
//...
}
client.getPosition(new PositionParams(ProductType.F_DEFI)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<ProductPosition> res = client.getPosition(new PositionParams(ProductType.L_DEFI)).sync();
}catch(ApiException e){
//...
}
client.getPosition(new PositionParams(ProductType.L_DEFI)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Purchase Staking product
- Staking product
- Flexible DeFi product
- Locked DeFi product
- Sync
- Async
try{
PurchaseResponse res = client.purchase(new PurchaseParams(ProductType.STAKING, productId, amount)).sync();
}catch(ApiException e){
//...
}
client.purchase(new PurchaseParams(ProductType.STAKING, productId, amount)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
PurchaseResponse res = client.purchase(new PurchaseParams(ProductType.F_DEFI, productId, amount)).sync();
}catch(ApiException e){
//...
}
client.purchase(new PurchaseParams(ProductType.F_DEFI, productId, amount)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
PurchaseResponse res = client.purchase(new PurchaseParams(ProductType.L_DEFI, productId, amount)).sync();
}catch(ApiException e){
//...
}
client.purchase(new PurchaseParams(ProductType.L_DEFI, productId, amount)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Redeem Staking product
- Staking product
- Flexible DeFi product
- Locked DeFi product
- Sync
- Async
try{
RedeemResponse res = client.redeem(new RedeemParams(ProductType.STAKING, productId)).sync();
}catch(ApiException e){
//...
}
client.redeem(new RedeemParams(ProductType.STAKING, productId)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
RedeemResponse res = client.redeem(new RedeemParams(ProductType.F_DEFI, productId)).sync();
}catch(ApiException e){
//...
}
client.redeem(new RedeemParams(ProductType.F_DEFI, productId)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
RedeemResponse res = client.redeem(new RedeemParams(ProductType.L_DEFI, productId)).sync();
}catch(ApiException e){
//...
}
client.redeem(new RedeemParams(ProductType.L_DEFI, productId)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Set auto staking on Locked Staking or Locked DeFi Staking
- Sync
- Async
try{
AutoStakingResponse res = client.setAutoStaking(new AutoStakingParams(ProductType.STAKING, productId, true/false)).sync();
}catch(ApiException e){
//...
}
client.setAutoStaking(new AutoStakingParams(ProductType.STAKING, productId, true/false)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});