mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-04 19:16:44 +00:00
get account from derivation path
This commit is contained in:
parent
766a986abb
commit
0c9a100c6d
1 changed files with 15 additions and 0 deletions
|
@ -409,6 +409,21 @@ public enum ScriptType {
|
||||||
return Collections.unmodifiableList(copy);
|
return Collections.unmodifiableList(copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAccount(String derivationPath) {
|
||||||
|
if(KeyDerivation.isValid(derivationPath)) {
|
||||||
|
List<ChildNumber> derivation = new ArrayList<>(KeyDerivation.parsePath(derivationPath));
|
||||||
|
if(derivation.size() > 2) {
|
||||||
|
int account = derivation.get(2).num();
|
||||||
|
List<ChildNumber> defaultDerivation = getDefaultDerivation(account);
|
||||||
|
if(defaultDerivation.equals(derivation)) {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract List<PolicyType> getAllowedPolicyTypes();
|
public abstract List<PolicyType> getAllowedPolicyTypes();
|
||||||
|
|
||||||
public boolean isAllowed(PolicyType policyType) {
|
public boolean isAllowed(PolicyType policyType) {
|
||||||
|
|
Loading…
Reference in a new issue