mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Add isReadyForTxBroadcast check for WithdrawalView
This commit is contained in:
parent
a805d5fd0e
commit
725bf14b22
1 changed files with 75 additions and 62 deletions
|
@ -27,6 +27,7 @@ import io.bisq.core.btc.InsufficientFundsException;
|
||||||
import io.bisq.core.btc.Restrictions;
|
import io.bisq.core.btc.Restrictions;
|
||||||
import io.bisq.core.btc.listeners.BalanceListener;
|
import io.bisq.core.btc.listeners.BalanceListener;
|
||||||
import io.bisq.core.btc.wallet.BtcWalletService;
|
import io.bisq.core.btc.wallet.BtcWalletService;
|
||||||
|
import io.bisq.core.btc.wallet.WalletsSetup;
|
||||||
import io.bisq.core.trade.Tradable;
|
import io.bisq.core.trade.Tradable;
|
||||||
import io.bisq.core.trade.Trade;
|
import io.bisq.core.trade.Trade;
|
||||||
import io.bisq.core.trade.TradeManager;
|
import io.bisq.core.trade.TradeManager;
|
||||||
|
@ -42,6 +43,7 @@ import io.bisq.gui.main.overlays.windows.WalletPasswordWindow;
|
||||||
import io.bisq.gui.util.BSFormatter;
|
import io.bisq.gui.util.BSFormatter;
|
||||||
import io.bisq.gui.util.GUIUtil;
|
import io.bisq.gui.util.GUIUtil;
|
||||||
import io.bisq.gui.util.validation.BtcAddressValidator;
|
import io.bisq.gui.util.validation.BtcAddressValidator;
|
||||||
|
import io.bisq.network.p2p.P2PService;
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
|
@ -89,6 +91,8 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
private final TradeManager tradeManager;
|
private final TradeManager tradeManager;
|
||||||
private final ClosedTradableManager closedTradableManager;
|
private final ClosedTradableManager closedTradableManager;
|
||||||
private final FailedTradesManager failedTradesManager;
|
private final FailedTradesManager failedTradesManager;
|
||||||
|
private final P2PService p2PService;
|
||||||
|
private final WalletsSetup walletsSetup;
|
||||||
private final BSFormatter formatter;
|
private final BSFormatter formatter;
|
||||||
private final Preferences preferences;
|
private final Preferences preferences;
|
||||||
private final BtcAddressValidator btcAddressValidator;
|
private final BtcAddressValidator btcAddressValidator;
|
||||||
|
@ -118,13 +122,18 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
TradeManager tradeManager,
|
TradeManager tradeManager,
|
||||||
ClosedTradableManager closedTradableManager,
|
ClosedTradableManager closedTradableManager,
|
||||||
FailedTradesManager failedTradesManager,
|
FailedTradesManager failedTradesManager,
|
||||||
BSFormatter formatter, Preferences preferences,
|
P2PService p2PService,
|
||||||
|
WalletsSetup walletsSetup,
|
||||||
|
BSFormatter formatter,
|
||||||
|
Preferences preferences,
|
||||||
BtcAddressValidator btcAddressValidator,
|
BtcAddressValidator btcAddressValidator,
|
||||||
WalletPasswordWindow walletPasswordWindow) {
|
WalletPasswordWindow walletPasswordWindow) {
|
||||||
this.walletService = walletService;
|
this.walletService = walletService;
|
||||||
this.tradeManager = tradeManager;
|
this.tradeManager = tradeManager;
|
||||||
this.closedTradableManager = closedTradableManager;
|
this.closedTradableManager = closedTradableManager;
|
||||||
this.failedTradesManager = failedTradesManager;
|
this.failedTradesManager = failedTradesManager;
|
||||||
|
this.p2PService = p2PService;
|
||||||
|
this.walletsSetup = walletsSetup;
|
||||||
this.formatter = formatter;
|
this.formatter = formatter;
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
this.btcAddressValidator = btcAddressValidator;
|
this.btcAddressValidator = btcAddressValidator;
|
||||||
|
@ -252,6 +261,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void onWithdraw() {
|
public void onWithdraw() {
|
||||||
|
if (GUIUtil.isReadyForTxBroadcast(p2PService, walletsSetup)) {
|
||||||
try {
|
try {
|
||||||
// We do not know sendersAmount if senderPaysFee is true. We repeat fee calculation after first attempt if senderPaysFee is true.
|
// We do not know sendersAmount if senderPaysFee is true. We repeat fee calculation after first attempt if senderPaysFee is true.
|
||||||
Transaction feeEstimationTransaction = walletService.getFeeEstimationTransactionForMultipleAddresses(fromAddresses, amountAsCoin);
|
Transaction feeEstimationTransaction = walletService.getFeeEstimationTransactionForMultipleAddresses(fromAddresses, amountAsCoin);
|
||||||
|
@ -313,12 +323,15 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InsufficientFundsException e) {
|
} catch (InsufficientFundsException e) {
|
||||||
new Popup<>().warning(Res.get("funds.withdrawal.warn.amountExceeds")+ "\n\nError message:\n" + e.getMessage()).show();
|
new Popup<>().warning(Res.get("funds.withdrawal.warn.amountExceeds") + "\n\nError message:\n" + e.getMessage()).show();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(e.toString());
|
log.error(e.toString());
|
||||||
new Popup<>().warning(e.toString()).show();
|
new Popup<>().warning(e.toString()).show();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
GUIUtil.showNotReadyForTxBroadcastPopups(p2PService, walletsSetup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectForWithdrawal(WithdrawalListItem item) {
|
private void selectForWithdrawal(WithdrawalListItem item) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue