@Test public void testDeploy() throws Exception { TransactionReceipt transactionReceipt = createTransactionReceipt(); Contract deployedContract = deployContract(transactionReceipt); assertThat(deployedContract.getContractAddress(), is(ADDRESS)); assertTrue(deployedContract.getTransactionReceipt().isPresent()); assertThat(deployedContract.getTransactionReceipt().get(), equalTo(transactionReceipt)); }
protected static <T extends Contract> T deploy( Class<T> type, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String binary, String encodedConstructor, BigInteger value) throws IOException, TransactionException { try { Constructor<T> constructor = type.getDeclaredConstructor( String.class, Web3j.class, Credentials.class, BigInteger.class, BigInteger.class); constructor.setAccessible(true); T contract = constructor.newInstance(null, web3j, credentials, gasPrice, gasLimit); return create(contract, binary, encodedConstructor, value); } catch (TransactionException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
Contract extends ManagedTransaction { protected static <T extends Contract> T deploy( Class<T> type, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String binary, String encodedConstructor, BigInteger value) throws IOException, TransactionException { try { Constructor<T> constructor = type.getDeclaredConstructor( String.class, Web3j.class, Credentials.class, BigInteger.class, BigInteger.class); constructor.setAccessible(true); T contract = constructor.newInstance(null, web3j, credentials, gasPrice, gasLimit); return create(contract, binary, encodedConstructor, value); } catch (TransactionException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } }
Contract extends ManagedTransaction { protected static <T extends Contract> T deploy( Class<T> type, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String binary, String encodedConstructor, BigInteger value) throws IOException, TransactionException { try { Constructor<T> constructor = type.getDeclaredConstructor( String.class, Web3j.class, Credentials.class, BigInteger.class, BigInteger.class); constructor.setAccessible(true); T contract = constructor.newInstance(null, web3j, credentials, gasPrice, gasLimit); return create(contract, binary, encodedConstructor, value); } catch (TransactionException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } protected  Contract(String contractBinary, String contractAddress,
                       Web3j web3j, TransactionManager transactionManager,
                       BigInteger gasPrice, BigInteger gasLimit); protected  Contract(String contractBinary, String contractAddress,
                       Web3j web3j, Credentials credentials,
                       BigInteger gasPrice, BigInteger gasLimit); @Deprecated protected  Contract(String contractAddress,
                       Web3j web3j, TransactionManager transactionManager,
                       BigInteger gasPrice, BigInteger gasLimit); @Deprecated protected  Contract(String contractAddress,
                       Web3j web3j, Credentials credentials,
                       BigInteger gasPrice, BigInteger gasLimit); }
Contract extends ManagedTransaction { protected static <T extends Contract> T deploy( Class<T> type, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String binary, String encodedConstructor, BigInteger value) throws IOException, TransactionException { try { Constructor<T> constructor = type.getDeclaredConstructor( String.class, Web3j.class, Credentials.class, BigInteger.class, BigInteger.class); constructor.setAccessible(true); T contract = constructor.newInstance(null, web3j, credentials, gasPrice, gasLimit); return create(contract, binary, encodedConstructor, value); } catch (TransactionException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } protected  Contract(String contractBinary, String contractAddress,
                       Web3j web3j, TransactionManager transactionManager,
                       BigInteger gasPrice, BigInteger gasLimit); protected  Contract(String contractBinary, String contractAddress,
                       Web3j web3j, Credentials credentials,
                       BigInteger gasPrice, BigInteger gasLimit); @Deprecated protected  Contract(String contractAddress,
                       Web3j web3j, TransactionManager transactionManager,
                       BigInteger gasPrice, BigInteger gasLimit); @Deprecated protected  Contract(String contractAddress,
                       Web3j web3j, Credentials credentials,
                       BigInteger gasPrice, BigInteger gasLimit); void setContractAddress(String contractAddress); String getContractAddress(); void setTransactionReceipt(TransactionReceipt transactionReceipt); String getContractBinary(); void setGasPrice(BigInteger newPrice); BigInteger getGasPrice(); boolean isValid(); Optional<TransactionReceipt> getTransactionReceipt(); void setDefaultBlockParameter(DefaultBlockParameter defaultBlockParameter); static RemoteCall<T> deployRemoteCall(
            Class<T> type,
            Web3j web3j, Credentials credentials,
            BigInteger gasPrice, BigInteger gasLimit,
            String binary, String encodedConstructor, BigInteger value); static RemoteCall<T> deployRemoteCall(
            Class<T> type,
            Web3j web3j, Credentials credentials,
            BigInteger gasPrice, BigInteger gasLimit,
            String binary, String encodedConstructor); static RemoteCall<T> deployRemoteCall(
            Class<T> type,
            Web3j web3j, TransactionManager transactionManager,
            BigInteger gasPrice, BigInteger gasLimit,
            String binary, String encodedConstructor, BigInteger value); static RemoteCall<T> deployRemoteCall(
            Class<T> type,
            Web3j web3j, TransactionManager transactionManager,
            BigInteger gasPrice, BigInteger gasLimit,
            String binary, String encodedConstructor); static EventValues staticExtractEventParameters(
            Event event, Log log); final void setDeployedAddress(String networkId, String address); final String getDeployedAddress(String networkId); }
Contract extends ManagedTransaction { protected static <T extends Contract> T deploy( Class<T> type, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String binary, String encodedConstructor, BigInteger value) throws IOException, TransactionException { try { Constructor<T> constructor = type.getDeclaredConstructor( String.class, Web3j.class, Credentials.class, BigInteger.class, BigInteger.class); constructor.setAccessible(true); T contract = constructor.newInstance(null, web3j, credentials, gasPrice, gasLimit); return create(contract, binary, encodedConstructor, value); } catch (TransactionException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } protected  Contract(String contractBinary, String contractAddress,
                       Web3j web3j, TransactionManager transactionManager,
                       BigInteger gasPrice, BigInteger gasLimit); protected  Contract(String contractBinary, String contractAddress,
                       Web3j web3j, Credentials credentials,
                       BigInteger gasPrice, BigInteger gasLimit); @Deprecated protected  Contract(String contractAddress,
                       Web3j web3j, TransactionManager transactionManager,
                       BigInteger gasPrice, BigInteger gasLimit); @Deprecated protected  Contract(String contractAddress,
                       Web3j web3j, Credentials credentials,
                       BigInteger gasPrice, BigInteger gasLimit); void setContractAddress(String contractAddress); String getContractAddress(); void setTransactionReceipt(TransactionReceipt transactionReceipt); String getContractBinary(); void setGasPrice(BigInteger newPrice); BigInteger getGasPrice(); boolean isValid(); Optional<TransactionReceipt> getTransactionReceipt(); void setDefaultBlockParameter(DefaultBlockParameter defaultBlockParameter); static RemoteCall<T> deployRemoteCall(
            Class<T> type,
            Web3j web3j, Credentials credentials,
            BigInteger gasPrice, BigInteger gasLimit,
            String binary, String encodedConstructor, BigInteger value); static RemoteCall<T> deployRemoteCall(
            Class<T> type,
            Web3j web3j, Credentials credentials,
            BigInteger gasPrice, BigInteger gasLimit,
            String binary, String encodedConstructor); static RemoteCall<T> deployRemoteCall(
            Class<T> type,
            Web3j web3j, TransactionManager transactionManager,
            BigInteger gasPrice, BigInteger gasLimit,
            String binary, String encodedConstructor, BigInteger value); static RemoteCall<T> deployRemoteCall(
            Class<T> type,
            Web3j web3j, TransactionManager transactionManager,
            BigInteger gasPrice, BigInteger gasLimit,
            String binary, String encodedConstructor); static EventValues staticExtractEventParameters(
            Event event, Log log); final void setDeployedAddress(String networkId, String address); final String getDeployedAddress(String networkId); static final BigInteger GAS_LIMIT; }