diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java index 7a68a874..6d55ca9f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java @@ -105,6 +105,9 @@ public class InitiatorController extends SorobanController { @FXML private Label step2Desc; + @FXML + private Hyperlink meetingFail; + @FXML private ProgressBar sorobanProgressBar; @@ -188,6 +191,17 @@ public class InitiatorController extends SorobanController { broadcastSuccessful.managedProperty().bind(broadcastSuccessful.visibleProperty()); broadcastSuccessful.setVisible(false); + meetingFail.managedProperty().bind(meetingFail.visibleProperty()); + meetingFail.setVisited(true); + meetingFail.setVisible(false); + meetingFail.setOnAction(event -> { + meetingFail.setVisible(false); + step2Desc.setText("Retrying..."); + sorobanProgressLabel.setVisible(true); + startInitiatorMeetingRequest(AppServices.getSorobanServices().getSoroban(walletId), wallet); + step2Timer.start(); + }); + step2.setVisible(false); step3.setVisible(false); step4.setVisible(false); @@ -419,17 +433,15 @@ public class InitiatorController extends SorobanController { } }, error -> { log.error("Error receiving meeting response", error); - String cutFrom = "Exception: "; - int index = error.getMessage().lastIndexOf(cutFrom); - String msg = index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length()); - msg = msg.replace("#Cahoots", "mix transaction"); - step2Desc.setText(msg); + step2Desc.setText(getErrorMessage(error)); sorobanProgressLabel.setVisible(false); + meetingFail.setVisible(true); }); }, error -> { log.error("Error sending meeting request", error); - step2Desc.setText(error.getMessage()); + step2Desc.setText(getErrorMessage(error)); sorobanProgressLabel.setVisible(false); + meetingFail.setVisible(true); }); } catch(Exception e) { log.error("Error sending meeting request", e); @@ -512,9 +524,7 @@ public class InitiatorController extends SorobanController { }, error -> { log.error("Error creating mix transaction", error); - String cutFrom = "Exception: "; - int index = error.getMessage().lastIndexOf(cutFrom); - step2Desc.setText(index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length())); + step2Desc.setText(getErrorMessage(error)); sorobanProgressLabel.setVisible(false); }); } catch(Exception e) { @@ -667,6 +677,15 @@ public class InitiatorController extends SorobanController { } } + private static String getErrorMessage(Throwable error) { + String cutFrom = "Exception: "; + int index = error.getMessage().lastIndexOf(cutFrom); + String msg = index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length()); + msg = msg.replace("#Cahoots", "mix transaction"); + msg = msg.endsWith(".") ? msg : msg + "."; + return msg; + } + public boolean isTransactionAccepted() { return transactionAccepted.get() == Boolean.TRUE; } diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorDialog.java b/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorDialog.java index ead9fea5..bfdaa10a 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorDialog.java @@ -47,6 +47,7 @@ public class InitiatorDialog extends Dialog { dialogPane.setPrefHeight(530); AppServices.moveToActiveWindowScreen(this); + dialogPane.getStylesheets().add(AppServices.class.getResource("general.css").toExternalForm()); dialogPane.getStylesheets().add(AppServices.class.getResource("app.css").toExternalForm()); dialogPane.getStylesheets().add(AppServices.class.getResource("soroban/initiator.css").toExternalForm()); diff --git a/src/main/resources/com/sparrowwallet/sparrow/soroban/initiator.fxml b/src/main/resources/com/sparrowwallet/sparrow/soroban/initiator.fxml index 57c2c479..5dea1bf3 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/soroban/initiator.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/soroban/initiator.fxml @@ -76,7 +76,10 @@ -