From 2cc02e38e662a249f0119bb4cd7b5c02e99c9a04 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 28 Feb 2024 14:52:52 +0200 Subject: [PATCH] add restart in signet to tools menu, add mempool.space signet public server --- .../com/sparrowwallet/sparrow/AppController.java | 15 +++++++++++---- .../sparrow/net/PublicElectrumServer.java | 5 +++-- .../resources/com/sparrowwallet/sparrow/app.fxml | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 648db4b3..f9274aa7 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -198,7 +198,7 @@ public class AppController implements Initializable { private static final BooleanProperty preventSleepProperty = new SimpleBooleanProperty(); @FXML - private MenuItem restart; + private Menu restart; @FXML private StackPane rootStack; @@ -375,7 +375,14 @@ void initializeView() { showLoadingLog.selectedProperty().bindBidirectional(showLoadingLogProperty); preventSleepProperty.set(Config.get().isPreventSleep()); preventSleep.selectedProperty().bindBidirectional(preventSleepProperty); - restart.setText("Restart in " + (Network.get() == Network.MAINNET ? Network.TESTNET.toDisplayString() : Network.MAINNET.toDisplayString())); + + List networks = new ArrayList<>(List.of(Network.MAINNET, Network.TESTNET, Network.SIGNET)); + networks.remove(Network.get()); + for(Network network : networks) { + MenuItem networkItem = new MenuItem(network.toDisplayString()); + networkItem.setOnAction(event -> restart(event, network)); + restart.getItems().add(networkItem); + } restart.setVisible(System.getProperty(JPACKAGE_APP_PATH) != null); saveTransaction.setDisable(true); @@ -957,7 +964,7 @@ public void preventSleep(ActionEvent event) { AppServices.get().setPreventSleep(item.isSelected()); } - public void restart(ActionEvent event) { + public void restart(ActionEvent event, Network network) { if(System.getProperty(JPACKAGE_APP_PATH) == null) { throw new IllegalStateException("Property " + JPACKAGE_APP_PATH + " is not present"); } @@ -968,7 +975,7 @@ public void restart(ActionEvent event) { jCommander.parse(argv); }); - args.network = (Network.get() == Network.MAINNET ? Network.TESTNET : Network.MAINNET); + args.network = network; try { List cmd = new ArrayList<>(); diff --git a/src/main/java/com/sparrowwallet/sparrow/net/PublicElectrumServer.java b/src/main/java/com/sparrowwallet/sparrow/net/PublicElectrumServer.java index 6934b350..dfe0cba0 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/PublicElectrumServer.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/PublicElectrumServer.java @@ -16,14 +16,15 @@ public enum PublicElectrumServer { DIYNODES_COM("electrum.diynodes.com", "ssl://electrum.diynodes.com:50022", Network.MAINNET), SETHFORPRIVACY_COM("fulcrum.sethforprivacy.com", "ssl://fulcrum.sethforprivacy.com:50002", Network.MAINNET), TESTNET_ARANGUREN_ORG("testnet.aranguren.org", "ssl://testnet.aranguren.org:51002", Network.TESTNET), - TESTNET_QTORNADO_COM("testnet.qtornado.com", "ssl://testnet.qtornado.com:51002", Network.TESTNET); + TESTNET_QTORNADO_COM("testnet.qtornado.com", "ssl://testnet.qtornado.com:51002", Network.TESTNET), + SIGNET_MEMPOOL_SPACE("mempool.space", "ssl://mempool.space:60602", Network.SIGNET); PublicElectrumServer(String name, String url, Network network) { this.server = new Server(url, name); this.network = network; } - public static final List SUPPORTED_NETWORKS = List.of(Network.MAINNET, Network.TESTNET); + public static final List SUPPORTED_NETWORKS = List.of(Network.MAINNET, Network.TESTNET, Network.SIGNET); private final Server server; private final Network network; diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.fxml b/src/main/resources/com/sparrowwallet/sparrow/app.fxml index 35d4a98c..e7893fe3 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/app.fxml @@ -114,7 +114,7 @@ - + @@ -143,7 +143,7 @@ - +