mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
show alternative xpub values as tooltips
This commit is contained in:
parent
53a590140d
commit
750f6483cb
3 changed files with 21 additions and 3 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
||||||
Subproject commit 0fbce035a3083f1cd5dc9f168b0cd4365a75ce40
|
Subproject commit ea5101dff725a9973ac3056b5b59d26d3b4674f3
|
|
@ -98,6 +98,7 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
|
|
||||||
if(keystore.getExtendedPublicKey() != null) {
|
if(keystore.getExtendedPublicKey() != null) {
|
||||||
xpub.setText(keystore.getExtendedPublicKey().toString());
|
xpub.setText(keystore.getExtendedPublicKey().toString());
|
||||||
|
setXpubTooltip(keystore.getExtendedPublicKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keystore.getKeyDerivation() != null) {
|
if(keystore.getKeyDerivation() != null) {
|
||||||
|
@ -123,12 +124,26 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
});
|
});
|
||||||
xpub.textProperty().addListener((observable, oldValue, newValue) -> {
|
xpub.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if(ExtendedKey.isValid(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));
|
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) {
|
public void selectSource(ActionEvent event) {
|
||||||
keystoreSourceToggleGroup.selectToggle(null);
|
keystoreSourceToggleGroup.selectToggle(null);
|
||||||
ToggleButton sourceButton = (ToggleButton)event.getSource();
|
ToggleButton sourceButton = (ToggleButton)event.getSource();
|
||||||
|
@ -288,6 +303,9 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
derivation.setText(derivationPath + " ");
|
derivation.setText(derivationPath + " ");
|
||||||
derivation.setText(derivationPath);
|
derivation.setText(derivationPath);
|
||||||
}
|
}
|
||||||
|
if(keystore.getExtendedPublicKey() != null) {
|
||||||
|
setXpubTooltip(keystore.getExtendedPublicKey());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
<Form GridPane.columnIndex="1" GridPane.rowIndex="4">
|
<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:">
|
<Field text="Type:">
|
||||||
<SegmentedButton>
|
<SegmentedButton>
|
||||||
<toggleGroup>
|
<toggleGroup>
|
||||||
|
|
Loading…
Reference in a new issue