@rabby-wallet/eth-hd-keyring 3.6.5 → 3.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -0
- package/index.ts +9 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -161,6 +161,14 @@ class HdKeyring extends eth_simple_keyring_1.default {
|
|
|
161
161
|
return sigUtil.normalize(w.getAddress().toString('hex'));
|
|
162
162
|
}));
|
|
163
163
|
}
|
|
164
|
+
getIndexByAddress(address) {
|
|
165
|
+
for (const key in this._index2wallet) {
|
|
166
|
+
if (this._index2wallet[key][0] === address) {
|
|
167
|
+
return Number(key);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
164
172
|
/* PRIVATE METHODS */
|
|
165
173
|
_addressFromIndex(i) {
|
|
166
174
|
if (!this._index2wallet[i]) {
|
package/index.ts
CHANGED
|
@@ -171,6 +171,15 @@ class HdKeyring extends SimpleKeyring {
|
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
getIndexByAddress(address: string): number | null {
|
|
175
|
+
for (const key in this._index2wallet) {
|
|
176
|
+
if (this._index2wallet[key][0] === address) {
|
|
177
|
+
return Number(key);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
|
|
174
183
|
/* PRIVATE METHODS */
|
|
175
184
|
|
|
176
185
|
_addressFromIndex(i: number): [string, Wallet] {
|