@rabby-wallet/eth-hd-keyring 3.6.8 → 3.6.9
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 +3 -0
- package/index.ts +6 -4
- package/package.json +1 -1
- package/test/index.js +1 -1
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ class HdKeyring extends eth_simple_keyring_1.default {
|
|
|
51
51
|
this.activeIndexes = [];
|
|
52
52
|
this.page = 0;
|
|
53
53
|
this.perPage = 5;
|
|
54
|
+
this.byImport = false;
|
|
54
55
|
this.deserialize(opts);
|
|
55
56
|
}
|
|
56
57
|
serialize() {
|
|
@@ -58,6 +59,7 @@ class HdKeyring extends eth_simple_keyring_1.default {
|
|
|
58
59
|
mnemonic: this.mnemonic,
|
|
59
60
|
activeIndexes: this.activeIndexes,
|
|
60
61
|
hdPath: this.hdPath,
|
|
62
|
+
byImport: this.byImport,
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
deserialize(opts = {}) {
|
|
@@ -65,6 +67,7 @@ class HdKeyring extends eth_simple_keyring_1.default {
|
|
|
65
67
|
this.mnemonic = null;
|
|
66
68
|
this.root = null;
|
|
67
69
|
this.hdPath = opts.hdPath || hdPathString;
|
|
70
|
+
this.byImport = !!opts.byImport;
|
|
68
71
|
if (opts.mnemonic) {
|
|
69
72
|
this.initFromMnemonic(opts.mnemonic);
|
|
70
73
|
}
|
package/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface DeserializeOption {
|
|
|
11
11
|
hdPath?: string;
|
|
12
12
|
mnemonic?: string;
|
|
13
13
|
activeIndexes?: number[];
|
|
14
|
+
byImport?: boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
class HdKeyring extends SimpleKeyring {
|
|
@@ -26,6 +27,7 @@ class HdKeyring extends SimpleKeyring {
|
|
|
26
27
|
activeIndexes: number[] = [];
|
|
27
28
|
page = 0;
|
|
28
29
|
perPage = 5;
|
|
30
|
+
byImport = false;
|
|
29
31
|
|
|
30
32
|
/* PUBLIC METHODS */
|
|
31
33
|
constructor(opts = {}) {
|
|
@@ -38,6 +40,7 @@ class HdKeyring extends SimpleKeyring {
|
|
|
38
40
|
mnemonic: this.mnemonic,
|
|
39
41
|
activeIndexes: this.activeIndexes,
|
|
40
42
|
hdPath: this.hdPath,
|
|
43
|
+
byImport: this.byImport,
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -46,6 +49,7 @@ class HdKeyring extends SimpleKeyring {
|
|
|
46
49
|
this.mnemonic = null;
|
|
47
50
|
this.root = null;
|
|
48
51
|
this.hdPath = opts.hdPath || hdPathString;
|
|
52
|
+
this.byImport = !!opts.byImport;
|
|
49
53
|
|
|
50
54
|
if (opts.mnemonic) {
|
|
51
55
|
this.initFromMnemonic(opts.mnemonic);
|
|
@@ -132,10 +136,8 @@ class HdKeyring extends SimpleKeyring {
|
|
|
132
136
|
}
|
|
133
137
|
return accounts;
|
|
134
138
|
}
|
|
135
|
-
|
|
136
|
-
async __getPage(
|
|
137
|
-
increment: number
|
|
138
|
-
): Promise<
|
|
139
|
+
|
|
140
|
+
async __getPage(increment: number): Promise<
|
|
139
141
|
Array<{
|
|
140
142
|
address: string;
|
|
141
143
|
index: string;
|
package/package.json
CHANGED
package/test/index.js
CHANGED
|
@@ -57,7 +57,7 @@ describe('hd-keyring', function () {
|
|
|
57
57
|
describe('#serialize empty wallets.', function () {
|
|
58
58
|
it('serializes a new mnemonic', function () {
|
|
59
59
|
keyring.serialize().then((output) => {
|
|
60
|
-
assert.equal(output.numberOfAccounts, 0);
|
|
60
|
+
// assert.equal(output.numberOfAccounts, 0);
|
|
61
61
|
assert.equal(output.mnemonic, null);
|
|
62
62
|
});
|
|
63
63
|
});
|