org.web3j.protocol.core.methods.response.EthGetTransactionReceipt Java Examples

The following examples show how to use org.web3j.protocol.core.methods.response.EthGetTransactionReceipt. 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: ContractTest.java    From web3j with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void testInvalidTransactionReceipt() throws Throwable {
    prepareNonceRequest();
    prepareTransactionRequest();

    EthGetTransactionReceipt ethGetTransactionReceipt = new EthGetTransactionReceipt();
    ethGetTransactionReceipt.setError(new Response.Error(1, "Invalid transaction receipt"));

    Request<?, EthGetTransactionReceipt> getTransactionReceiptRequest = mock(Request.class);
    when(getTransactionReceiptRequest.sendAsync())
            .thenReturn(Async.run(() -> ethGetTransactionReceipt));
    when(web3j.ethGetTransactionReceipt(TRANSACTION_HASH))
            .thenReturn((Request) getTransactionReceiptRequest);
    assertThrows(RuntimeException.class, this::testErrorScenario);
}
 
Example #2
Source File: ContractTest.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
@Test(expected = RuntimeException.class)
@SuppressWarnings("unchecked")
public void testInvalidTransactionReceipt() throws Throwable {
    prepareNonceRequest();
    prepareTransactionRequest();

    EthGetTransactionReceipt ethGetTransactionReceipt = new EthGetTransactionReceipt();
    ethGetTransactionReceipt.setError(new Response.Error(1, "Invalid transaction receipt"));

    Request<?, EthGetTransactionReceipt> getTransactionReceiptRequest = mock(Request.class);
    when(getTransactionReceiptRequest.sendAsync())
            .thenReturn(Async.run(() -> ethGetTransactionReceipt));
    when(web3j.ethGetTransactionReceipt(TRANSACTION_HASH))
            .thenReturn((Request) getTransactionReceiptRequest);

    testErrorScenario();
}
 
Example #3
Source File: TransactionFactory.java    From asf-sdk with GNU General Public License v3.0 6 votes vote down vote up
public static Transaction fromEthGetTransactionReceipt(
    EthGetTransactionReceipt ethGetTransactionReceipt) {
  TransactionReceipt transactionReceipt = ethGetTransactionReceipt.getTransactionReceipt();

  String hash = transactionReceipt.getTransactionHash();
  String from = transactionReceipt.getFrom();
  Log log = transactionReceipt.getLogs()
      .get(0);
  String to = log.getAddress();
  String value = extractValueFromEthGetTransactionReceipt(log.getData());
  Status status = parseStatus(transactionReceipt.getStatus());
  String contractAddress = ethGetTransactionReceipt.getTransactionReceipt()
      .getTo();

  return new Transaction(hash, from, to, value, status);
}
 
Example #4
Source File: Scenario.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
private Optional<TransactionReceipt> sendTransactionReceiptRequest(
        String transactionHash) throws Exception {
    EthGetTransactionReceipt transactionReceipt =
            web3j.ethGetTransactionReceipt(transactionHash).sendAsync().get();

    return transactionReceipt.getTransactionReceipt();
}
 
Example #5
Source File: ManagedTransactionTester.java    From web3j with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
void prepareTransactionReceipt(TransactionReceipt transactionReceipt) throws IOException {
    EthGetTransactionReceipt ethGetTransactionReceipt = new EthGetTransactionReceipt();
    ethGetTransactionReceipt.setResult(transactionReceipt);

    Request<?, EthGetTransactionReceipt> getTransactionReceiptRequest = mock(Request.class);
    when(getTransactionReceiptRequest.send()).thenReturn(ethGetTransactionReceipt);
    when(web3j.ethGetTransactionReceipt(TRANSACTION_HASH))
            .thenReturn((Request) getTransactionReceiptRequest);
}
 
Example #6
Source File: JsonRpc2_0Web3j.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
public Request<?, EthGetTransactionReceipt> ethGetTransactionReceipt(String transactionHash) {
    return new Request<>(
            "eth_getTransactionReceipt",
            Arrays.asList(transactionHash),
            web3jService,
            EthGetTransactionReceipt.class);
}
 
Example #7
Source File: TransactionReceiptProcessor.java    From web3j with Apache License 2.0 5 votes vote down vote up
Optional<? extends TransactionReceipt> sendTransactionReceiptRequest(String transactionHash)
        throws IOException, TransactionException {
    EthGetTransactionReceipt transactionReceipt =
            web3j.ethGetTransactionReceipt(transactionHash).send();
    if (transactionReceipt.hasError()) {
        throw new TransactionException(
                "Error processing request: " + transactionReceipt.getError().getMessage());
    }

    return transactionReceipt.getTransactionReceipt();
}
 
Example #8
Source File: CoreIT.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testEthGetTransactionReceipt() throws Exception {
    EthGetTransactionReceipt ethGetTransactionReceipt =
            web3j.ethGetTransactionReceipt(config.validTransactionHash()).send();
    assertTrue(ethGetTransactionReceipt.getTransactionReceipt().isPresent());
    TransactionReceipt transactionReceipt =
            ethGetTransactionReceipt.getTransactionReceipt().get();
    assertEquals(transactionReceipt.getTransactionHash(), (config.validTransactionHash()));
}
 
Example #9
Source File: Scenario.java    From web3j with Apache License 2.0 5 votes vote down vote up
private Optional<TransactionReceipt> sendTransactionReceiptRequest(String transactionHash)
        throws Exception {
    EthGetTransactionReceipt transactionReceipt =
            web3j.ethGetTransactionReceipt(transactionHash).sendAsync().get();

    return transactionReceipt.getTransactionReceipt();
}
 
Example #10
Source File: Web3jUtils.java    From web3j_demo with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the TransactionRecipt for the specified tx hash as an optional.
 */
public static Optional<TransactionReceipt> getReceipt(Web3j web3j, String transactionHash) 
		throws Exception 
{
	EthGetTransactionReceipt receipt = web3j
			.ethGetTransactionReceipt(transactionHash)
			.sendAsync()
			.get();

	return receipt.getTransactionReceipt();
}
 
Example #11
Source File: EthereumUtils.java    From jbpm-work-items with Apache License 2.0 5 votes vote down vote up
public static Optional<TransactionReceipt> sendTransactionReceiptRequest(
        String transactionHash,
        Web3j web3j) throws Exception {
    EthGetTransactionReceipt transactionReceipt =
            web3j.ethGetTransactionReceipt(transactionHash).sendAsync().get();

    return transactionReceipt.getTransactionReceipt();
}
 
Example #12
Source File: ManagedTransactionTester.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
void prepareTransactionReceipt(TransactionReceipt transactionReceipt) throws IOException {
    EthGetTransactionReceipt ethGetTransactionReceipt = new EthGetTransactionReceipt();
    ethGetTransactionReceipt.setResult(transactionReceipt);

    Request<?, EthGetTransactionReceipt> getTransactionReceiptRequest = mock(Request.class);
    when(getTransactionReceiptRequest.send())
            .thenReturn(ethGetTransactionReceipt);
    when(web3j.ethGetTransactionReceipt(TRANSACTION_HASH))
            .thenReturn((Request) getTransactionReceiptRequest);
}
 
Example #13
Source File: JsonRpc2_0Web3j.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Request<?, EthGetTransactionReceipt> ethGetTransactionReceipt(String transactionHash) {
    return new Request<>(
            "eth_getTransactionReceipt",
            Arrays.asList(transactionHash),
            web3jService,
            EthGetTransactionReceipt.class);
}
 
Example #14
Source File: TransactionReceiptProcessor.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
Optional<TransactionReceipt> sendTransactionReceiptRequest(
        String transactionHash) throws IOException, TransactionException {
    EthGetTransactionReceipt transactionReceipt =
            web3j.ethGetTransactionReceipt(transactionHash).send();
    if (transactionReceipt.hasError()) {
        throw new TransactionException("Error processing request: "
                + transactionReceipt.getError().getMessage());
    }

    return transactionReceipt.getTransactionReceipt();
}
 
Example #15
Source File: CoreIT.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testEthGetTransactionReceipt() throws Exception {
    EthGetTransactionReceipt ethGetTransactionReceipt = web3j.ethGetTransactionReceipt(
            config.validTransactionHash()).send();
    assertTrue(ethGetTransactionReceipt.getTransactionReceipt().isPresent());
    TransactionReceipt transactionReceipt =
            ethGetTransactionReceipt.getTransactionReceipt().get();
    assertThat(transactionReceipt.getTransactionHash(), is(config.validTransactionHash()));
}
 
Example #16
Source File: EthGetTransactionReceiptTransaction.java    From besu with Apache License 2.0 5 votes vote down vote up
@Override
public Optional<TransactionReceipt> execute(final NodeRequests node) {
  try {
    final EthGetTransactionReceipt result = node.eth().ethGetTransactionReceipt(input).send();
    assertThat(result.hasError()).isFalse();
    return result.getTransactionReceipt();
  } catch (final IOException e) {
    throw new RuntimeException(e);
  }
}
 
Example #17
Source File: ResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 4 votes vote down vote up
@Test
public void testeEthGetTransactionReceiptAfterByzantium() {
    //CHECKSTYLE:OFF
    buildResponse(
            "{\n"
                    + "    \"id\":1,\n"
                    + "    \"jsonrpc\":\"2.0\",\n"
                    + "    \"result\": {\n"
                    + "        \"transactionHash\": \"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238\",\n"
                    + "        \"transactionIndex\":  \"0x1\",\n"
                    + "        \"blockHash\": \"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b\",\n"
                    + "        \"blockNumber\": \"0xb\",\n"
                    + "        \"cumulativeGasUsed\": \"0x33bc\",\n"
                    + "        \"gasUsed\": \"0x4dc\",\n"
                    + "        \"contractAddress\": \"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\n"
                    + "        \"status\": \"0x1\",\n"
                    + "        \"from\":\"0x407d73d8a49eeb85d32cf465507dd71d507100c1\",\n"
                    + "        \"to\":\"0x85h43d8a49eeb85d32cf465507dd71d507100c1\",\n"
                    + "        \"logs\": [{\n"
                    + "            \"removed\": false,\n"
                    + "            \"logIndex\": \"0x1\",\n"
                    + "            \"transactionIndex\": \"0x0\",\n"
                    + "            \"transactionHash\": \"0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf\",\n"
                    + "            \"blockHash\": \"0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d\",\n"
                    + "            \"blockNumber\":\"0x1b4\",\n"
                    + "            \"address\": \"0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d\",\n"
                    + "            \"data\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\n"
                    + "            \"type\":\"mined\",\n"
                    + "            \"topics\": [\"0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5\"]"
                    + "        }],\n"
                    + "        \"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n"
                    + "  }\n"
                    + "}"
    );

    TransactionReceipt transactionReceipt =
            new TransactionReceipt(
                    "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
                    "0x1",
                    "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
                    "0xb",
                    "0x33bc",
                    "0x4dc",
                    "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
                    null,
                    "0x1",
                    "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
                    "0x85h43d8a49eeb85d32cf465507dd71d507100c1",
                    Arrays.asList(
                            new Log(
                                    false,
                                    "0x1",
                                    "0x0",
                                    "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
                                    "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                                    "0x1b4",
                                    "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                                    "0x0000000000000000000000000000000000000000000000000000000000000000",
                                    "mined",
                                    Arrays.asList(
                                            "0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"
                                    )
                            )
                    ),
                    "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

            );
    //CHECKSTYLE:ON

    EthGetTransactionReceipt ethGetTransactionReceipt = deserialiseResponse(
            EthGetTransactionReceipt.class);
    assertThat(ethGetTransactionReceipt.getTransactionReceipt().get(),
            equalTo(transactionReceipt));
}
 
Example #18
Source File: ResponseTest.java    From etherscan-explorer with GNU General Public License v3.0 4 votes vote down vote up
@Test
public void testeEthGetTransactionReceiptBeforeByzantium() {
    //CHECKSTYLE:OFF
    buildResponse(
            "{\n"
                    + "    \"id\":1,\n"
                    + "    \"jsonrpc\":\"2.0\",\n"
                    + "    \"result\": {\n"
                    + "        \"transactionHash\": \"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238\",\n"
                    + "        \"transactionIndex\":  \"0x1\",\n"
                    + "        \"blockHash\": \"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b\",\n"
                    + "        \"blockNumber\": \"0xb\",\n"
                    + "        \"cumulativeGasUsed\": \"0x33bc\",\n"
                    + "        \"gasUsed\": \"0x4dc\",\n"
                    + "        \"contractAddress\": \"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\n"
                    + "        \"root\": \"9307ba10e41ecf3d40507fc908655fe72fc129d46f6d99baf7605d0e29184911\",\n"
                    + "        \"from\":\"0x407d73d8a49eeb85d32cf465507dd71d507100c1\",\n"
                    + "        \"to\":\"0x85h43d8a49eeb85d32cf465507dd71d507100c1\",\n"
                    + "        \"logs\": [{\n"
                    + "            \"removed\": false,\n"
                    + "            \"logIndex\": \"0x1\",\n"
                    + "            \"transactionIndex\": \"0x0\",\n"
                    + "            \"transactionHash\": \"0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf\",\n"
                    + "            \"blockHash\": \"0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d\",\n"
                    + "            \"blockNumber\":\"0x1b4\",\n"
                    + "            \"address\": \"0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d\",\n"
                    + "            \"data\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\n"
                    + "            \"type\":\"mined\",\n"
                    + "            \"topics\": [\"0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5\"]"
                    + "        }],\n"
                    + "        \"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n"
                    + "  }\n"
                    + "}"
    );

    TransactionReceipt transactionReceipt =
            new TransactionReceipt(
                    "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
                    "0x1",
                    "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
                    "0xb",
                    "0x33bc",
                    "0x4dc",
                    "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
                    "9307ba10e41ecf3d40507fc908655fe72fc129d46f6d99baf7605d0e29184911",
                    null,
                    "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
                    "0x85h43d8a49eeb85d32cf465507dd71d507100c1",
                    Arrays.asList(
                            new Log(
                                    false,
                                    "0x1",
                                    "0x0",
                                    "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
                                    "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                                    "0x1b4",
                                    "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                                    "0x0000000000000000000000000000000000000000000000000000000000000000",
                                    "mined",
                                    Arrays.asList(
                                            "0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"
                                    )
                            )
                    ),
                    "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

            );
    //CHECKSTYLE:ON

    EthGetTransactionReceipt ethGetTransactionReceipt = deserialiseResponse(
            EthGetTransactionReceipt.class);
    assertThat(ethGetTransactionReceipt.getTransactionReceipt().get(),
            equalTo(transactionReceipt));
}
 
Example #19
Source File: ResponseTest.java    From web3j with Apache License 2.0 4 votes vote down vote up
@Test
public void testeEthGetTransactionReceiptBeforeByzantium() {

    buildResponse(
            "{\n"
                    + "    \"id\":1,\n"
                    + "    \"jsonrpc\":\"2.0\",\n"
                    + "    \"result\": {\n"
                    + "        \"transactionHash\": \"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238\",\n"
                    + "        \"transactionIndex\":  \"0x1\",\n"
                    + "        \"blockHash\": \"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b\",\n"
                    + "        \"blockNumber\": \"0xb\",\n"
                    + "        \"cumulativeGasUsed\": \"0x33bc\",\n"
                    + "        \"gasUsed\": \"0x4dc\",\n"
                    + "        \"contractAddress\": \"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\n"
                    + "        \"root\": \"9307ba10e41ecf3d40507fc908655fe72fc129d46f6d99baf7605d0e29184911\",\n"
                    + "        \"from\":\"0x407d73d8a49eeb85d32cf465507dd71d507100c1\",\n"
                    + "        \"to\":\"0x85h43d8a49eeb85d32cf465507dd71d507100c1\",\n"
                    + "        \"logs\": [{\n"
                    + "            \"removed\": false,\n"
                    + "            \"logIndex\": \"0x1\",\n"
                    + "            \"transactionIndex\": \"0x0\",\n"
                    + "            \"transactionHash\": \"0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf\",\n"
                    + "            \"blockHash\": \"0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d\",\n"
                    + "            \"blockNumber\":\"0x1b4\",\n"
                    + "            \"address\": \"0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d\",\n"
                    + "            \"data\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\n"
                    + "            \"type\":\"mined\",\n"
                    + "            \"topics\": [\"0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5\"]"
                    + "        }],\n"
                    + "        \"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n"
                    + "  }\n"
                    + "}");

    TransactionReceipt transactionReceipt =
            new TransactionReceipt(
                    "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
                    "0x1",
                    "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
                    "0xb",
                    "0x33bc",
                    "0x4dc",
                    "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
                    "9307ba10e41ecf3d40507fc908655fe72fc129d46f6d99baf7605d0e29184911",
                    null,
                    "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
                    "0x85h43d8a49eeb85d32cf465507dd71d507100c1",
                    Arrays.asList(
                            new Log(
                                    false,
                                    "0x1",
                                    "0x0",
                                    "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
                                    "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                                    "0x1b4",
                                    "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                                    "0x0000000000000000000000000000000000000000000000000000000000000000",
                                    "mined",
                                    Arrays.asList(
                                            "0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"))),
                    "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                    null);

    EthGetTransactionReceipt ethGetTransactionReceipt =
            deserialiseResponse(EthGetTransactionReceipt.class);
    assertEquals(ethGetTransactionReceipt.getTransactionReceipt().get(), (transactionReceipt));
}
 
Example #20
Source File: ResponseTest.java    From web3j with Apache License 2.0 4 votes vote down vote up
@Test
public void testeEthGetTransactionReceiptAfterByzantium() {

    buildResponse(
            "{\n"
                    + "    \"id\":1,\n"
                    + "    \"jsonrpc\":\"2.0\",\n"
                    + "    \"result\": {\n"
                    + "        \"transactionHash\": \"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238\",\n"
                    + "        \"transactionIndex\":  \"0x1\",\n"
                    + "        \"blockHash\": \"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b\",\n"
                    + "        \"blockNumber\": \"0xb\",\n"
                    + "        \"cumulativeGasUsed\": \"0x33bc\",\n"
                    + "        \"gasUsed\": \"0x4dc\",\n"
                    + "        \"contractAddress\": \"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\n"
                    + "        \"status\": \"0x1\",\n"
                    + "        \"from\":\"0x407d73d8a49eeb85d32cf465507dd71d507100c1\",\n"
                    + "        \"to\":\"0x85h43d8a49eeb85d32cf465507dd71d507100c1\",\n"
                    + "        \"logs\": [{\n"
                    + "            \"removed\": false,\n"
                    + "            \"logIndex\": \"0x1\",\n"
                    + "            \"transactionIndex\": \"0x0\",\n"
                    + "            \"transactionHash\": \"0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf\",\n"
                    + "            \"blockHash\": \"0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d\",\n"
                    + "            \"blockNumber\":\"0x1b4\",\n"
                    + "            \"address\": \"0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d\",\n"
                    + "            \"data\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\n"
                    + "            \"type\":\"mined\",\n"
                    + "            \"topics\": [\"0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5\"]"
                    + "        }],\n"
                    + "        \"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"\n"
                    + "  }\n"
                    + "}");

    TransactionReceipt transactionReceipt =
            new TransactionReceipt(
                    "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
                    "0x1",
                    "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
                    "0xb",
                    "0x33bc",
                    "0x4dc",
                    "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
                    null,
                    "0x1",
                    "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
                    "0x85h43d8a49eeb85d32cf465507dd71d507100c1",
                    Arrays.asList(
                            new Log(
                                    false,
                                    "0x1",
                                    "0x0",
                                    "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
                                    "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                                    "0x1b4",
                                    "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                                    "0x0000000000000000000000000000000000000000000000000000000000000000",
                                    "mined",
                                    Arrays.asList(
                                            "0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"))),
                    "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                    null);

    EthGetTransactionReceipt ethGetTransactionReceipt =
            deserialiseResponse(EthGetTransactionReceipt.class);
    assertEquals(ethGetTransactionReceipt.getTransactionReceipt().get(), (transactionReceipt));
}
 
Example #21
Source File: Ethereum.java    From etherscan-explorer with GNU General Public License v3.0 votes vote down vote up
Request<?, EthGetTransactionReceipt> ethGetTransactionReceipt(String transactionHash); 
Example #22
Source File: Ethereum.java    From web3j with Apache License 2.0 votes vote down vote up
Request<?, EthGetTransactionReceipt> ethGetTransactionReceipt(String transactionHash);