org.fisco.bcos.web3j.protocol.core.methods.response.Transaction Java Examples

The following examples show how to use org.fisco.bcos.web3j.protocol.core.methods.response.Transaction. 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: Web3ApiService.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
/**
 * getTransactionByHash.
 *
 * @param transHash transHash
 */
public Transaction getTransactionByHash(int groupId, String transHash) {

    Transaction transaction = null;
    try {
        Optional<Transaction> opt =
                getWeb3j(groupId).getTransactionByHash(transHash).send().getTransaction();
        if (opt.isPresent()) {
            transaction = opt.get();
        }
    } catch (IOException e) {
        log.error("getTransactionByHash fail. transHash:{} ", transHash);
        throw new FrontException(ConstantCode.NODE_REQUEST_FAILED);
    }
    return transaction;
}
 
Example #2
Source File: Web3ApiService.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
/**
 * getTransByBlockHashAndIndex.
 *
 * @param blockHash blockHash
 * @param transactionIndex index
 */
public Transaction getTransByBlockHashAndIndex(int groupId, String blockHash,
                                               BigInteger transactionIndex) {

    Transaction transaction = null;
    try {
        Optional<Transaction> opt = getWeb3j(groupId)
                .getTransactionByBlockHashAndIndex(blockHash, transactionIndex).send()
                .getTransaction();
        if (opt.isPresent()) {
            transaction = opt.get();
        }
    } catch (IOException e) {
        log.error("getTransByBlockHashAndIndex fail.", e);
        throw new FrontException(ConstantCode.NODE_REQUEST_FAILED);
    }
    return transaction;
}
 
Example #3
Source File: Web3ApiService.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
/**
 * getTransByBlockNumberAndIndex.
 *
 * @param blockNumber blockNumber
 * @param transactionIndex index
 */
public Transaction getTransByBlockNumberAndIndex(int groupId, BigInteger blockNumber,
                                                 BigInteger transactionIndex) {
    Transaction transaction = null;
    try {
        if (blockNumberCheck(groupId, blockNumber)) {
            throw new FrontException("ConstantCode.NODE_REQUEST_FAILED");
        }
        Optional<Transaction> opt =
                getWeb3j(groupId)
                        .getTransactionByBlockNumberAndIndex(
                                DefaultBlockParameter.valueOf(blockNumber), transactionIndex)
                        .send().getTransaction();
        if (opt.isPresent()) {
            transaction = opt.get();
        }
    } catch (IOException e) {
        log.error("getTransByBlockNumberAndIndex fail.", e);
        throw new FrontException(ConstantCode.NODE_REQUEST_FAILED);
    }
    return transaction;
}
 
Example #4
Source File: AccountCrawlerHandler.java    From WeBASE-Collect-Bee with Apache License 2.0 6 votes vote down vote up
/**
 * Get transaction from TransactionReceipt object firstly, then will get transaction input param, and get
 * constructor function transaction by judging if transaction's param named to is null, parsing transaction data and
 * save into database.
 * 
 * throw the IOException.
 * 
 * @param receipt: TransactionReceipt
 * @param blockTimeStamp: block timestamp
 * @return void
 * @throws IOException
 */
public Optional<AccountInfoBO> handle(TransactionReceipt receipt, BigInteger blockTimeStamp) throws IOException {
    Optional<Transaction> optt = ethClient.getTransactionByHash(receipt);
    if (optt.isPresent()) {
        Transaction transaction = optt.get();
        // get constructor function transaction by judging if transaction's param named to is null
        if (transaction.getTo() == null || transaction.getTo().equals(ContractConstants.EMPTY_ADDRESS)) {
            String contractAddress = receipt.getContractAddress();
            String input = ethClient.getCodeByContractAddress(contractAddress);
            log.debug("blockNumber: {}, input: {}", receipt.getBlockNumber(), input);
            Entry<String, String> entry = contractConstructorService.getConstructorNameByCode(input);
            if (entry == null) {
                log.info("block:{} constructor binary can't find!", receipt.getBlockNumber().longValue());
                return Optional.empty();
            }
            AccountInfoBO accountInfo = new AccountInfoBO();
            accountInfo.setBlockTimeStamp(new Date(blockTimeStamp.longValue()))
                    .setBlockHeight(receipt.getBlockNumber().longValue())
                    .setContractAddress(receipt.getContractAddress()).setContractName(entry.getValue())
                    .setTxHash(receipt.getTransactionHash());
            return Optional.of(accountInfo);
        }
    }
    return Optional.empty();

}
 
Example #5
Source File: MerkleProofUtility.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
/**
 * Verify transaction merkle proof
 *
 * @param transactionRoot
 * @param transAndProof
 * @return
 */
public static boolean verifyTransaction(
        String transactionRoot, TransactionWithProof.TransAndProof transAndProof) {
    // transaction index
    Transaction transaction = transAndProof.getTransaction();
    BigInteger index = transaction.getTransactionIndex();
    String input =
            Numeric.toHexString(RlpEncoder.encode(RlpString.create(index)))
                    + transaction.getHash().substring(2);
    String proof = Merkle.calculateMerkleRoot(transAndProof.getTxProof(), input);

    logger.debug(
            " transaction hash: {}, transaction index: {}, root: {}, proof: {}",
            transaction.getHash(),
            transaction.getTransactionIndex(),
            transactionRoot,
            proof);

    return proof.equals(transactionRoot);
}
 
Example #6
Source File: TransactionService.java    From WeBASE-Collect-Bee with Apache License 2.0 6 votes vote down vote up
public Optional<Entry<String, String>> getContractNameByTransaction(Transaction transaction,
        Map<String, String> txHashContractAddressMapping) throws IOException {
    String contractAddress = getContractAddressByTransaction(transaction, txHashContractAddressMapping);
    if (StringUtils.isEmpty(contractAddress)) {
        log.warn(
                "block:{} , unrecognized transaction, maybe the contract is not registered! See the DIR of contractPath.",
                transaction.getBlockNumber());
        return Optional.empty();
    }
    String input = ethClient.getCodeByContractAddress(contractAddress);
    log.debug("code: {}", JacksonUtils.toJson(input));
    Entry<String, String> contractEntry = contractConstructorService.getConstructorNameByCode(input);
    if (contractEntry == null) {
        log.warn(
                "block:{} constructor code can't be find, maybe the contract is not registered! See the DIR of contractPath.",
                transaction.getBlockNumber());
        return Optional.empty();
    }
    log.debug("Block{} contractAddress{} transactionInput: {}", transaction.getBlockNumber(), contractAddress,
            transaction.getInput());
    return Optional.of(contractEntry);
}
 
Example #7
Source File: BlockTxDetailInfoDAO.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
/**
 * Get block transaction detail info from transaction receipt object and insert BlockTxDetailInfo into db.
 * 
 * @param receipt : TransactionReceipt
 * @param blockTimeStamp
 * @param contractName: contract name
 * @param methodName: method name
 * @return void
 * @throws IOException
 */
public void save(TransactionReceipt receipt, BigInteger blockTimeStamp, String contractName, String methodName)
        throws IOException {
    BlockTxDetailInfo blockTxDetailInfo = new BlockTxDetailInfo();
    blockTxDetailInfo.setBlockHash(receipt.getBlockHash());
    blockTxDetailInfo.setBlockHeight(receipt.getBlockNumber().longValue());
    blockTxDetailInfo.setContractName(contractName);
    blockTxDetailInfo.setMethodName(methodName.substring(contractName.length()));
    Transaction transaction = ethClient.getTransactionByHash(receipt).get();
    blockTxDetailInfo.setTxFrom(transaction.getFrom());
    blockTxDetailInfo.setTxTo(transaction.getTo());
    blockTxDetailInfo.setTxHash(receipt.getTransactionHash());
    blockTxDetailInfo.setBlockTimeStamp(new Date(blockTimeStamp.longValue()));
    blockTxDetailInfoRepository.save(blockTxDetailInfo);
}
 
Example #8
Source File: Web3jApITest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
@Test
public void getTransactionByBlockHashAndIndex() throws IOException {
  BcosTransaction bcosTransaction =
      web3j.getTransactionByBlockHashAndIndex(blockHash, new BigInteger("0")).send();
  Transaction transaction = bcosTransaction.getTransaction().get();
  assertNotNull(transaction);
}
 
Example #9
Source File: Web3jApITest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
@Test
public void getTransactionByBlockNumberAndIndex() throws IOException {
  BcosTransaction bcosTransaction =
      web3j
          .getTransactionByBlockNumberAndIndex(
              DefaultBlockParameter.valueOf(blockNumber), new BigInteger("0"))
          .send();
  Transaction transaction = bcosTransaction.getTransaction().get();
  assertNotNull(transaction);
}
 
Example #10
Source File: JsonRpc2_0Web3j.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
@Deprecated
@Override
public Request<?, Call> call(
        org.fisco.bcos.web3j.protocol.core.methods.request.Transaction transaction,
        DefaultBlockParameter defaultBlockParameter) {
    return new Request<>("call", Arrays.asList(groupId, transaction), web3jService, Call.class);
}
 
Example #11
Source File: TransactionResource.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public TransactionWithProof getTransactionWithProof(String transactionHash, String rootHash)
        throws IOException {
    TransactionWithProof transactionWithProof =
            web3j.getTransactionByHashWithProof(transactionHash).send();
    if (transactionWithProof.getTransactionWithProof() == null) {
        return null;
    }

    Transaction transaction = transactionWithProof.getTransactionWithProof().getTransaction();
    logger.debug("Transaction:{}", transaction);

    // transaction index
    String index = transaction.getTransactionIndexRaw();
    BigInteger indexValue = Numeric.toBigInt(index);
    byte[] byteIndex = RlpEncoder.encode(RlpString.create(indexValue));
    String input = Numeric.toHexString(byteIndex) + transactionHash.substring(2);
    logger.info("TransWithIndex:{}", input);

    String proof =
            Merkle.calculateMerkleRoot(
                    transactionWithProof.getTransactionWithProof().getTxProof(), input);
    //        System.out.println("MerkleRoot: " + proof);

    if (!proof.equals(rootHash)) {
        logger.debug("MerkleRoot:{}", proof);
        logger.debug("TransRoot :{}", rootHash);
        return null;
    }
    return transactionWithProof;
}
 
Example #12
Source File: Web3SDK2Wrapper.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
private static void generateTbTransHashListPage(Integer pageIndex, Integer pageSize, ListPage<TbTransHash> tbTransHashListPage, List<TbTransHash> tbTransHashes, BcosBlock bcosBlock) throws BrokerException {
    BcosBlock.Block block = bcosBlock.getBlock();
    if (block == null || CollectionUtils.isEmpty(block.getTransactions())) {
        log.error("query transaction from block failed. transaction in block is empty");
        throw new BrokerException(ErrorCode.WEB3SDK_RPC_ERROR);
    }

    Integer transCount = block.getTransactions().size();

    if (pageIndex < 1 || (pageIndex - 1) * pageSize > transCount) {
        log.error("pageIndex error.");
        throw new BrokerException("pageIndex error.");
    }
    Integer transSize = (transCount <= pageIndex * pageSize) ? (transCount - ((pageIndex - 1) * pageSize)) : pageSize;
    Integer transIndexStart = (pageIndex - 1) * pageSize;

    List<Transaction> transactionHashList = block.getTransactions().stream()
            .map(transactionResult -> (Transaction) transactionResult.get()).collect(Collectors.toList()).subList(transIndexStart, transSize + transIndexStart);
    transactionHashList.forEach(tx -> {
        TbTransHash tbTransHash = new TbTransHash(tx.getHash(), tx.getFrom(), tx.getTo(),
                tx.getBlockNumber(), DataTypeUtils.getTimestamp(bcosBlock.getBlock().getTimestamp().longValue()));
        tbTransHashes.add(tbTransHash);
    });
    tbTransHashListPage.setPageSize(transSize);
    tbTransHashListPage.setTotal(transCount);
    tbTransHashListPage.setPageData(tbTransHashes);
}
 
Example #13
Source File: Web3ApiController.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "getTransactionByHash",
        notes = "Get transaction information based on transaction hash")
@ApiImplicitParam(name = "transHash", value = "transHash", required = true, dataType = "String",
        paramType = "path")
@GetMapping("/transaction/{transHash}")
public Transaction getTransactionByHash(@PathVariable int groupId,
        @PathVariable String transHash) {
    return web3ApiService.getTransactionByHash(groupId, transHash);
}
 
Example #14
Source File: BlockInfoServiceTest.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
@Test
public void testInput() throws IOException {
    Block block = ethClient.getBlock(BigInteger.valueOf(8677));
    List<TransactionResult> transactionResults = block.getTransactions();
    log.info("transactionResults.size:{}", transactionResults.size());
    for (TransactionResult result : transactionResults) {
        BcosTransactionReceipt ethGetTransactionReceipt = web3j.getTransactionReceipt((String) result.get()).send();
        Optional<TransactionReceipt> opt = ethGetTransactionReceipt.getTransactionReceipt();
        if (opt.isPresent()) {
            log.info("TransactionReceipt hash: {}", opt.get().getTransactionHash());
            Optional<Transaction> optt =
                    web3j.getTransactionByHash(opt.get().getTransactionHash()).send().getTransaction();
            if (optt.isPresent()) {
                log.info("transaction hash : {}", optt.get().getHash());
                log.info("transaction info : {}", optt.get().getValue());
                List<Type> lt = new ArrayList<>();
                lt.add(Uint64.DEFAULT);
                List<TypeReference<?>> references = new ArrayList<>();
                TypeReference<Uint64> typeReference = new TypeReference<Uint64>() {
                };
                references.add(typeReference);
                List<TypeReference<Type>> ll = Utils.convert(references);
                List<Type> inputList = FunctionReturnDecoder.decode(optt.get().getInput(), ll);
                log.info("input : {}", inputList.size());
                log.info("input : {}", JacksonUtils.toJson(inputList));
            }

        }
    }

}
 
Example #15
Source File: FunctionTest.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
public void testActivity() throws IOException, BaseException {
    BigInteger bigBlockHeight = new BigInteger(Integer.toString(200));
    Block block = ethClient.getBlock(bigBlockHeight);
    List<TransactionResult> transactionResults = block.getTransactions();
    log.info("transactionResults.size:{}", transactionResults.size());
    for (TransactionResult result : transactionResults) {
        BcosTransactionReceipt ethGetTransactionReceipt = web3j.getTransactionReceipt((String) result.get()).send();
        Optional<TransactionReceipt> opt = ethGetTransactionReceipt.getTransactionReceipt();
        if (opt.isPresent()) {
            log.info("TransactionReceipt hash: {}", opt.get().getTransactionHash());
            Optional<Transaction> optt =
                    web3j.getTransactionByHash(opt.get().getTransactionHash()).send().getTransaction();
            if (optt.isPresent()) {
                String rawInput = optt.get().getInput();
                log.info("input : {}", optt.get().getInput());
                List<TypeReference<Type>> referencesTypeList = new ArrayList<>(1);
                TypeReference exScore = TypeReferenceUtils.getTypeRef("uint64");
                referencesTypeList.add(exScore);

                List<Type> listT = FunctionReturnDecoder.decode(rawInput.substring(10), referencesTypeList);
                for (Type type : listT) {
                    log.info("type value : {}", type.getValue());
                }
                log.info("type info : {}", JacksonUtils.toJson(listT));
            }
        }
    }
}
 
Example #16
Source File: Web3ApiController.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "getTransByBlockHashAndIndex",
        notes = "Gets the transaction information for the specified "
                + "location of the specified block")
@ApiImplicitParams({
        @ApiImplicitParam(name = "blockHash", value = "blockHash", required = true,
                dataType = "String", paramType = "path"),
        @ApiImplicitParam(name = "transactionIndex", value = "transactionIndex",
                required = true, dataType = "BigInteger", paramType = "path")})
@GetMapping("/transByBlockHashAndIndex/{blockHash}/{transactionIndex}")
public Transaction getTransByBlockHashAndIndex(@PathVariable int groupId,
        @PathVariable String blockHash, @PathVariable BigInteger transactionIndex) {
    return web3ApiService.getTransByBlockHashAndIndex(groupId, blockHash, transactionIndex);
}
 
Example #17
Source File: TransactionService.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
public String getContractAddressByTransaction(Transaction transaction,
        Map<String, String> txHashContractAddressMapping) {
    log.debug("blocknumber: {} , to: {}, map: {}", transaction.getBlockNumber(), transaction.getTo(),
            JacksonUtils.toJson(txHashContractAddressMapping));
    if (transaction.getTo() == null || transaction.getTo().equals(ContractConstants.EMPTY_ADDRESS)) {
        return txHashContractAddressMapping.get(transaction.getHash());
    } else {
        return transaction.getTo();
    }
}
 
Example #18
Source File: EventCrawlerHandler.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public List<EventBO> crawl(Block block, Map<String, String> txHashContractNameMapping) throws IOException {
    List<EventBO> boList = new ArrayList<>();
    List<TransactionResult> transactionResults = block.getTransactions();
    for (TransactionResult result : transactionResults) {
        BcosTransactionReceipt bcosTransactionReceipt = ethClient.getTransactionReceipt(result);
        Optional<TransactionReceipt> opt = bcosTransactionReceipt.getTransactionReceipt();
        if (opt.isPresent()) {
            TransactionReceipt tr = opt.get();
            String contractName = txHashContractNameMapping.get(tr.getTransactionHash());
            Optional<Transaction> optt = ethClient.getTransactionByHash(tr);
            if (optt.isPresent()) {
                Transaction transaction = optt.get();
                if (transaction.getTo() != null && !transaction.getTo().equals(ContractConstants.EMPTY_ADDRESS)) {
                    tr.setContractAddress(transaction.getTo());
                }
            }
            if (ContractConstants.EXPORT_INNER_CALL_EVENT == false && StringUtils.isEmpty(contractName)) {
                log.error("TxHash {} is Empty, and the blockNumber is {}! Please check it. ",
                        tr.getTransactionHash(), block.getNumber());
                continue;
            }
            bcosEventCrawlerMap.forEach((k, v) -> {
                if (ContractConstants.EXPORT_INNER_CALL_EVENT == false
                        && !StringUtils.startsWithIgnoreCase(k, contractName)) {
                    return;
                }
                boList.addAll(v.handleReceipt(tr, block.getTimestamp()));
            });
        }
    }
    return boList;
}
 
Example #19
Source File: MethodCrawlerHandler.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
public BlockTxDetailInfoBO getBlockTxDetailInfo(Block block, Transaction transaction, TransactionReceipt receipt,
        MethodMetaInfo methodMetaInfo) {
    BlockTxDetailInfoBO blockTxDetailInfo = new BlockTxDetailInfoBO();
    blockTxDetailInfo.setBlockHash(receipt.getBlockHash()).setBlockHeight(receipt.getBlockNumber().longValue())
            .setContractName(methodMetaInfo.getContractName())
            .setMethodName(methodMetaInfo.getMethodName().substring(methodMetaInfo.getContractName().length()))
            .setTxFrom(transaction.getFrom()).setTxTo(transaction.getTo()).setTxHash(receipt.getTransactionHash())
            .setBlockTimeStamp(new Date(block.getTimestamp().longValue()));
    return blockTxDetailInfo;
}
 
Example #20
Source File: Web3ApiController.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "getTransByBlockNumberAndIndex",
        notes = "Gets the transaction information for the specified "
                + "location of the specified block")
@ApiImplicitParams({
        @ApiImplicitParam(name = "blockNumber", value = "blockNumber", required = true,
                dataType = "BigInteger", paramType = "path"),
        @ApiImplicitParam(name = "transactionIndex", value = "transactionIndex",
                required = true, dataType = "BigInteger", paramType = "path")})
@GetMapping("/transByBlockNumberAndIndex/{blockNumber}/{transactionIndex}")
public Transaction getTransByBlockNumberAndIndex(@PathVariable int groupId,
        @PathVariable BigInteger blockNumber, @PathVariable BigInteger transactionIndex) {
    return web3ApiService.getTransByBlockNumberAndIndex(groupId, blockNumber, transactionIndex);
}
 
Example #21
Source File: FunctionTest.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
@Test
public void testInput() throws IOException, BaseException {
    BigInteger bigBlockHeight = new BigInteger(Integer.toString(8));
    Block block = ethClient.getBlock(bigBlockHeight);
    List<TransactionResult> transactionResults = block.getTransactions();
    log.info("transactionResults.size:{}", transactionResults.size());
    for (TransactionResult result : transactionResults) {
        BcosTransactionReceipt ethGetTransactionReceipt = web3j.getTransactionReceipt((String) result.get()).send();
        Optional<TransactionReceipt> opt = ethGetTransactionReceipt.getTransactionReceipt();
        if (opt.isPresent()) {
            log.info("TransactionReceipt hash: {}", opt.get().getTransactionHash());
            Optional<Transaction> optt =
                    web3j.getTransactionByHash(opt.get().getTransactionHash()).send().getTransaction();
            if (optt.isPresent()) {
                String rawInput = optt.get().getInput();

                log.info("input : {}", optt.get().getInput());
                List<TypeReference<Type>> referencesTypeList = new ArrayList<>(1);
                TypeReference exScore = TypeReferenceUtils.getTypeRef("uint128");
                referencesTypeList.add(exScore);
                TypeReference operationType = TypeReferenceUtils.getTypeRef("uint8");
                referencesTypeList.add(operationType);

                List<Type> listT = FunctionReturnDecoder.decode(rawInput.substring(10), referencesTypeList);
                for (Type type : listT) {
                    log.info("type value : {}", type.getValue());
                }
                log.info("type info : {}", JacksonUtils.toJson(listT));
            }
        }
    }
}
 
Example #22
Source File: MethodCrawlerHandler.java    From WeBASE-Collect-Bee with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
public BlockMethodInfo crawl(Block block, Map<String, String> txHashContractAddressMapping) throws IOException {
    BlockMethodInfo blockMethodInfo = new BlockMethodInfo();
    List<BlockTxDetailInfoBO> blockTxDetailInfoList = new ArrayList<>();
    List<MethodBO> methodInfoList = new ArrayList();
    List<TransactionResult> transactionResults = block.getTransactions();
    Map<String, String> txHashContractNameMapping = new HashMap<>();
    for (TransactionResult result : transactionResults) {
        Optional<TransactionReceipt> opt = ethClient.getTransactionReceipt(result).getTransactionReceipt();
        if (opt.isPresent()) {
            TransactionReceipt receipt = opt.get();
            Optional<Transaction> optt = ethClient.getTransactionByHash(receipt);
            if (optt.isPresent()) {
                Transaction transaction = optt.get();
                Optional<Entry<String, String>> optional =
                        transactionService.getContractNameByTransaction(transaction, txHashContractAddressMapping);
                if (!optional.isPresent()) {
                    continue;
                }
                // key:contract binary, value:contract name
                Entry<String, String> contractEntry = optional.get();
                MethodMetaInfo methodMetaInfo =
                        transactionService.getMethodMetaInfo(transaction, contractEntry.getValue());
                if (methodMetaInfo == null) {
                    continue;
                }
                // get block tx detail info
                BlockTxDetailInfoBO blockTxDetailInfo =
                        getBlockTxDetailInfo(block, transaction, receipt, methodMetaInfo);
                blockTxDetailInfoList.add(blockTxDetailInfo);
                txHashContractNameMapping.putIfAbsent(blockTxDetailInfo.getTxHash(),
                        blockTxDetailInfo.getContractName());
                if (!methodCrawlService
                        .getMethodCrawler(
                                StringUtils.uncapitalize(methodMetaInfo.getMethodName()) + "MethodCrawlerImpl")
                        .isPresent()) {
                    log.info("The methodName {} doesn't exist or is constant, please check it !",
                            methodMetaInfo.getMethodName());
                    continue;
                }
                // get method bo
                methodInfoList.add(methodCrawlService
                        .getMethodCrawler(
                                StringUtils.uncapitalize(methodMetaInfo.getMethodName()) + "MethodCrawlerImpl")
                        .get()
                        .transactionHandler(transaction, receipt, block.getTimestamp(), contractEntry,
                                methodMetaInfo.getMethodName(), txHashContractAddressMapping)
                        .setMethodStatus(receipt.getStatus()));
            }
        }
    }
    blockMethodInfo.setBlockTxDetailInfoList(blockTxDetailInfoList).setMethodInfoList(methodInfoList)
            .setTxHashContractNameMapping(txHashContractNameMapping);
    return blockMethodInfo;

}
 
Example #23
Source File: JsonRpc2_0Web3j.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
@Override
public Flowable<Transaction> replayPastAndFutureTransactionsFlowable(
        DefaultBlockParameter startBlock) {
    return null;
}
 
Example #24
Source File: JsonRpc2_0Web3j.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
@Override
public Flowable<Transaction> replayPastTransactionsFlowable(DefaultBlockParameter startBlock) {
    return null;
}
 
Example #25
Source File: JsonRpc2_0Web3j.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
@Override
public Flowable<Transaction> replayPastTransactionsFlowable(
        DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    return null;
}
 
Example #26
Source File: JsonRpc2_0Web3j.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
@Override
public Flowable<Transaction> pendingTransactionFlowable() {
    return null;
}
 
Example #27
Source File: JsonRpc2_0Web3j.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
@Override
public Request<?, Call> call(
        org.fisco.bcos.web3j.protocol.core.methods.request.Transaction transaction) {
    return new Request<>("call", Arrays.asList(groupId, transaction), web3jService, Call.class);
}
 
Example #28
Source File: JsonRpc2_0Web3j.java    From web3sdk with Apache License 2.0 4 votes vote down vote up
@Override
public Flowable<Transaction> transactionFlowable() {
    return null;
}
 
Example #29
Source File: Web3jRx.java    From web3sdk with Apache License 2.0 2 votes vote down vote up
/**
 * As per {@link #replayPastAndFutureBlocksFlowable(DefaultBlockParameter, boolean)}, except
 * that all transactions contained within the blocks are emitted.
 *
 * @param startBlock the block number we wish to request from
 * @return a {@link Flowable} instance to emit all requested transactions and future
 */
Flowable<Transaction> replayPastAndFutureTransactionsFlowable(DefaultBlockParameter startBlock);
 
Example #30
Source File: EthClient.java    From WeBASE-Collect-Bee with Apache License 2.0 2 votes vote down vote up
public Optional<Transaction> getTransactionByHash(TransactionReceipt receipt) throws IOException {
    return web3j.getTransactionByHash(receipt.getTransactionHash()).send().getTransaction();

}