aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 22:49:36 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-16 22:49:36 +0800
commit0172939490f47f869b39b00d3f5f228b226ab170 (patch)
tree6f1f9d64248291d3e22feb309265fa826ccce485 /lib
parent2c36d5ff457952c557b467e580514b08126d7dd7 (diff)
downloadgo-tangerine-0172939490f47f869b39b00d3f5f228b226ab170.tar
go-tangerine-0172939490f47f869b39b00d3f5f228b226ab170.tar.gz
go-tangerine-0172939490f47f869b39b00d3f5f228b226ab170.tar.bz2
go-tangerine-0172939490f47f869b39b00d3f5f228b226ab170.tar.lz
go-tangerine-0172939490f47f869b39b00d3f5f228b226ab170.tar.xz
go-tangerine-0172939490f47f869b39b00d3f5f228b226ab170.tar.zst
go-tangerine-0172939490f47f869b39b00d3f5f228b226ab170.zip
fixed #28 and other small node.js issues
Diffstat (limited to 'lib')
-rw-r--r--lib/abi.js4
-rw-r--r--lib/contract.js6
-rw-r--r--lib/filter.js5
-rw-r--r--lib/providermanager.js4
-rw-r--r--lib/web3.js13
5 files changed, 9 insertions, 23 deletions
diff --git a/lib/abi.js b/lib/abi.js
index 8af10c382..fbd6effb6 100644
--- a/lib/abi.js
+++ b/lib/abi.js
@@ -23,10 +23,10 @@
// TODO: is these line is supposed to be here?
if (process.env.NODE_ENV !== 'build') {
- var web3 = require('./web3'); // jshint ignore:line
+ var BigNumber = require('bignumber.js'); // jshint ignore:line
}
-var BigNumber = require('bignumber.js');
+var web3 = require('./web3'); // jshint ignore:line
// TODO: make these be actually accurate instead of falling back onto JS's doubles.
var hexToDec = function (hex) {
diff --git a/lib/contract.js b/lib/contract.js
index 52ce08705..744fc88a4 100644
--- a/lib/contract.js
+++ b/lib/contract.js
@@ -20,11 +20,7 @@
* @date 2014
*/
-// TODO: is these line is supposed to be here?
-if (process.env.NODE_ENV !== 'build') {
- var web3 = require('./web3'); // jshint ignore:line
-}
-
+var web3 = require('./web3'); // jshint ignore:line
var abi = require('./abi');
/// method signature length in bytes
diff --git a/lib/filter.js b/lib/filter.js
index 47f5a070c..4a82babb9 100644
--- a/lib/filter.js
+++ b/lib/filter.js
@@ -23,10 +23,7 @@
* @date 2014
*/
-// TODO: is these line is supposed to be here?
-if (process.env.NODE_ENV !== 'build') {
- var web3 = require('./web3'); // jshint ignore:line
-}
+var web3 = require('./web3'); // jshint ignore:line
/// should be used when we want to watch something
/// it's using inner polling mechanism and is notified about changes
diff --git a/lib/providermanager.js b/lib/providermanager.js
index 00266154d..2697ebbd7 100644
--- a/lib/providermanager.js
+++ b/lib/providermanager.js
@@ -24,9 +24,7 @@
*/
// TODO: is these line is supposed to be here?
-if (process.env.NODE_ENV !== 'build') {
- var web3 = require('./web3'); // jshint ignore:line
-}
+var web3 = require('./web3'); // jshint ignore:line
/**
* Provider manager object prototype
diff --git a/lib/web3.js b/lib/web3.js
index 25c2901a8..f071eea49 100644
--- a/lib/web3.js
+++ b/lib/web3.js
@@ -23,9 +23,6 @@
* @date 2014
*/
-var Filter = require('./filter');
-var ProviderManager = require('./providermanager');
-
/// Recursively resolves all promises in given object and replaces the resolved values with promises
/// @param any object/array/promise/anything else..
/// @returns (resolves) object with replaced promises with their result
@@ -319,7 +316,7 @@ var web3 = {
/// eth object prototype
eth: {
watch: function (params) {
- return new Filter(params, ethWatch);
+ return new web3.filter(params, ethWatch);
}
},
@@ -329,7 +326,7 @@ var web3 = {
/// shh object prototype
shh: {
watch: function (params) {
- return new Filter(params, shhWatch);
+ return new web3.filter(params, shhWatch);
}
},
@@ -387,8 +384,6 @@ var shhWatch = {
setupMethods(shhWatch, shhWatchMethods());
-web3.provider = new ProviderManager();
-
web3.setProvider = function(provider) {
provider.onmessage = messageHandler;
web3.provider.set(provider);
@@ -411,5 +406,5 @@ function messageHandler(data) {
}
}
-if (typeof(module) !== "undefined")
- module.exports = web3;
+module.exports = web3;
+