diff --git a/src/main/java/com/sparrowwallet/drongo/wallet/Keystore.java b/src/main/java/com/sparrowwallet/drongo/wallet/Keystore.java index c2abf60..b39e6cd 100644 --- a/src/main/java/com/sparrowwallet/drongo/wallet/Keystore.java +++ b/src/main/java/com/sparrowwallet/drongo/wallet/Keystore.java @@ -66,7 +66,7 @@ public class Keystore { } public boolean isValid() { - if(label == null || keyDerivation == null || extendedPublicKey == null) { + if(label == null || source == null || walletModel == null || keyDerivation == null || extendedPublicKey == null) { return false; } @@ -85,6 +85,8 @@ public class Keystore { public Keystore copy() { Keystore copy = new Keystore(label); + copy.setSource(source); + copy.setWalletModel(walletModel); if(keyDerivation != null) { copy.setKeyDerivation(keyDerivation.copy()); } diff --git a/src/main/java/com/sparrowwallet/drongo/wallet/WalletModel.java b/src/main/java/com/sparrowwallet/drongo/wallet/WalletModel.java index 3ecfb83..28fff78 100644 --- a/src/main/java/com/sparrowwallet/drongo/wallet/WalletModel.java +++ b/src/main/java/com/sparrowwallet/drongo/wallet/WalletModel.java @@ -15,6 +15,16 @@ public enum WalletModel { return this.toString(); } + public static WalletModel fromType(String type) { + for(WalletModel model : values()) { + if(model.getType().equals(type)) { + return model; + } + } + + return null; + } + public String toDisplayString() { String line = this.toString().toLowerCase(); String[] words = line.split("_");