Browse Source

show alternative xpub values as tooltips

bwt
Craig Raw 4 years ago
parent
commit
750f6483cb
  1. 2
      drongo
  2. 20
      src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java
  3. 2
      src/main/resources/com/sparrowwallet/sparrow/transaction/input.fxml

2
drongo

@ -1 +1 @@
Subproject commit 0fbce035a3083f1cd5dc9f168b0cd4365a75ce40
Subproject commit ea5101dff725a9973ac3056b5b59d26d3b4674f3

20
src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java

@ -98,6 +98,7 @@ public class KeystoreController extends WalletFormController implements Initiali
if(keystore.getExtendedPublicKey() != null) {
xpub.setText(keystore.getExtendedPublicKey().toString());
setXpubTooltip(keystore.getExtendedPublicKey());
}
if(keystore.getKeyDerivation() != null) {
@ -123,12 +124,26 @@ public class KeystoreController extends WalletFormController implements Initiali
});
xpub.textProperty().addListener((observable, oldValue, newValue) -> {
if(ExtendedKey.isValid(newValue)) {
keystore.setExtendedPublicKey(ExtendedKey.fromDescriptor(newValue));
ExtendedKey extendedKey = ExtendedKey.fromDescriptor(newValue);
setXpubTooltip(extendedKey);
keystore.setExtendedPublicKey(extendedKey);
EventManager.get().post(new SettingsChangedEvent(walletForm.getWallet(), SettingsChangedEvent.Type.KEYSTORE_XPUB));
} else {
xpub.setTooltip(null);
}
});
}
private void setXpubTooltip(ExtendedKey extendedKey) {
ExtendedKey.Header header = ExtendedKey.Header.fromScriptType(walletForm.getWallet().getScriptType(), false);
if(header != ExtendedKey.Header.xpub) {
Tooltip tooltip = new Tooltip(extendedKey.getExtendedKey(header));
xpub.setTooltip(tooltip);
} else {
xpub.setTooltip(null);
}
}
public void selectSource(ActionEvent event) {
keystoreSourceToggleGroup.selectToggle(null);
ToggleButton sourceButton = (ToggleButton)event.getSource();
@ -288,6 +303,9 @@ public class KeystoreController extends WalletFormController implements Initiali
derivation.setText(derivationPath + " ");
derivation.setText(derivationPath);
}
if(keystore.getExtendedPublicKey() != null) {
setXpubTooltip(keystore.getExtendedPublicKey());
}
}
}
}

2
src/main/resources/com/sparrowwallet/sparrow/transaction/input.fxml

@ -98,7 +98,7 @@
</Form>
<Form GridPane.columnIndex="1" GridPane.rowIndex="4">
<Fieldset fx:id="locktimeFieldset" text="Locktime" inputGrow="SOMETIMES">
<Fieldset fx:id="locktimeFieldset" text="Locktime (nSequence)" inputGrow="SOMETIMES">
<Field text="Type:">
<SegmentedButton>
<toggleGroup>

Loading…
Cancel
Save