@metamask/eth-snap-keyring
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -9,2 +9,6 @@ # Changelog | ||
## [0.3.0] | ||
### Changed | ||
- handle approval when adding/removing account with handleUserInput callback ([#99](https://github.com/MetaMask/eth-snap-keyring/pull/99)) | ||
## [0.2.3] | ||
@@ -64,3 +68,4 @@ ### Added | ||
[Unreleased]: https://github.com/MetaMask/eth-snap-keyring/compare/v0.2.3...HEAD | ||
[Unreleased]: https://github.com/MetaMask/eth-snap-keyring/compare/v0.3.0...HEAD | ||
[0.3.0]: https://github.com/MetaMask/eth-snap-keyring/compare/v0.2.3...v0.3.0 | ||
[0.2.3]: https://github.com/MetaMask/eth-snap-keyring/compare/v0.2.2...v0.2.3 | ||
@@ -67,0 +72,0 @@ [0.2.2]: https://github.com/MetaMask/eth-snap-keyring/compare/v0.2.1...v0.2.2 |
@@ -49,4 +49,5 @@ /// <reference types="node" /> | ||
saveState: () => Promise<void>; | ||
removeAccount(address: string): Promise<void>; | ||
addressExists(address: string): Promise<boolean>; | ||
addAccount(address: string, snapId: string, handleUserInput: (accepted: boolean) => Promise<void>): Promise<void>; | ||
removeAccount(address: string, snapId: string, handleUserInput: (accepted: boolean) => Promise<void>): Promise<void>; | ||
}; | ||
@@ -53,0 +54,0 @@ /** |
@@ -319,4 +319,8 @@ "use strict"; | ||
} | ||
__classPrivateFieldGet(this, _SnapKeyring_accounts, "f").set(account.id, { account, snapId }); | ||
await __classPrivateFieldGet(this, _SnapKeyring_callbacks, "f").saveState(); | ||
await __classPrivateFieldGet(this, _SnapKeyring_callbacks, "f").addAccount(account.address, snapId, async (accepted) => { | ||
if (accepted) { | ||
__classPrivateFieldGet(this, _SnapKeyring_accounts, "f").set(account.id, { account, snapId }); | ||
await __classPrivateFieldGet(this, _SnapKeyring_callbacks, "f").saveState(); | ||
} | ||
}); | ||
return null; | ||
@@ -376,3 +380,7 @@ }, _SnapKeyring_handleAccountUpdated = | ||
} | ||
await __classPrivateFieldGet(this, _SnapKeyring_callbacks, "f").removeAccount(address.toLowerCase()); | ||
await __classPrivateFieldGet(this, _SnapKeyring_callbacks, "f").removeAccount(address.toLowerCase(), snapId, async (accepted) => { | ||
if (accepted) { | ||
await __classPrivateFieldGet(this, _SnapKeyring_callbacks, "f").saveState(); | ||
} | ||
}); | ||
return null; | ||
@@ -379,0 +387,0 @@ }, _SnapKeyring_handleRequestApproved = |
{ | ||
"name": "@metamask/eth-snap-keyring", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"description": "Snaps keyring bridge.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
93451
999