mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
use tPubs instead of xPubs on labels in testnet
This commit is contained in:
parent
eb8d66bf25
commit
639e145672
2 changed files with 10 additions and 8 deletions
|
@ -2,6 +2,7 @@ package com.sparrowwallet.sparrow.keystoreimport;
|
||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.sparrowwallet.drongo.KeyDerivation;
|
import com.sparrowwallet.drongo.KeyDerivation;
|
||||||
|
import com.sparrowwallet.drongo.Network;
|
||||||
import com.sparrowwallet.drongo.wallet.Keystore;
|
import com.sparrowwallet.drongo.wallet.Keystore;
|
||||||
import com.sparrowwallet.drongo.wallet.KeystoreSource;
|
import com.sparrowwallet.drongo.wallet.KeystoreSource;
|
||||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||||
|
@ -40,7 +41,7 @@ public class KeystoreImportDialog extends Dialog<Keystore> {
|
||||||
keystoreImportController.initializeView(wallet);
|
keystoreImportController.initializeView(wallet);
|
||||||
keystoreImportController.selectSource(initialSource);
|
keystoreImportController.selectSource(initialSource);
|
||||||
|
|
||||||
final ButtonType watchOnlyButtonType = new javafx.scene.control.ButtonType("xPub / Watch Only Wallet", ButtonBar.ButtonData.LEFT);
|
final ButtonType watchOnlyButtonType = new javafx.scene.control.ButtonType(Network.get().getXpubHeader().getDisplayName() + " / Watch Only Wallet", ButtonBar.ButtonData.LEFT);
|
||||||
final ButtonType cancelButtonType = new javafx.scene.control.ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
|
final ButtonType cancelButtonType = new javafx.scene.control.ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
|
||||||
dialogPane.getButtonTypes().addAll(watchOnlyButtonType, cancelButtonType);
|
dialogPane.getButtonTypes().addAll(watchOnlyButtonType, cancelButtonType);
|
||||||
dialogPane.setPrefWidth(650);
|
dialogPane.setPrefWidth(650);
|
||||||
|
|
|
@ -121,6 +121,7 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
setXpubContext(keystore.getExtendedPublicKey());
|
setXpubContext(keystore.getExtendedPublicKey());
|
||||||
} else {
|
} else {
|
||||||
switchXpubHeader.setDisable(true);
|
switchXpubHeader.setDisable(true);
|
||||||
|
xpubField.setText(Network.get().getXpubHeader().getDisplayName() + ":");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keystore.getKeyDerivation() != null) {
|
if(keystore.getKeyDerivation() != null) {
|
||||||
|
@ -163,7 +164,7 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
|
|
||||||
private void setXpubContext(ExtendedKey extendedKey) {
|
private void setXpubContext(ExtendedKey extendedKey) {
|
||||||
ContextMenu contextMenu = new ContextMenu();
|
ContextMenu contextMenu = new ContextMenu();
|
||||||
MenuItem copyXPub = new MenuItem("Copy xPub");
|
MenuItem copyXPub = new MenuItem("Copy " + Network.get().getXpubHeader().getDisplayName());
|
||||||
copyXPub.setOnAction(AE -> {
|
copyXPub.setOnAction(AE -> {
|
||||||
contextMenu.hide();
|
contextMenu.hide();
|
||||||
ClipboardContent content = new ClipboardContent();
|
ClipboardContent content = new ClipboardContent();
|
||||||
|
@ -185,11 +186,11 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
});
|
});
|
||||||
contextMenu.getItems().add(copyOtherPub);
|
contextMenu.getItems().add(copyOtherPub);
|
||||||
|
|
||||||
xpubField.setText("xPub / " + header.getDisplayName() + ":");
|
xpubField.setText(Network.get().getXpubHeader().getDisplayName() + " / " + header.getDisplayName() + ":");
|
||||||
switchXpubHeader.setDisable(false);
|
switchXpubHeader.setDisable(false);
|
||||||
switchXpubHeader.setTooltip(new Tooltip("Show as " + header.getDisplayName()));
|
switchXpubHeader.setTooltip(new Tooltip("Show as " + header.getDisplayName()));
|
||||||
} else {
|
} else {
|
||||||
xpubField.setText("xPub:");
|
xpubField.setText(Network.get().getXpubHeader().getDisplayName() + ":");
|
||||||
switchXpubHeader.setDisable(true);
|
switchXpubHeader.setDisable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,8 +225,8 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
));
|
));
|
||||||
|
|
||||||
validationSupport.registerValidator(xpub, Validator.combine(
|
validationSupport.registerValidator(xpub, Validator.combine(
|
||||||
Validator.createEmptyValidator("xPub is required"),
|
Validator.createEmptyValidator(Network.get().getXpubHeader().getDisplayName() + " is required"),
|
||||||
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, "xPub is invalid", !ExtendedKey.isValid(newValue))
|
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, Network.get().getXpubHeader().getDisplayName() + " is invalid", !ExtendedKey.isValid(newValue))
|
||||||
));
|
));
|
||||||
|
|
||||||
validationSupport.registerValidator(derivation, Validator.combine(
|
validationSupport.registerValidator(derivation, Validator.combine(
|
||||||
|
@ -367,7 +368,7 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
log.error("Error opening webcam", result.exception);
|
log.error("Error opening webcam", result.exception);
|
||||||
AppController.showErrorDialog("Error opening webcam", result.exception.getMessage());
|
AppController.showErrorDialog("Error opening webcam", result.exception.getMessage());
|
||||||
} else {
|
} else {
|
||||||
AppController.showErrorDialog("Invalid QR Code", "QR Code did not contain a valid xPub");
|
AppController.showErrorDialog("Invalid QR Code", "QR Code did not contain a valid " + Network.get().getXpubHeader().getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,7 +384,7 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
if(!xpub.getText().startsWith(header.getName())) {
|
if(!xpub.getText().startsWith(header.getName())) {
|
||||||
String otherPub = keystore.getExtendedPublicKey().getExtendedKey(header);
|
String otherPub = keystore.getExtendedPublicKey().getExtendedKey(header);
|
||||||
xpub.setText(otherPub);
|
xpub.setText(otherPub);
|
||||||
switchXpubHeader.setTooltip(new Tooltip("Show as xPub"));
|
switchXpubHeader.setTooltip(new Tooltip("Show as " + Network.get().getXpubHeader().getDisplayName()));
|
||||||
} else {
|
} else {
|
||||||
String xPub = keystore.getExtendedPublicKey().getExtendedKey();
|
String xPub = keystore.getExtendedPublicKey().getExtendedKey();
|
||||||
xpub.setText(xPub);
|
xpub.setText(xPub);
|
||||||
|
|
Loading…
Reference in a new issue