Skip to content

Latest commit

 

History

History
377 lines (278 loc) · 10.6 KB

BlockchainApi.md

File metadata and controls

377 lines (278 loc) · 10.6 KB

BlockchainApi

All URIs are relative to /v2.5.0

Method HTTP request Description
getBlockByHash GET /block-by-hash Get block by hash
getBlockByNumber GET /block-by-number Get block by number
getLatestBlock GET /latest-block Get the latest block
getLatestBlockNumber GET /latest-block-number Get the number of the latest block
getTransaction GET /transaction Get transaction
getTransactionLimits GET /transaction-limits Get transaction limits
getTransactionResult GET /transaction-result Get transaction result

getBlockByHash

GetBlockResponse getBlockByHash(hash)

Get block by hash

Returns a block by block hash.

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.BlockchainApi;

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

BlockchainApi apiInstance = new BlockchainApi();
String hash = "hash_example"; // String | Hash of block
try {
    GetBlockResponse result = apiInstance.getBlockByHash(hash);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling BlockchainApi#getBlockByHash");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hash String Hash of block

Return type

GetBlockResponse

Authorization

basicAuth

HTTP request headers

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

getBlockByNumber

GetBlockResponse getBlockByNumber(number)

Get block by number

Returns a block by block number.

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.BlockchainApi;

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

BlockchainApi apiInstance = new BlockchainApi();
String number = "number_example"; // String | Number of block
try {
    GetBlockResponse result = apiInstance.getBlockByNumber(number);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling BlockchainApi#getBlockByNumber");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
number String Number of block

Return type

GetBlockResponse

Authorization

basicAuth

HTTP request headers

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

getLatestBlock

GetLatestBlockResponse getLatestBlock()

Get the latest block

Returns the latest block.

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.BlockchainApi;

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

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

Parameters

This endpoint does not need any parameter.

Return type

GetLatestBlockResponse

Authorization

basicAuth

HTTP request headers

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

getLatestBlockNumber

GetLatestBlockNumberResponse getLatestBlockNumber()

Get the number of the latest block

Returns the number of the latest block.

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.BlockchainApi;

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

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

Parameters

This endpoint does not need any parameter.

Return type

GetLatestBlockNumberResponse

Authorization

basicAuth

HTTP request headers

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

getTransaction

GetTransactionResponse getTransaction(hash)

Get transaction

Returns a transactions if exists.

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.BlockchainApi;

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

BlockchainApi apiInstance = new BlockchainApi();
String hash = "hash_example"; // String | Transaction hash
try {
    GetTransactionResponse result = apiInstance.getTransaction(hash);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling BlockchainApi#getTransaction");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hash String Transaction hash

Return type

GetTransactionResponse

Authorization

basicAuth

HTTP request headers

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

getTransactionLimits

GetTransactionLimitsResponse getTransactionLimits(type)

Get transaction limits

Returns transaction limitations including minimum transaction fee and maximum transaction size.

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.BlockchainApi;

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

BlockchainApi apiInstance = new BlockchainApi();
String type = "type_example"; // String | Type of transaction
try {
    GetTransactionLimitsResponse result = apiInstance.getTransactionLimits(type);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling BlockchainApi#getTransactionLimits");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
type String Type of transaction [enum: COINBASE, TRANSFER, DELEGATE, VOTE, UNVOTE, CREATE, CALL]

Return type

GetTransactionLimitsResponse

Authorization

basicAuth

HTTP request headers

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

getTransactionResult

GetTransactionResultResponse getTransactionResult(hash)

Get transaction result

Returns the result of the requested transaction.

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.BlockchainApi;

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

BlockchainApi apiInstance = new BlockchainApi();
String hash = "hash_example"; // String | Transaction hash
try {
    GetTransactionResultResponse result = apiInstance.getTransactionResult(hash);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling BlockchainApi#getTransactionResult");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hash String Transaction hash

Return type

GetTransactionResultResponse

Authorization

basicAuth

HTTP request headers

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