mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Show popup if no btc funds available for BSQ tx
This commit is contained in:
parent
b0a51c0389
commit
64c696a264
@ -1174,6 +1174,8 @@ popup.warning.tooLargePercentageValue=You cannot set a percentage of 100% or lar
|
||||
popup.warning.examplePercentageValue=Please enter a percentage number like \"5.4\" for 5.4%
|
||||
popup.warning.noPriceFeedAvailable=There is no price feed available for that currency. You cannot use a percent based price.\nPlease select the fixed price.
|
||||
popup.warning.sendMsgFailed=Sending message to your trading partner failed.\nPlease try again and if it continue to fail report a bug.
|
||||
popup.warning.insufficientBtcFundsForBsqTx=You don''t have sufficient BTC funds for paying the tx fee for that BSQ transaction.\n\
|
||||
Please fund your BTC wallet to be able to transfer BSQ.\nMissing funds: {0}
|
||||
|
||||
popup.info.securityDepositInfo=To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\nThe deposit will stay in your local trading wallet until the offer gets accepted by another trader.\nIt will be refunded to you after the trade has successfully completed.\n\nPlease note that you need to keep you application running if you have an open offer.\nWhen another trader wants to take your offer it requires that your application is online and able to react.\nBe sure that you have standby mode deactivated as that would disconnect your client from the network (standby of the monitor is not a problem).
|
||||
|
||||
|
@ -188,7 +188,7 @@ public class BsqWalletService extends WalletService {
|
||||
public ObservableList<Transaction> getWalletTransactions() {
|
||||
return walletTransactions;
|
||||
}
|
||||
|
||||
|
||||
private void updateBsqWalletTransactions() {
|
||||
walletTransactions.setAll(getTransactions(false));
|
||||
// walletTransactions.setAll(getBsqWalletTransactions());
|
||||
|
@ -221,7 +221,7 @@ public abstract class WalletService {
|
||||
txIn.getScriptSig().correctlySpends(tx, index, txIn.getConnectedOutput().getScriptPubKey());
|
||||
log.warn("Input {} already correctly spends output, assuming SIGHASH type used will be safe and skipping signing.", index);
|
||||
return;
|
||||
} catch (ScriptException e) {
|
||||
} catch (ScriptException e) {
|
||||
// Expected.
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ public abstract class WalletService {
|
||||
// We assume if its already signed, its hopefully got a SIGHASH type that will not invalidate when
|
||||
// we sign missing pieces (to check this would require either assuming any signatures are signing
|
||||
// standard output types or a way to get processed signatures out of script execution)
|
||||
txIn.getScriptSig().correctlySpends(tx, index, txIn.getConnectedOutput().getScriptPubKey());
|
||||
txIn.getScriptSig().correctlySpends(tx, index, txIn.getConnectedOutput().getScriptPubKey(), Script.ALL_VERIFY_FLAGS);
|
||||
log.warn("Input {} already correctly spends output, assuming SIGHASH type used will be safe and skipping signing.", index);
|
||||
return;
|
||||
} catch (ScriptException e) {
|
||||
|
@ -25,10 +25,14 @@ import io.bisq.core.btc.exceptions.WalletException;
|
||||
import io.bisq.core.btc.wallet.BsqWalletService;
|
||||
import io.bisq.core.btc.wallet.BtcWalletService;
|
||||
import io.bisq.core.util.CoinUtil;
|
||||
import io.bisq.gui.Navigation;
|
||||
import io.bisq.gui.common.view.ActivatableView;
|
||||
import io.bisq.gui.common.view.FxmlView;
|
||||
import io.bisq.gui.components.InputTextField;
|
||||
import io.bisq.gui.main.MainView;
|
||||
import io.bisq.gui.main.dao.wallet.BsqBalanceUtil;
|
||||
import io.bisq.gui.main.funds.FundsView;
|
||||
import io.bisq.gui.main.funds.deposit.DepositView;
|
||||
import io.bisq.gui.main.overlays.popups.Popup;
|
||||
import io.bisq.gui.util.BSFormatter;
|
||||
import io.bisq.gui.util.BsqFormatter;
|
||||
@ -39,6 +43,7 @@ import javafx.beans.value.ChangeListener;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.InsufficientMoneyException;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -53,6 +58,7 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
|
||||
private final BtcWalletService btcWalletService;
|
||||
private final BsqFormatter bsqFormatter;
|
||||
private final BSFormatter btcFormatter;
|
||||
private Navigation navigation;
|
||||
private final BsqBalanceUtil bsqBalanceUtil;
|
||||
private final BsqValidator bsqValidator;
|
||||
private final BsqAddressValidator bsqAddressValidator;
|
||||
@ -70,12 +76,14 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
|
||||
|
||||
@Inject
|
||||
private BsqSendView(BsqWalletService bsqWalletService, BtcWalletService btcWalletService,
|
||||
BsqFormatter bsqFormatter, BSFormatter btcFormatter,
|
||||
BsqBalanceUtil bsqBalanceUtil, BsqValidator bsqValidator, BsqAddressValidator bsqAddressValidator) {
|
||||
BsqFormatter bsqFormatter, BSFormatter btcFormatter, Navigation navigation,
|
||||
BsqBalanceUtil bsqBalanceUtil, BsqValidator bsqValidator,
|
||||
BsqAddressValidator bsqAddressValidator) {
|
||||
this.bsqWalletService = bsqWalletService;
|
||||
this.btcWalletService = btcWalletService;
|
||||
this.bsqFormatter = bsqFormatter;
|
||||
this.btcFormatter = btcFormatter;
|
||||
this.navigation = navigation;
|
||||
this.bsqBalanceUtil = bsqBalanceUtil;
|
||||
this.bsqValidator = bsqValidator;
|
||||
this.bsqAddressValidator = bsqAddressValidator;
|
||||
@ -154,9 +162,18 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.show();
|
||||
} catch (Throwable t) {
|
||||
log.error(t.toString());
|
||||
t.printStackTrace();
|
||||
new Popup<>().warning(t.getMessage()).show();
|
||||
if (t instanceof InsufficientMoneyException) {
|
||||
final Coin missingCoin = ((InsufficientMoneyException) t).missing;
|
||||
final String missing = missingCoin != null ? missingCoin.toFriendlyString() : "null";
|
||||
new Popup<>().warning(Res.get("popup.warning.insufficientBtcFundsForBsqTx", missing))
|
||||
.actionButtonTextWithGoTo("navigation.funds.depositFunds")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, DepositView.class))
|
||||
.show();
|
||||
} else {
|
||||
log.error(t.toString());
|
||||
t.printStackTrace();
|
||||
new Popup<>().warning(t.getMessage()).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package io.bisq.gui.main.dao.wallet.tx;
|
||||
import de.jensd.fx.fontawesome.AwesomeDude;
|
||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.core.btc.wallet.BsqBalanceListener;
|
||||
import io.bisq.core.btc.wallet.BsqWalletService;
|
||||
import io.bisq.core.btc.wallet.BtcWalletService;
|
||||
import io.bisq.core.dao.blockchain.BsqBlockchainManager;
|
||||
@ -79,6 +80,7 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
||||
private int gridRow = 0;
|
||||
private Label chainHeightLabel;
|
||||
private BsqChainStateListener bsqChainStateListener;
|
||||
private BsqBalanceListener bsqBalanceListener;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -127,6 +129,9 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
||||
root.getChildren().add(vBox);
|
||||
|
||||
walletBsqTransactionsListener = change -> updateList();
|
||||
bsqBalanceListener = (availableBalance, unverifiedBalance) -> {
|
||||
updateList();
|
||||
};
|
||||
parentHeightListener = (observable, oldValue, newValue) -> layout();
|
||||
bsqChainStateListener = this::onChainHeightChanged;
|
||||
}
|
||||
@ -135,6 +140,7 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
||||
protected void activate() {
|
||||
bsqBalanceUtil.activate();
|
||||
bsqWalletService.getWalletTransactions().addListener(walletBsqTransactionsListener);
|
||||
bsqWalletService.addBsqBalanceListener(bsqBalanceListener);
|
||||
|
||||
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
|
||||
tableView.setItems(sortedList);
|
||||
@ -155,6 +161,7 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
||||
bsqBalanceUtil.deactivate();
|
||||
sortedList.comparatorProperty().unbind();
|
||||
bsqWalletService.getWalletTransactions().removeListener(walletBsqTransactionsListener);
|
||||
bsqWalletService.removeBsqBalanceListener(bsqBalanceListener);
|
||||
observableList.forEach(BsqTxListItem::cleanup);
|
||||
bsqBlockchainManager.removeBsqChainStateListener(bsqChainStateListener);
|
||||
|
||||
@ -392,7 +399,6 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
||||
txType = item.getTxType().get();
|
||||
else
|
||||
txType = item.getConfirmations() == 0 ? TxType.UNVERIFIED : TxType.INVALID;
|
||||
|
||||
String toolTipText = Res.get("dao.tx.type.enum." + txType.name());
|
||||
switch (txType) {
|
||||
case UNVERIFIED:
|
||||
@ -437,7 +443,6 @@ public class BsqTxView extends ActivatableView<GridPane, Void> {
|
||||
}
|
||||
Label label = AwesomeDude.createIconLabel(awesomeIcon);
|
||||
label.getStyleClass().add(style);
|
||||
|
||||
label.setTooltip(new Tooltip(toolTipText));
|
||||
setGraphic(label);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user