From cc4f70002f64bc38307401cfecc548e0ee9adbbe Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Sat, 30 May 2020 11:47:05 +0200 Subject: [PATCH] make wallet node static inner class --- .../sparrowwallet/drongo/wallet/Wallet.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java b/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java index 600599b..cd9ef03 100644 --- a/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java +++ b/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java @@ -141,6 +141,10 @@ public class Wallet { throw new IllegalStateException("Could not fill nodes to index " + index); } + public Address getAddress(Node node) { + return getAddress(node.getKeyPurpose(), node.getIndex()); + } + public Address getAddress(KeyPurpose keyPurpose, int index) { if(policyType == PolicyType.SINGLE) { Keystore keystore = getKeystores().get(0); @@ -155,6 +159,10 @@ public class Wallet { } } + public Script getOutputScript(Node node) { + return getOutputScript(node.getKeyPurpose(), node.getIndex()); + } + public Script getOutputScript(KeyPurpose keyPurpose, int index) { if(policyType == PolicyType.SINGLE) { Keystore keystore = getKeystores().get(0); @@ -169,6 +177,10 @@ public class Wallet { } } + public String getOutputDescriptor(Node node) { + return getOutputDescriptor(node.getKeyPurpose(), node.getIndex()); + } + public String getOutputDescriptor(KeyPurpose keyPurpose, int index) { if(policyType == PolicyType.SINGLE) { Keystore keystore = getKeystores().get(0); @@ -353,7 +365,7 @@ public class Wallet { } } - public class Node implements Comparable { + public static class Node implements Comparable { private final String derivationPath; private String label; private Long amount; @@ -449,18 +461,6 @@ public class Wallet { this.history = history; } - public Address getAddress() { - return Wallet.this.getAddress(keyPurpose, index); - } - - public Script getOutputScript() { - return Wallet.this.getOutputScript(keyPurpose, index); - } - - public String getOutputDescriptor() { - return Wallet.this.getOutputDescriptor(keyPurpose, index); - } - public void fillToIndex(int index) { for(int i = 0; i <= index; i++) { Node node = new Node(getKeyPurpose(), i);