show alternative xpub values as tooltips

This commit is contained in:
Craig Raw 2020-08-24 10:12:16 +02:00
parent 53a590140d
commit 750f6483cb
3 changed files with 21 additions and 3 deletions

2
drongo

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

View file

@ -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());
}
}
}
}

View file

@ -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>