aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/controllers/preferences.js
blob: c5e93a5b9f77c78dcb6bebf15d6376c4752448d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const ObservableStore = require('obs-store')
const normalizeAddress = require('eth-sig-util').normalize

class PreferencesController {

  constructor (opts = {}) {
    const initState = opts.initState || {}
    this.store = new ObservableStore(initState)
  }

  //
  // PUBLIC METHODS
  //

  setSelectedAddress(_address) {
    return new Promise((resolve, reject) => {
      const address = normalizeAddress(_address)
      this.store.updateState({ selectedAddress: address })
      resolve()
    })
  }

  getSelectedAddress(_address) {
    return this.store.getState().selectedAddress
  }

  //
  // PRIVATE METHODS
  //

}

module.exports = PreferencesController