Package com.academy.stratum.service
Interface EthereumService
-
- All Known Implementing Classes:
EthereumServiceImpl
public interface EthereumServiceEthereum 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 EtherlinkerResponseDatacreateWallet(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 directoryEtherlinkerResponseDatadeployContract(EtherlinkerRequestData etherlinkerRequestData)Deploy contract, which previously was compiled by Web3j into specific wrapper classEtherlinkerResponseDataenhanceResponseData(EtherlinkerResponseData etherlinkerResponseData, EtherlinkerRequestData etherlinkerRequestData, java.lang.String operationType)Enhance response data with parameters, which are common for any type of responseEtherlinkerResponseDataexecContractMethod(EtherlinkerRequestData etherlinkerRequestData)Execute custom solidity contract methodEtherlinkerResponseDatagetBalance(EtherlinkerRequestData etherlinkerRequestData)Get balance of specified wallet from request dataorg.web3j.crypto.CredentialsloadCredentials(EtherlinkerRequestData etherlinkerRequestData)Load wallet credentials by using provided request dataorg.web3j.crypto.CredentialsloadWallet(java.lang.String password, java.lang.String path)Load wallet credentials by using private key, located in selected path with provided passwordorg.web3j.crypto.CredentialsloadWalletBIP39(java.lang.String password, java.lang.String mnemonic)Load wallet credentials by using provided password and BIP39 mnemonicEtherlinkerBatchResponseDataprocessBatchRequest(EtherlinkerBatchRequestData etherlinkerBatchRequestData)Execute custom solidity contract methodorg.web3j.protocol.admin.AdminsetUp(java.lang.String URL)Setup Web3j JSON-RPC Request object building factory.EtherlinkerResponseDatatransferEther(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.ExceptionCreate 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.ExceptionLoad 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
Credentialsto 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.ExceptionLoad wallet credentials by using provided password and BIP39 mnemonic- Parameters:
password- Wallet passwordmnemonic- Wallet mnemonic- Returns:
- Wallet
Credentialsto 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
Credentialsto use in requests to the blockchain - Throws:
java.lang.Exception- any exception, which happened during method execution
-
-