aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-22 03:43:20 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-22 03:43:20 +0800
commitceb4357a8d66e5112369293b15247f03c561c514 (patch)
tree915e03281096df16c8d351574409fc98fd62aafe
parentfc986a3fbee02a4fcfbd4e74d9881fc25d5538b4 (diff)
downloaddexon-ceb4357a8d66e5112369293b15247f03c561c514.tar
dexon-ceb4357a8d66e5112369293b15247f03c561c514.tar.gz
dexon-ceb4357a8d66e5112369293b15247f03c561c514.tar.bz2
dexon-ceb4357a8d66e5112369293b15247f03c561c514.tar.lz
dexon-ceb4357a8d66e5112369293b15247f03c561c514.tar.xz
dexon-ceb4357a8d66e5112369293b15247f03c561c514.tar.zst
dexon-ceb4357a8d66e5112369293b15247f03c561c514.zip
sync api tests running, removed unused pieces of code
-rw-r--r--dist/ethereum.js84
-rw-r--r--dist/ethereum.js.map6
-rw-r--r--dist/ethereum.min.js2
-rw-r--r--lib/providermanager.js3
-rw-r--r--lib/web3.js81
-rw-r--r--test/db.methods.js1
-rw-r--r--test/eth.methods.js1
-rw-r--r--test/shh.methods.js1
-rw-r--r--test/utils.js2
-rw-r--r--test/web3.methods.js1
10 files changed, 9 insertions, 173 deletions
diff --git a/dist/ethereum.js b/dist/ethereum.js
index ea213c005..beb4f29ed 100644
--- a/dist/ethereum.js
+++ b/dist/ethereum.js
@@ -731,7 +731,8 @@ ProviderManager.prototype.send = function(data) {
this.id++;
if (this.provider === undefined) {
- console.error("provider is not set");
+ console.error('provider is not set');
+ return JSON.stringify({result: 'error, provider is not set'});
}
return this.provider.send(data);
@@ -808,48 +809,6 @@ module.exports = ProviderManager;
* @date 2014
*/
-/// 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
-function flattenPromise (obj) {
- if (obj instanceof Promise) {
- return Promise.resolve(obj);
- }
-
- if (obj instanceof Array) {
- return new Promise(function (resolve) {
- var promises = obj.map(function (o) {
- return flattenPromise(o);
- });
-
- return Promise.all(promises).then(function (res) {
- for (var i = 0; i < obj.length; i++) {
- obj[i] = res[i];
- }
- resolve(obj);
- });
- });
- }
-
- if (obj instanceof Object) {
- return new Promise(function (resolve) {
- var keys = Object.keys(obj);
- var promises = keys.map(function (key) {
- return flattenPromise(obj[key]);
- });
-
- return Promise.all(promises).then(function (res) {
- for (var i = 0; i < keys.length; i++) {
- obj[keys[i]] = res[i];
- }
- resolve(obj);
- });
- });
- }
-
- return Promise.resolve(obj);
-}
-
/// @returns an array of objects describing web3 api methods
var web3Methods = function () {
return [
@@ -964,22 +923,6 @@ var setupMethods = function (obj, methods) {
result = JSON.parse(result);
return result.result;
- //return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) {
- //var call = typeof method.call === "function" ? method.call(args) : method.call;
- //return {call: call, args: args};
- //}).then(function (request) {
- //return new Promise(function (resolve, reject) {
- //web3.provider.send(request, function (err, result) {
- //if (!err) {
- //resolve(result);
- //return;
- //}
- //reject(err);
- //});
- //});
- //}).catch(function(err) {
- //console.error(err);
- //});
};
});
};
@@ -997,16 +940,6 @@ var setupProperties = function (obj, properties) {
result = JSON.parse(result);
return result.result;
-
- //return new Promise(function(resolve, reject) {
- //web3.provider.send({call: property.getter}, function(err, result) {
- //if (!err) {
- //resolve(result);
- //return;
- //}
- //reject(err);
- //});
- //});
};
if (property.setter) {
proto.set = function (val) {
@@ -1018,19 +951,6 @@ var setupProperties = function (obj, properties) {
result = JSON.parse(result);
return result.result;
- //return flattenPromise([val]).then(function (args) {
- //return new Promise(function (resolve) {
- //web3.provider.send({call: property.setter, args: args}, function (err, result) {
- //if (!err) {
- //resolve(result);
- //return;
- //}
- //reject(err);
- //});
- //});
- //}).catch(function (err) {
- //console.error(err);
- //});
};
}
Object.defineProperty(obj, property.name, proto);
diff --git a/dist/ethereum.js.map b/dist/ethereum.js.map
index 6a3c82f0a..be79c9cc8 100644
--- a/dist/ethereum.js.map
+++ b/dist/ethereum.js.map
@@ -11,7 +11,7 @@
"index.js"
],
"names": [],
- "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA",
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA",
"file": "generated.js",
"sourceRoot": "",
"sourcesContent": [
@@ -20,8 +20,8 @@
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file contract.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); // jshint ignore:line\nvar abi = require('./abi');\n\n/// method signature length in bytes\nvar ETH_METHOD_SIGNATURE_LENGTH = 4;\n\n/**\n * This method should be called when we want to call / transact some solidity method from javascript\n * it returns an object which has same methods available as solidity contract description\n * usage example: \n *\n * var abi = [{\n * name: 'myMethod',\n * inputs: [{ name: 'a', type: 'string' }],\n * outputs: [{name: 'd', type: 'string' }]\n * }]; // contract abi\n *\n * var myContract = web3.eth.contract('0x0123123121', abi); // creation of contract object\n *\n * myContract.myMethod('this is test string param for call').call(); // myMethod call\n * myContract.myMethod('this is test string param for transact').transact() // myMethod transact\n *\n * @param address - address of the contract, which should be called\n * @param desc - abi json description of the contract, which is being created\n * @returns contract object\n */\nvar contract = function (address, desc) {\n var inputParser = abi.inputParser(desc);\n var outputParser = abi.outputParser(desc);\n\n var contract = {};\n\n desc.forEach(function (method) {\n\n var displayName = abi.methodDisplayName(method.name);\n var typeName = abi.methodTypeName(method.name);\n\n var impl = function () {\n var params = Array.prototype.slice.call(arguments);\n var parsed = inputParser[displayName][typeName].apply(null, params);\n\n var onSuccess = function (result) {\n return outputParser[displayName][typeName](result);\n };\n\n return {\n call: function (extra) {\n extra = extra || {};\n extra.to = address;\n return abi.methodSignature(desc, method.name).then(function (signature) {\n extra.data = signature.slice(0, 2 + ETH_METHOD_SIGNATURE_LENGTH * 2) + parsed;\n return web3.eth.call(extra).then(onSuccess);\n });\n },\n transact: function (extra) {\n extra = extra || {};\n extra.to = address;\n return abi.methodSignature(desc, method.name).then(function (signature) {\n extra.data = signature.slice(0, 2 + ETH_METHOD_SIGNATURE_LENGTH * 2) + parsed;\n web3._currentContractAbi = desc;\n web3._currentContractAddress = address;\n return web3.eth.transact(extra).then(onSuccess);\n });\n }\n };\n };\n\n if (contract[displayName] === undefined) {\n contract[displayName] = impl;\n }\n\n contract[displayName][typeName] = impl;\n });\n\n return contract;\n};\n\nmodule.exports = contract;\n\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file filter.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); // jshint ignore:line\n\n/// should be used when we want to watch something\n/// it's using inner polling mechanism and is notified about changes\nvar Filter = function(options, impl) {\n this.impl = impl;\n this.callbacks = [];\n\n var self = this;\n this.promise = impl.newFilter(options);\n this.promise.then(function (id) {\n self.id = id;\n web3.on(impl.changed, id, self.trigger.bind(self));\n web3.provider.startPolling({call: impl.changed, args: [id]}, id);\n });\n};\n\n/// alias for changed*\nFilter.prototype.arrived = function(callback) {\n this.changed(callback);\n};\n\n/// gets called when there is new eth/shh message\nFilter.prototype.changed = function(callback) {\n var self = this;\n this.promise.then(function(id) {\n self.callbacks.push(callback);\n });\n};\n\n/// trigger calling new message from people\nFilter.prototype.trigger = function(messages) {\n for(var i = 0; i < this.callbacks.length; i++) {\n this.callbacks[i].call(this, messages);\n }\n};\n\n/// should be called to uninstall current filter\nFilter.prototype.uninstall = function() {\n var self = this;\n this.promise.then(function (id) {\n self.impl.uninstallFilter(id);\n web3.provider.stopPolling(id);\n web3.off(impl.changed, id);\n });\n};\n\n/// should be called to manually trigger getting latest messages from the client\nFilter.prototype.messages = function() {\n var self = this;\n return this.promise.then(function (id) {\n return self.impl.getMessages(id);\n });\n};\n\n/// alias for messages\nFilter.prototype.logs = function () {\n return this.messages();\n};\n\nmodule.exports = Filter;\n",
"/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file httpsync.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\nvar HttpSyncProvider = function (host) {\n this.handlers = [];\n this.host = host;\n};\n\n/// Transforms inner message to proper jsonrpc object\n/// @param inner message object\n/// @returns jsonrpc object\nfunction formatJsonRpcObject(object) {\n return {\n jsonrpc: '2.0',\n method: object.call,\n params: object.args,\n id: object._id\n };\n}\n\n/// Transforms jsonrpc object to inner message\n/// @param incoming jsonrpc message \n/// @returns inner message object\nfunction formatJsonRpcMessage(message) {\n var object = JSON.parse(message);\n\n return {\n _id: object.id,\n data: object.result,\n error: object.error\n };\n}\n\nHttpSyncProvider.prototype.send = function (payload) {\n var data = formatJsonRpcObject(payload);\n \n var request = new XMLHttpRequest();\n request.open('POST', this.host, false);\n request.send(JSON.stringify(data));\n \n // check request.status\n return request.responseText;\n};\n\nmodule.exports = HttpSyncProvider;\n\n",
- "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file providermanager.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); // jshint ignore:line\n\n/**\n * Provider manager object prototype\n * It's responsible for passing messages to providers\n * If no provider is set it's responsible for queuing requests\n * It's also responsible for polling the ethereum node for incoming messages\n * Default poll timeout is 12 seconds\n * If we are running ethereum.js inside ethereum browser, there are backend based tools responsible for polling,\n * and provider manager polling mechanism is not used\n */\nvar ProviderManager = function() {\n this.queued = [];\n this.polls = [];\n this.ready = false;\n this.provider = undefined;\n this.id = 1;\n\n var self = this;\n var poll = function () {\n if (self.provider && self.provider.poll) {\n self.polls.forEach(function (data) {\n data.data._id = self.id;\n self.id++;\n self.provider.poll(data.data, data.id);\n });\n }\n setTimeout(poll, 12000);\n };\n poll();\n};\n\n/// sends outgoing requests, if provider is not available, enqueue the request\nProviderManager.prototype.send = function(data) {\n data._id = this.id;\n\n data.args = data.args || [];\n this.id++;\n\n if (this.provider === undefined) {\n console.error(\"provider is not set\");\n }\n\n return this.provider.send(data);\n};\n\n/// setups provider, which will be used for sending messages\nProviderManager.prototype.set = function(provider) {\n if(this.provider !== undefined && this.provider.unload !== undefined) {\n this.provider.unload();\n }\n\n this.provider = provider;\n this.ready = true;\n};\n\n/// resends queued messages\nProviderManager.prototype.sendQueued = function() {\n for(var i = 0; this.queued.length; i++) {\n // Resend\n this.send(this.queued[i]);\n }\n};\n\n/// @returns true if the provider i properly set\nProviderManager.prototype.installed = function() {\n return this.provider !== undefined;\n};\n\n/// this method is only used, when we do not have native qt bindings and have to do polling on our own\n/// should be callled, on start watching for eth/shh changes\nProviderManager.prototype.startPolling = function (data, pollId) {\n if (!this.provider || !this.provider.poll) {\n return;\n }\n this.polls.push({data: data, id: pollId});\n};\n\n/// should be called to stop polling for certain watch changes\nProviderManager.prototype.stopPolling = function (pollId) {\n for (var i = this.polls.length; i--;) {\n var poll = this.polls[i];\n if (poll.id === pollId) {\n this.polls.splice(i, 1);\n }\n }\n};\n\nmodule.exports = ProviderManager;\n\n",
- "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file web3.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\n/// Recursively resolves all promises in given object and replaces the resolved values with promises\n/// @param any object/array/promise/anything else..\n/// @returns (resolves) object with replaced promises with their result \nfunction flattenPromise (obj) {\n if (obj instanceof Promise) {\n return Promise.resolve(obj);\n }\n\n if (obj instanceof Array) {\n return new Promise(function (resolve) {\n var promises = obj.map(function (o) {\n return flattenPromise(o);\n });\n\n return Promise.all(promises).then(function (res) {\n for (var i = 0; i < obj.length; i++) {\n obj[i] = res[i];\n }\n resolve(obj);\n });\n });\n }\n\n if (obj instanceof Object) {\n return new Promise(function (resolve) {\n var keys = Object.keys(obj);\n var promises = keys.map(function (key) {\n return flattenPromise(obj[key]);\n });\n\n return Promise.all(promises).then(function (res) {\n for (var i = 0; i < keys.length; i++) {\n obj[keys[i]] = res[i];\n }\n resolve(obj);\n });\n });\n }\n\n return Promise.resolve(obj);\n}\n\n/// @returns an array of objects describing web3 api methods\nvar web3Methods = function () {\n return [\n { name: 'sha3', call: 'web3_sha3' }\n ];\n};\n\n/// @returns an array of objects describing web3.eth api methods\nvar ethMethods = function () {\n var blockCall = function (args) {\n return typeof args[0] === \"string\" ? \"eth_blockByHash\" : \"eth_blockByNumber\";\n };\n\n var transactionCall = function (args) {\n return typeof args[0] === \"string\" ? 'eth_transactionByHash' : 'eth_transactionByNumber';\n };\n\n var uncleCall = function (args) {\n return typeof args[0] === \"string\" ? 'eth_uncleByHash' : 'eth_uncleByNumber';\n };\n\n var methods = [\n { name: 'balanceAt', call: 'eth_balanceAt' },\n { name: 'stateAt', call: 'eth_stateAt' },\n { name: 'storageAt', call: 'eth_storageAt' },\n { name: 'countAt', call: 'eth_countAt'},\n { name: 'codeAt', call: 'eth_codeAt' },\n { name: 'transact', call: 'eth_transact' },\n { name: 'call', call: 'eth_call' },\n { name: 'block', call: blockCall },\n { name: 'transaction', call: transactionCall },\n { name: 'uncle', call: uncleCall },\n { name: 'compilers', call: 'eth_compilers' },\n { name: 'lll', call: 'eth_lll' },\n { name: 'solidity', call: 'eth_solidity' },\n { name: 'serpent', call: 'eth_serpent' },\n { name: 'logs', call: 'eth_logs' }\n ];\n return methods;\n};\n\n/// @returns an array of objects describing web3.eth api properties\nvar ethProperties = function () {\n return [\n { name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },\n { name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },\n { name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },\n { name: 'gasPrice', getter: 'eth_gasPrice' },\n { name: 'account', getter: 'eth_account' },\n { name: 'accounts', getter: 'eth_accounts' },\n { name: 'peerCount', getter: 'eth_peerCount' },\n { name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },\n { name: 'number', getter: 'eth_number'}\n ];\n};\n\n/// @returns an array of objects describing web3.db api methods\nvar dbMethods = function () {\n return [\n { name: 'put', call: 'db_put' },\n { name: 'get', call: 'db_get' },\n { name: 'putString', call: 'db_putString' },\n { name: 'getString', call: 'db_getString' }\n ];\n};\n\n/// @returns an array of objects describing web3.shh api methods\nvar shhMethods = function () {\n return [\n { name: 'post', call: 'shh_post' },\n { name: 'newIdentity', call: 'shh_newIdentity' },\n { name: 'haveIdentity', call: 'shh_haveIdentity' },\n { name: 'newGroup', call: 'shh_newGroup' },\n { name: 'addToGroup', call: 'shh_addToGroup' }\n ];\n};\n\n/// @returns an array of objects describing web3.eth.watch api methods\nvar ethWatchMethods = function () {\n var newFilter = function (args) {\n return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';\n };\n\n return [\n { name: 'newFilter', call: newFilter },\n { name: 'uninstallFilter', call: 'eth_uninstallFilter' },\n { name: 'getMessages', call: 'eth_filterLogs' }\n ];\n};\n\n/// @returns an array of objects describing web3.shh.watch api methods\nvar shhWatchMethods = function () {\n return [\n { name: 'newFilter', call: 'shh_newFilter' },\n { name: 'uninstallFilter', call: 'shh_uninstallFilter' },\n { name: 'getMessage', call: 'shh_getMessages' }\n ];\n};\n\n/// creates methods in a given object based on method description on input\n/// setups api calls for these methods\nvar setupMethods = function (obj, methods) {\n methods.forEach(function (method) {\n obj[method.name] = function () {\n var args = Array.prototype.slice.call(arguments);\n var call = typeof method.call === 'function' ? method.call(args) : method.call;\n var result = web3.provider.send({\n call: call,\n args: args\n });\n \n result = JSON.parse(result);\n return result.result;\n\n //return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) {\n //var call = typeof method.call === \"function\" ? method.call(args) : method.call;\n //return {call: call, args: args};\n //}).then(function (request) {\n //return new Promise(function (resolve, reject) {\n //web3.provider.send(request, function (err, result) {\n //if (!err) {\n //resolve(result);\n //return;\n //}\n //reject(err);\n //});\n //});\n //}).catch(function(err) {\n //console.error(err);\n //});\n };\n });\n};\n\n/// creates properties in a given object based on properties description on input\n/// setups api calls for these properties\nvar setupProperties = function (obj, properties) {\n properties.forEach(function (property) {\n var proto = {};\n proto.get = function () {\n var result = web3.provider.send({\n call: property.getter\n });\n\n result = JSON.parse(result);\n return result.result;\n\n \n //return new Promise(function(resolve, reject) {\n //web3.provider.send({call: property.getter}, function(err, result) {\n //if (!err) {\n //resolve(result);\n //return;\n //}\n //reject(err);\n //});\n //});\n };\n if (property.setter) {\n proto.set = function (val) {\n var result = web3.provider.send({\n call: property.setter,\n args: [val]\n });\n\n result = JSON.parse(result);\n return result.result;\n\n //return flattenPromise([val]).then(function (args) {\n //return new Promise(function (resolve) {\n //web3.provider.send({call: property.setter, args: args}, function (err, result) {\n //if (!err) {\n //resolve(result);\n //return;\n //}\n //reject(err);\n //});\n //});\n //}).catch(function (err) {\n //console.error(err);\n //});\n };\n }\n Object.defineProperty(obj, property.name, proto);\n });\n};\n\n// TODO: import from a dependency, don't duplicate.\nvar hexToDec = function (hex) {\n return parseInt(hex, 16).toString();\n};\n\nvar decToHex = function (dec) {\n return parseInt(dec).toString(16);\n};\n\n/// setups web3 object, and it's in-browser executed methods\nvar web3 = {\n _callbacks: {},\n _events: {},\n providers: {},\n\n toHex: function(str) {\n var hex = \"\";\n for(var i = 0; i < str.length; i++) {\n var n = str.charCodeAt(i).toString(16);\n hex += n.length < 2 ? '0' + n : n;\n }\n\n return hex;\n },\n\n /// @returns ascii string representation of hex value prefixed with 0x\n toAscii: function(hex) {\n // Find termination\n var str = \"\";\n var i = 0, l = hex.length;\n if (hex.substring(0, 2) === '0x')\n i = 2;\n for(; i < l; i+=2) {\n var code = parseInt(hex.substr(i, 2), 16);\n if(code === 0) {\n break;\n }\n\n str += String.fromCharCode(code);\n }\n\n return str;\n },\n\n /// @returns hex representation (prefixed by 0x) of ascii string\n fromAscii: function(str, pad) {\n pad = pad === undefined ? 0 : pad;\n var hex = this.toHex(str);\n while(hex.length < pad*2)\n hex += \"00\";\n return \"0x\" + hex;\n },\n\n /// @returns decimal representaton of hex value prefixed by 0x\n toDecimal: function (val) {\n return hexToDec(val.substring(2));\n },\n\n /// @returns hex representation (prefixed by 0x) of decimal value\n fromDecimal: function (val) {\n return \"0x\" + decToHex(val);\n },\n\n /// used to transform value/string to eth string\n toEth: function(str) {\n var val = typeof str === \"string\" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;\n var unit = 0;\n var units = [ 'wei', 'Kwei', 'Mwei', 'Gwei', 'szabo', 'finney', 'ether', 'grand', 'Mether', 'Gether', 'Tether', 'Pether', 'Eether', 'Zether', 'Yether', 'Nether', 'Dether', 'Vether', 'Uether' ];\n while (val > 3000 && unit < units.length - 1)\n {\n val /= 1000;\n unit++;\n }\n var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);\n var replaceFunction = function($0, $1, $2) {\n return $1 + ',' + $2;\n };\n\n while (true) {\n var o = s;\n s = s.replace(/(\\d)(\\d\\d\\d[\\.\\,])/, replaceFunction);\n if (o === s)\n break;\n }\n return s + ' ' + units[unit];\n },\n\n /// eth object prototype\n eth: {\n watch: function (params) {\n return new web3.filter(params, ethWatch);\n }\n },\n\n /// db object prototype\n db: {},\n\n /// shh object prototype\n shh: {\n watch: function (params) {\n return new web3.filter(params, shhWatch);\n }\n },\n\n /// used by filter to register callback with given id\n on: function(event, id, cb) {\n if(web3._events[event] === undefined) {\n web3._events[event] = {};\n }\n\n web3._events[event][id] = cb;\n return this;\n },\n\n /// used by filter to unregister callback with given id\n off: function(event, id) {\n if(web3._events[event] !== undefined) {\n delete web3._events[event][id];\n }\n\n return this;\n },\n\n /// used to trigger callback registered by filter\n trigger: function(event, id, data) {\n var callbacks = web3._events[event];\n if (!callbacks || !callbacks[id]) {\n return;\n }\n var cb = callbacks[id];\n cb(data);\n },\n\n /// @returns true if provider is installed\n haveProvider: function() {\n return !!web3.provider.provider;\n }\n};\n\n/// setups all api methods\nsetupMethods(web3, web3Methods());\nsetupMethods(web3.eth, ethMethods());\nsetupProperties(web3.eth, ethProperties());\nsetupMethods(web3.db, dbMethods());\nsetupMethods(web3.shh, shhMethods());\n\nvar ethWatch = {\n changed: 'eth_changed'\n};\n\nsetupMethods(ethWatch, ethWatchMethods());\n\nvar shhWatch = {\n changed: 'shh_changed'\n};\n\nsetupMethods(shhWatch, shhWatchMethods());\n\nweb3.setProvider = function(provider) {\n provider.onmessage = messageHandler;\n web3.provider.set(provider);\n web3.provider.sendQueued();\n};\n\n/// callled when there is new incoming message\nfunction messageHandler(data) {\n if(data._event !== undefined) {\n web3.trigger(data._event, data._id, data.data);\n return;\n }\n\n if(data._id) {\n var cb = web3._callbacks[data._id];\n if (cb) {\n cb.call(this, data.error, data.data);\n delete web3._callbacks[data._id];\n }\n }\n}\n\nmodule.exports = web3;\n\n",
+ "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file providermanager.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); // jshint ignore:line\n\n/**\n * Provider manager object prototype\n * It's responsible for passing messages to providers\n * If no provider is set it's responsible for queuing requests\n * It's also responsible for polling the ethereum node for incoming messages\n * Default poll timeout is 12 seconds\n * If we are running ethereum.js inside ethereum browser, there are backend based tools responsible for polling,\n * and provider manager polling mechanism is not used\n */\nvar ProviderManager = function() {\n this.queued = [];\n this.polls = [];\n this.ready = false;\n this.provider = undefined;\n this.id = 1;\n\n var self = this;\n var poll = function () {\n if (self.provider && self.provider.poll) {\n self.polls.forEach(function (data) {\n data.data._id = self.id;\n self.id++;\n self.provider.poll(data.data, data.id);\n });\n }\n setTimeout(poll, 12000);\n };\n poll();\n};\n\n/// sends outgoing requests, if provider is not available, enqueue the request\nProviderManager.prototype.send = function(data) {\n data._id = this.id;\n\n data.args = data.args || [];\n this.id++;\n\n if (this.provider === undefined) {\n console.error('provider is not set');\n return JSON.stringify({result: 'error, provider is not set'});\n }\n\n return this.provider.send(data);\n};\n\n/// setups provider, which will be used for sending messages\nProviderManager.prototype.set = function(provider) {\n if(this.provider !== undefined && this.provider.unload !== undefined) {\n this.provider.unload();\n }\n\n this.provider = provider;\n this.ready = true;\n};\n\n/// resends queued messages\nProviderManager.prototype.sendQueued = function() {\n for(var i = 0; this.queued.length; i++) {\n // Resend\n this.send(this.queued[i]);\n }\n};\n\n/// @returns true if the provider i properly set\nProviderManager.prototype.installed = function() {\n return this.provider !== undefined;\n};\n\n/// this method is only used, when we do not have native qt bindings and have to do polling on our own\n/// should be callled, on start watching for eth/shh changes\nProviderManager.prototype.startPolling = function (data, pollId) {\n if (!this.provider || !this.provider.poll) {\n return;\n }\n this.polls.push({data: data, id: pollId});\n};\n\n/// should be called to stop polling for certain watch changes\nProviderManager.prototype.stopPolling = function (pollId) {\n for (var i = this.polls.length; i--;) {\n var poll = this.polls[i];\n if (poll.id === pollId) {\n this.polls.splice(i, 1);\n }\n }\n};\n\nmodule.exports = ProviderManager;\n\n",
+ "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file web3.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\n/// @returns an array of objects describing web3 api methods\nvar web3Methods = function () {\n return [\n { name: 'sha3', call: 'web3_sha3' }\n ];\n};\n\n/// @returns an array of objects describing web3.eth api methods\nvar ethMethods = function () {\n var blockCall = function (args) {\n return typeof args[0] === \"string\" ? \"eth_blockByHash\" : \"eth_blockByNumber\";\n };\n\n var transactionCall = function (args) {\n return typeof args[0] === \"string\" ? 'eth_transactionByHash' : 'eth_transactionByNumber';\n };\n\n var uncleCall = function (args) {\n return typeof args[0] === \"string\" ? 'eth_uncleByHash' : 'eth_uncleByNumber';\n };\n\n var methods = [\n { name: 'balanceAt', call: 'eth_balanceAt' },\n { name: 'stateAt', call: 'eth_stateAt' },\n { name: 'storageAt', call: 'eth_storageAt' },\n { name: 'countAt', call: 'eth_countAt'},\n { name: 'codeAt', call: 'eth_codeAt' },\n { name: 'transact', call: 'eth_transact' },\n { name: 'call', call: 'eth_call' },\n { name: 'block', call: blockCall },\n { name: 'transaction', call: transactionCall },\n { name: 'uncle', call: uncleCall },\n { name: 'compilers', call: 'eth_compilers' },\n { name: 'lll', call: 'eth_lll' },\n { name: 'solidity', call: 'eth_solidity' },\n { name: 'serpent', call: 'eth_serpent' },\n { name: 'logs', call: 'eth_logs' }\n ];\n return methods;\n};\n\n/// @returns an array of objects describing web3.eth api properties\nvar ethProperties = function () {\n return [\n { name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },\n { name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },\n { name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },\n { name: 'gasPrice', getter: 'eth_gasPrice' },\n { name: 'account', getter: 'eth_account' },\n { name: 'accounts', getter: 'eth_accounts' },\n { name: 'peerCount', getter: 'eth_peerCount' },\n { name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },\n { name: 'number', getter: 'eth_number'}\n ];\n};\n\n/// @returns an array of objects describing web3.db api methods\nvar dbMethods = function () {\n return [\n { name: 'put', call: 'db_put' },\n { name: 'get', call: 'db_get' },\n { name: 'putString', call: 'db_putString' },\n { name: 'getString', call: 'db_getString' }\n ];\n};\n\n/// @returns an array of objects describing web3.shh api methods\nvar shhMethods = function () {\n return [\n { name: 'post', call: 'shh_post' },\n { name: 'newIdentity', call: 'shh_newIdentity' },\n { name: 'haveIdentity', call: 'shh_haveIdentity' },\n { name: 'newGroup', call: 'shh_newGroup' },\n { name: 'addToGroup', call: 'shh_addToGroup' }\n ];\n};\n\n/// @returns an array of objects describing web3.eth.watch api methods\nvar ethWatchMethods = function () {\n var newFilter = function (args) {\n return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';\n };\n\n return [\n { name: 'newFilter', call: newFilter },\n { name: 'uninstallFilter', call: 'eth_uninstallFilter' },\n { name: 'getMessages', call: 'eth_filterLogs' }\n ];\n};\n\n/// @returns an array of objects describing web3.shh.watch api methods\nvar shhWatchMethods = function () {\n return [\n { name: 'newFilter', call: 'shh_newFilter' },\n { name: 'uninstallFilter', call: 'shh_uninstallFilter' },\n { name: 'getMessage', call: 'shh_getMessages' }\n ];\n};\n\n/// creates methods in a given object based on method description on input\n/// setups api calls for these methods\nvar setupMethods = function (obj, methods) {\n methods.forEach(function (method) {\n obj[method.name] = function () {\n var args = Array.prototype.slice.call(arguments);\n var call = typeof method.call === 'function' ? method.call(args) : method.call;\n var result = web3.provider.send({\n call: call,\n args: args\n });\n \n result = JSON.parse(result);\n return result.result;\n\n };\n });\n};\n\n/// creates properties in a given object based on properties description on input\n/// setups api calls for these properties\nvar setupProperties = function (obj, properties) {\n properties.forEach(function (property) {\n var proto = {};\n proto.get = function () {\n var result = web3.provider.send({\n call: property.getter\n });\n\n result = JSON.parse(result);\n return result.result;\n\n };\n if (property.setter) {\n proto.set = function (val) {\n var result = web3.provider.send({\n call: property.setter,\n args: [val]\n });\n\n result = JSON.parse(result);\n return result.result;\n\n };\n }\n Object.defineProperty(obj, property.name, proto);\n });\n};\n\n// TODO: import from a dependency, don't duplicate.\nvar hexToDec = function (hex) {\n return parseInt(hex, 16).toString();\n};\n\nvar decToHex = function (dec) {\n return parseInt(dec).toString(16);\n};\n\n/// setups web3 object, and it's in-browser executed methods\nvar web3 = {\n _callbacks: {},\n _events: {},\n providers: {},\n\n toHex: function(str) {\n var hex = \"\";\n for(var i = 0; i < str.length; i++) {\n var n = str.charCodeAt(i).toString(16);\n hex += n.length < 2 ? '0' + n : n;\n }\n\n return hex;\n },\n\n /// @returns ascii string representation of hex value prefixed with 0x\n toAscii: function(hex) {\n // Find termination\n var str = \"\";\n var i = 0, l = hex.length;\n if (hex.substring(0, 2) === '0x')\n i = 2;\n for(; i < l; i+=2) {\n var code = parseInt(hex.substr(i, 2), 16);\n if(code === 0) {\n break;\n }\n\n str += String.fromCharCode(code);\n }\n\n return str;\n },\n\n /// @returns hex representation (prefixed by 0x) of ascii string\n fromAscii: function(str, pad) {\n pad = pad === undefined ? 0 : pad;\n var hex = this.toHex(str);\n while(hex.length < pad*2)\n hex += \"00\";\n return \"0x\" + hex;\n },\n\n /// @returns decimal representaton of hex value prefixed by 0x\n toDecimal: function (val) {\n return hexToDec(val.substring(2));\n },\n\n /// @returns hex representation (prefixed by 0x) of decimal value\n fromDecimal: function (val) {\n return \"0x\" + decToHex(val);\n },\n\n /// used to transform value/string to eth string\n toEth: function(str) {\n var val = typeof str === \"string\" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;\n var unit = 0;\n var units = [ 'wei', 'Kwei', 'Mwei', 'Gwei', 'szabo', 'finney', 'ether', 'grand', 'Mether', 'Gether', 'Tether', 'Pether', 'Eether', 'Zether', 'Yether', 'Nether', 'Dether', 'Vether', 'Uether' ];\n while (val > 3000 && unit < units.length - 1)\n {\n val /= 1000;\n unit++;\n }\n var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);\n var replaceFunction = function($0, $1, $2) {\n return $1 + ',' + $2;\n };\n\n while (true) {\n var o = s;\n s = s.replace(/(\\d)(\\d\\d\\d[\\.\\,])/, replaceFunction);\n if (o === s)\n break;\n }\n return s + ' ' + units[unit];\n },\n\n /// eth object prototype\n eth: {\n watch: function (params) {\n return new web3.filter(params, ethWatch);\n }\n },\n\n /// db object prototype\n db: {},\n\n /// shh object prototype\n shh: {\n watch: function (params) {\n return new web3.filter(params, shhWatch);\n }\n },\n\n /// used by filter to register callback with given id\n on: function(event, id, cb) {\n if(web3._events[event] === undefined) {\n web3._events[event] = {};\n }\n\n web3._events[event][id] = cb;\n return this;\n },\n\n /// used by filter to unregister callback with given id\n off: function(event, id) {\n if(web3._events[event] !== undefined) {\n delete web3._events[event][id];\n }\n\n return this;\n },\n\n /// used to trigger callback registered by filter\n trigger: function(event, id, data) {\n var callbacks = web3._events[event];\n if (!callbacks || !callbacks[id]) {\n return;\n }\n var cb = callbacks[id];\n cb(data);\n },\n\n /// @returns true if provider is installed\n haveProvider: function() {\n return !!web3.provider.provider;\n }\n};\n\n/// setups all api methods\nsetupMethods(web3, web3Methods());\nsetupMethods(web3.eth, ethMethods());\nsetupProperties(web3.eth, ethProperties());\nsetupMethods(web3.db, dbMethods());\nsetupMethods(web3.shh, shhMethods());\n\nvar ethWatch = {\n changed: 'eth_changed'\n};\n\nsetupMethods(ethWatch, ethWatchMethods());\n\nvar shhWatch = {\n changed: 'shh_changed'\n};\n\nsetupMethods(shhWatch, shhWatchMethods());\n\nweb3.setProvider = function(provider) {\n provider.onmessage = messageHandler;\n web3.provider.set(provider);\n web3.provider.sendQueued();\n};\n\n/// callled when there is new incoming message\nfunction messageHandler(data) {\n if(data._event !== undefined) {\n web3.trigger(data._event, data._id, data.data);\n return;\n }\n\n if(data._id) {\n var cb = web3._callbacks[data._id];\n if (cb) {\n cb.call(this, data.error, data.data);\n delete web3._callbacks[data._id];\n }\n }\n}\n\nmodule.exports = web3;\n\n",
"var web3 = require('./lib/web3');\nvar ProviderManager = require('./lib/providermanager');\nweb3.provider = new ProviderManager();\nweb3.filter = require('./lib/filter');\nweb3.providers.HttpSyncProvider = require('./lib/httpsync');\nweb3.eth.contract = require('./lib/contract');\nweb3.abi = require('./lib/abi');\n\n\nmodule.exports = web3;\n"
]
} \ No newline at end of file
diff --git a/dist/ethereum.min.js b/dist/ethereum.min.js
index 264ae2b5b..e74e5b642 100644
--- a/dist/ethereum.min.js
+++ b/dist/ethereum.min.js
@@ -1 +1 @@
-require=function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var f="function"==typeof require&&require;if(!u&&f)return f(a,!0);if(o)return o(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e){var n=t("./web3");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var r=32,i=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},o=function(t,e){return i(t,function(t){return t.name===e})},a=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},u=function(t){return function(e){return 0===e.indexOf(t)}},f=function(t){return function(e){return t===e}},s=function(t){return"[]"===t.slice(-2)},c=function(t){var e=2*r;return t instanceof BigNumber||"number"==typeof t?("number"==typeof t&&(t=new BigNumber(t)),t=t.round(),t.lessThan(0)&&(t=new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?c(new BigNumber(t)):(+t).toString(16),a(t,e)},l=function(t){return n.fromAscii(t,r).substr(2)},h=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},p=function(t){return c(new BigNumber(t).times(new BigNumber(2).pow(128)))},d=function(t,e){return s(t)||u("string")(t)?c(e.length):""},g=function(){return[{type:u("uint"),format:c},{type:u("int"),format:c},{type:u("hash"),format:c},{type:u("string"),format:l},{type:u("real"),format:p},{type:u("ureal"),format:p},{type:f("address"),format:c},{type:f("bool"),format:h}]},m=g(),v=function(t,e,n){var r="",i=o(t,e);if(-1!==i){var a=t[i];return a.inputs.forEach(function(t,e){r+=d(t.type,n[e])}),a.inputs.forEach(function(t,e){for(var i=!1,o=0;o<m.length&&!i;o++)i=m[o].type(a.inputs[e].type,n[e]);i||console.error("input parser does not support type: "+a.inputs[e].type);var u=m[o-1].format,f="";f=s(a.inputs[e].type)?n[e].reduce(function(t,e){return t+u(e)},""):u(n[e]),r+=f}),r}},b=function(t){return"1"===new BigNumber(t.substr(0,1),16).toString(2).substr(0,1)},y=function(t){return b(t)?new BigNumber(t,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(t,16)},_=function(t){return new BigNumber(t,16)},w=function(t){return y(t).dividedBy(new BigNumber(2).pow(128))},N=function(t){return _(t).dividedBy(new BigNumber(2).pow(128))},x=function(t){return"0x"+t},B=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},S=function(t){return n.toAscii(t)},A=function(t){return"0x"+t.slice(t.length-40,t.length)},O=function(t){return s(t)||u("string")(t)?2*r:0},P=function(){return[{type:u("uint"),format:_},{type:u("int"),format:y},{type:u("hash"),format:x},{type:u("string"),format:S},{type:u("real"),format:w},{type:u("ureal"),format:N},{type:f("address"),format:A},{type:f("bool"),format:B}]},k=P(),E=function(t,e,n){var i=o(t,e);if(-1!==i){n=n.slice(2);var a=[],f=t[i],c=2*r,l=f.outputs.reduce(function(t,e){return t+O(e.type)},0),h=n.slice(0,l);return n=n.slice(l),f.outputs.forEach(function(t,e){for(var r=!1,i=0;i<k.length&&!r;i++)r=k[i].type(f.outputs[e].type);r||console.error("output parser does not support type: "+f.outputs[e].type);var o=k[i-1].format;if(s(f.outputs[e].type)){var l=_(h.slice(0,c));h=h.slice(c);for(var p=[],d=0;l>d;d++)p.push(o(n.slice(0,c))),n=n.slice(c);a.push(p)}else u("string")(f.outputs[e].type)?(h=h.slice(c),a.push(o(n.slice(0,c))),n=n.slice(c)):(a.push(o(n.slice(0,c))),n=n.slice(c))}),a}},F=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},D=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)):""},I=function(t){var e={};return t.forEach(function(n){var r=F(n.name),i=D(n.name),o=function(){var e=Array.prototype.slice.call(arguments);return v(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},M=function(t){var e={};return t.forEach(function(n){var r=F(n.name),i=D(n.name),o=function(e){return E(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},T=function(t,e){return n.sha3(n.fromAscii(e))};e.exports={inputParser:I,outputParser:M,methodSignature:T,methodDisplayName:F,methodTypeName:D}},{"./web3":6}],2:[function(t,e){var n=t("./web3"),r=t("./abi"),i=4,o=function(t,e){var o=r.inputParser(e),a=r.outputParser(e),u={};return e.forEach(function(f){var s=r.methodDisplayName(f.name),c=r.methodTypeName(f.name),l=function(){var u=Array.prototype.slice.call(arguments),l=o[s][c].apply(null,u),h=function(t){return a[s][c](t)};return{call:function(o){return o=o||{},o.to=t,r.methodSignature(e,f.name).then(function(t){return o.data=t.slice(0,2+2*i)+l,n.eth.call(o).then(h)})},transact:function(o){return o=o||{},o.to=t,r.methodSignature(e,f.name).then(function(r){return o.data=r.slice(0,2+2*i)+l,n._currentContractAbi=e,n._currentContractAddress=t,n.eth.transact(o).then(h)})}}};void 0===u[s]&&(u[s]=l),u[s][c]=l}),u};e.exports=o},{"./abi":1,"./web3":6}],3:[function(t,e){var n=t("./web3"),r=function(t,e){this.impl=e,this.callbacks=[];var r=this;this.promise=e.newFilter(t),this.promise.then(function(t){r.id=t,n.on(e.changed,t,r.trigger.bind(r)),n.provider.startPolling({call:e.changed,args:[t]},t)})};r.prototype.arrived=function(t){this.changed(t)},r.prototype.changed=function(t){var e=this;this.promise.then(function(){e.callbacks.push(t)})},r.prototype.trigger=function(t){for(var e=0;e<this.callbacks.length;e++)this.callbacks[e].call(this,t)},r.prototype.uninstall=function(){var t=this;this.promise.then(function(e){t.impl.uninstallFilter(e),n.provider.stopPolling(e),n.off(impl.changed,e)})},r.prototype.messages=function(){var t=this;return this.promise.then(function(e){return t.impl.getMessages(e)})},r.prototype.logs=function(){return this.messages()},e.exports=r},{"./web3":6}],4:[function(t,e){function n(t){return{jsonrpc:"2.0",method:t.call,params:t.args,id:t._id}}var r=function(t){this.handlers=[],this.host=t};r.prototype.send=function(t){var e=n(t),r=new XMLHttpRequest;return r.open("POST",this.host,!1),r.send(JSON.stringify(e)),r.responseText},e.exports=r},{}],5:[function(t,e){var n=(t("./web3"),function(){this.queued=[],this.polls=[],this.ready=!1,this.provider=void 0,this.id=1;var t=this,e=function(){t.provider&&t.provider.poll&&t.polls.forEach(function(e){e.data._id=t.id,t.id++,t.provider.poll(e.data,e.id)}),setTimeout(e,12e3)};e()});n.prototype.send=function(t){return t._id=this.id,t.args=t.args||[],this.id++,void 0===this.provider&&console.error("provider is not set"),this.provider.send(t)},n.prototype.set=function(t){void 0!==this.provider&&void 0!==this.provider.unload&&this.provider.unload(),this.provider=t,this.ready=!0},n.prototype.sendQueued=function(){for(var t=0;this.queued.length;t++)this.send(this.queued[t])},n.prototype.installed=function(){return void 0!==this.provider},n.prototype.startPolling=function(t,e){this.provider&&this.provider.poll&&this.polls.push({data:t,id:e})},n.prototype.stopPolling=function(t){for(var e=this.polls.length;e--;){var n=this.polls[e];n.id===t&&this.polls.splice(e,1)}},e.exports=n},{"./web3":6}],6:[function(t,e){function n(t){if(void 0!==t._event)return void d.trigger(t._event,t._id,t.data);if(t._id){var e=d._callbacks[t._id];e&&(e.call(this,t.error,t.data),delete d._callbacks[t._id])}}var r=function(){return[{name:"sha3",call:"web3_sha3"}]},i=function(){var t=function(t){return"string"==typeof t[0]?"eth_blockByHash":"eth_blockByNumber"},e=function(t){return"string"==typeof t[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(t){return"string"==typeof t[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:e},{name:"uncle",call:n},{name:"compilers",call:"eth_compilers"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"}];return r},o=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"account",getter:"eth_account"},{name:"accounts",getter:"eth_accounts"},{name:"peerCount",getter:"eth_peerCount"},{name:"defaultBlock",getter:"eth_defaultBlock",setter:"eth_setDefaultBlock"},{name:"number",getter:"eth_number"}]},a=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]},u=function(){return[{name:"post",call:"shh_post"},{name:"newIdentity",call:"shh_newIdentity"},{name:"haveIdentity",call:"shh_haveIdentity"},{name:"newGroup",call:"shh_newGroup"},{name:"addToGroup",call:"shh_addToGroup"}]},f=function(){var t=function(t){return"string"==typeof t[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:t},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},s=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessage",call:"shh_getMessages"}]},c=function(t,e){e.forEach(function(e){t[e.name]=function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof e.call?e.call(t):e.call,r=d.provider.send({call:n,args:t});return r=JSON.parse(r),r.result}})},l=function(t,e){e.forEach(function(e){var n={};n.get=function(){var t=d.provider.send({call:e.getter});return t=JSON.parse(t),t.result},e.setter&&(n.set=function(t){var n=d.provider.send({call:e.setter,args:[t]});return n=JSON.parse(n),n.result}),Object.defineProperty(t,e.name,n)})},h=function(t){return parseInt(t,16).toString()},p=function(t){return parseInt(t).toString(16)},d={_callbacks:{},_events:{},providers:{},toHex:function(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}return e},toAscii:function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},fromAscii:function(t,e){e=void 0===e?0:e;for(var n=this.toHex(t);n.length<2*e;)n+="00";return"0x"+n},toDecimal:function(t){return h(t.substring(2))},fromDecimal:function(t){return"0x"+p(t)},toEth:function(t){for(var e="string"==typeof t?0===t.indexOf("0x")?parseInt(t.substr(2),16):parseInt(t):t,n=0,r=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e>3e3&&n<r.length-1;)e/=1e3,n++;for(var i=e.toString().length<e.toFixed(2).length?e.toString():e.toFixed(2),o=function(t,e,n){return e+","+n};;){var a=i;if(i=i.replace(/(\d)(\d\d\d[\.\,])/,o),a===i)break}return i+" "+r[n]},eth:{watch:function(t){return new d.filter(t,g)}},db:{},shh:{watch:function(t){return new d.filter(t,m)}},on:function(t,e,n){return void 0===d._events[t]&&(d._events[t]={}),d._events[t][e]=n,this},off:function(t,e){return void 0!==d._events[t]&&delete d._events[t][e],this},trigger:function(t,e,n){var r=d._events[t];if(r&&r[e]){var i=r[e];i(n)}},haveProvider:function(){return!!d.provider.provider}};c(d,r()),c(d.eth,i()),l(d.eth,o()),c(d.db,a()),c(d.shh,u());var g={changed:"eth_changed"};c(g,f());var m={changed:"shh_changed"};c(m,s()),d.setProvider=function(t){t.onmessage=n,d.provider.set(t),d.provider.sendQueued()},e.exports=d},{}],web3:[function(t,e){var n=t("./lib/web3"),r=t("./lib/providermanager");n.provider=new r,n.filter=t("./lib/filter"),n.providers.HttpSyncProvider=t("./lib/httpsync"),n.eth.contract=t("./lib/contract"),n.abi=t("./lib/abi"),e.exports=n},{"./lib/abi":1,"./lib/contract":2,"./lib/filter":3,"./lib/httpsync":4,"./lib/providermanager":5,"./lib/web3":6}]},{},["web3"]); \ No newline at end of file
+require=function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var f="function"==typeof require&&require;if(!u&&f)return f(a,!0);if(o)return o(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e){var n=t("./web3");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var r=32,i=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},o=function(t,e){return i(t,function(t){return t.name===e})},a=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},u=function(t){return function(e){return 0===e.indexOf(t)}},f=function(t){return function(e){return t===e}},s=function(t){return"[]"===t.slice(-2)},c=function(t){var e=2*r;return t instanceof BigNumber||"number"==typeof t?("number"==typeof t&&(t=new BigNumber(t)),t=t.round(),t.lessThan(0)&&(t=new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?c(new BigNumber(t)):(+t).toString(16),a(t,e)},l=function(t){return n.fromAscii(t,r).substr(2)},h=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},p=function(t){return c(new BigNumber(t).times(new BigNumber(2).pow(128)))},d=function(t,e){return s(t)||u("string")(t)?c(e.length):""},g=function(){return[{type:u("uint"),format:c},{type:u("int"),format:c},{type:u("hash"),format:c},{type:u("string"),format:l},{type:u("real"),format:p},{type:u("ureal"),format:p},{type:f("address"),format:c},{type:f("bool"),format:h}]},m=g(),v=function(t,e,n){var r="",i=o(t,e);if(-1!==i){var a=t[i];return a.inputs.forEach(function(t,e){r+=d(t.type,n[e])}),a.inputs.forEach(function(t,e){for(var i=!1,o=0;o<m.length&&!i;o++)i=m[o].type(a.inputs[e].type,n[e]);i||console.error("input parser does not support type: "+a.inputs[e].type);var u=m[o-1].format,f="";f=s(a.inputs[e].type)?n[e].reduce(function(t,e){return t+u(e)},""):u(n[e]),r+=f}),r}},b=function(t){return"1"===new BigNumber(t.substr(0,1),16).toString(2).substr(0,1)},y=function(t){return b(t)?new BigNumber(t,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(t,16)},_=function(t){return new BigNumber(t,16)},w=function(t){return y(t).dividedBy(new BigNumber(2).pow(128))},N=function(t){return _(t).dividedBy(new BigNumber(2).pow(128))},x=function(t){return"0x"+t},B=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},S=function(t){return n.toAscii(t)},A=function(t){return"0x"+t.slice(t.length-40,t.length)},O=function(t){return s(t)||u("string")(t)?2*r:0},P=function(){return[{type:u("uint"),format:_},{type:u("int"),format:y},{type:u("hash"),format:x},{type:u("string"),format:S},{type:u("real"),format:w},{type:u("ureal"),format:N},{type:f("address"),format:A},{type:f("bool"),format:B}]},k=P(),E=function(t,e,n){var i=o(t,e);if(-1!==i){n=n.slice(2);var a=[],f=t[i],c=2*r,l=f.outputs.reduce(function(t,e){return t+O(e.type)},0),h=n.slice(0,l);return n=n.slice(l),f.outputs.forEach(function(t,e){for(var r=!1,i=0;i<k.length&&!r;i++)r=k[i].type(f.outputs[e].type);r||console.error("output parser does not support type: "+f.outputs[e].type);var o=k[i-1].format;if(s(f.outputs[e].type)){var l=_(h.slice(0,c));h=h.slice(c);for(var p=[],d=0;l>d;d++)p.push(o(n.slice(0,c))),n=n.slice(c);a.push(p)}else u("string")(f.outputs[e].type)?(h=h.slice(c),a.push(o(n.slice(0,c))),n=n.slice(c)):(a.push(o(n.slice(0,c))),n=n.slice(c))}),a}},F=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},D=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)):""},I=function(t){var e={};return t.forEach(function(n){var r=F(n.name),i=D(n.name),o=function(){var e=Array.prototype.slice.call(arguments);return v(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},M=function(t){var e={};return t.forEach(function(n){var r=F(n.name),i=D(n.name),o=function(e){return E(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},T=function(t,e){return n.sha3(n.fromAscii(e))};e.exports={inputParser:I,outputParser:M,methodSignature:T,methodDisplayName:F,methodTypeName:D}},{"./web3":6}],2:[function(t,e){var n=t("./web3"),r=t("./abi"),i=4,o=function(t,e){var o=r.inputParser(e),a=r.outputParser(e),u={};return e.forEach(function(f){var s=r.methodDisplayName(f.name),c=r.methodTypeName(f.name),l=function(){var u=Array.prototype.slice.call(arguments),l=o[s][c].apply(null,u),h=function(t){return a[s][c](t)};return{call:function(o){return o=o||{},o.to=t,r.methodSignature(e,f.name).then(function(t){return o.data=t.slice(0,2+2*i)+l,n.eth.call(o).then(h)})},transact:function(o){return o=o||{},o.to=t,r.methodSignature(e,f.name).then(function(r){return o.data=r.slice(0,2+2*i)+l,n._currentContractAbi=e,n._currentContractAddress=t,n.eth.transact(o).then(h)})}}};void 0===u[s]&&(u[s]=l),u[s][c]=l}),u};e.exports=o},{"./abi":1,"./web3":6}],3:[function(t,e){var n=t("./web3"),r=function(t,e){this.impl=e,this.callbacks=[];var r=this;this.promise=e.newFilter(t),this.promise.then(function(t){r.id=t,n.on(e.changed,t,r.trigger.bind(r)),n.provider.startPolling({call:e.changed,args:[t]},t)})};r.prototype.arrived=function(t){this.changed(t)},r.prototype.changed=function(t){var e=this;this.promise.then(function(){e.callbacks.push(t)})},r.prototype.trigger=function(t){for(var e=0;e<this.callbacks.length;e++)this.callbacks[e].call(this,t)},r.prototype.uninstall=function(){var t=this;this.promise.then(function(e){t.impl.uninstallFilter(e),n.provider.stopPolling(e),n.off(impl.changed,e)})},r.prototype.messages=function(){var t=this;return this.promise.then(function(e){return t.impl.getMessages(e)})},r.prototype.logs=function(){return this.messages()},e.exports=r},{"./web3":6}],4:[function(t,e){function n(t){return{jsonrpc:"2.0",method:t.call,params:t.args,id:t._id}}var r=function(t){this.handlers=[],this.host=t};r.prototype.send=function(t){var e=n(t),r=new XMLHttpRequest;return r.open("POST",this.host,!1),r.send(JSON.stringify(e)),r.responseText},e.exports=r},{}],5:[function(t,e){var n=(t("./web3"),function(){this.queued=[],this.polls=[],this.ready=!1,this.provider=void 0,this.id=1;var t=this,e=function(){t.provider&&t.provider.poll&&t.polls.forEach(function(e){e.data._id=t.id,t.id++,t.provider.poll(e.data,e.id)}),setTimeout(e,12e3)};e()});n.prototype.send=function(t){return t._id=this.id,t.args=t.args||[],this.id++,void 0===this.provider?(console.error("provider is not set"),JSON.stringify({result:"error, provider is not set"})):this.provider.send(t)},n.prototype.set=function(t){void 0!==this.provider&&void 0!==this.provider.unload&&this.provider.unload(),this.provider=t,this.ready=!0},n.prototype.sendQueued=function(){for(var t=0;this.queued.length;t++)this.send(this.queued[t])},n.prototype.installed=function(){return void 0!==this.provider},n.prototype.startPolling=function(t,e){this.provider&&this.provider.poll&&this.polls.push({data:t,id:e})},n.prototype.stopPolling=function(t){for(var e=this.polls.length;e--;){var n=this.polls[e];n.id===t&&this.polls.splice(e,1)}},e.exports=n},{"./web3":6}],6:[function(t,e){function n(t){if(void 0!==t._event)return void d.trigger(t._event,t._id,t.data);if(t._id){var e=d._callbacks[t._id];e&&(e.call(this,t.error,t.data),delete d._callbacks[t._id])}}var r=function(){return[{name:"sha3",call:"web3_sha3"}]},i=function(){var t=function(t){return"string"==typeof t[0]?"eth_blockByHash":"eth_blockByNumber"},e=function(t){return"string"==typeof t[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(t){return"string"==typeof t[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:e},{name:"uncle",call:n},{name:"compilers",call:"eth_compilers"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"}];return r},o=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"account",getter:"eth_account"},{name:"accounts",getter:"eth_accounts"},{name:"peerCount",getter:"eth_peerCount"},{name:"defaultBlock",getter:"eth_defaultBlock",setter:"eth_setDefaultBlock"},{name:"number",getter:"eth_number"}]},a=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]},u=function(){return[{name:"post",call:"shh_post"},{name:"newIdentity",call:"shh_newIdentity"},{name:"haveIdentity",call:"shh_haveIdentity"},{name:"newGroup",call:"shh_newGroup"},{name:"addToGroup",call:"shh_addToGroup"}]},f=function(){var t=function(t){return"string"==typeof t[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:t},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},s=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessage",call:"shh_getMessages"}]},c=function(t,e){e.forEach(function(e){t[e.name]=function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof e.call?e.call(t):e.call,r=d.provider.send({call:n,args:t});return r=JSON.parse(r),r.result}})},l=function(t,e){e.forEach(function(e){var n={};n.get=function(){var t=d.provider.send({call:e.getter});return t=JSON.parse(t),t.result},e.setter&&(n.set=function(t){var n=d.provider.send({call:e.setter,args:[t]});return n=JSON.parse(n),n.result}),Object.defineProperty(t,e.name,n)})},h=function(t){return parseInt(t,16).toString()},p=function(t){return parseInt(t).toString(16)},d={_callbacks:{},_events:{},providers:{},toHex:function(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}return e},toAscii:function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},fromAscii:function(t,e){e=void 0===e?0:e;for(var n=this.toHex(t);n.length<2*e;)n+="00";return"0x"+n},toDecimal:function(t){return h(t.substring(2))},fromDecimal:function(t){return"0x"+p(t)},toEth:function(t){for(var e="string"==typeof t?0===t.indexOf("0x")?parseInt(t.substr(2),16):parseInt(t):t,n=0,r=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e>3e3&&n<r.length-1;)e/=1e3,n++;for(var i=e.toString().length<e.toFixed(2).length?e.toString():e.toFixed(2),o=function(t,e,n){return e+","+n};;){var a=i;if(i=i.replace(/(\d)(\d\d\d[\.\,])/,o),a===i)break}return i+" "+r[n]},eth:{watch:function(t){return new d.filter(t,g)}},db:{},shh:{watch:function(t){return new d.filter(t,m)}},on:function(t,e,n){return void 0===d._events[t]&&(d._events[t]={}),d._events[t][e]=n,this},off:function(t,e){return void 0!==d._events[t]&&delete d._events[t][e],this},trigger:function(t,e,n){var r=d._events[t];if(r&&r[e]){var i=r[e];i(n)}},haveProvider:function(){return!!d.provider.provider}};c(d,r()),c(d.eth,i()),l(d.eth,o()),c(d.db,a()),c(d.shh,u());var g={changed:"eth_changed"};c(g,f());var m={changed:"shh_changed"};c(m,s()),d.setProvider=function(t){t.onmessage=n,d.provider.set(t),d.provider.sendQueued()},e.exports=d},{}],web3:[function(t,e){var n=t("./lib/web3"),r=t("./lib/providermanager");n.provider=new r,n.filter=t("./lib/filter"),n.providers.HttpSyncProvider=t("./lib/httpsync"),n.eth.contract=t("./lib/contract"),n.abi=t("./lib/abi"),e.exports=n},{"./lib/abi":1,"./lib/contract":2,"./lib/filter":3,"./lib/httpsync":4,"./lib/providermanager":5,"./lib/web3":6}]},{},["web3"]); \ No newline at end of file
diff --git a/lib/providermanager.js b/lib/providermanager.js
index 83ea9417b..90e5ee409 100644
--- a/lib/providermanager.js
+++ b/lib/providermanager.js
@@ -63,7 +63,8 @@ ProviderManager.prototype.send = function(data) {
this.id++;
if (this.provider === undefined) {
- console.error("provider is not set");
+ console.error('provider is not set');
+ return JSON.stringify({result: 'error, provider is not set'});
}
return this.provider.send(data);
diff --git a/lib/web3.js b/lib/web3.js
index 58bcc0c3f..166bf68de 100644
--- a/lib/web3.js
+++ b/lib/web3.js
@@ -23,48 +23,6 @@
* @date 2014
*/
-/// 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
-function flattenPromise (obj) {
- if (obj instanceof Promise) {
- return Promise.resolve(obj);
- }
-
- if (obj instanceof Array) {
- return new Promise(function (resolve) {
- var promises = obj.map(function (o) {
- return flattenPromise(o);
- });
-
- return Promise.all(promises).then(function (res) {
- for (var i = 0; i < obj.length; i++) {
- obj[i] = res[i];
- }
- resolve(obj);
- });
- });
- }
-
- if (obj instanceof Object) {
- return new Promise(function (resolve) {
- var keys = Object.keys(obj);
- var promises = keys.map(function (key) {
- return flattenPromise(obj[key]);
- });
-
- return Promise.all(promises).then(function (res) {
- for (var i = 0; i < keys.length; i++) {
- obj[keys[i]] = res[i];
- }
- resolve(obj);
- });
- });
- }
-
- return Promise.resolve(obj);
-}
-
/// @returns an array of objects describing web3 api methods
var web3Methods = function () {
return [
@@ -179,22 +137,6 @@ var setupMethods = function (obj, methods) {
result = JSON.parse(result);
return result.result;
- //return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) {
- //var call = typeof method.call === "function" ? method.call(args) : method.call;
- //return {call: call, args: args};
- //}).then(function (request) {
- //return new Promise(function (resolve, reject) {
- //web3.provider.send(request, function (err, result) {
- //if (!err) {
- //resolve(result);
- //return;
- //}
- //reject(err);
- //});
- //});
- //}).catch(function(err) {
- //console.error(err);
- //});
};
});
};
@@ -212,16 +154,6 @@ var setupProperties = function (obj, properties) {
result = JSON.parse(result);
return result.result;
-
- //return new Promise(function(resolve, reject) {
- //web3.provider.send({call: property.getter}, function(err, result) {
- //if (!err) {
- //resolve(result);
- //return;
- //}
- //reject(err);
- //});
- //});
};
if (property.setter) {
proto.set = function (val) {
@@ -233,19 +165,6 @@ var setupProperties = function (obj, properties) {
result = JSON.parse(result);
return result.result;
- //return flattenPromise([val]).then(function (args) {
- //return new Promise(function (resolve) {
- //web3.provider.send({call: property.setter, args: args}, function (err, result) {
- //if (!err) {
- //resolve(result);
- //return;
- //}
- //reject(err);
- //});
- //});
- //}).catch(function (err) {
- //console.error(err);
- //});
};
}
Object.defineProperty(obj, property.name, proto);
diff --git a/test/db.methods.js b/test/db.methods.js
index 662f4e7cc..55cf699fe 100644
--- a/test/db.methods.js
+++ b/test/db.methods.js
@@ -3,7 +3,6 @@ require('es6-promise').polyfill();
var assert = require('assert');
var web3 = require('../index.js');
var u = require('./utils.js');
-web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider
describe('web3', function() {
describe('db', function() {
diff --git a/test/eth.methods.js b/test/eth.methods.js
index 892db0d8b..5baedb884 100644
--- a/test/eth.methods.js
+++ b/test/eth.methods.js
@@ -3,7 +3,6 @@ require('es6-promise').polyfill();
var assert = require('assert');
var web3 = require('../index.js');
var u = require('./utils.js');
-web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider
describe('web3', function() {
describe('eth', function() {
diff --git a/test/shh.methods.js b/test/shh.methods.js
index f2f56edbc..2e7e1387b 100644
--- a/test/shh.methods.js
+++ b/test/shh.methods.js
@@ -3,7 +3,6 @@ require('es6-promise').polyfill();
var assert = require('assert');
var web3 = require('../index.js');
var u = require('./utils.js');
-web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider
describe('web3', function() {
describe('shh', function() {
diff --git a/test/utils.js b/test/utils.js
index 8617348e4..8a1e9a0b6 100644
--- a/test/utils.js
+++ b/test/utils.js
@@ -8,7 +8,7 @@ var methodExists = function (object, method) {
var propertyExists = function (object, property) {
it('should have property ' + property + ' implemented', function() {
- assert.equal('object', typeof object[property], 'property ' + property + ' is not implemented');
+ assert.notEqual('undefined', typeof object[property], 'property ' + property + ' is not implemented');
});
};
diff --git a/test/web3.methods.js b/test/web3.methods.js
index 5c30177e5..3ff4103e3 100644
--- a/test/web3.methods.js
+++ b/test/web3.methods.js
@@ -3,7 +3,6 @@ require('es6-promise').polyfill();
var assert = require('assert');
var web3 = require('../index.js');
var u = require('./utils.js');
-web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider
describe('web3', function() {
u.methodExists(web3, 'sha3');