diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-09-19 10:08:02 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-09-19 10:08:02 +0800 |
commit | 29dd81d029fb3cb5e0477758a59917b4cdf1091e (patch) | |
tree | bdaa8fe49a3690a1b12a6e9274f1cac8e30ac60a /mascara/src/mascara.js | |
parent | bbae8d975e1800b37b05b35713728cd39f992071 (diff) | |
download | tangerine-wallet-browser-29dd81d029fb3cb5e0477758a59917b4cdf1091e.tar tangerine-wallet-browser-29dd81d029fb3cb5e0477758a59917b4cdf1091e.tar.gz tangerine-wallet-browser-29dd81d029fb3cb5e0477758a59917b4cdf1091e.tar.bz2 tangerine-wallet-browser-29dd81d029fb3cb5e0477758a59917b4cdf1091e.tar.lz tangerine-wallet-browser-29dd81d029fb3cb5e0477758a59917b4cdf1091e.tar.xz tangerine-wallet-browser-29dd81d029fb3cb5e0477758a59917b4cdf1091e.tar.zst tangerine-wallet-browser-29dd81d029fb3cb5e0477758a59917b4cdf1091e.zip |
require metamascara
Diffstat (limited to 'mascara/src/mascara.js')
-rw-r--r-- | mascara/src/mascara.js | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/mascara/src/mascara.js b/mascara/src/mascara.js index 1655d1f64..0af6f532f 100644 --- a/mascara/src/mascara.js +++ b/mascara/src/mascara.js @@ -1,47 +1 @@ -const Web3 = require('web3') -const setupProvider = require('./lib/setup-provider.js') -const setupDappAutoReload = require('../../app/scripts/lib/auto-reload.js') -const MASCARA_ORIGIN = process.env.MASCARA_ORIGIN || 'http://localhost:9001' -console.log('MASCARA_ORIGIN:', MASCARA_ORIGIN) - -// -// setup web3 -// - -const provider = setupProvider({ - mascaraUrl: MASCARA_ORIGIN + '/proxy/', -}) -instrumentForUserInteractionTriggers(provider) - -const web3 = new Web3(provider) -setupDappAutoReload(web3, provider.publicConfigStore) -// -// ui stuff -// - -let shouldPop = false -window.addEventListener('click', maybeTriggerPopup) - -// -// util -// - -function maybeTriggerPopup(){ - if (!shouldPop) return - shouldPop = false - window.open(MASCARA_ORIGIN, '', 'width=360 height=500') - console.log('opening window...') -} - -function instrumentForUserInteractionTriggers(provider){ - const _super = provider.sendAsync.bind(provider) - provider.sendAsync = function(payload, cb){ - if (payload.method === 'eth_sendTransaction') { - console.log('saw send') - shouldPop = true - } - _super(payload, cb) - } -} - - +global.metamask = require('metamascara') |