aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-19 18:36:41 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-19 18:36:41 +0800
commit86b417e83f1f631cd55d16596b458b74601c43e5 (patch)
treeaea7f955094fab0bce6ee03bea8eaac6d27f5547
parent823fb2995b0ff6ebaf257206ad1ecf827b8567b8 (diff)
downloaddexon-86b417e83f1f631cd55d16596b458b74601c43e5.tar
dexon-86b417e83f1f631cd55d16596b458b74601c43e5.tar.gz
dexon-86b417e83f1f631cd55d16596b458b74601c43e5.tar.bz2
dexon-86b417e83f1f631cd55d16596b458b74601c43e5.tar.lz
dexon-86b417e83f1f631cd55d16596b458b74601c43e5.tar.xz
dexon-86b417e83f1f631cd55d16596b458b74601c43e5.tar.zst
dexon-86b417e83f1f631cd55d16596b458b74601c43e5.zip
fixes for autoprovider
-rw-r--r--dist/ethereum.js8
-rw-r--r--dist/ethereum.js.map6
-rw-r--r--dist/ethereum.min.js2
-rw-r--r--lib/autoprovider.js5
-rw-r--r--lib/providermanager.js1
5 files changed, 9 insertions, 13 deletions
diff --git a/dist/ethereum.js b/dist/ethereum.js
index 8062c7daf..aadbf6835 100644
--- a/dist/ethereum.js
+++ b/dist/ethereum.js
@@ -387,10 +387,9 @@ module.exports = {
* if it fails, it uses HttpRpcProvider
*/
-// TODO: is these line is supposed to be here?
+var web3 = require('./web3'); // jshint ignore:line
if ("build" !== 'build') {/*
var WebSocket = require('ws'); // jshint ignore:line
- var web3 = require('./web3'); // jshint ignore:line
*/}
/**
@@ -433,7 +432,7 @@ var AutoProvider = function (userOptions) {
self.poll = self.provider.poll.bind(self.provider);
}
self.sendQueue.forEach(function (payload) {
- self.provider(payload);
+ self.provider.send(payload);
});
self.onmessageQueue.forEach(function (handler) {
self.provider.onmessage = handler;
@@ -474,7 +473,7 @@ Object.defineProperty(AutoProvider.prototype, 'onmessage', {
module.exports = AutoProvider;
-},{}],3:[function(require,module,exports){
+},{"./web3":8}],3:[function(require,module,exports){
/*
This file is part of ethereum.js.
@@ -807,7 +806,6 @@ module.exports = HttpRpcProvider;
* @date 2014
*/
-// TODO: is these line is supposed to be here?
var web3 = require('./web3'); // jshint ignore:line
/**
diff --git a/dist/ethereum.js.map b/dist/ethereum.js.map
index e2efa400b..d6b5a1198 100644
--- a/dist/ethereum.js.map
+++ b/dist/ethereum.js.map
@@ -14,17 +14,17 @@
"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;;ACrWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClGA;AACA;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;;ACrWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA",
"file": "generated.js",
"sourceRoot": "",
"sourcesContent": [
"(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})",
"/*\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 abi.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n var BigNumber = require('bignumber.js'); // jshint ignore:line\n*/}\n\nvar web3 = require('./web3'); // jshint ignore:line\n\nBigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_DOWN });\n\nvar ETH_PADDING = 32;\n\n/// Finds first index of array element matching pattern\n/// @param array\n/// @param callback pattern\n/// @returns index of element\nvar findIndex = function (array, callback) {\n var end = false;\n var i = 0;\n for (; i < array.length && !end; i++) {\n end = callback(array[i]);\n }\n return end ? i - 1 : -1;\n};\n\n/// @returns a function that is used as a pattern for 'findIndex'\nvar findMethodIndex = function (json, methodName) {\n return findIndex(json, function (method) {\n return method.name === methodName;\n });\n};\n\n/// @param string string to be padded\n/// @param number of characters that result string should have\n/// @param sign, by default 0\n/// @returns right aligned string\nvar padLeft = function (string, chars, sign) {\n return new Array(chars - string.length + 1).join(sign ? sign : \"0\") + string;\n};\n\n/// @param expected type prefix (string)\n/// @returns function which checks if type has matching prefix. if yes, returns true, otherwise false\nvar prefixedType = function (prefix) {\n return function (type) {\n return type.indexOf(prefix) === 0;\n };\n};\n\n/// @param expected type name (string)\n/// @returns function which checks if type is matching expected one. if yes, returns true, otherwise false\nvar namedType = function (name) {\n return function (type) {\n return name === type;\n };\n};\n\nvar arrayType = function (type) {\n return type.slice(-2) === '[]';\n};\n\n/// Formats input value to byte representation of int\n/// If value is negative, return it's two's complement\n/// If the value is floating point, round it down\n/// @returns right-aligned byte representation of int\nvar formatInputInt = function (value) {\n var padding = ETH_PADDING * 2;\n if (value instanceof BigNumber || typeof value === 'number') {\n if (typeof value === 'number')\n value = new BigNumber(value);\n value = value.round();\n\n if (value.lessThan(0)) \n value = new BigNumber(\"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\", 16).plus(value).plus(1);\n value = value.toString(16);\n }\n else if (value.indexOf('0x') === 0)\n value = value.substr(2);\n else if (typeof value === 'string')\n value = formatInputInt(new BigNumber(value));\n else\n value = (+value).toString(16);\n return padLeft(value, padding);\n};\n\n/// Formats input value to byte representation of string\n/// @returns left-algined byte representation of string\nvar formatInputString = function (value) {\n return web3.fromAscii(value, ETH_PADDING).substr(2);\n};\n\n/// Formats input value to byte representation of bool\n/// @returns right-aligned byte representation bool\nvar formatInputBool = function (value) {\n return '000000000000000000000000000000000000000000000000000000000000000' + (value ? '1' : '0');\n};\n\nvar dynamicTypeBytes = function (type, value) {\n // TODO: decide what to do with array of strings\n if (arrayType(type) || prefixedType('string')(type))\n return formatInputInt(value.length); \n return \"\";\n};\n\n/// Setups input formatters for solidity types\n/// @returns an array of input formatters \nvar setupInputTypes = function () {\n \n return [\n { type: prefixedType('uint'), format: formatInputInt },\n { type: prefixedType('int'), format: formatInputInt },\n { type: prefixedType('hash'), format: formatInputInt },\n { type: prefixedType('string'), format: formatInputString }, \n { type: prefixedType('real'), format: formatInputInt },\n { type: prefixedType('ureal'), format: formatInputInt },\n { type: namedType('address'), format: formatInputInt },\n { type: namedType('bool'), format: formatInputBool }\n ];\n};\n\nvar inputTypes = setupInputTypes();\n\n/// Formats input params to bytes\n/// @param contract json abi\n/// @param name of the method that we want to use\n/// @param array of params that will be formatted to bytes\n/// @returns bytes representation of input params\nvar toAbiInput = function (json, methodName, params) {\n var bytes = \"\";\n var index = findMethodIndex(json, methodName);\n\n if (index === -1) {\n return;\n }\n\n var method = json[index];\n var padding = ETH_PADDING * 2;\n\n /// first we iterate in search for dynamic \n method.inputs.forEach(function (input, index) {\n bytes += dynamicTypeBytes(input.type, params[index]);\n });\n\n method.inputs.forEach(function (input, i) {\n var typeMatch = false;\n for (var j = 0; j < inputTypes.length && !typeMatch; j++) {\n typeMatch = inputTypes[j].type(method.inputs[i].type, params[i]);\n }\n if (!typeMatch) {\n console.error('input parser does not support type: ' + method.inputs[i].type);\n }\n\n var formatter = inputTypes[j - 1].format;\n var toAppend = \"\";\n\n if (arrayType(method.inputs[i].type))\n toAppend = params[i].reduce(function (acc, curr) {\n return acc + formatter(curr);\n }, \"\");\n else\n toAppend = formatter(params[i]);\n\n bytes += toAppend; \n });\n return bytes;\n};\n\n/// Formats input right-aligned input bytes to int\n/// @returns right-aligned input bytes formatted to int\nvar formatOutputInt = function (value) {\n // check if it's negative number\n // it it is, return two's complement\n var firstBit = new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1);\n if (firstBit === '1') {\n return new BigNumber(value, 16).minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)).minus(1);\n }\n return new BigNumber(value, 16);\n};\n\n/// Formats big right-aligned input bytes to uint\n/// @returns right-aligned input bytes formatted to uint\nvar formatOutputUInt = function (value) {\n return new BigNumber(value, 16);\n};\n\n/// @returns right-aligned input bytes formatted to hex\nvar formatOutputHash = function (value) {\n return \"0x\" + value;\n};\n\n/// @returns right-aligned input bytes formatted to bool\nvar formatOutputBool = function (value) {\n return value === '0000000000000000000000000000000000000000000000000000000000000001' ? true : false;\n};\n\n/// @returns left-aligned input bytes formatted to ascii string\nvar formatOutputString = function (value) {\n return web3.toAscii(value);\n};\n\n/// @returns right-aligned input bytes formatted to address\nvar formatOutputAddress = function (value) {\n return \"0x\" + value.slice(value.length - 40, value.length);\n};\n\nvar dynamicBytesLength = function (type) {\n if (arrayType(type) || prefixedType('string')(type))\n return ETH_PADDING * 2;\n return 0;\n};\n\n/// Setups output formaters for solidity types\n/// @returns an array of output formatters\nvar setupOutputTypes = function () {\n\n return [\n { type: prefixedType('uint'), format: formatOutputUInt },\n { type: prefixedType('int'), format: formatOutputInt },\n { type: prefixedType('hash'), format: formatOutputHash },\n { type: prefixedType('string'), format: formatOutputString },\n { type: prefixedType('real'), format: formatOutputInt },\n { type: prefixedType('ureal'), format: formatOutputInt },\n { type: namedType('address'), format: formatOutputAddress },\n { type: namedType('bool'), format: formatOutputBool }\n ];\n};\n\nvar outputTypes = setupOutputTypes();\n\n/// Formats output bytes back to param list\n/// @param contract json abi\n/// @param name of the method that we want to use\n/// @param bytes representtion of output \n/// @returns array of output params \nvar fromAbiOutput = function (json, methodName, output) {\n var index = findMethodIndex(json, methodName);\n\n if (index === -1) {\n return;\n }\n\n output = output.slice(2);\n\n var result = [];\n var method = json[index];\n var padding = ETH_PADDING * 2;\n\n var dynamicPartLength = method.outputs.reduce(function (acc, curr) {\n return acc + dynamicBytesLength(curr.type);\n }, 0);\n \n var dynamicPart = output.slice(0, dynamicPartLength);\n output = output.slice(dynamicPartLength);\n\n method.outputs.forEach(function (out, i) {\n var typeMatch = false;\n for (var j = 0; j < outputTypes.length && !typeMatch; j++) {\n typeMatch = outputTypes[j].type(method.outputs[i].type);\n }\n\n if (!typeMatch) {\n console.error('output parser does not support type: ' + method.outputs[i].type);\n }\n\n var formatter = outputTypes[j - 1].format;\n if (arrayType(method.outputs[i].type)) {\n var size = formatOutputUInt(dynamicPart.slice(0, padding));\n dynamicPart = dynamicPart.slice(padding);\n var array = [];\n for (var k = 0; k < size; k++) {\n array.push(formatter(output.slice(0, padding))); \n output = output.slice(padding);\n }\n result.push(array);\n }\n else if (prefixedType('string')(method.outputs[i].type)) {\n dynamicPart = dynamicPart.slice(padding); \n result.push(formatter(output.slice(0, padding)));\n output = output.slice(padding);\n } else {\n result.push(formatter(output.slice(0, padding)));\n output = output.slice(padding);\n }\n });\n\n return result;\n};\n\n/// @param json abi for contract\n/// @returns input parser object for given json abi\nvar inputParser = function (json) {\n var parser = {};\n json.forEach(function (method) {\n parser[method.name] = function () {\n var params = Array.prototype.slice.call(arguments);\n return toAbiInput(json, method.name, params);\n };\n });\n\n return parser;\n};\n\n/// @param json abi for contract\n/// @returns output parser for given json abi\nvar outputParser = function (json) {\n var parser = {};\n json.forEach(function (method) {\n parser[method.name] = function (output) {\n return fromAbiOutput(json, method.name, output);\n };\n });\n\n return parser;\n};\n\n/// @param json abi for contract\n/// @param method name for which we want to get method signature\n/// @returns (promise) contract method signature for method with given name\nvar methodSignature = function (json, name) {\n var method = json[findMethodIndex(json, name)];\n var result = name + '(';\n var inputTypes = method.inputs.map(function (inp) {\n return inp.type;\n });\n result += inputTypes.join(',');\n result += ')';\n\n return web3.sha3(web3.fromAscii(result));\n};\n\nmodule.exports = {\n inputParser: inputParser,\n outputParser: outputParser,\n methodSignature: methodSignature\n};\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 autoprovider.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\n/*\n * @brief if qt object is available, uses QtProvider,\n * if not tries to connect over websockets\n * if it fails, it uses HttpRpcProvider\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n var WebSocket = require('ws'); // jshint ignore:line\n var web3 = require('./web3'); // jshint ignore:line\n*/}\n\n/**\n * AutoProvider object prototype is implementing 'provider protocol'\n * Automatically tries to setup correct provider(Qt, WebSockets or HttpRpc)\n * First it checkes if we are ethereum browser (if navigator.qt object is available)\n * if yes, we are using QtProvider\n * if no, we check if it is possible to establish websockets connection with ethereum (ws://localhost:40404/eth is default)\n * if it's not possible, we are using httprpc provider (http://localhost:8080)\n * The constructor allows you to specify uris on which we are trying to connect over http or websockets\n * You can do that by passing objects with fields httrpc and websockets\n */\nvar AutoProvider = function (userOptions) {\n if (web3.haveProvider()) {\n return;\n }\n\n // before we determine what provider we are, we have to cache request\n this.sendQueue = [];\n this.onmessageQueue = [];\n\n if (navigator.qt) {\n this.provider = new web3.providers.QtProvider();\n return;\n }\n\n userOptions = userOptions || {};\n var options = {\n httprpc: userOptions.httprpc || 'http://localhost:8080',\n websockets: userOptions.websockets || 'ws://localhost:40404/eth'\n };\n\n var self = this;\n var closeWithSuccess = function (success) {\n ws.close();\n if (success) {\n self.provider = new web3.providers.WebSocketProvider(options.websockets);\n } else {\n self.provider = new web3.providers.HttpRpcProvider(options.httprpc);\n self.poll = self.provider.poll.bind(self.provider);\n }\n self.sendQueue.forEach(function (payload) {\n self.provider(payload);\n });\n self.onmessageQueue.forEach(function (handler) {\n self.provider.onmessage = handler;\n });\n };\n\n var ws = new WebSocket(options.websockets);\n\n ws.onopen = function() {\n closeWithSuccess(true);\n };\n\n ws.onerror = function() {\n closeWithSuccess(false);\n };\n};\n\n/// Sends message forward to the provider, that is being used\n/// if provider is not yet set, enqueues the message\nAutoProvider.prototype.send = function (payload) {\n if (this.provider) {\n this.provider.send(payload);\n return;\n }\n this.sendQueue.push(payload);\n};\n\n/// On incoming message sends the message to the provider that is currently being used\nObject.defineProperty(AutoProvider.prototype, 'onmessage', {\n set: function (handler) {\n if (this.provider) {\n this.provider.onmessage = handler;\n return;\n }\n this.onmessageQueue.push(handler);\n }\n});\n\nmodule.exports = AutoProvider;\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 autoprovider.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\n/*\n * @brief if qt object is available, uses QtProvider,\n * if not tries to connect over websockets\n * if it fails, it uses HttpRpcProvider\n */\n\nvar web3 = require('./web3'); // jshint ignore:line\nif (\"build\" !== 'build') {/*\n var WebSocket = require('ws'); // jshint ignore:line\n*/}\n\n/**\n * AutoProvider object prototype is implementing 'provider protocol'\n * Automatically tries to setup correct provider(Qt, WebSockets or HttpRpc)\n * First it checkes if we are ethereum browser (if navigator.qt object is available)\n * if yes, we are using QtProvider\n * if no, we check if it is possible to establish websockets connection with ethereum (ws://localhost:40404/eth is default)\n * if it's not possible, we are using httprpc provider (http://localhost:8080)\n * The constructor allows you to specify uris on which we are trying to connect over http or websockets\n * You can do that by passing objects with fields httrpc and websockets\n */\nvar AutoProvider = function (userOptions) {\n if (web3.haveProvider()) {\n return;\n }\n\n // before we determine what provider we are, we have to cache request\n this.sendQueue = [];\n this.onmessageQueue = [];\n\n if (navigator.qt) {\n this.provider = new web3.providers.QtProvider();\n return;\n }\n\n userOptions = userOptions || {};\n var options = {\n httprpc: userOptions.httprpc || 'http://localhost:8080',\n websockets: userOptions.websockets || 'ws://localhost:40404/eth'\n };\n\n var self = this;\n var closeWithSuccess = function (success) {\n ws.close();\n if (success) {\n self.provider = new web3.providers.WebSocketProvider(options.websockets);\n } else {\n self.provider = new web3.providers.HttpRpcProvider(options.httprpc);\n self.poll = self.provider.poll.bind(self.provider);\n }\n self.sendQueue.forEach(function (payload) {\n self.provider.send(payload);\n });\n self.onmessageQueue.forEach(function (handler) {\n self.provider.onmessage = handler;\n });\n };\n\n var ws = new WebSocket(options.websockets);\n\n ws.onopen = function() {\n closeWithSuccess(true);\n };\n\n ws.onerror = function() {\n closeWithSuccess(false);\n };\n};\n\n/// Sends message forward to the provider, that is being used\n/// if provider is not yet set, enqueues the message\nAutoProvider.prototype.send = function (payload) {\n if (this.provider) {\n this.provider.send(payload);\n return;\n }\n this.sendQueue.push(payload);\n};\n\n/// On incoming message sends the message to the provider that is currently being used\nObject.defineProperty(AutoProvider.prototype, 'onmessage', {\n set: function (handler) {\n if (this.provider) {\n this.provider.onmessage = handler;\n return;\n }\n this.onmessageQueue.push(handler);\n }\n});\n\nmodule.exports = AutoProvider;\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 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 contract[method.name] = function () {\n var params = Array.prototype.slice.call(arguments);\n var parsed = inputParser[method.name].apply(null, params);\n\n var onSuccess = function (result) {\n return outputParser[method.name](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 return web3.eth.transact(extra).then(onSuccess);\n });\n }\n };\n };\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 httprpc.js\n * @authors:\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line\n*/}\n\n/**\n * HttpRpcProvider object prototype is implementing 'provider protocol'\n * Should be used when we want to connect to ethereum backend over http && jsonrpc\n * It's compatible with cpp client\n * The contructor allows to specify host uri\n * This provider is using in-browser polling mechanism\n */\nvar HttpRpcProvider = 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\n/// Prototype object method \n/// Asynchronously sends request to server\n/// @param payload is inner message object\n/// @param cb is callback which is being called when response is comes back\nHttpRpcProvider.prototype.sendRequest = function (payload, cb) {\n var data = formatJsonRpcObject(payload);\n\n var request = new XMLHttpRequest();\n request.open(\"POST\", this.host, true);\n request.send(JSON.stringify(data));\n request.onreadystatechange = function () {\n if (request.readyState === 4 && cb) {\n cb(request);\n }\n };\n};\n\n/// Prototype object method\n/// Should be called when we want to send single api request to server\n/// Asynchronous\n/// On response it passes message to handlers\n/// @param payload is inner message object\nHttpRpcProvider.prototype.send = function (payload) {\n var self = this;\n this.sendRequest(payload, function (request) {\n self.handlers.forEach(function (handler) {\n handler.call(self, formatJsonRpcMessage(request.responseText));\n });\n });\n};\n\n/// Prototype object method\n/// Should be called only for polling requests\n/// Asynchronous\n/// On response it passege message to handlers, but only if message's result is true or not empty array\n/// Otherwise response is being silently ignored\n/// @param payload is inner message object\n/// @id is id of poll that we are calling\nHttpRpcProvider.prototype.poll = function (payload, id) {\n var self = this;\n this.sendRequest(payload, function (request) {\n var parsed = JSON.parse(request.responseText);\n if (parsed.error || (parsed.result instanceof Array ? parsed.result.length === 0 : !parsed.result)) {\n return;\n }\n self.handlers.forEach(function (handler) {\n handler.call(self, {_event: payload.call, _id: id, data: parsed.result});\n });\n });\n};\n\n/// Prototype object property\n/// Should be used to set message handlers for this provider\nObject.defineProperty(HttpRpcProvider.prototype, \"onmessage\", {\n set: function (handler) {\n this.handlers.push(handler);\n }\n});\n\nmodule.exports = HttpRpcProvider;\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\n// TODO: is these line is supposed to be here? \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, cb) {\n data._id = this.id;\n if (cb) {\n web3._callbacks[data._id] = cb;\n }\n\n data.args = data.args || [];\n this.id++;\n\n if(this.provider !== undefined) {\n this.provider.send(data);\n } else {\n console.warn(\"provider is not set\");\n this.queued.push(data);\n }\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 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, cb) {\n data._id = this.id;\n if (cb) {\n web3._callbacks[data._id] = cb;\n }\n\n data.args = data.args || [];\n this.id++;\n\n if(this.provider !== undefined) {\n this.provider.send(data);\n } else {\n console.warn(\"provider is not set\");\n this.queued.push(data);\n }\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 qt.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * @date 2014\n */\n\n/**\n * QtProvider object prototype is implementing 'provider protocol'\n * Should be used inside ethereum browser. It's compatible with cpp and go clients.\n * It uses navigator.qt object to pass the messages to native bindings\n */\nvar QtProvider = function() {\n this.handlers = [];\n\n var self = this;\n navigator.qt.onmessage = function (message) {\n self.handlers.forEach(function (handler) {\n handler.call(self, JSON.parse(message.data));\n });\n };\n};\n\n/// Prototype object method\n/// Should be called when we want to send single api request to native bindings\n/// Asynchronous\n/// Response will be received by navigator.qt.onmessage method and passed to handlers\n/// @param payload is inner message object\nQtProvider.prototype.send = function(payload) {\n navigator.qt.postMessage(JSON.stringify(payload));\n};\n\n/// Prototype object property\n/// Should be used to set message handlers for this provider\nObject.defineProperty(QtProvider.prototype, \"onmessage\", {\n set: function(handler) {\n this.handlers.push(handler);\n }\n});\n\nmodule.exports = QtProvider;\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 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 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 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 websocket.js\n * @authors:\n * Jeffrey Wilcke <jeff@ethdev.com>\n * Marek Kotewicz <marek@ethdev.com>\n * Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\n// TODO: is these line is supposed to be here? \nif (\"build\" !== 'build') {/*\n var WebSocket = require('ws'); // jshint ignore:line\n*/}\n\n/**\n * WebSocketProvider object prototype is implementing 'provider protocol'\n * Should be used when we want to connect to ethereum backend over websockets\n * It's compatible with go client\n * The constructor allows to specify host uri\n */\nvar WebSocketProvider = function(host) {\n\n // onmessage handlers\n this.handlers = [];\n\n // queue will be filled with messages if send is invoked before the ws is ready\n this.queued = [];\n this.ready = false;\n\n this.ws = new WebSocket(host);\n\n var self = this;\n this.ws.onmessage = function(event) {\n for(var i = 0; i < self.handlers.length; i++) {\n self.handlers[i].call(self, JSON.parse(event.data), event);\n }\n };\n\n this.ws.onopen = function() {\n self.ready = true;\n\n for (var i = 0; i < self.queued.length; i++) {\n // Resend\n self.send(self.queued[i]);\n }\n };\n};\n\n/// Prototype object method\n/// Should be called when we want to send single api request to server\n/// Asynchronous, it's using websockets\n/// Response for the call will be received by ws.onmessage\n/// @param payload is inner message object\nWebSocketProvider.prototype.send = function(payload) {\n if (this.ready) {\n var data = JSON.stringify(payload);\n\n this.ws.send(data);\n } else {\n this.queued.push(payload);\n }\n};\n\n/// Prototype object method\n/// Should be called to add handlers\nWebSocketProvider.prototype.onMessage = function(handler) {\n this.handlers.push(handler);\n};\n\n/// Prototype object method\n/// Should be called to close websockets connection\nWebSocketProvider.prototype.unload = function() {\n this.ws.close();\n};\n\n/// Prototype object property\n/// Should be used to set message handlers for this provider\nObject.defineProperty(WebSocketProvider.prototype, \"onmessage\", {\n set: function(provider) { this.onMessage(provider); }\n});\n\nif (typeof(module) !== \"undefined\")\n module.exports = WebSocketProvider;\n",
diff --git a/dist/ethereum.min.js b/dist/ethereum.min.js
index 670e6d774..2bf4db8d6 100644
--- a/dist/ethereum.min.js
+++ b/dist/ethereum.min.js
@@ -1 +1 @@
-require=function e(t,n,r){function o(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t){var n=e("./web3");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var r=32,o=function(e,t){for(var n=!1,r=0;r<e.length&&!n;r++)n=t(e[r]);return n?r-1:-1},i=function(e,t){return o(e,function(e){return e.name===t})},s=function(e,t,n){return new Array(t-e.length+1).join(n?n:"0")+e},a=function(e){return function(t){return 0===t.indexOf(e)}},u=function(e){return function(t){return e===t}},f=function(e){return"[]"===e.slice(-2)},c=function(e){var t=2*r;return e instanceof BigNumber||"number"==typeof e?("number"==typeof e&&(e=new BigNumber(e)),e=e.round(),e.lessThan(0)&&(e=new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(e).plus(1)),e=e.toString(16)):e=0===e.indexOf("0x")?e.substr(2):"string"==typeof e?c(new BigNumber(e)):(+e).toString(16),s(e,t)},l=function(e){return n.fromAscii(e,r).substr(2)},p=function(e){return"000000000000000000000000000000000000000000000000000000000000000"+(e?"1":"0")},h=function(e,t){return f(e)||a("string")(e)?c(t.length):""},d=function(){return[{type:a("uint"),format:c},{type:a("int"),format:c},{type:a("hash"),format:c},{type:a("string"),format:l},{type:a("real"),format:c},{type:a("ureal"),format:c},{type:u("address"),format:c},{type:u("bool"),format:p}]},v=d(),g=function(e,t,n){var r="",o=i(e,t);if(-1!==o){var s=e[o];return s.inputs.forEach(function(e,t){r+=h(e.type,n[t])}),s.inputs.forEach(function(e,t){for(var o=!1,i=0;i<v.length&&!o;i++)o=v[i].type(s.inputs[t].type,n[t]);o||console.error("input parser does not support type: "+s.inputs[t].type);var a=v[i-1].format,u="";u=f(s.inputs[t].type)?n[t].reduce(function(e,t){return e+a(t)},""):a(n[t]),r+=u}),r}},m=function(e){var t=new BigNumber(e.substr(0,1),16).toString(2).substr(0,1);return"1"===t?new BigNumber(e,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(e,16)},b=function(e){return new BigNumber(e,16)},y=function(e){return"0x"+e},_=function(e){return"0000000000000000000000000000000000000000000000000000000000000001"===e?!0:!1},w=function(e){return n.toAscii(e)},P=function(e){return"0x"+e.slice(e.length-40,e.length)},x=function(e){return f(e)||a("string")(e)?2*r:0},S=function(){return[{type:a("uint"),format:b},{type:a("int"),format:m},{type:a("hash"),format:y},{type:a("string"),format:w},{type:a("real"),format:m},{type:a("ureal"),format:m},{type:u("address"),format:P},{type:u("bool"),format:_}]},N=S(),k=function(e,t,n){var o=i(e,t);if(-1!==o){n=n.slice(2);var s=[],u=e[o],c=2*r,l=u.outputs.reduce(function(e,t){return e+x(t.type)},0),p=n.slice(0,l);return n=n.slice(l),u.outputs.forEach(function(e,t){for(var r=!1,o=0;o<N.length&&!r;o++)r=N[o].type(u.outputs[t].type);r||console.error("output parser does not support type: "+u.outputs[t].type);var i=N[o-1].format;if(f(u.outputs[t].type)){var l=b(p.slice(0,c));p=p.slice(c);for(var h=[],d=0;l>d;d++)h.push(i(n.slice(0,c))),n=n.slice(c);s.push(h)}else a("string")(u.outputs[t].type)?(p=p.slice(c),s.push(i(n.slice(0,c))),n=n.slice(c)):(s.push(i(n.slice(0,c))),n=n.slice(c))}),s}},O=function(e){var t={};return e.forEach(function(n){t[n.name]=function(){var t=Array.prototype.slice.call(arguments);return g(e,n.name,t)}}),t},A=function(e){var t={};return e.forEach(function(n){t[n.name]=function(t){return k(e,n.name,t)}}),t},q=function(e,t){var r=e[i(e,t)],o=t+"(",s=r.inputs.map(function(e){return e.type});return o+=s.join(","),o+=")",n.sha3(n.fromAscii(o))};t.exports={inputParser:O,outputParser:A,methodSignature:q}},{"./web3":8}],2:[function(e,t){var n=function(e){if(!web3.haveProvider()){if(this.sendQueue=[],this.onmessageQueue=[],navigator.qt)return void(this.provider=new web3.providers.QtProvider);e=e||{};var t={httprpc:e.httprpc||"http://localhost:8080",websockets:e.websockets||"ws://localhost:40404/eth"},n=this,r=function(e){o.close(),e?n.provider=new web3.providers.WebSocketProvider(t.websockets):(n.provider=new web3.providers.HttpRpcProvider(t.httprpc),n.poll=n.provider.poll.bind(n.provider)),n.sendQueue.forEach(function(e){n.provider(e)}),n.onmessageQueue.forEach(function(e){n.provider.onmessage=e})},o=new WebSocket(t.websockets);o.onopen=function(){r(!0)},o.onerror=function(){r(!1)}}};n.prototype.send=function(e){return this.provider?void this.provider.send(e):void this.sendQueue.push(e)},Object.defineProperty(n.prototype,"onmessage",{set:function(e){return this.provider?void(this.provider.onmessage=e):void this.onmessageQueue.push(e)}}),t.exports=n},{}],3:[function(e,t){var n=e("./web3"),r=e("./abi"),o=4,i=function(e,t){var i=r.inputParser(t),s=r.outputParser(t),a={};return t.forEach(function(u){a[u.name]=function(){var a=Array.prototype.slice.call(arguments),f=i[u.name].apply(null,a),c=function(e){return s[u.name](e)};return{call:function(i){return i=i||{},i.to=e,r.methodSignature(t,u.name).then(function(e){return i.data=e.slice(0,2+2*o)+f,n.eth.call(i).then(c)})},transact:function(i){return i=i||{},i.to=e,r.methodSignature(t,u.name).then(function(e){return i.data=e.slice(0,2+2*o)+f,n.eth.transact(i).then(c)})}}}}),a};t.exports=i},{"./abi":1,"./web3":8}],4:[function(e,t){var n=e("./web3"),r=function(e,t){this.impl=t,this.callbacks=[];var r=this;this.promise=t.newFilter(e),this.promise.then(function(e){r.id=e,n.on(t.changed,e,r.trigger.bind(r)),n.provider.startPolling({call:t.changed,args:[e]},e)})};r.prototype.arrived=function(e){this.changed(e)},r.prototype.changed=function(e){var t=this;this.promise.then(function(){t.callbacks.push(e)})},r.prototype.trigger=function(e){for(var t=0;t<this.callbacks.length;t++)this.callbacks[t].call(this,e)},r.prototype.uninstall=function(){var e=this;this.promise.then(function(t){e.impl.uninstallFilter(t),n.provider.stopPolling(t),n.off(impl.changed,t)})},r.prototype.messages=function(){var e=this;return this.promise.then(function(t){return e.impl.getMessages(t)})},r.prototype.logs=function(){return this.messages()},t.exports=r},{"./web3":8}],5:[function(e,t){function n(e){return{jsonrpc:"2.0",method:e.call,params:e.args,id:e._id}}function r(e){var t=JSON.parse(e);return{_id:t.id,data:t.result,error:t.error}}var o=function(e){this.handlers=[],this.host=e};o.prototype.sendRequest=function(e,t){var r=n(e),o=new XMLHttpRequest;o.open("POST",this.host,!0),o.send(JSON.stringify(r)),o.onreadystatechange=function(){4===o.readyState&&t&&t(o)}},o.prototype.send=function(e){var t=this;this.sendRequest(e,function(e){t.handlers.forEach(function(n){n.call(t,r(e.responseText))})})},o.prototype.poll=function(e,t){var n=this;this.sendRequest(e,function(r){var o=JSON.parse(r.responseText);!o.error&&(o.result instanceof Array?0!==o.result.length:o.result)&&n.handlers.forEach(function(r){r.call(n,{_event:e.call,_id:t,data:o.result})})})},Object.defineProperty(o.prototype,"onmessage",{set:function(e){this.handlers.push(e)}}),t.exports=o},{}],6:[function(e,t){var n=e("./web3"),r=function(){this.queued=[],this.polls=[],this.ready=!1,this.provider=void 0,this.id=1;var e=this,t=function(){e.provider&&e.provider.poll&&e.polls.forEach(function(t){t.data._id=e.id,e.id++,e.provider.poll(t.data,t.id)}),setTimeout(t,12e3)};t()};r.prototype.send=function(e,t){e._id=this.id,t&&(n._callbacks[e._id]=t),e.args=e.args||[],this.id++,void 0!==this.provider?this.provider.send(e):(console.warn("provider is not set"),this.queued.push(e))},r.prototype.set=function(e){void 0!==this.provider&&void 0!==this.provider.unload&&this.provider.unload(),this.provider=e,this.ready=!0},r.prototype.sendQueued=function(){for(var e=0;this.queued.length;e++)this.send(this.queued[e])},r.prototype.installed=function(){return void 0!==this.provider},r.prototype.startPolling=function(e,t){this.provider&&this.provider.poll&&this.polls.push({data:e,id:t})},r.prototype.stopPolling=function(e){for(var t=this.polls.length;t--;){var n=this.polls[t];n.id===e&&this.polls.splice(t,1)}},t.exports=r},{"./web3":8}],7:[function(e,t){var n=function(){this.handlers=[];var e=this;navigator.qt.onmessage=function(t){e.handlers.forEach(function(n){n.call(e,JSON.parse(t.data))})}};n.prototype.send=function(e){navigator.qt.postMessage(JSON.stringify(e))},Object.defineProperty(n.prototype,"onmessage",{set:function(e){this.handlers.push(e)}}),t.exports=n},{}],8:[function(e,t){function n(e){return e instanceof Promise?Promise.resolve(e):e instanceof Array?new Promise(function(t){var r=e.map(function(e){return n(e)});return Promise.all(r).then(function(n){for(var r=0;r<e.length;r++)e[r]=n[r];t(e)})}):e instanceof Object?new Promise(function(t){var r=Object.keys(e),o=r.map(function(t){return n(e[t])});return Promise.all(o).then(function(n){for(var o=0;o<r.length;o++)e[r[o]]=n[o];t(e)})}):Promise.resolve(e)}function r(e){if(void 0!==e._event)return void v.trigger(e._event,e._id,e.data);if(e._id){var t=v._callbacks[e._id];t&&(t.call(this,e.error,e.data),delete v._callbacks[e._id])}}var o=function(){return[{name:"sha3",call:"web3_sha3"}]},i=function(){var e=function(e){return"string"==typeof e[0]?"eth_blockByHash":"eth_blockByNumber"},t=function(e){return"string"==typeof e[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(e){return"string"==typeof e[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:e},{name:"transaction",call:t},{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},s=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 e=function(e){return"string"==typeof e[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:e},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},c=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessage",call:"shh_getMessages"}]},l=function(e,t){t.forEach(function(t){e[t.name]=function(){return n(Array.prototype.slice.call(arguments)).then(function(e){var n="function"==typeof t.call?t.call(e):t.call;return{call:n,args:e}}).then(function(e){return new Promise(function(t,n){v.provider.send(e,function(e,r){return e?void n(e):void t(r)})})}).catch(function(e){console.error(e)})}})},p=function(e,t){t.forEach(function(t){var r={};r.get=function(){return new Promise(function(e,n){v.provider.send({call:t.getter},function(t,r){return t?void n(t):void e(r)})})},t.setter&&(r.set=function(e){return n([e]).then(function(e){return new Promise(function(n){v.provider.send({call:t.setter,args:e},function(e,t){return e?void reject(e):void n(t)})})}).catch(function(e){console.error(e)})}),Object.defineProperty(e,t.name,r)})},h=function(e){return parseInt(e,16).toString()},d=function(e){return parseInt(e).toString(16)},v={_callbacks:{},_events:{},providers:{},toHex:function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n).toString(16);t+=r.length<2?"0"+r:r}return t},toAscii:function(e){var t="",n=0,r=e.length;for("0x"===e.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(e.substr(n,2),16);if(0===o)break;t+=String.fromCharCode(o)}return t},fromAscii:function(e,t){t=void 0===t?0:t;for(var n=this.toHex(e);n.length<2*t;)n+="00";return"0x"+n},toDecimal:function(e){return h(e.substring(2))},fromDecimal:function(e){return"0x"+d(e)},toEth:function(e){for(var t="string"==typeof e?0===e.indexOf("0x")?parseInt(e.substr(2),16):parseInt(e):e,n=0,r=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];t>3e3&&n<r.length-1;)t/=1e3,n++;for(var o=t.toString().length<t.toFixed(2).length?t.toString():t.toFixed(2),i=function(e,t,n){return t+","+n};;){var s=o;if(o=o.replace(/(\d)(\d\d\d[\.\,])/,i),s===o)break}return o+" "+r[n]},eth:{watch:function(e){return new v.filter(e,g)}},db:{},shh:{watch:function(e){return new v.filter(e,m)}},on:function(e,t,n){return void 0===v._events[e]&&(v._events[e]={}),v._events[e][t]=n,this},off:function(e,t){return void 0!==v._events[e]&&delete v._events[e][t],this},trigger:function(e,t,n){var r=v._events[e];if(r&&r[t]){var o=r[t];o(n)}},haveProvider:function(){return!!v.provider.provider}};l(v,o()),l(v.eth,i()),p(v.eth,s()),l(v.db,a()),l(v.shh,u());var g={changed:"eth_changed"};l(g,f());var m={changed:"shh_changed"};l(m,c()),v.setProvider=function(e){e.onmessage=r,v.provider.set(e),v.provider.sendQueued()},t.exports=v},{}],9:[function(e,t){var n=function(e){this.handlers=[],this.queued=[],this.ready=!1,this.ws=new WebSocket(e);var t=this;this.ws.onmessage=function(e){for(var n=0;n<t.handlers.length;n++)t.handlers[n].call(t,JSON.parse(e.data),e)},this.ws.onopen=function(){t.ready=!0;for(var e=0;e<t.queued.length;e++)t.send(t.queued[e])}};n.prototype.send=function(e){if(this.ready){var t=JSON.stringify(e);this.ws.send(t)}else this.queued.push(e)},n.prototype.onMessage=function(e){this.handlers.push(e)},n.prototype.unload=function(){this.ws.close()},Object.defineProperty(n.prototype,"onmessage",{set:function(e){this.onMessage(e)}}),"undefined"!=typeof t&&(t.exports=n)},{}],web3:[function(e,t){var n=e("./lib/web3"),r=e("./lib/providermanager");n.provider=new r,n.filter=e("./lib/filter"),n.providers.WebSocketProvider=e("./lib/websocket"),n.providers.HttpRpcProvider=e("./lib/httprpc"),n.providers.QtProvider=e("./lib/qt"),n.providers.AutoProvider=e("./lib/autoprovider"),n.eth.contract=e("./lib/contract"),t.exports=n},{"./lib/autoprovider":2,"./lib/contract":3,"./lib/filter":4,"./lib/httprpc":5,"./lib/providermanager":6,"./lib/qt":7,"./lib/web3":8,"./lib/websocket":9}]},{},["web3"]); \ No newline at end of file
+require=function e(t,n,r){function o(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t){var n=e("./web3");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var r=32,o=function(e,t){for(var n=!1,r=0;r<e.length&&!n;r++)n=t(e[r]);return n?r-1:-1},i=function(e,t){return o(e,function(e){return e.name===t})},s=function(e,t,n){return new Array(t-e.length+1).join(n?n:"0")+e},a=function(e){return function(t){return 0===t.indexOf(e)}},u=function(e){return function(t){return e===t}},f=function(e){return"[]"===e.slice(-2)},c=function(e){var t=2*r;return e instanceof BigNumber||"number"==typeof e?("number"==typeof e&&(e=new BigNumber(e)),e=e.round(),e.lessThan(0)&&(e=new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(e).plus(1)),e=e.toString(16)):e=0===e.indexOf("0x")?e.substr(2):"string"==typeof e?c(new BigNumber(e)):(+e).toString(16),s(e,t)},l=function(e){return n.fromAscii(e,r).substr(2)},p=function(e){return"000000000000000000000000000000000000000000000000000000000000000"+(e?"1":"0")},h=function(e,t){return f(e)||a("string")(e)?c(t.length):""},d=function(){return[{type:a("uint"),format:c},{type:a("int"),format:c},{type:a("hash"),format:c},{type:a("string"),format:l},{type:a("real"),format:c},{type:a("ureal"),format:c},{type:u("address"),format:c},{type:u("bool"),format:p}]},v=d(),g=function(e,t,n){var r="",o=i(e,t);if(-1!==o){var s=e[o];return s.inputs.forEach(function(e,t){r+=h(e.type,n[t])}),s.inputs.forEach(function(e,t){for(var o=!1,i=0;i<v.length&&!o;i++)o=v[i].type(s.inputs[t].type,n[t]);o||console.error("input parser does not support type: "+s.inputs[t].type);var a=v[i-1].format,u="";u=f(s.inputs[t].type)?n[t].reduce(function(e,t){return e+a(t)},""):a(n[t]),r+=u}),r}},m=function(e){var t=new BigNumber(e.substr(0,1),16).toString(2).substr(0,1);return"1"===t?new BigNumber(e,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(e,16)},b=function(e){return new BigNumber(e,16)},y=function(e){return"0x"+e},_=function(e){return"0000000000000000000000000000000000000000000000000000000000000001"===e?!0:!1},w=function(e){return n.toAscii(e)},P=function(e){return"0x"+e.slice(e.length-40,e.length)},x=function(e){return f(e)||a("string")(e)?2*r:0},S=function(){return[{type:a("uint"),format:b},{type:a("int"),format:m},{type:a("hash"),format:y},{type:a("string"),format:w},{type:a("real"),format:m},{type:a("ureal"),format:m},{type:u("address"),format:P},{type:u("bool"),format:_}]},N=S(),k=function(e,t,n){var o=i(e,t);if(-1!==o){n=n.slice(2);var s=[],u=e[o],c=2*r,l=u.outputs.reduce(function(e,t){return e+x(t.type)},0),p=n.slice(0,l);return n=n.slice(l),u.outputs.forEach(function(e,t){for(var r=!1,o=0;o<N.length&&!r;o++)r=N[o].type(u.outputs[t].type);r||console.error("output parser does not support type: "+u.outputs[t].type);var i=N[o-1].format;if(f(u.outputs[t].type)){var l=b(p.slice(0,c));p=p.slice(c);for(var h=[],d=0;l>d;d++)h.push(i(n.slice(0,c))),n=n.slice(c);s.push(h)}else a("string")(u.outputs[t].type)?(p=p.slice(c),s.push(i(n.slice(0,c))),n=n.slice(c)):(s.push(i(n.slice(0,c))),n=n.slice(c))}),s}},O=function(e){var t={};return e.forEach(function(n){t[n.name]=function(){var t=Array.prototype.slice.call(arguments);return g(e,n.name,t)}}),t},A=function(e){var t={};return e.forEach(function(n){t[n.name]=function(t){return k(e,n.name,t)}}),t},q=function(e,t){var r=e[i(e,t)],o=t+"(",s=r.inputs.map(function(e){return e.type});return o+=s.join(","),o+=")",n.sha3(n.fromAscii(o))};t.exports={inputParser:O,outputParser:A,methodSignature:q}},{"./web3":8}],2:[function(e,t){var n=e("./web3"),r=function(e){if(!n.haveProvider()){if(this.sendQueue=[],this.onmessageQueue=[],navigator.qt)return void(this.provider=new n.providers.QtProvider);e=e||{};var t={httprpc:e.httprpc||"http://localhost:8080",websockets:e.websockets||"ws://localhost:40404/eth"},r=this,o=function(e){i.close(),e?r.provider=new n.providers.WebSocketProvider(t.websockets):(r.provider=new n.providers.HttpRpcProvider(t.httprpc),r.poll=r.provider.poll.bind(r.provider)),r.sendQueue.forEach(function(e){r.provider.send(e)}),r.onmessageQueue.forEach(function(e){r.provider.onmessage=e})},i=new WebSocket(t.websockets);i.onopen=function(){o(!0)},i.onerror=function(){o(!1)}}};r.prototype.send=function(e){return this.provider?void this.provider.send(e):void this.sendQueue.push(e)},Object.defineProperty(r.prototype,"onmessage",{set:function(e){return this.provider?void(this.provider.onmessage=e):void this.onmessageQueue.push(e)}}),t.exports=r},{"./web3":8}],3:[function(e,t){var n=e("./web3"),r=e("./abi"),o=4,i=function(e,t){var i=r.inputParser(t),s=r.outputParser(t),a={};return t.forEach(function(u){a[u.name]=function(){var a=Array.prototype.slice.call(arguments),f=i[u.name].apply(null,a),c=function(e){return s[u.name](e)};return{call:function(i){return i=i||{},i.to=e,r.methodSignature(t,u.name).then(function(e){return i.data=e.slice(0,2+2*o)+f,n.eth.call(i).then(c)})},transact:function(i){return i=i||{},i.to=e,r.methodSignature(t,u.name).then(function(e){return i.data=e.slice(0,2+2*o)+f,n.eth.transact(i).then(c)})}}}}),a};t.exports=i},{"./abi":1,"./web3":8}],4:[function(e,t){var n=e("./web3"),r=function(e,t){this.impl=t,this.callbacks=[];var r=this;this.promise=t.newFilter(e),this.promise.then(function(e){r.id=e,n.on(t.changed,e,r.trigger.bind(r)),n.provider.startPolling({call:t.changed,args:[e]},e)})};r.prototype.arrived=function(e){this.changed(e)},r.prototype.changed=function(e){var t=this;this.promise.then(function(){t.callbacks.push(e)})},r.prototype.trigger=function(e){for(var t=0;t<this.callbacks.length;t++)this.callbacks[t].call(this,e)},r.prototype.uninstall=function(){var e=this;this.promise.then(function(t){e.impl.uninstallFilter(t),n.provider.stopPolling(t),n.off(impl.changed,t)})},r.prototype.messages=function(){var e=this;return this.promise.then(function(t){return e.impl.getMessages(t)})},r.prototype.logs=function(){return this.messages()},t.exports=r},{"./web3":8}],5:[function(e,t){function n(e){return{jsonrpc:"2.0",method:e.call,params:e.args,id:e._id}}function r(e){var t=JSON.parse(e);return{_id:t.id,data:t.result,error:t.error}}var o=function(e){this.handlers=[],this.host=e};o.prototype.sendRequest=function(e,t){var r=n(e),o=new XMLHttpRequest;o.open("POST",this.host,!0),o.send(JSON.stringify(r)),o.onreadystatechange=function(){4===o.readyState&&t&&t(o)}},o.prototype.send=function(e){var t=this;this.sendRequest(e,function(e){t.handlers.forEach(function(n){n.call(t,r(e.responseText))})})},o.prototype.poll=function(e,t){var n=this;this.sendRequest(e,function(r){var o=JSON.parse(r.responseText);!o.error&&(o.result instanceof Array?0!==o.result.length:o.result)&&n.handlers.forEach(function(r){r.call(n,{_event:e.call,_id:t,data:o.result})})})},Object.defineProperty(o.prototype,"onmessage",{set:function(e){this.handlers.push(e)}}),t.exports=o},{}],6:[function(e,t){var n=e("./web3"),r=function(){this.queued=[],this.polls=[],this.ready=!1,this.provider=void 0,this.id=1;var e=this,t=function(){e.provider&&e.provider.poll&&e.polls.forEach(function(t){t.data._id=e.id,e.id++,e.provider.poll(t.data,t.id)}),setTimeout(t,12e3)};t()};r.prototype.send=function(e,t){e._id=this.id,t&&(n._callbacks[e._id]=t),e.args=e.args||[],this.id++,void 0!==this.provider?this.provider.send(e):(console.warn("provider is not set"),this.queued.push(e))},r.prototype.set=function(e){void 0!==this.provider&&void 0!==this.provider.unload&&this.provider.unload(),this.provider=e,this.ready=!0},r.prototype.sendQueued=function(){for(var e=0;this.queued.length;e++)this.send(this.queued[e])},r.prototype.installed=function(){return void 0!==this.provider},r.prototype.startPolling=function(e,t){this.provider&&this.provider.poll&&this.polls.push({data:e,id:t})},r.prototype.stopPolling=function(e){for(var t=this.polls.length;t--;){var n=this.polls[t];n.id===e&&this.polls.splice(t,1)}},t.exports=r},{"./web3":8}],7:[function(e,t){var n=function(){this.handlers=[];var e=this;navigator.qt.onmessage=function(t){e.handlers.forEach(function(n){n.call(e,JSON.parse(t.data))})}};n.prototype.send=function(e){navigator.qt.postMessage(JSON.stringify(e))},Object.defineProperty(n.prototype,"onmessage",{set:function(e){this.handlers.push(e)}}),t.exports=n},{}],8:[function(e,t){function n(e){return e instanceof Promise?Promise.resolve(e):e instanceof Array?new Promise(function(t){var r=e.map(function(e){return n(e)});return Promise.all(r).then(function(n){for(var r=0;r<e.length;r++)e[r]=n[r];t(e)})}):e instanceof Object?new Promise(function(t){var r=Object.keys(e),o=r.map(function(t){return n(e[t])});return Promise.all(o).then(function(n){for(var o=0;o<r.length;o++)e[r[o]]=n[o];t(e)})}):Promise.resolve(e)}function r(e){if(void 0!==e._event)return void v.trigger(e._event,e._id,e.data);if(e._id){var t=v._callbacks[e._id];t&&(t.call(this,e.error,e.data),delete v._callbacks[e._id])}}var o=function(){return[{name:"sha3",call:"web3_sha3"}]},i=function(){var e=function(e){return"string"==typeof e[0]?"eth_blockByHash":"eth_blockByNumber"},t=function(e){return"string"==typeof e[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(e){return"string"==typeof e[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:e},{name:"transaction",call:t},{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},s=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 e=function(e){return"string"==typeof e[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:e},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},c=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessage",call:"shh_getMessages"}]},l=function(e,t){t.forEach(function(t){e[t.name]=function(){return n(Array.prototype.slice.call(arguments)).then(function(e){var n="function"==typeof t.call?t.call(e):t.call;return{call:n,args:e}}).then(function(e){return new Promise(function(t,n){v.provider.send(e,function(e,r){return e?void n(e):void t(r)})})}).catch(function(e){console.error(e)})}})},p=function(e,t){t.forEach(function(t){var r={};r.get=function(){return new Promise(function(e,n){v.provider.send({call:t.getter},function(t,r){return t?void n(t):void e(r)})})},t.setter&&(r.set=function(e){return n([e]).then(function(e){return new Promise(function(n){v.provider.send({call:t.setter,args:e},function(e,t){return e?void reject(e):void n(t)})})}).catch(function(e){console.error(e)})}),Object.defineProperty(e,t.name,r)})},h=function(e){return parseInt(e,16).toString()},d=function(e){return parseInt(e).toString(16)},v={_callbacks:{},_events:{},providers:{},toHex:function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n).toString(16);t+=r.length<2?"0"+r:r}return t},toAscii:function(e){var t="",n=0,r=e.length;for("0x"===e.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(e.substr(n,2),16);if(0===o)break;t+=String.fromCharCode(o)}return t},fromAscii:function(e,t){t=void 0===t?0:t;for(var n=this.toHex(e);n.length<2*t;)n+="00";return"0x"+n},toDecimal:function(e){return h(e.substring(2))},fromDecimal:function(e){return"0x"+d(e)},toEth:function(e){for(var t="string"==typeof e?0===e.indexOf("0x")?parseInt(e.substr(2),16):parseInt(e):e,n=0,r=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];t>3e3&&n<r.length-1;)t/=1e3,n++;for(var o=t.toString().length<t.toFixed(2).length?t.toString():t.toFixed(2),i=function(e,t,n){return t+","+n};;){var s=o;if(o=o.replace(/(\d)(\d\d\d[\.\,])/,i),s===o)break}return o+" "+r[n]},eth:{watch:function(e){return new v.filter(e,g)}},db:{},shh:{watch:function(e){return new v.filter(e,m)}},on:function(e,t,n){return void 0===v._events[e]&&(v._events[e]={}),v._events[e][t]=n,this},off:function(e,t){return void 0!==v._events[e]&&delete v._events[e][t],this},trigger:function(e,t,n){var r=v._events[e];if(r&&r[t]){var o=r[t];o(n)}},haveProvider:function(){return!!v.provider.provider}};l(v,o()),l(v.eth,i()),p(v.eth,s()),l(v.db,a()),l(v.shh,u());var g={changed:"eth_changed"};l(g,f());var m={changed:"shh_changed"};l(m,c()),v.setProvider=function(e){e.onmessage=r,v.provider.set(e),v.provider.sendQueued()},t.exports=v},{}],9:[function(e,t){var n=function(e){this.handlers=[],this.queued=[],this.ready=!1,this.ws=new WebSocket(e);var t=this;this.ws.onmessage=function(e){for(var n=0;n<t.handlers.length;n++)t.handlers[n].call(t,JSON.parse(e.data),e)},this.ws.onopen=function(){t.ready=!0;for(var e=0;e<t.queued.length;e++)t.send(t.queued[e])}};n.prototype.send=function(e){if(this.ready){var t=JSON.stringify(e);this.ws.send(t)}else this.queued.push(e)},n.prototype.onMessage=function(e){this.handlers.push(e)},n.prototype.unload=function(){this.ws.close()},Object.defineProperty(n.prototype,"onmessage",{set:function(e){this.onMessage(e)}}),"undefined"!=typeof t&&(t.exports=n)},{}],web3:[function(e,t){var n=e("./lib/web3"),r=e("./lib/providermanager");n.provider=new r,n.filter=e("./lib/filter"),n.providers.WebSocketProvider=e("./lib/websocket"),n.providers.HttpRpcProvider=e("./lib/httprpc"),n.providers.QtProvider=e("./lib/qt"),n.providers.AutoProvider=e("./lib/autoprovider"),n.eth.contract=e("./lib/contract"),t.exports=n},{"./lib/autoprovider":2,"./lib/contract":3,"./lib/filter":4,"./lib/httprpc":5,"./lib/providermanager":6,"./lib/qt":7,"./lib/web3":8,"./lib/websocket":9}]},{},["web3"]); \ No newline at end of file
diff --git a/lib/autoprovider.js b/lib/autoprovider.js
index a2c265ccb..0501b93d8 100644
--- a/lib/autoprovider.js
+++ b/lib/autoprovider.js
@@ -27,10 +27,9 @@
* if it fails, it uses HttpRpcProvider
*/
-// TODO: is these line is supposed to be here?
+var web3 = require('./web3'); // jshint ignore:line
if (process.env.NODE_ENV !== 'build') {
var WebSocket = require('ws'); // jshint ignore:line
- var web3 = require('./web3'); // jshint ignore:line
}
/**
@@ -73,7 +72,7 @@ var AutoProvider = function (userOptions) {
self.poll = self.provider.poll.bind(self.provider);
}
self.sendQueue.forEach(function (payload) {
- self.provider(payload);
+ self.provider.send(payload);
});
self.onmessageQueue.forEach(function (handler) {
self.provider.onmessage = handler;
diff --git a/lib/providermanager.js b/lib/providermanager.js
index 2697ebbd7..f79a9b087 100644
--- a/lib/providermanager.js
+++ b/lib/providermanager.js
@@ -23,7 +23,6 @@
* @date 2014
*/
-// TODO: is these line is supposed to be here?
var web3 = require('./web3'); // jshint ignore:line
/**