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

The following examples show how to use org.web3j.protocol.core.methods.response.EthLog. 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: EventUtils.java    From alpha-wallet-android with MIT License 6 votes vote down vote up
public String getSelectVal(EventDefinition ev, EthLog.LogResult ethLog)
{
    String selectVal = "";
    final Event resolverEvent = generateEventFunction(ev);
    final EventValues eventValues = staticExtractEventParameters(resolverEvent, (Log)ethLog.get());
    int selectIndexInNonIndexed = ev.getSelectIndex(false);
    int selectIndexInIndexed = ev.getSelectIndex(true);

    if (selectIndexInNonIndexed >= 0)
    {
        selectVal = getValueFromParams(eventValues.getNonIndexedValues(), selectIndexInNonIndexed);
    }
    else if (selectIndexInIndexed >= 0)
    {
        selectVal = getValueFromParams(eventValues.getIndexedValues(), selectIndexInIndexed);
    }

    Log log = (Log)ethLog;
    ev.readBlock = log.getBlockNumber().add(BigInteger.ONE);

    return selectVal;
}
 
Example #2
Source File: Filter.java    From web3j with Apache License 2.0 6 votes vote down vote up
private void pollFilter(EthFilter ethFilter) {
    EthLog ethLog = null;
    try {
        ethLog = web3j.ethGetFilterChanges(filterId).send();
    } catch (IOException e) {
        throwException(e);
    }
    if (ethLog.hasError()) {
        Error error = ethLog.getError();
        switch (error.getCode()) {
            case RpcErrors.FILTER_NOT_FOUND:
                reinstallFilter();
                break;
            default:
                throwException(error);
                break;
        }
    } else {
        process(ethLog.getLogs());
    }
}
 
Example #3
Source File: AssetDefinitionService.java    From alpha-wallet-android with MIT License 6 votes vote down vote up
private void processLogs(EventDefinition ev, List<EthLog.LogResult> logs)
{
    if (logs.size() == 0) return; //early return
    int chainId = ev.contract.addresses.keySet().iterator().next();
    Web3j web3j = getWeb3jService(chainId);

    for (EthLog.LogResult ethLog : logs)
    {
        String selectVal = eventUtils.getSelectVal(ev, ethLog);
        EthBlock txBlock = eventUtils.getTransactionDetails(((Log)ethLog.get()).getBlockHash(), web3j).blockingGet();

        long blockTime = txBlock.getBlock().getTimestamp().longValue();
        if (eventCallback != null) eventCallback.receivedEvent(ev.attributeName, ev.parentAttribute.getSyntaxVal(selectVal), blockTime, chainId);
        storeEventValue(ev, ethLog, ev.parentAttribute, blockTime, selectVal);
    }
}
 
Example #4
Source File: JsonRpc2_0Web3j.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
public Request<?, EthLog> ethGetFilterLogs(BigInteger filterId) {
    return new Request<>(
            "eth_getFilterLogs",
            Arrays.asList(Numeric.toHexStringWithPrefixSafe(filterId)),
            web3jService,
            EthLog.class);
}
 
Example #5
Source File: PendingTransactionFilterTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testPendingTransactionFilter() throws Exception {
    EthLog ethLog =
            objectMapper.readValue(
                    "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":[\"0x31c2342b1e0b8ffda1507fbffddf213c4b3c1e819ff6a84b943faabb0ebf2403\",\"0xccc0d2e07c1febcaca0c3341c4e1268204b06fefa4bb0c8c0d693d8e581c82da\"]}",
                    EthLog.class);

    runTest(ethLog, web3j.ethPendingTransactionHashFlowable());
}
 
Example #6
Source File: LogFilterTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testLogFilter() throws Exception {

    EthLog ethLog =
            objectMapper.readValue(
                    "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":[{\"address\":\"0x2a98c5f40bfa3dee83431103c535f6fae9a8ad38\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x45544855534400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"logIndex\":\"0x0\",\"removed\":false,\"topics\":[\"0x5a690ecd0cb15c1c1fd6b6f8a32df0d4f56cb41a54fea7e94020f013595de796\",\"0x0000000000000000000000000000000000000000000000000000000000000002\",\"0x0000000000000000000000003f37a1c95bbc0aa6bf62e99b30b147e68dee7b43\",\"0x0000000000000000000000000000000000000000000000000000000000000000\"],\"transactionHash\":\"0x9d8a4410204140a8fa7f191b0b1d9526822a87d212ade0b6a3cbd20a6e2ed2e9\",\"transactionIndex\":\"0x0\"},{\"address\":\"0x2a98c5f40bfa3dee83431103c535f6fae9a8ad38\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x0000000000000000000000000000000000000000000000006c93a67534ce4000\",\"logIndex\":\"0x1\",\"removed\":false,\"topics\":[\"0xa9c6cbc4bd352a6940479f6d802a1001550581858b310d7f68f7bea51218cda6\",\"0x4554485553440000000000000000000000000000000000000000000000000000\"],\"transactionHash\":\"0x9d8a4410204140a8fa7f191b0b1d9526822a87d212ade0b6a3cbd20a6e2ed2e9\",\"transactionIndex\":\"0x0\"},{\"address\":\"0x3f37a1c95bbc0aa6bf62e99b30b147e68dee7b43\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x0000000000000000000000000000000000000000000000006c93a67534ce4000\",\"logIndex\":\"0x2\",\"removed\":false,\"topics\":[\"0xa609f6bd4ad0b4f419ddad4ac9f0d02c2b9295c5e6891469055cf73c2b568fff\",\"0x0000000000000000000000003f37a1c95bbc0aa6bf62e99b30b147e68dee7b43\"],\"transactionHash\":\"0x9d8a4410204140a8fa7f191b0b1d9526822a87d212ade0b6a3cbd20a6e2ed2e9\",\"transactionIndex\":\"0x0\"},{\"address\":\"0x870283380c7da544d2b16d3434709874e3ed77cb\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x000000000000000000000000000000000000000000000000000000005853a9f4000000000000000000000000000000000000000000000000000000000000004e\",\"logIndex\":\"0x3\",\"removed\":false,\"topics\":[\"0x9de614b5c45179d41912c87ca7f7af67525f50c10b6b9cea79dc2c12b8d693a3\"],\"transactionHash\":\"0xccf367f7c845de706ccf985a187ea168f9df241d4878780f996aa08a303ad910\",\"transactionIndex\":\"0x1\"},{\"address\":\"0x870283380c7da544d2b16d3434709874e3ed77cb\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x000000000000000000000000000000000000000000000000000000005853aa04000000000000000000000000000000000000000000000000000000000000004e\",\"logIndex\":\"0x4\",\"removed\":false,\"topics\":[\"0x9de614b5c45179d41912c87ca7f7af67525f50c10b6b9cea79dc2c12b8d693a3\"],\"transactionHash\":\"0x83d38a70d55279be43cfb6da97256e438b6f72337be1a0919b349244fe633daa\",\"transactionIndex\":\"0x2\"}]}",
                    EthLog.class);

    runTest(ethLog, web3j.ethLogFlowable(new EthFilter().addSingleTopic("test")));
}
 
Example #7
Source File: FilterTester.java    From web3j with Apache License 2.0 5 votes vote down vote up
List createExpected(EthLog ethLog) {
    List<EthLog.LogResult> logResults = ethLog.getLogs();
    if (logResults.isEmpty()) {
        fail("Results cannot be empty");
    }

    return ethLog.getLogs().stream().map(t -> t.get()).collect(Collectors.toList());
}
 
Example #8
Source File: BlockFilterTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testBlockFilter() throws Exception {

    EthLog ethLog =
            objectMapper.readValue(
                    "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":["
                            + "\"0x31c2342b1e0b8ffda1507fbffddf213c4b3c1e819ff6a84b943faabb0ebf2403\","
                            + "\"0xccc0d2e07c1febcaca0c3341c4e1268204b06fefa4bb0c8c0d693d8e581c82da\""
                            + "]}",
                    EthLog.class);

    runTest(ethLog, web3j.ethBlockHashFlowable());
}
 
Example #9
Source File: EqualsVerifierResponseTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testHash() {
    EqualsVerifier.forClass(EthLog.Hash.class)
            .suppress(Warning.NONFINAL_FIELDS)
            .suppress(Warning.STRICT_INHERITANCE)
            .verify();
}
 
Example #10
Source File: ResponseTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testEthLog() {

    buildResponse(
            "{\n"
                    + "    \"id\":1,\n"
                    + "    \"jsonrpc\":\"2.0\",\n"
                    + "    \"result\": [{\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\"]"
                    + "    }]"
                    + "}");

    List<Log> logs =
            Collections.singletonList(
                    new EthLog.LogObject(
                            false,
                            "0x1",
                            "0x0",
                            "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
                            "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                            "0x1b4",
                            "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
                            "0x0000000000000000000000000000000000000000000000000000000000000000",
                            "mined",
                            Collections.singletonList(
                                    "0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5")));

    EthLog ethLog = deserialiseResponse(EthLog.class);
    assertEquals(ethLog.getLogs(), (logs));
}
 
Example #11
Source File: LogsFilter.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(List<LogResult> logResults) {
    List<Log> logs = new ArrayList<>(logResults.size());

    for (EthLog.LogResult logResult : logResults) {
        if (!(logResult instanceof EthLog.LogObject)) {
            throw new FilterException(
                    "Unexpected result type: " + logResult.get() + " required LogObject");
        }

        logs.add(((EthLog.LogObject) logResult).get());
    }

    callback.onEvent(logs);
}
 
Example #12
Source File: JsonRpc2_0Besu.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
public Request<?, EthLog> privGetFilterLogs(String privacyGroupId, String filterId) {
    return new Request<>(
            "priv_getFilterLogs",
            Arrays.asList(privacyGroupId, filterId),
            web3jService,
            EthLog.class);
}
 
Example #13
Source File: PendingTransactionFilter.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(List<EthLog.LogResult> logResults) {
    for (EthLog.LogResult logResult : logResults) {
        if (logResult instanceof EthLog.Hash) {
            String transactionHash = ((EthLog.Hash) logResult).get();
            callback.onEvent(transactionHash);
        } else {
            throw new FilterException(
                    "Unexpected result type: " + logResult.get() + ", required Hash");
        }
    }
}
 
Example #14
Source File: BlockFilter.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(List<EthLog.LogResult> logResults) {
    for (EthLog.LogResult logResult : logResults) {
        if (logResult instanceof EthLog.Hash) {
            String blockHash = ((EthLog.Hash) logResult).get();
            callback.onEvent(blockHash);
        } else {
            throw new FilterException(
                    "Unexpected result type: " + logResult.get() + ", required Hash");
        }
    }
}
 
Example #15
Source File: EventFilterIT.java    From web3j with Apache License 2.0 5 votes vote down vote up
private List<EthLog.LogResult> createFilterForEvent(
        String encodedEventSignature, String contractAddress) throws Exception {
    EthFilter ethFilter =
            new EthFilter(
                    DefaultBlockParameterName.EARLIEST,
                    DefaultBlockParameterName.LATEST,
                    contractAddress);

    ethFilter.addSingleTopic(encodedEventSignature);

    EthLog ethLog = web3j.ethGetLogs(ethFilter).send();
    return ethLog.getLogs();
}
 
Example #16
Source File: LogFilter.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(List<EthLog.LogResult> logResults) {
    for (EthLog.LogResult logResult : logResults) {
        if (logResult instanceof EthLog.LogObject) {
            Log log = ((EthLog.LogObject) logResult).get();
            callback.onEvent(log);
        } else {
            throw new FilterException(
                    "Unexpected result type: " + logResult.get() + " required LogObject");
        }
    }
}
 
Example #17
Source File: BlocksFilter.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(List<LogResult> logResults) {
    List<String> blockHashes = new ArrayList<>(logResults.size());

    for (EthLog.LogResult logResult : logResults) {
        if (!(logResult instanceof EthLog.Hash)) {
            throw new FilterException(
                    "Unexpected result type: " + logResult.get() + ", required Hash");
        }

        blockHashes.add(((EthLog.Hash) logResult).get());
    }

    callback.onEvent(blockHashes);
}
 
Example #18
Source File: PendingTransactionsFilter.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(List<EthLog.LogResult> logResults) {
    List<String> logs = new ArrayList<>(logResults.size());

    for (EthLog.LogResult logResult : logResults) {
        if (!(logResult instanceof EthLog.Hash)) {
            throw new FilterException(
                    "Unexpected result type: " + logResult.get() + ", required Hash");
        }

        logs.add(((EthLog.Hash) logResult).get());
    }

    callback.onEvent(logs);
}
 
Example #19
Source File: JsonRpc2_0Web3j.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
public Request<?, EthLog> ethGetFilterChanges(BigInteger filterId) {
    return new Request<>(
            "eth_getFilterChanges",
            Arrays.asList(Numeric.toHexStringWithPrefixSafe(filterId)),
            web3jService,
            EthLog.class);
}
 
Example #20
Source File: JsonRpc2_0Besu.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
public Request<?, EthLog> privGetFilterChanges(String privacyGroupId, String filterId) {
    return new Request<>(
            "priv_getFilterChanges",
            Arrays.asList(privacyGroupId, filterId),
            web3jService,
            EthLog.class);
}
 
Example #21
Source File: JsonRpc2_0Besu.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
public Request<?, EthLog> privGetLogs(
        final String privacyGroupId,
        final org.web3j.protocol.core.methods.request.EthFilter ethFilter) {
    return new Request<>(
            "priv_getLogs",
            Arrays.asList(privacyGroupId, ethFilter),
            web3jService,
            EthLog.class);
}
 
Example #22
Source File: PrivateLogFilter.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Override
protected Optional<Request<?, EthLog>> getFilterLogs(BigInteger filterId) {
    return Optional.of(
            ((Besu) web3j)
                    .privGetFilterLogs(
                            privacyGroupId, Numeric.toHexStringWithPrefix(filterId)));
}
 
Example #23
Source File: CoreIT.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testEthGetLogs() throws Exception {
    org.web3j.protocol.core.methods.request.EthFilter ethFilter =
            new org.web3j.protocol.core.methods.request.EthFilter(
                    DefaultBlockParameterName.EARLIEST,
                    DefaultBlockParameterName.LATEST,
                    config.validContractAddress());

    ethFilter.addSingleTopic(config.encodedEvent());

    EthLog ethLog = web3j.ethGetLogs(ethFilter).send();
    List<EthLog.LogResult> logs = ethLog.getLogs();
    assertFalse(logs.isEmpty());
}
 
Example #24
Source File: CoreIT.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testFiltersByFilterId() throws Exception {
    org.web3j.protocol.core.methods.request.EthFilter ethFilter =
            new org.web3j.protocol.core.methods.request.EthFilter(
                    DefaultBlockParameterName.EARLIEST,
                    DefaultBlockParameterName.LATEST,
                    config.validContractAddress());

    String eventSignature = config.encodedEvent();
    ethFilter.addSingleTopic(eventSignature);

    // eth_newFilter
    EthFilter ethNewFilter = web3j.ethNewFilter(ethFilter).send();
    BigInteger filterId = ethNewFilter.getFilterId();

    // eth_getFilterLogs
    EthLog ethFilterLogs = web3j.ethGetFilterLogs(filterId).send();
    List<EthLog.LogResult> filterLogs = ethFilterLogs.getLogs();
    assertFalse(filterLogs.isEmpty());

    // eth_getFilterChanges - nothing will have changed in this interval
    EthLog ethLog = web3j.ethGetFilterChanges(filterId).send();
    assertTrue(ethLog.getLogs().isEmpty());

    // eth_uninstallFilter
    EthUninstallFilter ethUninstallFilter = web3j.ethUninstallFilter(filterId).send();
    assertTrue(ethUninstallFilter.isUninstalled());
}
 
Example #25
Source File: EthFilterChangesTransaction.java    From besu with Apache License 2.0 5 votes vote down vote up
@Override
public EthLog execute(final NodeRequests node) {
  try {
    final EthLog response = node.eth().ethGetFilterChanges(filterId).send();
    assertThat(response.getLogs()).isNotNull();
    return response;
  } catch (final IOException e) {
    throw new RuntimeException(e);
  }
}
 
Example #26
Source File: AssetDefinitionService.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
private void getEvents(EventDefinition ev) throws Exception
    {
        int chainId = ev.contract.addresses.keySet().iterator().next();
        String address = ev.contract.addresses.get(chainId).get(0);

        int originChainId = ev.parentAttribute.originContract.addresses.keySet().iterator().next();
        String originAddress = ev.parentAttribute.originContract.addresses.get(originChainId).get(0);

        Token originToken = tokensService.getToken(originChainId, originAddress);
        if (originToken == null ||
                (originToken.isNonFungible() && !originToken.hasPositiveBalance())) return; // early return if NFT and wallet has zero balance for this token
                                                                                            // Note: Fungible with zero balance is safe to query events as filter is always ownerAddress
        Web3j web3j = getWeb3jService(chainId);

        final EthFilter filter = eventUtils.generateLogFilter(ev, originToken, this);

        try
        {
            eventConnection.acquire(); //prevent overlapping event calls
            EthLog ethLogs = web3j.ethGetLogs(filter).send();
            processLogs(ev, ethLogs.getLogs());
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            eventConnection.release();
        }

        //More elegant, but requires a private node
//        return web3j.ethLogFlowable(filter)
//                .subscribeOn(Schedulers.io())
//                .observeOn(AndroidSchedulers.mainThread())
//                .subscribe(log -> {
//            System.out.println("log.toString(): " +  log.toString());
//            //TODO here: callback to event service listener
//        }, this::onLogError);
    }
 
Example #27
Source File: EventUtils.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
public String getTopicVal(EventDefinition ev, EthLog.LogResult ethLog)
{
    String topicVal = "";
    final Event resolverEvent = generateEventFunction(ev);
    final EventValues eventValues = staticExtractEventParameters(resolverEvent, (Log)ethLog.get());
    String filterTopic = ev.getFilterTopicIndex();
    int topicIndex = ev.getTopicIndex(filterTopic);

    topicVal = getValueFromParams(eventValues.getIndexedValues(), topicIndex);

    return topicVal;
}
 
Example #28
Source File: PendingTransactionFilterTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testPendingTransactionFilter() throws Exception {
    EthLog ethLog = objectMapper.readValue(
            //CHECKSTYLE:OFF
            "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":[\"0x31c2342b1e0b8ffda1507fbffddf213c4b3c1e819ff6a84b943faabb0ebf2403\",\"0xccc0d2e07c1febcaca0c3341c4e1268204b06fefa4bb0c8c0d693d8e581c82da\"]}",
            //CHECKSTYLE:ON
            EthLog.class);

    runTest(ethLog, web3j.ethPendingTransactionHashObservable());
}
 
Example #29
Source File: LogFilterTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testLogFilter() throws Exception {

    EthLog ethLog = objectMapper.readValue(
            //CHECKSTYLE:OFF
            "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":[{\"address\":\"0x2a98c5f40bfa3dee83431103c535f6fae9a8ad38\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x45544855534400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"logIndex\":\"0x0\",\"removed\":false,\"topics\":[\"0x5a690ecd0cb15c1c1fd6b6f8a32df0d4f56cb41a54fea7e94020f013595de796\",\"0x0000000000000000000000000000000000000000000000000000000000000002\",\"0x0000000000000000000000003f37a1c95bbc0aa6bf62e99b30b147e68dee7b43\",\"0x0000000000000000000000000000000000000000000000000000000000000000\"],\"transactionHash\":\"0x9d8a4410204140a8fa7f191b0b1d9526822a87d212ade0b6a3cbd20a6e2ed2e9\",\"transactionIndex\":\"0x0\"},{\"address\":\"0x2a98c5f40bfa3dee83431103c535f6fae9a8ad38\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x0000000000000000000000000000000000000000000000006c93a67534ce4000\",\"logIndex\":\"0x1\",\"removed\":false,\"topics\":[\"0xa9c6cbc4bd352a6940479f6d802a1001550581858b310d7f68f7bea51218cda6\",\"0x4554485553440000000000000000000000000000000000000000000000000000\"],\"transactionHash\":\"0x9d8a4410204140a8fa7f191b0b1d9526822a87d212ade0b6a3cbd20a6e2ed2e9\",\"transactionIndex\":\"0x0\"},{\"address\":\"0x3f37a1c95bbc0aa6bf62e99b30b147e68dee7b43\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x0000000000000000000000000000000000000000000000006c93a67534ce4000\",\"logIndex\":\"0x2\",\"removed\":false,\"topics\":[\"0xa609f6bd4ad0b4f419ddad4ac9f0d02c2b9295c5e6891469055cf73c2b568fff\",\"0x0000000000000000000000003f37a1c95bbc0aa6bf62e99b30b147e68dee7b43\"],\"transactionHash\":\"0x9d8a4410204140a8fa7f191b0b1d9526822a87d212ade0b6a3cbd20a6e2ed2e9\",\"transactionIndex\":\"0x0\"},{\"address\":\"0x870283380c7da544d2b16d3434709874e3ed77cb\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x000000000000000000000000000000000000000000000000000000005853a9f4000000000000000000000000000000000000000000000000000000000000004e\",\"logIndex\":\"0x3\",\"removed\":false,\"topics\":[\"0x9de614b5c45179d41912c87ca7f7af67525f50c10b6b9cea79dc2c12b8d693a3\"],\"transactionHash\":\"0xccf367f7c845de706ccf985a187ea168f9df241d4878780f996aa08a303ad910\",\"transactionIndex\":\"0x1\"},{\"address\":\"0x870283380c7da544d2b16d3434709874e3ed77cb\",\"blockHash\":\"0xd263df878c66b8a08c8509a8f33d6758bc3a1ee3c5ab3c9a765ea981ae9d72e3\",\"blockNumber\":\"0x2865a\",\"data\":\"0x000000000000000000000000000000000000000000000000000000005853aa04000000000000000000000000000000000000000000000000000000000000004e\",\"logIndex\":\"0x4\",\"removed\":false,\"topics\":[\"0x9de614b5c45179d41912c87ca7f7af67525f50c10b6b9cea79dc2c12b8d693a3\"],\"transactionHash\":\"0x83d38a70d55279be43cfb6da97256e438b6f72337be1a0919b349244fe633daa\",\"transactionIndex\":\"0x2\"}]}",
            //CHECKSTYLE:ON
            EthLog.class);

    runTest(ethLog, web3j.ethLogObservable(new EthFilter().addSingleTopic("test")));
}
 
Example #30
Source File: FilterTester.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
List createExpected(EthLog ethLog) {
    List<EthLog.LogResult> logResults = ethLog.getLogs();
    if (logResults.isEmpty()) {
        fail("Results cannot be empty");
    }

    return ethLog.getLogs().stream()
            .map(t -> t.get()).collect(Collectors.toList());
}