aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-07-23 02:15:47 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-07-23 02:15:47 +0800
commit86832e6feb502a3f1de24b81b111addf1f06bea6 (patch)
tree8f3ac5ce8c1772916d93cf79e7fd7336e3b6a7bc /app
parent22528002e1edef84ade67d5bc30b2580e6542c05 (diff)
parent0bbfedc2bf21d8c3eec17fef35e93a98a946469e (diff)
downloadtangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar
tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.gz
tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.bz2
tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.lz
tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.xz
tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.tar.zst
tangerine-wallet-browser-86832e6feb502a3f1de24b81b111addf1f06bea6.zip
Fix merge conflicts. Fix typos. Ensure currency immediately updated on load.
Diffstat (limited to 'app')
-rw-r--r--app/manifest.json5
-rw-r--r--app/scripts/lib/config-manager.js17
-rw-r--r--app/scripts/lib/idStore.js1
-rw-r--r--app/scripts/metamask-controller.js39
4 files changed, 52 insertions, 10 deletions
diff --git a/app/manifest.json b/app/manifest.json
index 4cca79c72..2c5629f7a 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -37,11 +37,6 @@
"all_frames": false
}
],
- "applications": {
- "gecko": {
- "id": "MOZILLA_EXTENSION_ID"
- }
- },
"permissions": [
"notifications",
"storage",
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js
index e0f389ed4..8d250e555 100644
--- a/app/scripts/lib/config-manager.js
+++ b/app/scripts/lib/config-manager.js
@@ -289,6 +289,12 @@ ConfigManager.prototype.updateConversionRate = function () {
const parsedResponse = JSON.parse(response)
this.setConversionPrice(parsedResponse.ticker.price)
this.setConversionDate(parsedResponse.timestamp)
+ console.log('=================')
+ console.log('Updated currency!')
+ console.log('=================')
+ console.log(this.getConversionRate())
+ console.log(this.getCurrentFiat())
+ console.log(parsedResponse)
}).catch((err) => {
console.error('Error in conversion.', err)
})
@@ -315,3 +321,14 @@ ConfigManager.prototype.getConversionDate = function () {
var data = this.getData()
return ('conversionDate' in data) && data.conversionDate
}
+
+ConfigManager.prototype.setShouldntShowWarning = function (confirmed) {
+ var data = this.getData()
+ data.isEthConfirmed = confirmed
+ this.setData(data)
+}
+
+ConfigManager.prototype.getShouldntShowWarning = function () {
+ var data = this.getData()
+ return ('isEthConfirmed' in data) && data.isEthConfirmed
+}
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index b6c136b8f..9d8012d54 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -94,6 +94,7 @@ IdentityStore.prototype.getState = function () {
isUnlocked: this._isUnlocked(),
seedWords: seedWords,
isConfirmed: configManager.getConfirmed(),
+ isEthConfirmed: configManager.getShouldntShowWarning(),
unconfTxs: configManager.unconfirmedTxs(),
transactions: configManager.getTxList(),
unconfMsgs: messageManager.unconfirmedMsgs(),
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 0537bda97..613484ffb 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -20,7 +20,9 @@ module.exports = class MetamaskController {
this.ethStore = new EthStore(this.provider)
this.idStore.setStore(this.ethStore)
this.messageManager = messageManager
- this.publicConfigStore = this.initPublicConfigStore()
+ this.publicConfigStore = this.initPublicConfigStore
+ this.configManager.setCurrentFiat('usd')
+ this.configManager.updateConversionRate()
this.scheduleConversionInterval()
}
@@ -42,6 +44,8 @@ module.exports = class MetamaskController {
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),
@@ -58,6 +62,8 @@ module.exports = class MetamaskController {
saveAccountLabel: idStore.saveAccountLabel.bind(idStore),
tryPassword: idStore.tryPassword.bind(idStore),
recoverSeed: idStore.recoverSeed.bind(idStore),
+ // coinbase
+ buyEth: this.buyEth.bind(this),
}
}
@@ -260,11 +266,18 @@ module.exports = class MetamaskController {
clearInterval(this.conversionInterval)
}
this.conversionInterval = setInterval(() => {
- console.log('=================')
- console.log('Updated currency!')
- console.log('=================')
+ console.log('started update conversion rate.')
this.configManager.updateConversionRate()
- }, 1000)
+ }, 300000)
+ }
+
+ agreeToEthWarning (cb) {
+ try {
+ this.configManager.setShouldntShowWarning(true)
+ cb()
+ } catch (e) {
+ cb(e)
+ }
}
// called from popup
@@ -284,6 +297,22 @@ module.exports = class MetamaskController {
this.configManager.useEtherscanProvider()
extension.runtime.reload()
}
+
+ buyEth (address, amount) {
+ if (!amount) amount = '5'
+
+ var network = this.idStore._currentState.network
+ var url = `https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${amount}&address=${address}&crypto_currency=ETH`
+
+ if (network === '2') {
+ url = 'https://testfaucet.metamask.io/'
+ }
+
+ extension.tabs.create({
+ url,
+ })
+ }
+
}
function noop () {}