use of bisq.desktop.main.overlays.windows.SelectDepositTxWindow in project bisq-desktop by bisq-network.
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 = btcWalletService.getRecentTransactions(100, true);
transactions.stream().forEach(transaction -> {
Coin valueSentFromMe = btcWalletService.getValueSentFromMeForTransaction(transaction);
if (!valueSentFromMe.isZero()) {
// spending tx
// MS tx
candidates.addAll(transaction.getOutputs().stream().filter(output -> !btcWalletService.isTransactionOutputMine(output)).filter(output -> output.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(Res.get("shared.cancel")).show();
else
log.error("Trade.depositTx is null and we did not find any MultiSig transaction.");
}
} else {
log.error("Trade is null");
}
}
Aggregations