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);
}
Aggregations