diff --git a/src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java b/src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java index dfb93786..88efa5ed 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/PayNymAvatar.java @@ -54,10 +54,6 @@ public class PayNymAvatar extends StackPane { this.paymentCodeProperty.set(paymentCode); } - public void setPayNymAvatarUri(String uri) { - setPaymentCode(new PaymentCode(uri.replace("/", "").replace("avatar", ""))); - } - private class PayNymAvatarService extends Service { private final PaymentCode paymentCode; @@ -77,7 +73,7 @@ public class PayNymAvatar extends StackPane { try(InputStream is = (proxy == null ? new URL(url).openStream() : new URL(url).openConnection(proxy).getInputStream())) { return new Image(is, getWidth(), getHeight(), true, false); } catch(Exception e) { - log.warn("Error loading PayNym avatar", e); + log.debug("Error loading PayNym avatar", e); throw e; } } diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index 8e23a5e9..fe777bd3 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -208,11 +208,11 @@ public class TransactionDiagram extends GridPane { if(externalUserSet || addUserSet) { boolean replace = !isFinal() && set > 0 && SorobanServices.canWalletMix(walletTx.getWallet()); Glyph bracketGlyph = !replace && walletTx.isCoinControlUsed() ? getLockGlyph() : (addUserSet ? getUserAddGlyph() : getCoinsGlyph(replace)); - String tooltipText = addUserSet ? "Click to add a mixing partner" : (walletTx.getWallet().getFullDisplayName() + (replace ? "\nClick to replace with a mixing partner" : "")); + String tooltipText = addUserSet ? "Click to add a mix partner" : (walletTx.getWallet().getFullDisplayName() + (replace ? "\nClick to replace with a mix partner" : "")); StackPane stackPane = getBracket(width, setHeight, bracketGlyph, tooltipText); allBrackets.getChildren().add(stackPane); } else { - StackPane stackPane = getBracket(width, setHeight, getUserGlyph(), "Mixing partner"); + StackPane stackPane = getBracket(width, setHeight, getUserGlyph(), "Mix partner"); allBrackets.getChildren().add(stackPane); } } @@ -564,7 +564,7 @@ public class TransactionDiagram extends GridPane { private Pane getTransactionPane() { VBox txPane = new VBox(); - txPane.setPadding(new Insets(0, 10, 0, 10)); + txPane.setPadding(new Insets(0, 8, 0, 8)); txPane.setAlignment(Pos.CENTER); txPane.getChildren().add(createSpacer()); @@ -897,7 +897,7 @@ public class TransactionDiagram extends GridPane { @Override public String getLabel() { - return "Add Mixing Partner?"; + return "Add Mix Partner?"; } } diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java index 4b9d2567..b1e481b5 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java @@ -79,6 +79,9 @@ public class CounterpartyController extends SorobanController { @FXML private Label mixingPartner; + @FXML + private PayNymAvatar mixPartnerAvatar; + @FXML private Label meetingFail; @@ -156,8 +159,6 @@ public class CounterpartyController extends SorobanController { payNym.managedProperty().bind(payNym.visibleProperty()); payNymAvatar.managedProperty().bind(payNymAvatar.visibleProperty()); payNymAvatar.visibleProperty().bind(payNym.visibleProperty()); - payNymAvatar.prefWidthProperty().bind(payNym.heightProperty()); - payNymAvatar.prefHeightProperty().bind(payNym.heightProperty()); payNymButton.managedProperty().bind(payNymButton.visibleProperty()); payNymButton.visibleProperty().bind(payNym.visibleProperty().not()); if(Config.get().isUsePayNym()) { @@ -242,12 +243,8 @@ public class CounterpartyController extends SorobanController { private void updateMixPartner(Soroban soroban, PaymentCode paymentCodeInitiator, CahootsType cahootsType) { String code = paymentCodeInitiator.toString(); mixingPartner.setText(code.substring(0, 12) + "..." + code.substring(code.length() - 5)); - PayNymAvatar payNymAvatar = new PayNymAvatar(); - payNymAvatar.setPrefHeight(mixingPartner.getHeight()); - payNymAvatar.setPrefWidth(mixingPartner.getHeight()); - payNymAvatar.setPaymentCode(paymentCodeInitiator); - mixingPartner.setGraphic(payNymAvatar); if(Config.get().isUsePayNym()) { + mixPartnerAvatar.setPaymentCode(paymentCodeInitiator); soroban.getPayNym(paymentCodeInitiator.toString()).subscribe(payNym -> { mixingPartner.setText(payNym.nymName()); }, error -> { diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java index 4ca90a38..c1280b1a 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/InitiatorController.java @@ -148,8 +148,6 @@ public class InitiatorController extends SorobanController { }); payNymAvatar.managedProperty().bind(payNymAvatar.visibleProperty()); - payNymAvatar.prefWidthProperty().bind(counterparty.heightProperty()); - payNymAvatar.prefHeightProperty().bind(counterparty.heightProperty()); payNymFollowers.prefWidthProperty().bind(counterparty.widthProperty()); payNymFollowers.valueProperty().addListener((observable, oldValue, payNym) -> { if(payNym == FIND_FOLLOWERS) { @@ -236,7 +234,12 @@ public class InitiatorController extends SorobanController { soroban.getFollowers().subscribe(followerPayNyms -> { payNymFollowers.setItems(FXCollections.observableList(followerPayNyms)); }, error -> { - log.warn("Could not retrieve followers: ", error); + if(error.getMessage().endsWith("404")) { + Config.get().setUsePayNym(false); + AppServices.showErrorDialog("Could not retrieve PayNym", "This wallet does not have an associated PayNym or any followers. You can retrieve the PayNym using the Tools menu → Find Mix Partner."); + } else { + log.warn("Could not retrieve followers: ", error); + } }); } } @@ -302,17 +305,17 @@ public class InitiatorController extends SorobanController { .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .subscribe(meetingRequest -> { - sorobanProgressLabel.setText("Waiting for mixing partner..."); + sorobanProgressLabel.setText("Waiting for mix partner..."); sorobanMeetingService.receiveMeetingResponse(paymentCodeCounterparty, meetingRequest, TIMEOUT_MS) .subscribeOn(Schedulers.io()) .observeOn(JavaFxScheduler.platform()) .subscribe(sorobanResponse -> { if(sorobanResponse.isAccept()) { sorobanProgressBar.setProgress(0.1); - sorobanProgressLabel.setText("Mixing partner accepted!"); + sorobanProgressLabel.setText("Mix partner accepted!"); startInitiatorCollaborative(initiatorCahootsWallet, paymentCodeCounterparty); } else { - step2Desc.setText("Mixing partner declined."); + step2Desc.setText("Mix partner declined."); sorobanProgressLabel.setVisible(false); } }, error -> { @@ -364,7 +367,7 @@ public class InitiatorController extends SorobanController { if(accepted) { interaction.sorobanAccept(); } else { - interaction.sorobanReject("Mixing partner declined to broadcast the transaction."); + interaction.sorobanReject("Mix partner declined to broadcast the transaction."); } }); diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymService.java b/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymService.java index 5cf56f6d..99302d6f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymService.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymService.java @@ -123,7 +123,7 @@ public class PayNymService { public Observable getPayNym(String nymIdentifier) { return fetchPayNym(nymIdentifier).map(nymMap -> { List> codes = (List>)nymMap.get("codes"); - PaymentCode code = new PaymentCode((String)codes.get(0).get("code")); + PaymentCode code = new PaymentCode((String)codes.stream().filter(codeMap -> codeMap.get("segwit") == Boolean.FALSE).map(codeMap -> codeMap.get("code")).findFirst().orElse(codes.get(0).get("code"))); return new PayNym(code, (String)nymMap.get("nymID"), (String)nymMap.get("nymName"), (Boolean)nymMap.get("segwit")); }); } diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index ed7d2c5b..46eb9f0b 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -1435,9 +1435,9 @@ public class SendController extends WalletFormController implements Initializabl } if(!SorobanServices.canWalletMix(getWalletForm().getWallet())) { - addLabel("Can only add mixing partner to Native Segwit software wallets", getInfoGlyph()); + addLabel("Can only add mix partner to Native Segwit software wallets", getInfoGlyph()); } else { - addLabel("Add a mixing partner to create a two person coinjoin", getInfoGlyph()); + addLabel("Add a mix partner to create a two person coinjoin", getInfoGlyph()); } } } diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.fxml b/src/main/resources/com/sparrowwallet/sparrow/app.fxml index a06170c8..01d20e52 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/app.fxml @@ -109,7 +109,7 @@ - + diff --git a/src/main/resources/com/sparrowwallet/sparrow/soroban/counterparty.fxml b/src/main/resources/com/sparrowwallet/sparrow/soroban/counterparty.fxml index 03b418db..2ed7e8f9 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/soroban/counterparty.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/soroban/counterparty.fxml @@ -19,7 +19,7 @@ - @@ -33,35 +33,39 @@ - + + + @@ -74,29 +78,36 @@ - @@ -116,7 +127,7 @@ - diff --git a/src/main/resources/com/sparrowwallet/sparrow/soroban/initiator.fxml b/src/main/resources/com/sparrowwallet/sparrow/soroban/initiator.fxml index d28063ad..86b04557 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/soroban/initiator.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/soroban/initiator.fxml @@ -19,7 +19,7 @@ - @@ -33,19 +33,25 @@ - @@ -58,7 +64,7 @@ -