aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2016-07-22 04:41:10 +0800
committerDan Finlay <somniac@me.com>2016-07-22 04:41:10 +0800
commitfcd523abe4c5e8c4da7f176b2fc15578903384b7 (patch)
tree9118133325c282d01f49bc717dacabfd824aa762 /app/scripts/metamask-controller.js
parent6658bea8d444281491718f8eee7bc3ae42f91b69 (diff)
downloadtangerine-wallet-browser-fcd523abe4c5e8c4da7f176b2fc15578903384b7.tar
tangerine-wallet-browser-fcd523abe4c5e8c4da7f176b2fc15578903384b7.tar.gz
tangerine-wallet-browser-fcd523abe4c5e8c4da7f176b2fc15578903384b7.tar.bz2
tangerine-wallet-browser-fcd523abe4c5e8c4da7f176b2fc15578903384b7.tar.lz
tangerine-wallet-browser-fcd523abe4c5e8c4da7f176b2fc15578903384b7.tar.xz
tangerine-wallet-browser-fcd523abe4c5e8c4da7f176b2fc15578903384b7.tar.zst
tangerine-wallet-browser-fcd523abe4c5e8c4da7f176b2fc15578903384b7.zip
Buy button (#474)
* WIP: Buy button link * Add buy eth and the buy eth warning message * Add css * Move the opening of coinbase page to background and send to faucet if on test net * Create a Warning about storeing eth * Finish Buy button and Eth store warning screen * Add to CHANGELOG * fix frankies deletion and change chrome to extension
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 17af4cc29..4f03ace8f 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -40,6 +40,7 @@ module.exports = class MetamaskController {
setProviderType: this.setProviderType.bind(this),
useEtherscanProvider: this.useEtherscanProvider.bind(this),
agreeToDisclaimer: this.agreeToDisclaimer.bind(this),
+ agreeToEthWarning: this.agreeToEthWarning.bind(this),
// forward directly to idStore
createNewVault: idStore.createNewVault.bind(idStore),
recoverFromSeed: idStore.recoverFromSeed.bind(idStore),
@@ -56,6 +57,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),
}
}
@@ -237,6 +240,15 @@ module.exports = class MetamaskController {
}
}
+ agreeToEthWarning (cb) {
+ try {
+ this.configManager.setShouldntShowWarning(true)
+ cb()
+ } catch (e) {
+ cb(e)
+ }
+ }
+
// called from popup
setRpcTarget (rpcTarget) {
this.configManager.setRpcTarget(rpcTarget)
@@ -254,6 +266,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 () {}