aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/background.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-04-09 05:24:10 +0800
committerkumavis <aaron@kumavis.me>2016-04-09 05:24:10 +0800
commit266e3c7ddb920c933355d559144bab6c633a65fb (patch)
treece57869cb3f9eed23c6ff717004668a366a315dc /app/scripts/background.js
parent379294f16415a6ca112c590b1bcc12448189d245 (diff)
downloadtangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.gz
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.bz2
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.lz
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.xz
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.tar.zst
tangerine-wallet-browser-266e3c7ddb920c933355d559144bab6c633a65fb.zip
popup - fix web3 plumbing
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r--app/scripts/background.js19
1 files changed, 3 insertions, 16 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 850a7bc6e..dfcdcc06c 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -1,6 +1,5 @@
const Dnode = require('dnode')
const Multiplex = require('multiplex')
-const Through = require('through2')
const eos = require('end-of-stream')
const combineStreams = require('pumpify')
const extend = require('xtend')
@@ -10,6 +9,8 @@ const MetaMaskProvider = require('./lib/zero.js')
const IdentityStore = require('./lib/idStore')
const createTxNotification = require('./lib/tx-notification.js')
const configManager = require('./lib/config-manager-singleton')
+const jsonParseStream = require('./lib/stream-utils.js').jsonParseStream
+const jsonStringifyStream = require('./lib/stream-utils.js').jsonStringifyStream
//
// connect to other contexts
@@ -100,7 +101,7 @@ function handleInternalCommunication(portStream){
mx.destroy()
})
var dnodeStream = mx.createSharedStream('dnode')
- var providerStream = combineStreams(
+ var providerStream = combineStreams.obj(
jsonStringifyStream(),
mx.createSharedStream('provider'),
jsonParseStream()
@@ -191,18 +192,4 @@ function useEtherscanProvider() {
// util
-function jsonParseStream(){
- return Through.obj(function(serialized){
- this.push(JSON.parse(serialized))
- cb()
- })
-}
-
-function jsonStringifyStream(){
- return Through.obj(function(obj){
- this.push(JSON.stringify(obj))
- cb()
- })
-}
-
function noop(){}