Class EthereumUtils


  • public class EthereumUtils
    extends Object
    • Constructor Detail

      • EthereumUtils

        public EthereumUtils()
    • 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)
      • 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)