diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-28 13:32:07 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-28 13:32:07 +0800 |
commit | 5a1d50cd431819874f634679a1ea47fa64f9fbb4 (patch) | |
tree | fe76102102c875ee6eaaee8cb57829899936c519 /mascara/src/mascara.js | |
parent | deee689426f0b6236093128b47be81faf56d6b75 (diff) | |
parent | cdf41c28573822c7c4d50efe7dfa34a062825d7f (diff) | |
download | tangerine-wallet-browser-5a1d50cd431819874f634679a1ea47fa64f9fbb4.tar tangerine-wallet-browser-5a1d50cd431819874f634679a1ea47fa64f9fbb4.tar.gz tangerine-wallet-browser-5a1d50cd431819874f634679a1ea47fa64f9fbb4.tar.bz2 tangerine-wallet-browser-5a1d50cd431819874f634679a1ea47fa64f9fbb4.tar.lz tangerine-wallet-browser-5a1d50cd431819874f634679a1ea47fa64f9fbb4.tar.xz tangerine-wallet-browser-5a1d50cd431819874f634679a1ea47fa64f9fbb4.tar.zst tangerine-wallet-browser-5a1d50cd431819874f634679a1ea47fa64f9fbb4.zip |
Merge branch 'master' into mmn
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') |