Class EthereumUtils
- java.lang.Object
-
- org.jbpm.process.workitem.ethereum.EthereumUtils
-
public class EthereumUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_ATTEMPTSstatic BigIntegerDEFAULT_GAS_LIMITstatic BigIntegerDEFAULT_GAS_PRICEstatic intDEFAULT_SLEEP_DURATIONstatic StringTMP_FILE_PREFIXstatic StringTMP_FILE_SUFFIX
-
Constructor Summary
Constructors Constructor Description EthereumUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringconvertStreamToStr(InputStream inputStream)static FilecreateTmpFile(InputStream in)static FilecreateTmpFile(InputStream in, String filePrefix, String fileSuffix)static StringdeployContract(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j, String contractBinary, int toSendEther, boolean waitForReceipt, int sleepDuration, int attempts)static BigDecimalgetBalanceInEther(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j)static StringgetEncodedFunction(String queryName, List<org.web3j.abi.datatypes.Type> queryInputTypes, List<org.web3j.abi.TypeReference<?>> queryOutputTypes)static StringgetEncodedFunction(org.web3j.abi.datatypes.Function function)static org.web3j.abi.datatypes.FunctiongetFunction(String queryName, List<org.web3j.abi.datatypes.Type> queryInputTypes, List<org.web3j.abi.TypeReference<?>> queryOutputTypes)static BigIntegergetNextNonce(String address, org.web3j.protocol.Web3j web3j)static Optional<org.web3j.protocol.core.methods.response.TransactionReceipt>getTransactionReceipt(String transactionHash, int sleepDuration, int attempts, org.web3j.protocol.Web3j web3j)static voidobserveContractEvent(org.web3j.protocol.Web3j web3j, String contractEventName, String contractAddress, List<org.web3j.abi.TypeReference<?>> indexedParameters, List<org.web3j.abi.TypeReference<?>> nonIndexedParameters, String eventReturnType, org.kie.api.runtime.KieSession kieSession, String signalName, boolean doAbortOnUpdate, org.kie.api.runtime.process.WorkItemManager workItemManager, org.kie.api.runtime.process.WorkItem workItem)static voidobserveContractEvent(org.web3j.protocol.Web3j web3j, String contractEventName, String contractAddress, List<org.web3j.abi.TypeReference<?>> indexedParameters, List<org.web3j.abi.TypeReference<?>> nonIndexedParameters, String eventReturnType, rx.functions.Action1 action1)static ObjectqueryExistingContract(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j, String contractAddress, String contractMethodName, List<org.web3j.abi.datatypes.Type> contractMethodInputTypes, List<org.web3j.abi.TypeReference<?>> contractMethodOutputTypes)static org.web3j.protocol.core.methods.response.TransactionReceiptsendFundsToContract(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j, int etherAmount, String toAddress, org.web3j.tx.Transfer transfer)static Optional<org.web3j.protocol.core.methods.response.TransactionReceipt>sendTransactionReceiptRequest(String transactionHash, org.web3j.protocol.Web3j web3j)static org.web3j.protocol.core.methods.response.TransactionReceipttransactExistingContract(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j, int etherAmount, BigInteger gasPrice, BigInteger gasLimit, String toAddress, String methodName, List<org.web3j.abi.datatypes.Type> methodInputTypes, List<org.web3j.abi.TypeReference<?>> methodOutputTypes, boolean waitForReceipt, int sleepDuration, int attempts)static org.web3j.protocol.core.methods.response.TransactionReceiptwaitForTransactionReceipt(String transactionHash, int sleepDuration, int attempts, org.web3j.protocol.Web3j web3j)
-
-
-
Field Detail
-
DEFAULT_GAS_PRICE
public static final BigInteger DEFAULT_GAS_PRICE
-
DEFAULT_GAS_LIMIT
public static final BigInteger DEFAULT_GAS_LIMIT
-
DEFAULT_SLEEP_DURATION
public static final int DEFAULT_SLEEP_DURATION
- See Also:
- Constant Field Values
-
DEFAULT_ATTEMPTS
public static final int DEFAULT_ATTEMPTS
- See Also:
- Constant Field Values
-
TMP_FILE_PREFIX
public static final String TMP_FILE_PREFIX
- See Also:
- Constant Field Values
-
TMP_FILE_SUFFIX
public static final String TMP_FILE_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFunction
public static org.web3j.abi.datatypes.Function getFunction(String queryName, List<org.web3j.abi.datatypes.Type> queryInputTypes, List<org.web3j.abi.TypeReference<?>> queryOutputTypes)
-
getEncodedFunction
public static String getEncodedFunction(String queryName, List<org.web3j.abi.datatypes.Type> queryInputTypes, List<org.web3j.abi.TypeReference<?>> queryOutputTypes)
-
getEncodedFunction
public static String getEncodedFunction(org.web3j.abi.datatypes.Function function)
-
getNextNonce
public static BigInteger getNextNonce(String address, org.web3j.protocol.Web3j web3j) throws Exception
- Throws:
Exception
-
getBalanceInEther
public static BigDecimal getBalanceInEther(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j) throws Exception
- Throws:
Exception
-
deployContract
public static String deployContract(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j, String contractBinary, int toSendEther, boolean waitForReceipt, int sleepDuration, int attempts) throws Exception
- Throws:
Exception
-
queryExistingContract
public static Object queryExistingContract(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j, String contractAddress, String contractMethodName, List<org.web3j.abi.datatypes.Type> contractMethodInputTypes, List<org.web3j.abi.TypeReference<?>> contractMethodOutputTypes) throws Exception
- Throws:
Exception
-
transactExistingContract
public static org.web3j.protocol.core.methods.response.TransactionReceipt transactExistingContract(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j, int etherAmount, BigInteger gasPrice, BigInteger gasLimit, String toAddress, String methodName, List<org.web3j.abi.datatypes.Type> methodInputTypes, List<org.web3j.abi.TypeReference<?>> methodOutputTypes, boolean waitForReceipt, int sleepDuration, int attempts) throws Exception- Throws:
Exception
-
sendFundsToContract
public static org.web3j.protocol.core.methods.response.TransactionReceipt sendFundsToContract(org.web3j.crypto.Credentials credentials, org.web3j.protocol.Web3j web3j, int etherAmount, String toAddress, org.web3j.tx.Transfer transfer) throws Exception- Throws:
Exception
-
waitForTransactionReceipt
public static org.web3j.protocol.core.methods.response.TransactionReceipt waitForTransactionReceipt(String transactionHash, int sleepDuration, int attempts, org.web3j.protocol.Web3j web3j) throws Exception
- Throws:
Exception
-
getTransactionReceipt
public static Optional<org.web3j.protocol.core.methods.response.TransactionReceipt> getTransactionReceipt(String transactionHash, int sleepDuration, int attempts, org.web3j.protocol.Web3j web3j) throws Exception
- Throws:
Exception
-
sendTransactionReceiptRequest
public static Optional<org.web3j.protocol.core.methods.response.TransactionReceipt> sendTransactionReceiptRequest(String transactionHash, org.web3j.protocol.Web3j web3j) throws Exception
- Throws:
Exception
-
observeContractEvent
public static void observeContractEvent(org.web3j.protocol.Web3j web3j, String contractEventName, String contractAddress, List<org.web3j.abi.TypeReference<?>> indexedParameters, List<org.web3j.abi.TypeReference<?>> nonIndexedParameters, String eventReturnType, org.kie.api.runtime.KieSession kieSession, String signalName, boolean doAbortOnUpdate, org.kie.api.runtime.process.WorkItemManager workItemManager, org.kie.api.runtime.process.WorkItem workItem)
-
observeContractEvent
public static void observeContractEvent(org.web3j.protocol.Web3j web3j, String contractEventName, String contractAddress, List<org.web3j.abi.TypeReference<?>> indexedParameters, List<org.web3j.abi.TypeReference<?>> nonIndexedParameters, String eventReturnType, rx.functions.Action1 action1)
-
createTmpFile
public static File createTmpFile(InputStream in) throws IOException
- Throws:
IOException
-
createTmpFile
public static File createTmpFile(InputStream in, String filePrefix, String fileSuffix) throws IOException
- Throws:
IOException
-
convertStreamToStr
public static String convertStreamToStr(InputStream inputStream) throws IOException
- Throws:
IOException
-
-