Search in sources :

Example 1 with FaultHandler

use of io.bitsquare.common.handlers.FaultHandler in project bitsquare by bitsquare.

the class BuyerStep5View method doWithdrawal.

private void doWithdrawal(Coin receiverAmount) {
    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.walletService.getWallet().isEncrypted()) {
        UserThread.runAfter(() -> model.dataModel.walletPasswordWindow.onAesKey(aesKey -> doWithdrawRequest(toAddress, receiverAmount, aesKey, resultHandler, faultHandler)).show(), 300, TimeUnit.MILLISECONDS);
    } else
        doWithdrawRequest(toAddress, receiverAmount, null, resultHandler, faultHandler);
}
Also used : TradeStepView(io.bitsquare.gui.main.portfolio.pendingtrades.steps.TradeStepView) Button(javafx.scene.control.Button) Popup(io.bitsquare.gui.main.overlays.popups.Popup) MainView(io.bitsquare.gui.main.MainView) Coin(org.bitcoinj.core.Coin) Restrictions(io.bitsquare.btc.Restrictions) Tuple2(io.bitsquare.common.util.Tuple2) FundsView(io.bitsquare.gui.main.funds.FundsView) DevFlags(io.bitsquare.app.DevFlags) PendingTradesViewModel(io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesViewModel) Insets(javafx.geometry.Insets) WalletService(io.bitsquare.btc.WalletService) Layout(io.bitsquare.gui.util.Layout) ResultHandler(io.bitsquare.common.handlers.ResultHandler) KeyParameter(org.spongycastle.crypto.params.KeyParameter) AddressEntry(io.bitsquare.btc.AddressEntry) GridPane(javafx.scene.layout.GridPane) Log(io.bitsquare.app.Log) BSFormatter(io.bitsquare.gui.util.BSFormatter) HBox(javafx.scene.layout.HBox) AddressFormatException(org.bitcoinj.core.AddressFormatException) InputTextField(io.bitsquare.gui.components.InputTextField) TextField(javafx.scene.control.TextField) Label(javafx.scene.control.Label) UserThread(io.bitsquare.common.UserThread) TimeUnit(java.util.concurrent.TimeUnit) AddressEntryException(io.bitsquare.btc.AddressEntryException) FormBuilder(io.bitsquare.gui.util.FormBuilder) Notification(io.bitsquare.gui.main.overlays.notifications.Notification) FaultHandler(io.bitsquare.common.handlers.FaultHandler) ChangeListener(javafx.beans.value.ChangeListener) TransactionsView(io.bitsquare.gui.main.funds.transactions.TransactionsView) Popup(io.bitsquare.gui.main.overlays.popups.Popup) ResultHandler(io.bitsquare.common.handlers.ResultHandler) FaultHandler(io.bitsquare.common.handlers.FaultHandler)

Aggregations

DevFlags (io.bitsquare.app.DevFlags)1 Log (io.bitsquare.app.Log)1 AddressEntry (io.bitsquare.btc.AddressEntry)1 AddressEntryException (io.bitsquare.btc.AddressEntryException)1 Restrictions (io.bitsquare.btc.Restrictions)1 WalletService (io.bitsquare.btc.WalletService)1 UserThread (io.bitsquare.common.UserThread)1 FaultHandler (io.bitsquare.common.handlers.FaultHandler)1 ResultHandler (io.bitsquare.common.handlers.ResultHandler)1 Tuple2 (io.bitsquare.common.util.Tuple2)1 InputTextField (io.bitsquare.gui.components.InputTextField)1 MainView (io.bitsquare.gui.main.MainView)1 FundsView (io.bitsquare.gui.main.funds.FundsView)1 TransactionsView (io.bitsquare.gui.main.funds.transactions.TransactionsView)1 Notification (io.bitsquare.gui.main.overlays.notifications.Notification)1 Popup (io.bitsquare.gui.main.overlays.popups.Popup)1 PendingTradesViewModel (io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesViewModel)1 TradeStepView (io.bitsquare.gui.main.portfolio.pendingtrades.steps.TradeStepView)1 BSFormatter (io.bitsquare.gui.util.BSFormatter)1 FormBuilder (io.bitsquare.gui.util.FormBuilder)1