diff options
author | kumavis <aaron@kumavis.me> | 2018-05-23 04:20:04 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-05-23 04:20:04 +0800 |
commit | 3a80f3dd836889b7e4f4d4db8eaf42883623d9bf (patch) | |
tree | bcde7f3a6acbdf311bf66b70be6bfac2b3ed088a /app/scripts/controllers/address-book.js | |
parent | 3084dc47d10e3e455c924e5aad0b0961c500ec8d (diff) | |
parent | cee55b47d03006630b1dbe038c6008654ca8f674 (diff) | |
download | dexon-wallet-3a80f3dd836889b7e4f4d4db8eaf42883623d9bf.tar.gz dexon-wallet-3a80f3dd836889b7e4f4d4db8eaf42883623d9bf.tar.zst dexon-wallet-3a80f3dd836889b7e4f4d4db8eaf42883623d9bf.zip |
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
Diffstat (limited to 'app/scripts/controllers/address-book.js')
-rw-r--r-- | app/scripts/controllers/address-book.js | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/app/scripts/controllers/address-book.js b/app/scripts/controllers/address-book.js index c91e6b2e..4697e074 100644 --- a/app/scripts/controllers/address-book.js +++ b/app/scripts/controllers/address-book.js @@ -13,19 +13,17 @@ class AddressBookController { * @param {object} opts Overrides the defaults for the initial state of this.store * @property {array} opts.initState initializes the the state of the AddressBookController. Can contain an * addressBook property to initialize the addressBook array - * @param {KeyringController} keyringController (Soon to be deprecated) The keyringController used in the current - * MetamaskController. Contains the identities used in this AddressBookController. + * @property {object} opts.preferencesStore the {@code PreferencesController} store * @property {object} store The the store of the current users address book * @property {array} store.addressBook An array of addresses and nicknames. These are set by the user when sending * to a new address. * */ - constructor (opts = {}, keyringController) { - const initState = extend({ + constructor ({initState, preferencesStore}) { + this.store = new ObservableStore(extend({ addressBook: [], - }, opts.initState) - this.store = new ObservableStore(initState) - this.keyringController = keyringController + }, initState)) + this._preferencesStore = preferencesStore } // @@ -62,7 +60,7 @@ class AddressBookController { */ _addToAddressBook (address, name) { const addressBook = this._getAddressBook() - const identities = this._getIdentities() + const {identities} = this._preferencesStore.getState() const addressBookIndex = addressBook.findIndex((element) => { return element.address.toLowerCase() === address.toLowerCase() || element.name === name }) const identitiesIndex = Object.keys(identities).findIndex((element) => { return element.toLowerCase() === address.toLowerCase() }) @@ -95,19 +93,6 @@ class AddressBookController { _getAddressBook () { return this.store.getState().addressBook } - - /** - * Retrieves identities from the keyring controller in order to avoid - * duplication - * - * @deprecated - * @returns {array} Returns the identies array from the keyringContoller's state - * - */ - _getIdentities () { - return this.keyringController.memStore.getState().identities - } - } module.exports = AddressBookController |