diff --git a/src/main/java/com/sparrowwallet/drongo/protocol/ScriptType.java b/src/main/java/com/sparrowwallet/drongo/protocol/ScriptType.java index 5428b1c..d74d50e 100644 --- a/src/main/java/com/sparrowwallet/drongo/protocol/ScriptType.java +++ b/src/main/java/com/sparrowwallet/drongo/protocol/ScriptType.java @@ -17,7 +17,7 @@ import static com.sparrowwallet.drongo.protocol.ScriptOpCodes.*; import static com.sparrowwallet.drongo.protocol.Transaction.WITNESS_SCALE_FACTOR; public enum ScriptType { - P2PK("P2PK", "m/44'/0'/0'") { + P2PK("P2PK", "Legacy (P2PK)", "m/44'/0'/0'") { @Override public Address getAddress(byte[] pubKey) { return new P2PKAddress(pubKey); @@ -131,7 +131,7 @@ public enum ScriptType { return List.of(SINGLE); } }, - P2PKH("P2PKH", "m/44'/0'/0'") { + P2PKH("P2PKH", "Legacy (P2PKH)", "m/44'/0'/0'") { @Override public Address getAddress(byte[] pubKeyHash) { return new P2PKHAddress(pubKeyHash); @@ -244,7 +244,7 @@ public enum ScriptType { return List.of(SINGLE); } }, - MULTISIG("Bare Multisig", "m/44'/0'/0'") { + MULTISIG("Bare Multisig", "Bare Multisig", "m/44'/0'/0'") { @Override public Address getAddress(byte[] bytes) { throw new ProtocolException("No single address for multisig script type"); @@ -430,7 +430,7 @@ public enum ScriptType { return List.of(MULTI); } }, - P2SH("P2SH", "m/45'") { + P2SH("P2SH", "Legacy (P2SH)", "m/45'") { @Override public Address getAddress(byte[] scriptHash) { return new P2SHAddress(scriptHash); @@ -555,7 +555,7 @@ public enum ScriptType { return List.of(MULTI); } }, - P2SH_P2WPKH("P2SH-P2WPKH", "m/49'/0'/0'") { + P2SH_P2WPKH("P2SH-P2WPKH", "Nested Segwit (P2SH-P2WSH)", "m/49'/0'/0'") { @Override public Address getAddress(byte[] scriptHash) { return P2SH.getAddress(scriptHash); @@ -658,7 +658,7 @@ public enum ScriptType { return List.of(SINGLE); } }, - P2SH_P2WSH("P2SH-P2WSH", "m/48'/0'/0'/1'") { + P2SH_P2WSH("P2SH-P2WSH", "Nested Segwit (P2SH-P2WSH)", "m/48'/0'/0'/1'") { @Override public Address getAddress(byte[] scriptHash) { return P2SH.getAddress(scriptHash); @@ -759,7 +759,7 @@ public enum ScriptType { return List.of(MULTI, CUSTOM); } }, - P2WPKH("P2WPKH", "m/84'/0'/0'") { + P2WPKH("P2WPKH", "Native Segwit (P2WPKH)", "m/84'/0'/0'") { @Override public Address getAddress(byte[] pubKeyHash) { return new P2WPKHAddress(pubKeyHash); @@ -864,7 +864,7 @@ public enum ScriptType { return List.of(SINGLE); } }, - P2WSH("P2WSH", "m/48'/0'/0'/2'") { + P2WSH("P2WSH", "Native Segwit (P2WSH)", "m/48'/0'/0'/2'") { @Override public Address getAddress(byte[] scriptHash) { return new P2WSHAddress(scriptHash); @@ -977,10 +977,12 @@ public enum ScriptType { }; private final String name; + private final String description; private final String defaultDerivationPath; - ScriptType(String name, String defaultDerivationPath) { + ScriptType(String name, String description, String defaultDerivationPath) { this.name = name; + this.description = description; this.defaultDerivationPath = defaultDerivationPath; } @@ -988,6 +990,10 @@ public enum ScriptType { return name; } + public String getDescription() { + return description; + } + public String getDefaultDerivationPath() { return Network.get() != Network.MAINNET ? defaultDerivationPath.replace("/0'/0'", "/1'/0'") : defaultDerivationPath; }