aboutsummaryrefslogtreecommitdiffstats
path: root/mascara/src
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-04-06 01:27:04 +0800
committerkumavis <aaron@kumavis.me>2017-04-06 01:27:04 +0800
commita6c6ecf2759d300f660da4e9058b29a0f5f07a8b (patch)
tree4242ef690fee121cc8988189220751a89eef5d1c /mascara/src
parentc1e14cd75b3a873ffa9e691911818b68b3d62e07 (diff)
downloadtangerine-wallet-browser-a6c6ecf2759d300f660da4e9058b29a0f5f07a8b.tar
tangerine-wallet-browser-a6c6ecf2759d300f660da4e9058b29a0f5f07a8b.tar.gz
tangerine-wallet-browser-a6c6ecf2759d300f660da4e9058b29a0f5f07a8b.tar.bz2
tangerine-wallet-browser-a6c6ecf2759d300f660da4e9058b29a0f5f07a8b.tar.lz
tangerine-wallet-browser-a6c6ecf2759d300f660da4e9058b29a0f5f07a8b.tar.xz
tangerine-wallet-browser-a6c6ecf2759d300f660da4e9058b29a0f5f07a8b.tar.zst
tangerine-wallet-browser-a6c6ecf2759d300f660da4e9058b29a0f5f07a8b.zip
mascara - mascara lib - read mascara origin from env var
Diffstat (limited to 'mascara/src')
-rw-r--r--mascara/src/mascara.js31
1 files changed, 14 insertions, 17 deletions
diff --git a/mascara/src/mascara.js b/mascara/src/mascara.js
index f9bed7e52..0fc2868e1 100644
--- a/mascara/src/mascara.js
+++ b/mascara/src/mascara.js
@@ -1,44 +1,41 @@
const Web3 = require('web3')
const setupProvider = require('./lib/setup-provider.js')
-const MASACARA_DOMAIN = 'http://localhost:9001'
+const MASCARA_ORIGIN = process.env.MASCARA_ORIGIN || 'http://localhost:9001'
+console.log('MASCARA_ORIGIN:', MASCARA_ORIGIN)
//
// setup web3
//
-var provider = setupProvider({
- mascaraUrl: MASACARA_DOMAIN + '/proxy/',
+const provider = setupProvider({
+ mascaraUrl: MASCARA_ORIGIN + '/proxy/',
})
instrumentForUserInteractionTriggers(provider)
-var web3 = new Web3(provider)
-web3.setProvider = function(){
- console.log('MetaMask - overrode web3.setProvider')
-}
+const web3 = new Web3(provider)
+global.web3 = web3
//
-//
-// export web3
+// ui stuff
//
-global.web3 = web3
+let shouldPop = false
+window.addEventListener('click', maybeTriggerPopup)
//
-// ui stuff
+// util
//
-var shouldPop = false
-window.addEventListener('click', function(){
+function maybeTriggerPopup(){
if (!shouldPop) return
shouldPop = false
- window.open(MASACARA_DOMAIN, '', 'width=360 height=500')
+ window.open(MASCARA_ORIGIN, '', 'width=360 height=500')
console.log('opening window...')
-})
-
+}
function instrumentForUserInteractionTriggers(provider){
- var _super = provider.sendAsync.bind(provider)
+ const _super = provider.sendAsync.bind(provider)
provider.sendAsync = function(payload, cb){
if (payload.method === 'eth_sendTransaction') {
console.log('saw send')