aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorFrankie <frankie.pangilinan@consensys.net>2016-08-19 02:06:32 +0800
committerFrankie <frankie.pangilinan@consensys.net>2016-08-19 02:06:32 +0800
commitefa61f2cf892eb1383fcfacd60d906e76dbaa757 (patch)
tree4e19f1abbadc02f861f0b54027954bf9cb6b5fac /app/scripts/metamask-controller.js
parent752d16f6c072b0dd54eb245209881a25ff06cb8e (diff)
parent90d6bec3ed51ba4b2d4696132642a4d97712dec9 (diff)
downloadtangerine-wallet-browser-efa61f2cf892eb1383fcfacd60d906e76dbaa757.tar
tangerine-wallet-browser-efa61f2cf892eb1383fcfacd60d906e76dbaa757.tar.gz
tangerine-wallet-browser-efa61f2cf892eb1383fcfacd60d906e76dbaa757.tar.bz2
tangerine-wallet-browser-efa61f2cf892eb1383fcfacd60d906e76dbaa757.tar.lz
tangerine-wallet-browser-efa61f2cf892eb1383fcfacd60d906e76dbaa757.tar.xz
tangerine-wallet-browser-efa61f2cf892eb1383fcfacd60d906e76dbaa757.tar.zst
tangerine-wallet-browser-efa61f2cf892eb1383fcfacd60d906e76dbaa757.zip
Merge branch 'master' into shapeshiftTx
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index d34f594d7..0b1d40148 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -21,6 +21,9 @@ module.exports = class MetamaskController {
this.idStore.setStore(this.ethStore)
this.messageManager = messageManager
this.publicConfigStore = this.initPublicConfigStore()
+ this.configManager.setCurrentFiat('USD')
+ this.configManager.updateConversionRate()
+ this.scheduleConversionInterval()
}
getState () {
@@ -40,7 +43,9 @@ module.exports = class MetamaskController {
setProviderType: this.setProviderType.bind(this),
useEtherscanProvider: this.useEtherscanProvider.bind(this),
agreeToDisclaimer: this.agreeToDisclaimer.bind(this),
+ setCurrentFiat: this.setCurrentFiat.bind(this),
agreeToEthWarning: this.agreeToEthWarning.bind(this),
+
// forward directly to idStore
createNewVault: idStore.createNewVault.bind(idStore),
recoverFromSeed: idStore.recoverFromSeed.bind(idStore),
@@ -247,6 +252,31 @@ module.exports = class MetamaskController {
}
}
+ setCurrentFiat (fiat, cb) {
+ try {
+ this.configManager.setCurrentFiat(fiat)
+ this.configManager.updateConversionRate()
+ this.scheduleConversionInterval()
+ const data = {
+ conversionRate: this.configManager.getConversionRate(),
+ currentFiat: this.configManager.getCurrentFiat(),
+ conversionDate: this.configManager.getConversionDate(),
+ }
+ cb(data)
+ } catch (e) {
+ cb(null, e)
+ }
+ }
+
+ scheduleConversionInterval () {
+ if (this.conversionInterval) {
+ clearInterval(this.conversionInterval)
+ }
+ this.conversionInterval = setInterval(() => {
+ this.configManager.updateConversionRate()
+ }, 300000)
+ }
+
agreeToEthWarning (cb) {
try {
this.configManager.setShouldntShowWarning()