@rabby-wallet/eth-hd-keyring 3.6.0 → 3.6.4
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 +14 -1
- package/index.ts +15 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ class HdKeyring extends eth_simple_keyring_1.default {
|
|
|
50
50
|
this._index2wallet = {};
|
|
51
51
|
this.activeIndexes = [];
|
|
52
52
|
this.page = 0;
|
|
53
|
-
this.perPage =
|
|
53
|
+
this.perPage = 10;
|
|
54
54
|
this.deserialize(opts);
|
|
55
55
|
}
|
|
56
56
|
serialize() {
|
|
@@ -124,6 +124,19 @@ class HdKeyring extends eth_simple_keyring_1.default {
|
|
|
124
124
|
getPreviousPage() {
|
|
125
125
|
return this.__getPage(-1);
|
|
126
126
|
}
|
|
127
|
+
getAddresses(start, end) {
|
|
128
|
+
const from = start;
|
|
129
|
+
const to = end;
|
|
130
|
+
const accounts = [];
|
|
131
|
+
for (let i = from; i < to; i++) {
|
|
132
|
+
const [address] = this._addressFromIndex(i);
|
|
133
|
+
accounts.push({
|
|
134
|
+
address,
|
|
135
|
+
index: i + 1,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return accounts;
|
|
139
|
+
}
|
|
127
140
|
__getPage(increment) {
|
|
128
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
129
142
|
this.page += increment;
|
package/index.ts
CHANGED
|
@@ -25,7 +25,7 @@ class HdKeyring extends SimpleKeyring {
|
|
|
25
25
|
_index2wallet: Record<number, [string, Wallet]> = {};
|
|
26
26
|
activeIndexes: number[] = [];
|
|
27
27
|
page = 0;
|
|
28
|
-
perPage =
|
|
28
|
+
perPage = 10;
|
|
29
29
|
|
|
30
30
|
/* PUBLIC METHODS */
|
|
31
31
|
constructor(opts = {}) {
|
|
@@ -119,7 +119,20 @@ class HdKeyring extends SimpleKeyring {
|
|
|
119
119
|
getPreviousPage() {
|
|
120
120
|
return this.__getPage(-1);
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
getAddresses(start: number, end: number) {
|
|
123
|
+
const from = start;
|
|
124
|
+
const to = end;
|
|
125
|
+
const accounts: any[] = [];
|
|
126
|
+
for (let i = from; i < to; i++) {
|
|
127
|
+
const [address] = this._addressFromIndex(i);
|
|
128
|
+
accounts.push({
|
|
129
|
+
address,
|
|
130
|
+
index: i+1,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return accounts;
|
|
134
|
+
}
|
|
135
|
+
|
|
123
136
|
async __getPage(
|
|
124
137
|
increment: number
|
|
125
138
|
): Promise<
|