use of io.bitsquare.gui.main.overlays.windows.SelectDepositTxWindow in project bitsquare by bitsquare.
the class PendingTradesDataModel method tryOpenDispute.
private void tryOpenDispute(boolean isSupportTicket) {
if (getTrade() != null) {
Transaction depositTx = getTrade().getDepositTx();
if (depositTx != null) {
doOpenDispute(isSupportTicket, getTrade().getDepositTx());
} else {
log.info("Trade.depositTx is null. We try to find the tx in our wallet.");
List<Transaction> candidates = new ArrayList<>();
List<Transaction> transactions = walletService.getWallet().getRecentTransactions(100, true);
transactions.stream().forEach(transaction -> {
Coin valueSentFromMe = transaction.getValueSentFromMe(walletService.getWallet());
if (!valueSentFromMe.isZero()) {
candidates.addAll(transaction.getOutputs().stream().filter(transactionOutput -> !transactionOutput.isMine(walletService.getWallet())).filter(transactionOutput -> transactionOutput.getScriptPubKey().isPayToScriptHash()).map(transactionOutput -> transaction).collect(Collectors.toList()));
}
});
if (candidates.size() == 1)
doOpenDispute(isSupportTicket, candidates.get(0));
else if (candidates.size() > 1)
new SelectDepositTxWindow().transactions(candidates).onSelect(transaction -> doOpenDispute(isSupportTicket, transaction)).closeButtonText("Cancel").show();
else
log.error("Trade.depositTx is null and we did not find any MultiSig transaction.");
}
} else {
log.error("Trade is null");
}
}
Aggregations