All URIs are relative to /v2.5.0
Method | HTTP request | Description |
---|---|---|
call | POST /transaction/call | Call a contract |
create | POST /transaction/create | Deploy a contract |
createAccount | POST /create-account | Create or import an account to wallet |
delegate | POST /transaction/delegate | Register as delegate |
deleteAccount | POST /delete-account | Delete an account from wallet |
getAccounts | GET /accounts | List all accounts in wallet |
signMessage | POST /sign-message | Sign a message |
signRawTransaction | POST /sign-raw-transaction | Sign an unsigned raw transaction |
transfer | POST /transaction/transfer | Transfer coins |
unvote | POST /transaction/unvote | Unvote for a delegate |
vote | POST /transaction/vote | Vote for a delegate |
DoTransactionResponse call(from, to, gas, gasPrice, value, nonce, data)
Call a contract
Call a VM contract.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String from = "from_example"; // String | Sender's address. The address must exist in the wallet.data of this Semux node.
String to = "to_example"; // String | Recipient's address (the contract address)
String gas = "gas_example"; // String | The gas limit for the call
String gasPrice = "gasPrice_example"; // String | The gas price in nano SEM
String value = "value_example"; // String | Amount of value to transfer in nano SEM
String nonce = "nonce_example"; // String | Transaction nonce, default to sender's nonce if omitted
String data = "data_example"; // String | Transaction data encoded in hexadecimal string
try {
DoTransactionResponse result = apiInstance.call(from, to, gas, gasPrice, value, nonce, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#call");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
from | String | Sender's address. The address must exist in the wallet.data of this Semux node. | |
to | String | Recipient's address (the contract address) | |
gas | String | The gas limit for the call | |
gasPrice | String | The gas price in nano SEM | |
value | String | Amount of value to transfer in nano SEM | [optional] |
nonce | String | Transaction nonce, default to sender's nonce if omitted | [optional] |
data | String | Transaction data encoded in hexadecimal string | [optional] |
- Content-Type: Not defined
- Accept: application/json
DoTransactionResponse create(from, data, gas, gasPrice, value, nonce)
Deploy a contract
Create a VM contract.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String from = "from_example"; // String | Sender's address. The address must exist in the wallet.data of this Semux node.
String data = "data_example"; // String | The contract data encoded in hexadecimal string
String gas = "gas_example"; // String | The gas limit for the call
String gasPrice = "gasPrice_example"; // String | The gas price
String value = "value_example"; // String | Amount of SEM to transfer in nano SEM
String nonce = "nonce_example"; // String | Transaction nonce, default to sender's nonce if omitted
try {
DoTransactionResponse result = apiInstance.create(from, data, gas, gasPrice, value, nonce);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#create");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
from | String | Sender's address. The address must exist in the wallet.data of this Semux node. | |
data | String | The contract data encoded in hexadecimal string | |
gas | String | The gas limit for the call | |
gasPrice | String | The gas price | |
value | String | Amount of SEM to transfer in nano SEM | [optional] |
nonce | String | Transaction nonce, default to sender's nonce if omitted | [optional] |
- Content-Type: Not defined
- Accept: application/json
CreateAccountResponse createAccount(name, privateKey)
Create or import an account to wallet
Creates a new account by generating a new private key or importing an existing private key when parameter 'privateKey' is provided.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String name = "name_example"; // String | Assigned alias to the created account.
String privateKey = "privateKey_example"; // String | The private key to be imported, create a new key if omitted
try {
CreateAccountResponse result = apiInstance.createAccount(name, privateKey);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#createAccount");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
name | String | Assigned alias to the created account. | [optional] |
privateKey | String | The private key to be imported, create a new key if omitted | [optional] |
- Content-Type: Not defined
- Accept: application/json
DoTransactionResponse delegate(from, data, fee, nonce)
Register as delegate
Registers as a delegate
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String from = "from_example"; // String | Registering address
String data = "data_example"; // String | Delegate name in hexadecimal encoded UTF-8 string, 16 bytes of data at maximum
String fee = "fee_example"; // String | Transaction fee in nano SEM, default to minimum fee if omitted
String nonce = "nonce_example"; // String | Transaction nonce, default to sender's nonce if omitted
try {
DoTransactionResponse result = apiInstance.delegate(from, data, fee, nonce);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#delegate");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
from | String | Registering address | |
data | String | Delegate name in hexadecimal encoded UTF-8 string, 16 bytes of data at maximum | |
fee | String | Transaction fee in nano SEM, default to minimum fee if omitted | [optional] |
nonce | String | Transaction nonce, default to sender's nonce if omitted | [optional] |
- Content-Type: Not defined
- Accept: application/json
DeleteAccountResponse deleteAccount(address)
Delete an account from wallet
Deletes an account from this wallet.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String address = "address_example"; // String | Address of the account
try {
DeleteAccountResponse result = apiInstance.deleteAccount(address);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#deleteAccount");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
address | String | Address of the account |
- Content-Type: Not defined
- Accept: application/json
GetAccountsResponse getAccounts()
List all accounts in wallet
Returns accounts in the wallet.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
try {
GetAccountsResponse result = apiInstance.getAccounts();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#getAccounts");
e.printStackTrace();
}
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
SignMessageResponse signMessage(address, message)
Sign a message
Sign a message.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String address = "address_example"; // String | Signing address. The address must exist in the wallet.data of this Semux node.
String message = "message_example"; // String | Message to sign in UTF-8 string
try {
SignMessageResponse result = apiInstance.signMessage(address, message);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#signMessage");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
address | String | Signing address. The address must exist in the wallet.data of this Semux node. | |
message | String | Message to sign in UTF-8 string |
- Content-Type: Not defined
- Accept: application/json
SignRawTransactionResponse signRawTransaction(raw, address)
Sign an unsigned raw transaction
Sign an unsigned raw transaction then return its hexadecimal encoded string. An unsigned raw transaction can be created using /compose-raw-transaction API.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String raw = "raw_example"; // String | Unsigned raw transaction encoded in hexadecimal string.
String address = "address_example"; // String | Signer's address. This address must exist in the wallet.
try {
SignRawTransactionResponse result = apiInstance.signRawTransaction(raw, address);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#signRawTransaction");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
raw | String | Unsigned raw transaction encoded in hexadecimal string. | |
address | String | Signer's address. This address must exist in the wallet. |
- Content-Type: Not defined
- Accept: application/json
DoTransactionResponse transfer(from, to, value, fee, nonce, data)
Transfer coins
Transfers coins to another address.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String from = "from_example"; // String | Sender's address. The account must exist in the wallet of this node.
String to = "to_example"; // String | Recipient's address
String value = "value_example"; // String | Amount of value to transfer in nano SEM
String fee = "fee_example"; // String | Transaction fee in nano SEM, default to minimum fee if omitted
String nonce = "nonce_example"; // String | Transaction nonce, default to sender's nonce if omitted
String data = "data_example"; // String | Transaction data encoded in hexadecimal string
try {
DoTransactionResponse result = apiInstance.transfer(from, to, value, fee, nonce, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#transfer");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
from | String | Sender's address. The account must exist in the wallet of this node. | |
to | String | Recipient's address | |
value | String | Amount of value to transfer in nano SEM | |
fee | String | Transaction fee in nano SEM, default to minimum fee if omitted | [optional] |
nonce | String | Transaction nonce, default to sender's nonce if omitted | [optional] |
data | String | Transaction data encoded in hexadecimal string | [optional] |
- Content-Type: Not defined
- Accept: application/json
DoTransactionResponse unvote(from, to, value, fee, nonce)
Unvote for a delegate
Unvotes for a delegate.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String from = "from_example"; // String | Voter's address. The address must exist in the wallet.data of this Semux node.
String to = "to_example"; // String | Delegate address
String value = "value_example"; // String | Number of votes in nano SEM
String fee = "fee_example"; // String | Transaction fee in nano SEM, default to minimum fee if omitted
String nonce = "nonce_example"; // String | Transaction nonce, default to sender's nonce if omitted
try {
DoTransactionResponse result = apiInstance.unvote(from, to, value, fee, nonce);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#unvote");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
from | String | Voter's address. The address must exist in the wallet.data of this Semux node. | |
to | String | Delegate address | |
value | String | Number of votes in nano SEM | |
fee | String | Transaction fee in nano SEM, default to minimum fee if omitted | [optional] |
nonce | String | Transaction nonce, default to sender's nonce if omitted | [optional] |
- Content-Type: Not defined
- Accept: application/json
DoTransactionResponse vote(from, to, value, fee, nonce)
Vote for a delegate
Votes for a delegate.
// 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.WalletApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
WalletApi apiInstance = new WalletApi();
String from = "from_example"; // String | Voter's address. The address must exist in the wallet.data of this Semux node.
String to = "to_example"; // String | Delegate address
String value = "value_example"; // String | Number of votes in nano SEM
String fee = "fee_example"; // String | Transaction fee in nano SEM, default to minimum fee if omitted
String nonce = "nonce_example"; // String | Transaction nonce, default to sender's nonce if omitted
try {
DoTransactionResponse result = apiInstance.vote(from, to, value, fee, nonce);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletApi#vote");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
from | String | Voter's address. The address must exist in the wallet.data of this Semux node. | |
to | String | Delegate address | |
value | String | Number of votes in nano SEM | |
fee | String | Transaction fee in nano SEM, default to minimum fee if omitted | [optional] |
nonce | String | Transaction nonce, default to sender's nonce if omitted | [optional] |
- Content-Type: Not defined
- Accept: application/json