@Test public void getTransactionReceipt() { String hashs[] = {"0x6ee4c7c22cae33226884900a2f78aeb2bbdc1bdc88913235a70469f0a248cc3c", "0xf4fa892f8cdab498c1058b78dff1d30e4047950f29188a2197944109ee2c08a3", "0x7c60553fe3dcdf19f641ee58c5691e49b63c4d7055b92fe1b09b517471f26143", "0x1f96da0638287b8db23c3b25d4afea1cca7fb881b4dca75a52aeb98af219e9a9"}; String hash = "0x6ee4c7c22cae33226884900a2f78aeb2bbdc1bdc88913235a70469f0a248cc3c"; TransactionReceipt receipt = ServerUtils .getCommonApi() .getTransactionsStatus(ApiRequestBody.newBuilder() .put("hash", Arrays.asList(hashs)) .build()) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse != null && apiResponseResponse.isSuccessful(); } }) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { List<TransactionReceipt> transactionReceiptList = apiResponseResponse.body().getData(); return transactionReceiptList != null && !transactionReceiptList.isEmpty(); } }) .map(new Function<Response<ApiResponse<List<TransactionReceipt>>>, TransactionReceipt>() { @Override public TransactionReceipt apply(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse.body().getData().get(0); } }) .defaultIfEmpty(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .onErrorReturnItem(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .toSingle() .blockingGet(); Log.d("======", "得到结果result---------->" + receipt.getHash() + "==========" + receipt.getStatus()); }
private TransactionReceipt getTransactionReceipt(String hash) { return ServerUtils .getCommonApi() .getTransactionsStatus(ApiRequestBody.newBuilder() .put("hash", Arrays.asList(hash)) .build()) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse != null && apiResponseResponse.isSuccessful(); } }) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { List<TransactionReceipt> transactionReceiptList = apiResponseResponse.body().getData(); return transactionReceiptList != null && !transactionReceiptList.isEmpty(); } }) .map(new Function<Response<ApiResponse<List<TransactionReceipt>>>, TransactionReceipt>() { @Override public TransactionReceipt apply(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse.body().getData().get(0); } }) .defaultIfEmpty(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .onErrorReturnItem(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .toSingle() .blockingGet(); }
TransactionManager { private TransactionReceipt getTransactionReceipt(String hash) { return ServerUtils .getCommonApi() .getTransactionsStatus(ApiRequestBody.newBuilder() .put("hash", Arrays.asList(hash)) .build()) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse != null && apiResponseResponse.isSuccessful(); } }) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { List<TransactionReceipt> transactionReceiptList = apiResponseResponse.body().getData(); return transactionReceiptList != null && !transactionReceiptList.isEmpty(); } }) .map(new Function<Response<ApiResponse<List<TransactionReceipt>>>, TransactionReceipt>() { @Override public TransactionReceipt apply(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse.body().getData().get(0); } }) .defaultIfEmpty(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .onErrorReturnItem(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .toSingle() .blockingGet(); } }
TransactionManager { private TransactionReceipt getTransactionReceipt(String hash) { return ServerUtils .getCommonApi() .getTransactionsStatus(ApiRequestBody.newBuilder() .put("hash", Arrays.asList(hash)) .build()) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse != null && apiResponseResponse.isSuccessful(); } }) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { List<TransactionReceipt> transactionReceiptList = apiResponseResponse.body().getData(); return transactionReceiptList != null && !transactionReceiptList.isEmpty(); } }) .map(new Function<Response<ApiResponse<List<TransactionReceipt>>>, TransactionReceipt>() { @Override public TransactionReceipt apply(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse.body().getData().get(0); } }) .defaultIfEmpty(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .onErrorReturnItem(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .toSingle() .blockingGet(); } private  TransactionManager(); }
TransactionManager { private TransactionReceipt getTransactionReceipt(String hash) { return ServerUtils .getCommonApi() .getTransactionsStatus(ApiRequestBody.newBuilder() .put("hash", Arrays.asList(hash)) .build()) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse != null && apiResponseResponse.isSuccessful(); } }) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { List<TransactionReceipt> transactionReceiptList = apiResponseResponse.body().getData(); return transactionReceiptList != null && !transactionReceiptList.isEmpty(); } }) .map(new Function<Response<ApiResponse<List<TransactionReceipt>>>, TransactionReceipt>() { @Override public TransactionReceipt apply(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse.body().getData().get(0); } }) .defaultIfEmpty(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .onErrorReturnItem(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .toSingle() .blockingGet(); } private  TransactionManager(); static TransactionManager getInstance(); Wallet getBalanceByAddress(Wallet walletEntity); Disposable removeTaskByHash(String hash); void putPendingTransaction(String from, long timeStamp); long getPendingTransactionTimeStamp(String from); void removePendingTransaction(String from); long getSendTransactionTimeInterval(String from, long currentTime); boolean isAllowSendTransaction(String from, long currentTime); void putTask(String hash, Disposable disposable); void cancelTaskByHash(String hash); Single<RPCTransactionResult> sendContractTransaction(PlatOnContract platOnContract, Credentials credentials, PlatOnFunction platOnFunction, String nonce); Single<RPCTransactionResult> submitTransaction(String sign, String signedMessage, String remark); Single<BigInteger> getNonce(String from); RPCTransactionResult getTransactionResult(String hexValue); String sendContractTransaction(String signedMessage); PlatonSendTransaction sendTransactionReturnPlatonSendTransaction(String signedMessage); String signTransaction(Credentials credentials, String data, String toAddress, BigDecimal amount, BigInteger nonce, BigInteger gasPrice, BigInteger gasLimit); Single<Transaction> sendTransferTransaction(ECKeyPair ecKeyPair, String fromAddress, String toAddress, String walletName, BigDecimal transferAmount, BigDecimal feeAmount, BigInteger gasPrice, BigInteger gasLimit, BigInteger nonce, String remark); Disposable getTransactionByLoop(Transaction transaction); }
TransactionManager { private TransactionReceipt getTransactionReceipt(String hash) { return ServerUtils .getCommonApi() .getTransactionsStatus(ApiRequestBody.newBuilder() .put("hash", Arrays.asList(hash)) .build()) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse != null && apiResponseResponse.isSuccessful(); } }) .filter(new Predicate<Response<ApiResponse<List<TransactionReceipt>>>>() { @Override public boolean test(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { List<TransactionReceipt> transactionReceiptList = apiResponseResponse.body().getData(); return transactionReceiptList != null && !transactionReceiptList.isEmpty(); } }) .map(new Function<Response<ApiResponse<List<TransactionReceipt>>>, TransactionReceipt>() { @Override public TransactionReceipt apply(Response<ApiResponse<List<TransactionReceipt>>> apiResponseResponse) throws Exception { return apiResponseResponse.body().getData().get(0); } }) .defaultIfEmpty(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .onErrorReturnItem(new TransactionReceipt(TransactionStatus.PENDING.ordinal(), hash)) .toSingle() .blockingGet(); } private  TransactionManager(); static TransactionManager getInstance(); Wallet getBalanceByAddress(Wallet walletEntity); Disposable removeTaskByHash(String hash); void putPendingTransaction(String from, long timeStamp); long getPendingTransactionTimeStamp(String from); void removePendingTransaction(String from); long getSendTransactionTimeInterval(String from, long currentTime); boolean isAllowSendTransaction(String from, long currentTime); void putTask(String hash, Disposable disposable); void cancelTaskByHash(String hash); Single<RPCTransactionResult> sendContractTransaction(PlatOnContract platOnContract, Credentials credentials, PlatOnFunction platOnFunction, String nonce); Single<RPCTransactionResult> submitTransaction(String sign, String signedMessage, String remark); Single<BigInteger> getNonce(String from); RPCTransactionResult getTransactionResult(String hexValue); String sendContractTransaction(String signedMessage); PlatonSendTransaction sendTransactionReturnPlatonSendTransaction(String signedMessage); String signTransaction(Credentials credentials, String data, String toAddress, BigDecimal amount, BigInteger nonce, BigInteger gasPrice, BigInteger gasLimit); Single<Transaction> sendTransferTransaction(ECKeyPair ecKeyPair, String fromAddress, String toAddress, String walletName, BigDecimal transferAmount, BigDecimal feeAmount, BigInteger gasPrice, BigInteger gasLimit, BigInteger nonce, String remark); Disposable getTransactionByLoop(Transaction transaction);  }