aboutsummaryrefslogtreecommitdiffstats
path: root/library/src/mascara.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-04-03 13:01:44 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-04-03 13:01:44 +0800
commit8d49d519c090d287484008346aba1df6d7ad77e7 (patch)
treea4064ac0a05429c591e6776bf496c803d1819ae9 /library/src/mascara.js
parent29a602a89b176e7af3f15297c2f586a4ece0a726 (diff)
downloadtangerine-wallet-browser-8d49d519c090d287484008346aba1df6d7ad77e7.tar
tangerine-wallet-browser-8d49d519c090d287484008346aba1df6d7ad77e7.tar.gz
tangerine-wallet-browser-8d49d519c090d287484008346aba1df6d7ad77e7.tar.bz2
tangerine-wallet-browser-8d49d519c090d287484008346aba1df6d7ad77e7.tar.lz
tangerine-wallet-browser-8d49d519c090d287484008346aba1df6d7ad77e7.tar.xz
tangerine-wallet-browser-8d49d519c090d287484008346aba1df6d7ad77e7.tar.zst
tangerine-wallet-browser-8d49d519c090d287484008346aba1df6d7ad77e7.zip
Rename and move around files
Diffstat (limited to 'library/src/mascara.js')
-rw-r--r--library/src/mascara.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/library/src/mascara.js b/library/src/mascara.js
new file mode 100644
index 000000000..759353c1b
--- /dev/null
+++ b/library/src/mascara.js
@@ -0,0 +1,44 @@
+const Web3 = require('web3')
+const setupProvider = require('./lib/setup-provider.js')
+
+//
+// setup web3
+//
+var provider = setupProvider()
+hijackProvider(provider)
+var web3 = new Web3(provider)
+web3.setProvider = function(){
+ console.log('MetaMask - overrode web3.setProvider')
+}
+//
+//
+// export web3
+//
+
+global.web3 = web3
+
+//
+// ui stuff
+//
+
+var shouldPop = false
+window.addEventListener('click', function(){
+ if (!shouldPop) return
+ shouldPop = false
+ window.open('http://localhost:9001/popup/popup.html', '', 'width=360 height=500')
+ console.log('opening window...')
+})
+
+
+function hijackProvider(provider){
+ var _super = provider.sendAsync.bind(provider)
+ provider.sendAsync = function(payload, cb){
+ if (payload.method === 'eth_sendTransaction') {
+ console.log('saw send')
+ shouldPop = true
+ }
+ _super(payload, cb)
+ }
+}
+
+