Skip to content

Latest commit

 

History

History
887 lines (703 loc) · 40.9 KB

StakingsApi.md

File metadata and controls

887 lines (703 loc) · 40.9 KB

StakingsApi

All URIs are relative to https://api.dev.cobo.com/v2

Method HTTP request Description
createClaimActivity POST /stakings/activities/claim Create claim activity
createStakeActivity POST /stakings/activities/stake Create stake activity
createUnstakeActivity POST /stakings/activities/unstake Create unstake activity
createWithdrawActivity POST /stakings/activities/withdraw Create withdraw activity
getStakingActivityById GET /stakings/activities/{activity_id} Get staking activity details
getStakingById GET /stakings/{staking_id} Get staking position details
getStakingEstimationFee POST /stakings/estimate_fee Estimate staking fees
getStakingEstimationFeeV2 POST /stakings/estimate_fee_v2 Estimate staking fees v2
getStakingPoolById GET /stakings/pools/{pool_id} Get staking pool details
listStakingActivities GET /stakings/activities List staking activities
listStakingPools GET /stakings/pools List staking pools
listStakings GET /stakings List staking positions

createClaimActivity

CreateStakeActivity201Response createClaimActivity(createClaimActivityRequest)

Create claim activity

This operation creates a claim request. <Note>Currently, only the Ethereum Beacon protocol supports this operation.</Note> For some protocols, you can use the `fee` property in the request body to specify the maximum fee you are willing to pay. The transaction will fail if the actual fee exceeds the specified maximum fee.

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    CreateClaimActivityRequest createClaimActivityRequest = new CreateClaimActivityRequest();
    try {
      CreateStakeActivity201Response result = apiInstance.createClaimActivity(createClaimActivityRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#createClaimActivity");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
createClaimActivityRequest CreateClaimActivityRequest The request body to create a staking request. [optional]

Return type

CreateStakeActivity201Response

Authorization

CoboAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Successfully created a staking activity. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -

createStakeActivity

CreateStakeActivity201Response createStakeActivity(createStakeActivityRequest)

Create stake activity

This operation creates a staking request. For some protocols, you can use the `fee` property in the request body to specify the maximum fee you are willing to pay. The transaction will fail if the actual fee exceeds the specified maximum fee. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    CreateStakeActivityRequest createStakeActivityRequest = new CreateStakeActivityRequest();
    try {
      CreateStakeActivity201Response result = apiInstance.createStakeActivity(createStakeActivityRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#createStakeActivity");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
createStakeActivityRequest CreateStakeActivityRequest The request body to create a staking request. [optional]

Return type

CreateStakeActivity201Response

Authorization

CoboAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Successfully created a staking activity. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -

createUnstakeActivity

CreateStakeActivity201Response createUnstakeActivity(createUnstakeActivityRequest)

Create unstake activity

This operation creates an unstaking request. Your staked tokens will be automatically unlocked once the specified locking period ends. If you want to withdraw your tokens beforehand, you can unstake them with this operation. For some protocols, you can use the `fee` property in the request body to specify the maximum fee you are willing to pay. The transaction will fail if the actual fee exceeds the specified maximum fee. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    CreateUnstakeActivityRequest createUnstakeActivityRequest = new CreateUnstakeActivityRequest();
    try {
      CreateStakeActivity201Response result = apiInstance.createUnstakeActivity(createUnstakeActivityRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#createUnstakeActivity");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
createUnstakeActivityRequest CreateUnstakeActivityRequest The request body to create a unstaking request. [optional]

Return type

CreateStakeActivity201Response

Authorization

CoboAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Successfully created a staking activity. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -

createWithdrawActivity

CreateStakeActivity201Response createWithdrawActivity(createWithdrawActivityRequest)

Create withdraw activity

This operation creates a withdrawal request. For some protocols, you can use the `fee` property in the request body to specify the maximum fee you are willing to pay. The transaction will fail if the actual fee exceeds the specified maximum fee. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    CreateWithdrawActivityRequest createWithdrawActivityRequest = new CreateWithdrawActivityRequest();
    try {
      CreateStakeActivity201Response result = apiInstance.createWithdrawActivity(createWithdrawActivityRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#createWithdrawActivity");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
createWithdrawActivityRequest CreateWithdrawActivityRequest The request body to create a withdraw activity. [optional]

Return type

CreateStakeActivity201Response

Authorization

CoboAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Successfully created a staking activity. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -

getStakingActivityById

Activity getStakingActivityById(activityId)

Get staking activity details

This operation retrieves the details of a specified staking activity.

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    String activityId = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
    try {
      Activity result = apiInstance.getStakingActivityById(activityId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#getStakingActivityById");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
activityId String The activity ID.

Return type

Activity

Authorization

CoboAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A staking activity has been successfully retrieved. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -
404 Requested resources not found. -

getStakingById

Stakings getStakingById(stakingId)

Get staking position details

This operation retrieves the detailed information about a specified staking position.

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    String stakingId = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
    try {
      Stakings result = apiInstance.getStakingById(stakingId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#getStakingById");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
stakingId String The ID of the staking position. You can retrieve a list of staking positions by calling List staking positions.

Return type

Stakings

Authorization

CoboAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A staking position has been successfully retrieved. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -
404 Requested resources not found. -

getStakingEstimationFee

GetStakingEstimationFee201Response getStakingEstimationFee(getStakingEstimationFeeRequest)

Estimate staking fees

<Note>This operation is deprecated. Please use the updated version instead.</Note> This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. For some protocols, you can use the `fee.fee_rate` property in the request body to specify the fee rate you are willing to pay. The `fee.max_fee_amount` property in the request body will be ignored. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    GetStakingEstimationFeeRequest getStakingEstimationFeeRequest = new GetStakingEstimationFeeRequest();
    try {
      GetStakingEstimationFee201Response result = apiInstance.getStakingEstimationFee(getStakingEstimationFeeRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#getStakingEstimationFee");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
getStakingEstimationFeeRequest GetStakingEstimationFeeRequest The request body to get the estimated fee of a staking activity. [optional]

Return type

GetStakingEstimationFee201Response

Authorization

CoboAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 The request was successful. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -

getStakingEstimationFeeV2

EthStakeEstimatedFee getStakingEstimationFeeV2(getStakingEstimationFeeRequest)

Estimate staking fees v2

This operation calculates the fee required for a staking activity based on factors such as network congestion and transaction complexity. <Note>For the Babylon protocol, you can only select UTXO as the fee model.</Note>

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    GetStakingEstimationFeeRequest getStakingEstimationFeeRequest = new GetStakingEstimationFeeRequest();
    try {
      EthStakeEstimatedFee result = apiInstance.getStakingEstimationFeeV2(getStakingEstimationFeeRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#getStakingEstimationFeeV2");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
getStakingEstimationFeeRequest GetStakingEstimationFeeRequest The request body to get the estimated fee of a staking activity. [optional]

Return type

EthStakeEstimatedFee

Authorization

CoboAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 The request was successful. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -

getStakingPoolById

PoolDetails getStakingPoolById(poolId)

Get staking pool details

This operation retrieves the detailed information about a specified staking pool.

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    String poolId = "babylon_btc";
    try {
      PoolDetails result = apiInstance.getStakingPoolById(poolId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#getStakingPoolById");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
poolId String The ID of the staking pool. A staking pool is a pairing of a staking protocol and a specific type of token. You can call List staking pools to retrieve a list of staking pools.

Return type

PoolDetails

Authorization

CoboAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A staking pool has been successfully retrieved. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -
404 Requested resources not found. -

listStakingActivities

ListStakingActivities200Response listStakingActivities(poolId, stakingId, activityType, activityStatus, minModifiedTimestamp, maxModifiedTimestamp, initiator, requestId, limit, before, after)

List staking activities

This operation retrieves a list of staking activities.

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    String poolId = "babylon_btc";
    String stakingId = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
    ActivityType activityType = ActivityType.fromValue("Stake");
    ActivityStatus activityStatus = ActivityStatus.fromValue("Success");
    Long minModifiedTimestamp = 1635744000000L;
    Long maxModifiedTimestamp = 1635744000000L;
    String initiator = "[email protected]";
    String requestId = "web_send_by_user_327_1610444045047";
    Integer limit = 10;
    String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
    String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
    try {
      ListStakingActivities200Response result = apiInstance.listStakingActivities(poolId, stakingId, activityType, activityStatus, minModifiedTimestamp, maxModifiedTimestamp, initiator, requestId, limit, before, after);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#listStakingActivities");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
poolId String The ID of the staking pool. A staking pool is a pairing of a staking protocol and a specific type of token. You can call List staking pools to retrieve a list of staking pools. [optional]
stakingId String The position ID. [optional]
activityType ActivityType [optional] [enum: Stake, Unstake, Withdraw, Claim]
activityStatus ActivityStatus [optional] [enum: Success, Processing, Failed]
minModifiedTimestamp Long The start time of the query. All staking activities updated after the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds. [optional]
maxModifiedTimestamp Long The end time of the query. All staking activities updated before the specified time will be retrieved. The time is in Unix timestamp format, measured in milliseconds. [optional]
initiator String The activity initiator, which is your API key by default. You can also specify the initiator when creating the activity. [optional]
requestId String The request ID that is used to track a transaction request. The request ID is provided by you and must be unique within your organization. [optional]
limit Integer The maximum number of objects to return. For most operations, the value range is [1, 50]. [optional] [default to 10]
before String This parameter specifies an object ID as a starting point for pagination, retrieving data before the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `before` to the ID of Object C (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object A. Notes: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. - If you set it to `infinity`, the last page of data is returned. [optional]
after String This parameter specifies an object ID as a starting point for pagination, retrieving data after the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `after` to the ID of Object A (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object C. Notes: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. [optional]

Return type

ListStakingActivities200Response

Authorization

CoboAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A list of staking activities have been successfully retrieved. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -

listStakingPools

ListStakingPools200Response listStakingPools(chainId, tokenId, limit, before, after)

List staking pools

This operation retrieves a list of staking pools currently supported.

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    String chainId = "ETH";
    String tokenId = "ETH_USDT";
    Integer limit = 10;
    String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
    String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
    try {
      ListStakingPools200Response result = apiInstance.listStakingPools(chainId, tokenId, limit, before, after);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#listStakingPools");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
chainId String The chain ID, which is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling List enabled chains. [optional]
tokenId String The token ID, which is the unique identifier of a token. You can retrieve the IDs of all the tokens you can use by calling List enabled tokens. [optional]
limit Integer The maximum number of objects to return. For most operations, the value range is [1, 50]. [optional] [default to 10]
before String This parameter specifies an object ID as a starting point for pagination, retrieving data before the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `before` to the ID of Object C (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object A. Notes: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. - If you set it to `infinity`, the last page of data is returned. [optional]
after String This parameter specifies an object ID as a starting point for pagination, retrieving data after the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `after` to the ID of Object A (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object C. Notes: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. [optional]

Return type

ListStakingPools200Response

Authorization

CoboAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A list of staking pools has been successfully retrieved. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -

listStakings

ListStakings200Response listStakings(poolId, statuses, walletId, tokenId, limit, before, after)

List staking positions

This operation retrieves a list of staking positions.

Example

// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.model.*;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.StakingsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    // Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD
    defaultClient.setEnv(Env.DEV);

    // Replace `<YOUR_PRIVATE_KEY>` with your private key
    defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
    StakingsApi apiInstance = new StakingsApi();
    String poolId = "babylon_btc";
    String statuses = "Active,StakeInProgress,";
    UUID walletId = UUID.fromString("f47ac10b-58cc-4372-a567-0e02b2c3d479");
    String tokenId = "ETH_USDT";
    Integer limit = 10;
    String before = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGmk1";
    String after = "RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk";
    try {
      ListStakings200Response result = apiInstance.listStakings(poolId, statuses, walletId, tokenId, limit, before, after);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling StakingsApi#listStakings");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
poolId String The ID of the staking pool. A staking pool is a pairing of a staking protocol and a specific type of token. You can call List staking pools to retrieve a list of staking pools. [optional]
statuses String The statuses of the staking amounts, separated by comma. Possible values include: - `StakeInProgress`: The staking request is submitted and is waiting to be confirmed by the staking protocol. - `Active`: The amount has been staked. - `Rejected`: The staking request has been rejected because the signer refuses to sign the transaction. - `LimitExceeded`: The total staking cap of the staking protocol has been reached. - `Invalid`: The staking request is invalid. This is often due to the failure to broadcast the transaction. - `UnstakeInProgress`: The unstaking request is submitted and is waiting to be confirmed by the staking protocol. - `Withdrawable`: The tokens have been unstaked and are ready to be withdrawn. - `WithdrawInProgress`: The withdrawal request is submitted and is waiting to be confirmed on the chain network. - `Closed`: The staking position is closed. [optional]
walletId UUID The wallet ID. [optional]
tokenId String The token ID, which is the unique identifier of a token. You can retrieve the IDs of all the tokens you can use by calling List enabled tokens. [optional]
limit Integer The maximum number of objects to return. For most operations, the value range is [1, 50]. [optional] [default to 10]
before String This parameter specifies an object ID as a starting point for pagination, retrieving data before the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `before` to the ID of Object C (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object A. Notes: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. - If you set it to `infinity`, the last page of data is returned. [optional]
after String This parameter specifies an object ID as a starting point for pagination, retrieving data after the specified object relative to the current dataset. Suppose the current data is ordered as Object A, Object B, and Object C. If you set `after` to the ID of Object A (`RqeEoTkgKG5rpzqYzg2Hd3szmPoj2cE7w5jWwShz3C1vyGSAk`), the response will include Object B and Object C. Notes: - If you set both `after` and `before`, an error will occur. - If you leave both `before` and `after` empty, the first page of data is returned. [optional]

Return type

ListStakings200Response

Authorization

CoboAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A list of staking positions has been successfully retrieved. -
400 Bad request. Your request contains malformed syntax or invalid parameters. -
401 Unauthorized. Please provide valid credentials. -
403 Forbidden. You do not have the permission to access the requested resource. -