@rabby-wallet/eth-hd-keyring 3.6.10 → 3.6.11

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 CHANGED
@@ -143,6 +143,11 @@ class HdKeyring extends eth_simple_keyring_1.default {
143
143
  }
144
144
  return accounts;
145
145
  }
146
+ removeAccount(address) {
147
+ super.removeAccount(address);
148
+ const index = this.getIndexByAddress(address);
149
+ this.activeIndexes = this.activeIndexes.filter((i) => i !== index);
150
+ }
146
151
  __getPage(increment) {
147
152
  return __awaiter(this, void 0, void 0, function* () {
148
153
  this.page += increment;
package/index.ts CHANGED
@@ -141,6 +141,12 @@ class HdKeyring extends SimpleKeyring {
141
141
  return accounts;
142
142
  }
143
143
 
144
+ removeAccount(address) {
145
+ super.removeAccount(address);
146
+ const index = this.getIndexByAddress(address);
147
+ this.activeIndexes = this.activeIndexes.filter((i) => i !== index);
148
+ }
149
+
144
150
  async __getPage(increment: number): Promise<
145
151
  Array<{
146
152
  address: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/eth-hd-keyring",
3
- "version": "3.6.10",
3
+ "version": "3.6.11",
4
4
  "description": "A simple standard interface for a seed phrase generated set of Ethereum accounts.",
5
5
  "keywords": [
6
6
  "ethereum",
package/test/index.js CHANGED
@@ -507,4 +507,20 @@ describe('hd-keyring', function () {
507
507
  });
508
508
  });
509
509
  });
510
+
511
+ describe('removeAccount', function () {
512
+ it('should return correct activeIndexes', async function () {
513
+ const address = firstAcct;
514
+
515
+ keyring = new HdKeyring({
516
+ mnemonic: sampleMnemonic,
517
+ activeIndexes: [0, 2, 3, 6],
518
+ });
519
+ await keyring.removeAccount(address);
520
+ const { activeIndexes } = await keyring.serialize();
521
+
522
+ assert.equal(activeIndexes.length, 3);
523
+ assert.deepEqual(activeIndexes, [2, 3, 6]);
524
+ });
525
+ });
510
526
  });