Search in sources :

Example 1 with SelectDepositTxWindow

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");
    }
}
Also used : GUIUtil(bisq.desktop.util.GUIUtil) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) PubKeyRing(bisq.common.crypto.PubKeyRing) Transaction(org.bitcoinj.core.Transaction) Coin(org.bitcoinj.core.Coin) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Inject(com.google.inject.Inject) FXCollections(javafx.collections.FXCollections) Dispute(bisq.core.arbitration.Dispute) DisputeManager(bisq.core.arbitration.DisputeManager) NotificationCenter(bisq.desktop.main.overlays.notifications.NotificationCenter) ArrayList(java.util.ArrayList) DisputesView(bisq.desktop.main.disputes.DisputesView) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) OfferPayload(bisq.core.offer.OfferPayload) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) SellerTrade(bisq.core.trade.SellerTrade) PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) ErrorMessageHandler(bisq.common.handlers.ErrorMessageHandler) KeyParameter(org.spongycastle.crypto.params.KeyParameter) Nullable(javax.annotation.Nullable) Navigation(bisq.desktop.Navigation) Popup(bisq.desktop.main.overlays.popups.Popup) Offer(bisq.core.offer.Offer) ObjectProperty(javafx.beans.property.ObjectProperty) WalletPasswordWindow(bisq.desktop.main.overlays.windows.WalletPasswordWindow) ActivatableDataModel(bisq.desktop.common.model.ActivatableDataModel) P2PService(bisq.network.p2p.P2PService) Trade(bisq.core.trade.Trade) FaultHandler(bisq.common.handlers.FaultHandler) ResultHandler(bisq.common.handlers.ResultHandler) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) Log(bisq.common.app.Log) Collectors(java.util.stream.Collectors) SelectDepositTxWindow(bisq.desktop.main.overlays.windows.SelectDepositTxWindow) MainView(bisq.desktop.main.MainView) List(java.util.List) BuyerTrade(bisq.core.trade.BuyerTrade) WalletsSetup(bisq.core.btc.wallet.WalletsSetup) TradeManager(bisq.core.trade.TradeManager) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Preferences(bisq.core.user.Preferences) DisputeAlreadyOpenException(bisq.core.arbitration.DisputeAlreadyOpenException) KeyRing(bisq.common.crypto.KeyRing) ObservableList(javafx.collections.ObservableList) StringProperty(javafx.beans.property.StringProperty) ChangeListener(javafx.beans.value.ChangeListener) Coin(org.bitcoinj.core.Coin) Transaction(org.bitcoinj.core.Transaction) ArrayList(java.util.ArrayList) SelectDepositTxWindow(bisq.desktop.main.overlays.windows.SelectDepositTxWindow)

Aggregations

Log (bisq.common.app.Log)1 KeyRing (bisq.common.crypto.KeyRing)1 PubKeyRing (bisq.common.crypto.PubKeyRing)1 ErrorMessageHandler (bisq.common.handlers.ErrorMessageHandler)1 FaultHandler (bisq.common.handlers.FaultHandler)1 ResultHandler (bisq.common.handlers.ResultHandler)1 Dispute (bisq.core.arbitration.Dispute)1 DisputeAlreadyOpenException (bisq.core.arbitration.DisputeAlreadyOpenException)1 DisputeManager (bisq.core.arbitration.DisputeManager)1 BtcWalletService (bisq.core.btc.wallet.BtcWalletService)1 WalletsSetup (bisq.core.btc.wallet.WalletsSetup)1 Res (bisq.core.locale.Res)1 Offer (bisq.core.offer.Offer)1 OfferPayload (bisq.core.offer.OfferPayload)1 PaymentAccountPayload (bisq.core.payment.payload.PaymentAccountPayload)1 BuyerTrade (bisq.core.trade.BuyerTrade)1 SellerTrade (bisq.core.trade.SellerTrade)1 Trade (bisq.core.trade.Trade)1 TradeManager (bisq.core.trade.TradeManager)1 Preferences (bisq.core.user.Preferences)1