Java Code Examples for org.web3j.protocol.core.methods.response.EthSendTransaction#hasError()

The following examples show how to use org.web3j.protocol.core.methods.response.EthSendTransaction#hasError() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransactionManager.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
private TransactionReceipt processResponse(EthSendTransaction transactionResponse)
        throws IOException, TransactionException {
    if (transactionResponse.hasError()) {
        throw new RuntimeException("Error processing transaction request: "
                + transactionResponse.getError().getMessage());
    }

    String transactionHash = transactionResponse.getTransactionHash();

    return transactionReceiptProcessor.waitForTransactionReceipt(transactionHash);
}
 
Example 2
Source File: PrivateTransactionManager.java    From web3j with Apache License 2.0 5 votes vote down vote up
private TransactionReceipt processResponse(final EthSendTransaction transactionResponse)
        throws IOException, TransactionException {
    if (transactionResponse.hasError()) {
        throw new RuntimeException(
                "Error processing transaction request: "
                        + transactionResponse.getError().getMessage());
    }

    final String transactionHash = transactionResponse.getTransactionHash();

    return transactionReceiptProcessor.waitForTransactionReceipt(transactionHash);
}
 
Example 3
Source File: TransactionManager.java    From web3j with Apache License 2.0 5 votes vote down vote up
private TransactionReceipt processResponse(EthSendTransaction transactionResponse)
        throws IOException, TransactionException {
    if (transactionResponse.hasError()) {
        throw new RuntimeException(
                "Error processing transaction request: "
                        + transactionResponse.getError().getMessage());
    }

    String transactionHash = transactionResponse.getTransactionHash();

    return transactionReceiptProcessor.waitForTransactionReceipt(transactionHash);
}
 
Example 4
Source File: RawTransactionManager.java    From web3j with Apache License 2.0 5 votes vote down vote up
public EthSendTransaction signAndSend(RawTransaction rawTransaction) throws IOException {
    String hexValue = sign(rawTransaction);
    EthSendTransaction ethSendTransaction = web3j.ethSendRawTransaction(hexValue).send();

    if (ethSendTransaction != null && !ethSendTransaction.hasError()) {
        String txHashLocal = Hash.sha3(hexValue);
        String txHashRemote = ethSendTransaction.getTransactionHash();
        if (!txHashVerifier.verify(txHashLocal, txHashRemote)) {
            throw new TxHashMismatchException(txHashLocal, txHashRemote);
        }
    }

    return ethSendTransaction;
}