Search in sources :

Example 1 with FaultHandler

use of bisq.common.handlers.FaultHandler in project bisq-desktop by bisq-network.

the class BuyerStep4View method doWithdrawal.

private void doWithdrawal(Coin amount, Coin fee) {
    String toAddress = withdrawAddressTextField.getText();
    ResultHandler resultHandler = this::handleTradeCompleted;
    FaultHandler faultHandler = (errorMessage, throwable) -> {
        useSavingsWalletButton.setDisable(false);
        withdrawToExternalWalletButton.setDisable(false);
        if (throwable != null && throwable.getMessage() != null)
            new Popup<>().error(errorMessage + "\n\n" + throwable.getMessage()).show();
        else
            new Popup<>().error(errorMessage).show();
    };
    if (model.dataModel.btcWalletService.isEncrypted()) {
        UserThread.runAfter(() -> model.dataModel.walletPasswordWindow.onAesKey(aesKey -> doWithdrawRequest(toAddress, amount, fee, aesKey, resultHandler, faultHandler)).show(), 300, TimeUnit.MILLISECONDS);
    } else
        doWithdrawRequest(toAddress, amount, fee, null, resultHandler, faultHandler);
}
Also used : Button(javafx.scene.control.Button) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) Transaction(org.bitcoinj.core.Transaction) Coin(org.bitcoinj.core.Coin) Layout(bisq.desktop.util.Layout) ClosedTradesView(bisq.desktop.main.portfolio.closedtrades.ClosedTradesView) Notification(bisq.desktop.main.overlays.notifications.Notification) BSFormatter(bisq.desktop.util.BSFormatter) Tuple2(bisq.common.util.Tuple2) Insets(javafx.geometry.Insets) InputTextField(bisq.desktop.components.InputTextField) Res(bisq.core.locale.Res) KeyParameter(org.spongycastle.crypto.params.KeyParameter) TitledGroupBg(bisq.desktop.components.TitledGroupBg) GridPane(javafx.scene.layout.GridPane) PendingTradesViewModel(bisq.desktop.main.portfolio.pendingtrades.PendingTradesViewModel) AddressFormatException(org.bitcoinj.core.AddressFormatException) HBox(javafx.scene.layout.HBox) Popup(bisq.desktop.main.overlays.popups.Popup) AddressEntryException(bisq.core.btc.AddressEntryException) Label(javafx.scene.control.Label) FaultHandler(bisq.common.handlers.FaultHandler) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) InsufficientFundsException(bisq.core.btc.InsufficientFundsException) DontShowAgainLookup(bisq.core.user.DontShowAgainLookup) ResultHandler(bisq.common.handlers.ResultHandler) FormBuilder(bisq.desktop.util.FormBuilder) Log(bisq.common.app.Log) TradeStepView(bisq.desktop.main.portfolio.pendingtrades.steps.TradeStepView) TimeUnit(java.util.concurrent.TimeUnit) MainView(bisq.desktop.main.MainView) AddressEntry(bisq.core.btc.AddressEntry) DevEnv(bisq.common.app.DevEnv) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) UserThread(bisq.common.UserThread) BtcAddressValidator(bisq.desktop.util.validation.BtcAddressValidator) PortfolioView(bisq.desktop.main.portfolio.PortfolioView) Restrictions(bisq.core.btc.Restrictions) CoinUtil(bisq.core.util.CoinUtil) Popup(bisq.desktop.main.overlays.popups.Popup) ResultHandler(bisq.common.handlers.ResultHandler) FaultHandler(bisq.common.handlers.FaultHandler)

Aggregations

UserThread (bisq.common.UserThread)1 DevEnv (bisq.common.app.DevEnv)1 Log (bisq.common.app.Log)1 FaultHandler (bisq.common.handlers.FaultHandler)1 ResultHandler (bisq.common.handlers.ResultHandler)1 Tuple2 (bisq.common.util.Tuple2)1 AddressEntry (bisq.core.btc.AddressEntry)1 AddressEntryException (bisq.core.btc.AddressEntryException)1 InsufficientFundsException (bisq.core.btc.InsufficientFundsException)1 Restrictions (bisq.core.btc.Restrictions)1 BtcWalletService (bisq.core.btc.wallet.BtcWalletService)1 Res (bisq.core.locale.Res)1 DontShowAgainLookup (bisq.core.user.DontShowAgainLookup)1 CoinUtil (bisq.core.util.CoinUtil)1 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)1 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)1 InputTextField (bisq.desktop.components.InputTextField)1 TitledGroupBg (bisq.desktop.components.TitledGroupBg)1 MainView (bisq.desktop.main.MainView)1 Notification (bisq.desktop.main.overlays.notifications.Notification)1