Package com.academy.stratum.service
Interface EthereumService
-
- All Known Implementing Classes:
EthereumServiceImpl
public interface EthereumService
Ethereum service interface Allows you to interact with Ethereum blockchain- Author:
- Ruslan Nazirov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EtherlinkerResponseData
createWallet(EtherlinkerRequestData etherlinkerRequestData)
Create a new wallet by using request datajava.util.ArrayList<java.lang.String>
createWallet(java.lang.String path, java.lang.String password)
Create a new wallet in a specified directoryEtherlinkerResponseData
deployContract(EtherlinkerRequestData etherlinkerRequestData)
Deploy contract, which previously was compiled by Web3j into specific wrapper classEtherlinkerResponseData
enhanceResponseData(EtherlinkerResponseData etherlinkerResponseData, EtherlinkerRequestData etherlinkerRequestData, java.lang.String operationType)
Enhance response data with parameters, which are common for any type of responseEtherlinkerResponseData
execContractMethod(EtherlinkerRequestData etherlinkerRequestData)
Execute custom solidity contract methodEtherlinkerResponseData
getBalance(EtherlinkerRequestData etherlinkerRequestData)
Get balance of specified wallet from request dataorg.web3j.crypto.Credentials
loadCredentials(EtherlinkerRequestData etherlinkerRequestData)
Load wallet credentials by using provided request dataorg.web3j.crypto.Credentials
loadWallet(java.lang.String password, java.lang.String path)
Load wallet credentials by using private key, located in selected path with provided passwordorg.web3j.crypto.Credentials
loadWalletBIP39(java.lang.String password, java.lang.String mnemonic)
Load wallet credentials by using provided password and BIP39 mnemonicEtherlinkerBatchResponseData
processBatchRequest(EtherlinkerBatchRequestData etherlinkerBatchRequestData)
Execute custom solidity contract methodorg.web3j.protocol.admin.Admin
setUp(java.lang.String URL)
Setup Web3j JSON-RPC Request object building factory.EtherlinkerResponseData
transferEther(EtherlinkerRequestData etherlinkerRequestData)
-
-
-
Method Detail
-
setUp
org.web3j.protocol.admin.Admin setUp(java.lang.String URL)
Setup Web3j JSON-RPC Request object building factory.- Parameters:
URL
- access URL from Infura (https://infura.io/)- Returns:
- Admin Web3j JSON-RPC Request object building factory
-
transferEther
EtherlinkerResponseData transferEther(EtherlinkerRequestData etherlinkerRequestData) throws java.lang.Exception
- Parameters:
etherlinkerRequestData
- request data from compatible application (like UE4)- Returns:
- EtherlinkerResponseData with transaction result
- Throws:
java.lang.Exception
- any exception, which happened during method execution
-
createWallet
java.util.ArrayList<java.lang.String> createWallet(java.lang.String path, java.lang.String password) throws java.lang.Exception
Create a new wallet in a specified directory- Parameters:
path
- Path to the directory, where you want to the private keypassword
- Wallet password- Returns:
- Wallet filename[0], mnemonic[1] inside of ArrayList
- Throws:
java.lang.Exception
- any exception, which happened during method execution
-
createWallet
EtherlinkerResponseData createWallet(EtherlinkerRequestData etherlinkerRequestData) throws java.lang.Exception
Create a new wallet by using request data- Parameters:
etherlinkerRequestData
- request data from compatible application (like UE4)- Returns:
- EtherlinkerResponseData response data with a result of method execution
- Throws:
java.lang.Exception
- any exception, which happened during method execution
-
loadWallet
org.web3j.crypto.Credentials loadWallet(java.lang.String password, java.lang.String path) throws java.lang.Exception
Load wallet credentials by using private key, located in selected path with provided password- Parameters:
password
- Wallet passwordpath
- File system path to the private key- Returns:
- Wallet
Credentials
to use in requests to the blockchain - Throws:
java.lang.Exception
- any exception, which happened during method execution
-
loadWalletBIP39
org.web3j.crypto.Credentials loadWalletBIP39(java.lang.String password, java.lang.String mnemonic) throws java.lang.Exception
Load wallet credentials by using provided password and BIP39 mnemonic- Parameters:
password
- Wallet passwordmnemonic
- Wallet mnemonic- Returns:
- Wallet
Credentials
to use in requests to the blockchain - Throws:
java.lang.Exception
- any exception, which happened during method execution
-
getBalance
EtherlinkerResponseData getBalance(EtherlinkerRequestData etherlinkerRequestData) throws java.lang.Exception
Get balance of specified wallet from request data- Parameters:
etherlinkerRequestData
- request data from compatible application (like UE4)- Returns:
- EtherlinkerResponseData response data with a wallet balance
- Throws:
java.lang.Exception
- any exception, which happened during method execution
-
deployContract
EtherlinkerResponseData deployContract(EtherlinkerRequestData etherlinkerRequestData) throws java.lang.Exception
Deploy contract, which previously was compiled by Web3j into specific wrapper class- Parameters:
etherlinkerRequestData
- request data from compatible application (like UE4)- Returns:
- EtherlinkerResponseData response data with a transaction result
- Throws:
java.lang.Exception
- any exception, which happened during method execution
-
execContractMethod
EtherlinkerResponseData execContractMethod(EtherlinkerRequestData etherlinkerRequestData) throws java.lang.Exception
Execute custom solidity contract method- Parameters:
etherlinkerRequestData
- request data from compatible application (like UE4)- Returns:
- EtherlinkerResponseData response data with a result of method execution
- Throws:
java.lang.Exception
- any exception, which happened during method execution
-
processBatchRequest
EtherlinkerBatchResponseData processBatchRequest(EtherlinkerBatchRequestData etherlinkerBatchRequestData) throws java.lang.Exception
Execute custom solidity contract method- Parameters:
etherlinkerBatchRequestData
- batch request data from compatible application (like UE4)- Returns:
- EtherlinkerBatchResponseData batch response data with a results of method execution
- Throws:
java.lang.Exception
- any exception, which happened during method execution
-
enhanceResponseData
EtherlinkerResponseData enhanceResponseData(EtherlinkerResponseData etherlinkerResponseData, EtherlinkerRequestData etherlinkerRequestData, java.lang.String operationType)
Enhance response data with parameters, which are common for any type of response- Parameters:
etherlinkerResponseData
- half-populated response data to enhanceetherlinkerRequestData
- request data from compatible application (like UE4)operationType
- Operation type, which was used during method execution (like "createWallet" or "deployContract")- Returns:
- EtherlinkerResponseData enhanced response data
-
loadCredentials
org.web3j.crypto.Credentials loadCredentials(EtherlinkerRequestData etherlinkerRequestData) throws java.lang.Exception
Load wallet credentials by using provided request data- Parameters:
etherlinkerRequestData
- request data from compatible application (like UE4)- Returns:
- Wallet
Credentials
to use in requests to the blockchain - Throws:
java.lang.Exception
- any exception, which happened during method execution
-
-