Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

fix: remove the removeAccountsBySnapId method #121

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/SnapKeyring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,12 +757,4 @@ describe('SnapKeyring', () => {
expect(result).toStrictEqual(expected);
});
});

describe('removeAccountsBySnapId', () => {
it('removes all accounts owned by a snap', async () => {
mockSnapController.handleRequest.mockResolvedValue(null);
await keyring.removeAccountsBySnapId(snapId);
expect(await keyring.getAccounts()).toStrictEqual([]);
});
});
});
14 changes: 0 additions & 14 deletions src/SnapKeyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,20 +624,6 @@ export class SnapKeyring extends EventEmitter {
: undefined;
}

/**
* Remove all accounts associated with a given Snap ID.
*
* @param snapId - The Snap ID to remove accounts for.
* @returns A Promise that resolves when all accounts have been removed.
*/
async removeAccountsBySnapId(snapId: string): Promise<void> {
for (const entry of this.#accounts.values()) {
if (entry.snapId === snapId) {
await this.removeAccount(entry.account.address.toLowerCase());
}
}
}

/**
* List all snap keyring accounts.
*
Expand Down