Skip to content

Latest commit

 

History

History
271 lines (200 loc) · 7.27 KB

DelegateApi.md

File metadata and controls

271 lines (200 loc) · 7.27 KB

DelegateApi

All URIs are relative to /v2.5.0

Method HTTP request Description
getDelegate GET /delegate Get delegate info
getDelegates GET /delegates Get all delegates
getValidators GET /validators Get all validators
getVote GET /vote Get the vote between a delegate and a voter
getVotes GET /votes Get all votes of a delegate

getDelegate

GetDelegateResponse getDelegate(address)

Get delegate info

Returns the information about delegate.

Example

// Import classes:
//import org.semux.sdk.client.ApiClient;
//import org.semux.sdk.client.ApiException;
//import org.semux.sdk.client.Configuration;
//import org.semux.sdk.client.auth.*;
//import org.semux.sdk.client.api.DelegateApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

DelegateApi apiInstance = new DelegateApi();
String address = "address_example"; // String | Delegate address
try {
    GetDelegateResponse result = apiInstance.getDelegate(address);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DelegateApi#getDelegate");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
address String Delegate address

Return type

GetDelegateResponse

Authorization

basicAuth

HTTP request headers

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

getDelegates

GetDelegatesResponse getDelegates()

Get all delegates

Returns a list of delegates.

Example

// Import classes:
//import org.semux.sdk.client.ApiClient;
//import org.semux.sdk.client.ApiException;
//import org.semux.sdk.client.Configuration;
//import org.semux.sdk.client.auth.*;
//import org.semux.sdk.client.api.DelegateApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

DelegateApi apiInstance = new DelegateApi();
try {
    GetDelegatesResponse result = apiInstance.getDelegates();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DelegateApi#getDelegates");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

GetDelegatesResponse

Authorization

basicAuth

HTTP request headers

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

getValidators

GetValidatorsResponse getValidators()

Get all validators

Returns a list of validators in Semux addresses.

Example

// Import classes:
//import org.semux.sdk.client.ApiClient;
//import org.semux.sdk.client.ApiException;
//import org.semux.sdk.client.Configuration;
//import org.semux.sdk.client.auth.*;
//import org.semux.sdk.client.api.DelegateApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

DelegateApi apiInstance = new DelegateApi();
try {
    GetValidatorsResponse result = apiInstance.getValidators();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DelegateApi#getValidators");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

GetValidatorsResponse

Authorization

basicAuth

HTTP request headers

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

getVote

GetVoteResponse getVote(delegate, voter)

Get the vote between a delegate and a voter

Returns the vote from a voter to a delegate.

Example

// Import classes:
//import org.semux.sdk.client.ApiClient;
//import org.semux.sdk.client.ApiException;
//import org.semux.sdk.client.Configuration;
//import org.semux.sdk.client.auth.*;
//import org.semux.sdk.client.api.DelegateApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

DelegateApi apiInstance = new DelegateApi();
String delegate = "delegate_example"; // String | Delegate address
String voter = "voter_example"; // String | Voter address
try {
    GetVoteResponse result = apiInstance.getVote(delegate, voter);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DelegateApi#getVote");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
delegate String Delegate address
voter String Voter address

Return type

GetVoteResponse

Authorization

basicAuth

HTTP request headers

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

getVotes

GetVotesResponse getVotes(delegate)

Get all votes of a delegate

Returns all the votes to a delegate as a map of [voter address] => [votes]

Example

// Import classes:
//import org.semux.sdk.client.ApiClient;
//import org.semux.sdk.client.ApiException;
//import org.semux.sdk.client.Configuration;
//import org.semux.sdk.client.auth.*;
//import org.semux.sdk.client.api.DelegateApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

DelegateApi apiInstance = new DelegateApi();
String delegate = "delegate_example"; // String | Delegate address
try {
    GetVotesResponse result = apiInstance.getVotes(delegate);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DelegateApi#getVotes");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
delegate String Delegate address

Return type

GetVotesResponse

Authorization

basicAuth

HTTP request headers

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