@Test public void testIsValidEmptyCode() throws Exception { prepareEthGetCode(""); Contract contract = deployContract(createTransactionReceipt()); assertFalse(contract.isValid()); }
public boolean isValid() throws IOException { if (contractAddress.equals("")) { throw new UnsupportedOperationException( "Contract binary not present, you will need to regenerate your smart " + "contract wrapper with web3j v2.2.0+"); } EthGetCode ethGetCode = web3j .ethGetCode(contractAddress, DefaultBlockParameterName.LATEST) .send(); if (ethGetCode.hasError()) { return false; } String code = Numeric.cleanHexPrefix(ethGetCode.getCode()); return !code.isEmpty() && contractBinary.contains(code); }
Contract extends ManagedTransaction { public boolean isValid() throws IOException { if (contractAddress.equals("")) { throw new UnsupportedOperationException( "Contract binary not present, you will need to regenerate your smart " + "contract wrapper with web3j v2.2.0+"); } EthGetCode ethGetCode = web3j .ethGetCode(contractAddress, DefaultBlockParameterName.LATEST) .send(); if (ethGetCode.hasError()) { return false; } String code = Numeric.cleanHexPrefix(ethGetCode.getCode()); return !code.isEmpty() && contractBinary.contains(code); } }
Contract extends ManagedTransaction { public boolean isValid() throws IOException { if (contractAddress.equals("")) { throw new UnsupportedOperationException( "Contract binary not present, you will need to regenerate your smart " + "contract wrapper with web3j v2.2.0+"); } EthGetCode ethGetCode = web3j .ethGetCode(contractAddress, DefaultBlockParameterName.LATEST) .send(); if (ethGetCode.hasError()) { return false; } String code = Numeric.cleanHexPrefix(ethGetCode.getCode()); return !code.isEmpty() && contractBinary.contains(code); } 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 { public boolean isValid() throws IOException { if (contractAddress.equals("")) { throw new UnsupportedOperationException( "Contract binary not present, you will need to regenerate your smart " + "contract wrapper with web3j v2.2.0+"); } EthGetCode ethGetCode = web3j .ethGetCode(contractAddress, DefaultBlockParameterName.LATEST) .send(); if (ethGetCode.hasError()) { return false; } String code = Numeric.cleanHexPrefix(ethGetCode.getCode()); return !code.isEmpty() && contractBinary.contains(code); } 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 { public boolean isValid() throws IOException { if (contractAddress.equals("")) { throw new UnsupportedOperationException( "Contract binary not present, you will need to regenerate your smart " + "contract wrapper with web3j v2.2.0+"); } EthGetCode ethGetCode = web3j .ethGetCode(contractAddress, DefaultBlockParameterName.LATEST) .send(); if (ethGetCode.hasError()) { return false; } String code = Numeric.cleanHexPrefix(ethGetCode.getCode()); return !code.isEmpty() && contractBinary.contains(code); } 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; }