You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/Web3Core/KeystoreManager/BIP44.swift
+7-9Lines changed: 7 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,10 @@ import Foundation
8
8
publicprotocolBIP44{
9
9
/**
10
10
Derive an `HDNode` based on the provided `path`. The function will throws `BIP44Error.warning` if it was invoked with `warns` as true and the root key doesn't have a previous child with at least one transaction, using false the child node will be derived directly not throwing. This function needs to query the blockchain history when `warns`is true, so it can throw network errors.
11
-
12
-
- Parameter path: valid BIP32 path.
13
-
- Parameter warns: true to be warned about following BIP44 standard, false otherwise.
14
-
- Throws: `BIP44Error.warning` if the child key shouldn't be used according to BIP44 standard.
15
-
- Returns: an HDNode child key for the provided `path` if it can be created, otherwise nil
11
+
- Parameter path: valid BIP32 path.
12
+
- Parameter warns: true to be warned about following BIP44 standard, false otherwise.
13
+
- Throws: `BIP44Error.warning` if the child key shouldn't be used according to BIP44 standard.
14
+
- Returns: an HDNode child key for the provided `path` if it can be created, otherwise nil
@@ -24,8 +23,7 @@ public enum BIP44Error: Error, Equatable {
24
23
25
24
publicprotocolTransactionChecker{
26
25
/**
27
-
It verifies if the provided `address` has at least one transaction
28
-
26
+
It verifies if the provided `address` has at least one transaction
29
27
- Parameter address: to be queried
30
28
- Throws: any error related to query the blockchain provider
31
29
- Returns: true if the `address` has at least one transaction, false otherwise
@@ -79,7 +77,7 @@ extension String {
79
77
returnfalse
80
78
}
81
79
}
82
-
80
+
83
81
/// Returns the account from the path if the string contains a well formed BIP44 path
84
82
varaccountFromPath:Int?{
85
83
guard isBip44Path else{
@@ -93,7 +91,7 @@ extension String {
93
91
}
94
92
return account
95
93
}
96
-
94
+
97
95
/**
98
96
Transforms a bip44 path into a new one changing `account` & `index`. The resulting one will have the change value equal to `0` to represent external chain. Format `m/44'/coin_type'/account'/change/address_index`
0 commit comments