From df17c338988260aab4db8f946076a67f3323caba Mon Sep 17 00:00:00 2001
From: Marek Kotewicz <marek.kotewicz@gmail.com>
Date: Thu, 29 Jan 2015 15:05:43 +0100
Subject: event example

---
 dist/ethereum.js     | 50 +++++++++++++++++++++++++++++++++++----
 dist/ethereum.js.map |  8 +++----
 dist/ethereum.min.js |  2 +-
 example/balance.html |  2 +-
 example/event.html   | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/contract.js      | 14 ++++++++---
 lib/event.js         | 21 +++++++++++++++-
 lib/filter.js        | 13 ++++++++++
 8 files changed, 162 insertions(+), 15 deletions(-)
 create mode 100644 example/event.html

diff --git a/dist/ethereum.js b/dist/ethereum.js
index c114529fe..deb3b0377 100644
--- a/dist/ethereum.js
+++ b/dist/ethereum.js
@@ -453,7 +453,7 @@ module.exports = {
 
 var web3 = require('./web3'); 
 var abi = require('./abi');
-var eventImplementation = require('./event');
+var eventImpl = require('./event');
 
 var addFunctionRelatedPropertiesToContract = function (contract) {
     
@@ -558,10 +558,18 @@ var addEventsToContract = function (contract, desc, address) {
         var impl = function () {
             var params = Array.prototype.slice.call(arguments);
             var signature = abi.methodSignature(e.name);
-            var eventImpl = eventImplementation(address, signature);
-            var o = eventImpl.apply(null, params);
+            var event = eventImpl(address, signature);
+            var o = event.apply(null, params);
             return web3.eth.watch(o);  
         };
+
+        impl.address = address;
+
+        Object.defineProperty(impl, 'topics', {
+            get: function() {
+                return [abi.methodSignature(e.name)];
+            }
+        });
         
         // TODO: rename these methods, cause they are used not only for methods
         var displayName = abi.methodDisplayName(e.name);
@@ -628,8 +636,27 @@ module.exports = contract;
 
 
 },{"./abi":1,"./event":3,"./web3":8}],3:[function(require,module,exports){
+/*
+    This file is part of ethereum.js.
 
-var abi = require('./abi');
+    ethereum.js is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    ethereum.js is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public License
+    along with ethereum.js.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/** @file event.js
+ * @authors:
+ *   Marek Kotewicz <marek@ethdev.com>
+ * @date 2014
+ */
 
 var implementationOfEvent = function (address, signature) {
     
@@ -645,7 +672,7 @@ var implementationOfEvent = function (address, signature) {
 module.exports = implementationOfEvent;
 
 
-},{"./abi":1}],4:[function(require,module,exports){
+},{}],4:[function(require,module,exports){
 /*
     This file is part of ethereum.js.
 
@@ -679,6 +706,19 @@ var Filter = function(options, impl) {
     this.impl = impl;
     this.callbacks = [];
 
+    if (typeof options !== "string") {
+        // evaluate lazy properties
+        options = {
+            to: options.to,
+            topics: options.topics,
+            earliest: options.earliest,
+            latest: options.latest,
+            max: options.max,
+            skip: options.skip,
+            address: options.address
+        };
+    }
+
     this.id = impl.newFilter(options);
     web3.provider.startPolling({call: impl.changed, args: [this.id]}, this.id, this.trigger.bind(this));
 };
diff --git a/dist/ethereum.js.map b/dist/ethereum.js.map
index 021d6a858..f8a8509bd 100644
--- a/dist/ethereum.js.map
+++ b/dist/ethereum.js.map
@@ -13,15 +13,15 @@
     "index.js"
   ],
   "names": [],
-  "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5aA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvUA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5aA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvUA;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/// method signature length in bytes\nvar ETH_METHOD_SIGNATURE_LENGTH = 4;\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/// @returns method with given method name\nvar getMethodWithName = function (json, methodName) {\n    var index = findMethodIndex(json, methodName);\n    if (index === -1) {\n        console.error('method ' + methodName + ' not found in the abi');\n        return undefined;\n    }\n    return json[index];\n};\n\n/// Filters all function from input abi\n/// @returns abi array with filtered objects of type 'function'\nvar filterFunctions = function (json) {\n    return json.filter(function (current) {\n        return current.type === 'function'; \n    }); \n};\n\n/// Filters all events form input abi\n/// @returns abi array with filtered objects of type 'event'\nvar filterEvents = function (json) {\n    return json.filter(function (current) {\n        return current.type === 'event';\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\n/// Formats input value to byte representation of real\n/// Values are multiplied by 2^m and encoded as integers\n/// @returns byte representation of real\nvar formatInputReal = function (value) {\n    return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128))); \n};\n\nvar dynamicTypeBytes = function (type, value) {\n    // TODO: decide what to do with array of strings\n    if (arrayType(type) || type === 'string')    // only string itself that is dynamic; stringX is static length.\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: formatInputReal },\n        { type: prefixedType('ureal'), format: formatInputReal },\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\n    var method = getMethodWithName(json, methodName);\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/// Check if input value is negative\n/// @param value is hex format\n/// @returns true if it is negative, otherwise false\nvar signedIsNegative = function (value) {\n    return (new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1)) === '1';\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    value = value || \"0\";\n    // check if it's negative number\n    // it it is, return two's complement\n    if (signedIsNegative(value)) {\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    value = value || \"0\";\n    return new BigNumber(value, 16);\n};\n\n/// @returns input bytes formatted to real\nvar formatOutputReal = function (value) {\n    return formatOutputInt(value).dividedBy(new BigNumber(2).pow(128)); \n};\n\n/// @returns input bytes formatted to ureal\nvar formatOutputUReal = function (value) {\n    return formatOutputUInt(value).dividedBy(new BigNumber(2).pow(128)); \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) || type === 'string')   // only string itself that is dynamic; stringX is static length.\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: formatOutputReal },\n        { type: prefixedType('ureal'), format: formatOutputUReal },\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    \n    output = output.slice(2);\n    var result = [];\n    var method = getMethodWithName(json, methodName);\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/// @returns display name for method eg. multiply(uint256) -> multiply\nvar methodDisplayName = function (method) {\n    var length = method.indexOf('('); \n    return length !== -1 ? method.substr(0, length) : method;\n};\n\n/// @returns overloaded part of method's name\nvar methodTypeName = function (method) {\n    /// TODO: make it not vulnerable\n    var length = method.indexOf('(');\n    return length !== -1 ? method.substr(length + 1, method.length - 1 - (length + 1)) : \"\";\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    filterFunctions(json).forEach(function (method) {\n        var displayName = methodDisplayName(method.name); \n        var typeName = methodTypeName(method.name);\n\n        var impl = function () {\n            var params = Array.prototype.slice.call(arguments);\n            return toAbiInput(json, method.name, params);\n        };\n       \n        if (parser[displayName] === undefined) {\n            parser[displayName] = impl;\n        }\n\n        parser[displayName][typeName] = impl;\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    filterFunctions(json).forEach(function (method) {\n\n        var displayName = methodDisplayName(method.name); \n        var typeName = methodTypeName(method.name);\n\n        var impl = function (output) {\n            return fromAbiOutput(json, method.name, output);\n        };\n\n        if (parser[displayName] === undefined) {\n            parser[displayName] = impl;\n        }\n\n        parser[displayName][typeName] = impl;\n    });\n\n    return parser;\n};\n\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 (name) {\n    return web3.sha3(web3.fromAscii(name)).slice(0, 2 + ETH_METHOD_SIGNATURE_LENGTH * 2);\n};\n\nmodule.exports = {\n    inputParser: inputParser,\n    outputParser: outputParser,\n    methodSignature: methodSignature,\n    methodDisplayName: methodDisplayName,\n    methodTypeName: methodTypeName,\n    getMethodWithName: getMethodWithName,\n    filterFunctions: filterFunctions,\n    filterEvents: filterEvents\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 contract.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); \nvar abi = require('./abi');\nvar eventImplementation = require('./event');\n\nvar addFunctionRelatedPropertiesToContract = function (contract) {\n    \n    contract.call = function (options) {\n        contract._isTransact = false;\n        contract._options = options;\n        return contract;\n    };\n\n    contract.transact = function (options) {\n        contract._isTransact = true;\n        contract._options = options;\n        return contract;\n    };\n\n    contract._options = {};\n    ['gas', 'gasPrice', 'value', 'from'].forEach(function(p) {\n        contract[p] = function (v) {\n            contract._options[p] = v;\n            return contract;\n        };\n    });\n\n};\n\nvar addFunctionsToContract = function (contract, desc, address) {\n    var inputParser = abi.inputParser(desc);\n    var outputParser = abi.outputParser(desc);\n\n    // create contract functions\n    abi.filterFunctions(desc).forEach(function (method) {\n\n        var displayName = abi.methodDisplayName(method.name);\n        var typeName = abi.methodTypeName(method.name);\n\n        var impl = function () {\n            var params = Array.prototype.slice.call(arguments);\n            var signature = abi.methodSignature(method.name);\n            var parsed = inputParser[displayName][typeName].apply(null, params);\n\n            var options = contract._options || {};\n            options.to = address;\n            options.data = signature + parsed;\n            \n            var isTransact = contract._isTransact === true || (contract._isTransact !== false && !method.constant);\n            var collapse = options.collapse !== false;\n            \n            // reset\n            contract._options = {};\n            contract._isTransact = null;\n\n            if (isTransact) {\n                // it's used byt natspec.js\n                // TODO: figure out better way to solve this\n                web3._currentContractAbi = desc;\n                web3._currentContractAddress = address;\n                web3._currentContractMethodName = method.name;\n                web3._currentContractMethodParams = params;\n\n                // transactions do not have any output, cause we do not know, when they will be processed\n                web3.eth.transact(options);\n                return;\n            }\n            \n            var output = web3.eth.call(options);\n            var ret = outputParser[displayName][typeName](output);\n            if (collapse)\n            {\n                if (ret.length === 1)\n                    ret = ret[0];\n                else if (ret.length === 0)\n                    ret = null;\n            }\n            return ret;\n        };\n\n        if (contract[displayName] === undefined) {\n            contract[displayName] = impl;\n        }\n\n        contract[displayName][typeName] = impl;\n    });\n};\n\nvar addEventRelatedPropertiesToContract = function (contract, desc, address) {\n    contract.address = address;\n    \n    Object.defineProperty(contract, 'topics', {\n        get: function() {\n            return abi.filterEvents(desc).map(function (e) {\n                return abi.methodSignature(e.name);\n            });\n        }\n    });\n\n};\n\nvar addEventsToContract = function (contract, desc, address) {\n    // create contract events\n    abi.filterEvents(desc).forEach(function (e) {\n\n        var impl = function () {\n            var params = Array.prototype.slice.call(arguments);\n            var signature = abi.methodSignature(e.name);\n            var eventImpl = eventImplementation(address, signature);\n            var o = eventImpl.apply(null, params);\n            return web3.eth.watch(o);  \n        };\n        \n        // TODO: rename these methods, cause they are used not only for methods\n        var displayName = abi.methodDisplayName(e.name);\n        var typeName = abi.methodTypeName(e.name);\n\n        if (contract[displayName] === undefined) {\n            contract[displayName] = impl;\n        }\n\n        contract[displayName][typeName] = impl;\n\n    });\n};\n\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'); // myMethod call (implicit, default)\n * myContract.call().myMethod('this is test string param for call'); // myMethod call (explicit)\n * myContract.transact().myMethod('this is test string param for 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 */\n\nvar contract = function (address, desc) {\n\n    desc.forEach(function (method) {\n        // workaround for invalid assumption that method.name is the full anonymous prototype of the method.\n        // it's not. it's just the name. the rest of the code assumes it's actually the anonymous\n        // prototype, so we make it so as a workaround.\n        // TODO: we may not want to modify input params, maybe use copy instead?\n        if (method.name.indexOf('(') === -1) {\n            var displayName = method.name;\n            var typeName = method.inputs.map(function(i){return i.type; }).join();\n            method.name = displayName + '(' + typeName + ')';\n        }\n    });\n\n\n\n    var result = {};\n    addFunctionRelatedPropertiesToContract(result);\n    addFunctionsToContract(result, desc, address);\n    addEventRelatedPropertiesToContract(result, desc, address);\n    addEventsToContract(result, desc, address);\n\n    return result;\n};\n\nmodule.exports = contract;\n\n",
-    "\nvar abi = require('./abi');\n\nvar implementationOfEvent = function (address, signature) {\n    \n    return function (options) {\n        var o = options || {};\n        o.address = o.address || address;\n        o.topics = o.topics || [];\n        o.topics.push(signature);\n        return o;\n    };\n};\n\nmodule.exports = implementationOfEvent;\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    this.id = impl.newFilter(options);\n    web3.provider.startPolling({call: impl.changed, args: [this.id]}, this.id, this.trigger.bind(this));\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    this.callbacks.push(callback);\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        for (var j = 0; j < messages.length; j++) {\n            this.callbacks[i].call(this, messages[j]);\n        }\n    }\n};\n\n/// should be called to uninstall current filter\nFilter.prototype.uninstall = function() {\n    this.impl.uninstallFilter(this.id);\n    web3.provider.stopPolling(this.id);\n};\n\n/// should be called to manually trigger getting latest messages from the client\nFilter.prototype.messages = function() {\n    return this.impl.getMessages(this.id);\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 contract.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); \nvar abi = require('./abi');\nvar eventImpl = require('./event');\n\nvar addFunctionRelatedPropertiesToContract = function (contract) {\n    \n    contract.call = function (options) {\n        contract._isTransact = false;\n        contract._options = options;\n        return contract;\n    };\n\n    contract.transact = function (options) {\n        contract._isTransact = true;\n        contract._options = options;\n        return contract;\n    };\n\n    contract._options = {};\n    ['gas', 'gasPrice', 'value', 'from'].forEach(function(p) {\n        contract[p] = function (v) {\n            contract._options[p] = v;\n            return contract;\n        };\n    });\n\n};\n\nvar addFunctionsToContract = function (contract, desc, address) {\n    var inputParser = abi.inputParser(desc);\n    var outputParser = abi.outputParser(desc);\n\n    // create contract functions\n    abi.filterFunctions(desc).forEach(function (method) {\n\n        var displayName = abi.methodDisplayName(method.name);\n        var typeName = abi.methodTypeName(method.name);\n\n        var impl = function () {\n            var params = Array.prototype.slice.call(arguments);\n            var signature = abi.methodSignature(method.name);\n            var parsed = inputParser[displayName][typeName].apply(null, params);\n\n            var options = contract._options || {};\n            options.to = address;\n            options.data = signature + parsed;\n            \n            var isTransact = contract._isTransact === true || (contract._isTransact !== false && !method.constant);\n            var collapse = options.collapse !== false;\n            \n            // reset\n            contract._options = {};\n            contract._isTransact = null;\n\n            if (isTransact) {\n                // it's used byt natspec.js\n                // TODO: figure out better way to solve this\n                web3._currentContractAbi = desc;\n                web3._currentContractAddress = address;\n                web3._currentContractMethodName = method.name;\n                web3._currentContractMethodParams = params;\n\n                // transactions do not have any output, cause we do not know, when they will be processed\n                web3.eth.transact(options);\n                return;\n            }\n            \n            var output = web3.eth.call(options);\n            var ret = outputParser[displayName][typeName](output);\n            if (collapse)\n            {\n                if (ret.length === 1)\n                    ret = ret[0];\n                else if (ret.length === 0)\n                    ret = null;\n            }\n            return ret;\n        };\n\n        if (contract[displayName] === undefined) {\n            contract[displayName] = impl;\n        }\n\n        contract[displayName][typeName] = impl;\n    });\n};\n\nvar addEventRelatedPropertiesToContract = function (contract, desc, address) {\n    contract.address = address;\n    \n    Object.defineProperty(contract, 'topics', {\n        get: function() {\n            return abi.filterEvents(desc).map(function (e) {\n                return abi.methodSignature(e.name);\n            });\n        }\n    });\n\n};\n\nvar addEventsToContract = function (contract, desc, address) {\n    // create contract events\n    abi.filterEvents(desc).forEach(function (e) {\n\n        var impl = function () {\n            var params = Array.prototype.slice.call(arguments);\n            var signature = abi.methodSignature(e.name);\n            var event = eventImpl(address, signature);\n            var o = event.apply(null, params);\n            return web3.eth.watch(o);  \n        };\n\n        impl.address = address;\n\n        Object.defineProperty(impl, 'topics', {\n            get: function() {\n                return [abi.methodSignature(e.name)];\n            }\n        });\n        \n        // TODO: rename these methods, cause they are used not only for methods\n        var displayName = abi.methodDisplayName(e.name);\n        var typeName = abi.methodTypeName(e.name);\n\n        if (contract[displayName] === undefined) {\n            contract[displayName] = impl;\n        }\n\n        contract[displayName][typeName] = impl;\n\n    });\n};\n\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'); // myMethod call (implicit, default)\n * myContract.call().myMethod('this is test string param for call'); // myMethod call (explicit)\n * myContract.transact().myMethod('this is test string param for 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 */\n\nvar contract = function (address, desc) {\n\n    desc.forEach(function (method) {\n        // workaround for invalid assumption that method.name is the full anonymous prototype of the method.\n        // it's not. it's just the name. the rest of the code assumes it's actually the anonymous\n        // prototype, so we make it so as a workaround.\n        // TODO: we may not want to modify input params, maybe use copy instead?\n        if (method.name.indexOf('(') === -1) {\n            var displayName = method.name;\n            var typeName = method.inputs.map(function(i){return i.type; }).join();\n            method.name = displayName + '(' + typeName + ')';\n        }\n    });\n\n\n\n    var result = {};\n    addFunctionRelatedPropertiesToContract(result);\n    addFunctionsToContract(result, desc, address);\n    addEventRelatedPropertiesToContract(result, desc, address);\n    addEventsToContract(result, desc, address);\n\n    return result;\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 event.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n * @date 2014\n */\n\nvar implementationOfEvent = function (address, signature) {\n    \n    return function (options) {\n        var o = options || {};\n        o.address = o.address || address;\n        o.topics = o.topics || [];\n        o.topics.push(signature);\n        return o;\n    };\n};\n\nmodule.exports = implementationOfEvent;\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    if (typeof options !== \"string\") {\n        // evaluate lazy properties\n        options = {\n            to: options.to,\n            topics: options.topics,\n            earliest: options.earliest,\n            latest: options.latest,\n            max: options.max,\n            skip: options.skip,\n            address: options.address\n        };\n    }\n\n    this.id = impl.newFilter(options);\n    web3.provider.startPolling({call: impl.changed, args: [this.id]}, this.id, this.trigger.bind(this));\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    this.callbacks.push(callback);\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        for (var j = 0; j < messages.length; j++) {\n            this.callbacks[i].call(this, messages[j]);\n        }\n    }\n};\n\n/// should be called to uninstall current filter\nFilter.prototype.uninstall = function() {\n    this.impl.uninstallFilter(this.id);\n    web3.provider.stopPolling(this.id);\n};\n\n/// should be called to manually trigger getting latest messages from the client\nFilter.prototype.messages = function() {\n    return this.impl.getMessages(this.id);\n};\n\n/// alias for messages\nFilter.prototype.logs = function () {\n    return this.messages();\n};\n\nmodule.exports = Filter;\n",
     "/*\n    This file is part of ethereum.js.\n\n    ethereum.js is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Lesser General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    ethereum.js is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Lesser General Public License for more details.\n\n    You should have received a copy of the GNU Lesser General Public License\n    along with ethereum.js.  If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file httpsync.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n *   Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\nif (\"build\" !== 'build') {/*\n        var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line\n*/}\n\nvar HttpSyncProvider = function (host) {\n    this.handlers = [];\n    this.host = host || 'http://localhost:8080';\n};\n\n/// Transforms inner message to proper jsonrpc object\n/// @param inner message object\n/// @returns jsonrpc object\nfunction formatJsonRpcObject(object) {\n    return {\n        jsonrpc: '2.0',\n        method: object.call,\n        params: object.args,\n        id: object._id\n    };\n}\n\n/// Transforms jsonrpc object to inner message\n/// @param incoming jsonrpc message \n/// @returns inner message object\nfunction formatJsonRpcMessage(message) {\n    var object = JSON.parse(message);\n\n    return {\n        _id: object.id,\n        data: object.result,\n        error: object.error\n    };\n}\n\nHttpSyncProvider.prototype.send = function (payload) {\n    var data = formatJsonRpcObject(payload);\n    \n    var request = new XMLHttpRequest();\n    request.open('POST', this.host, false);\n    request.send(JSON.stringify(data));\n    \n    // check request.status\n    return request.responseText;\n};\n\nmodule.exports = HttpSyncProvider;\n\n",
     "/*\n    This file is part of ethereum.js.\n\n    ethereum.js is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Lesser General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    ethereum.js is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Lesser General Public License for more details.\n\n    You should have received a copy of the GNU Lesser General Public License\n    along with ethereum.js.  If not, see <http://www.gnu.org/licenses/>.\n*/\n/** @file providermanager.js\n * @authors:\n *   Jeffrey Wilcke <jeff@ethdev.com>\n *   Marek Kotewicz <marek@ethdev.com>\n *   Marian Oancea <marian@ethdev.com>\n *   Gav Wood <g@ethdev.com>\n * @date 2014\n */\n\nvar web3 = require('./web3'); // jshint ignore:line\n\n/**\n * Provider manager object prototype\n * It's responsible for passing messages to providers\n * If no provider is set it's responsible for queuing requests\n * It's also responsible for polling the ethereum node for incoming messages\n * Default poll timeout is 12 seconds\n * If we are running ethereum.js inside ethereum browser, there are backend based tools responsible for polling,\n * and provider manager polling mechanism is not used\n */\nvar ProviderManager = function() {\n    this.polls = [];\n    this.provider = undefined;\n    this.id = 1;\n\n    var self = this;\n    var poll = function () {\n        if (self.provider) {\n            self.polls.forEach(function (data) {\n                data.data._id = self.id;\n                self.id++;\n                var result = self.provider.send(data.data);\n            \n                result = JSON.parse(result);\n                \n                // dont call the callback if result is not an array, or empty one\n                if (result.error || !(result.result instanceof Array) || result.result.length === 0) {\n                    return;\n                }\n\n                data.callback(result.result);\n            });\n        }\n        setTimeout(poll, 1000);\n    };\n    poll();\n};\n\n/// sends outgoing requests\nProviderManager.prototype.send = function(data) {\n\n    data.args = data.args || [];\n    data._id = this.id++;\n\n    if (this.provider === undefined) {\n        console.error('provider is not set');\n        return null; \n    }\n\n    //TODO: handle error here? \n    var result = this.provider.send(data);\n    result = JSON.parse(result);\n\n    if (result.error) {\n        console.log(result.error);\n        return null;\n    }\n\n    return result.result;\n};\n\n/// setups provider, which will be used for sending messages\nProviderManager.prototype.set = function(provider) {\n    this.provider = provider;\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, callback) {\n    this.polls.push({data: data, id: pollId, callback: callback});\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 qtsync.js\n * @authors:\n *   Marek Kotewicz <marek@ethdev.com>\n *   Marian Oancea <marian@ethdev.com>\n * @date 2014\n */\n\nvar QtSyncProvider = function () {\n};\n\nQtSyncProvider.prototype.send = function (payload) {\n    return navigator.qt.callMethod(JSON.stringify(payload));\n};\n\nmodule.exports = QtSyncProvider;\n\n",
diff --git a/dist/ethereum.min.js b/dist/ethereum.min.js
index 798665136..23e474fe2 100644
--- a/dist/ethereum.min.js
+++ b/dist/ethereum.min.js
@@ -1 +1 @@
-require=function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var f="function"==typeof require&&require;if(!u&&f)return f(a,!0);if(o)return o(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e){var n=t("./web3");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var r=32,i=4,o=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},a=function(t,e){return o(t,function(t){return t.name===e})},u=function(t,e){var n=a(t,e);return-1===n?void console.error("method "+e+" not found in the abi"):t[n]},f=function(t){return t.filter(function(t){return"function"===t.type})},s=function(t){return t.filter(function(t){return"event"===t.type})},c=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},l=function(t){return function(e){return 0===e.indexOf(t)}},p=function(t){return function(e){return t===e}},h=function(t){return"[]"===t.slice(-2)},d=function(t){var e=2*r;return t instanceof BigNumber||"number"==typeof t?("number"==typeof t&&(t=new BigNumber(t)),t=t.round(),t.lessThan(0)&&(t=new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?d(new BigNumber(t)):(+t).toString(16),c(t,e)},m=function(t){return n.fromAscii(t,r).substr(2)},g=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},v=function(t){return d(new BigNumber(t).times(new BigNumber(2).pow(128)))},b=function(t,e){return h(t)||"string"===t?d(e.length):""},y=function(){return[{type:l("uint"),format:d},{type:l("int"),format:d},{type:l("hash"),format:d},{type:l("string"),format:m},{type:l("real"),format:v},{type:l("ureal"),format:v},{type:p("address"),format:d},{type:p("bool"),format:g}]},_=y(),w=function(t,e,n){var r="",i=u(t,e);return i.inputs.forEach(function(t,e){r+=b(t.type,n[e])}),i.inputs.forEach(function(t,e){for(var o=!1,a=0;a<_.length&&!o;a++)o=_[a].type(i.inputs[e].type,n[e]);o||console.error("input parser does not support type: "+i.inputs[e].type);var u=_[a-1].format,f="";f=h(i.inputs[e].type)?n[e].reduce(function(t,e){return t+u(e)},""):u(n[e]),r+=f}),r},N=function(t){return"1"===new BigNumber(t.substr(0,1),16).toString(2).substr(0,1)},x=function(t){return t=t||"0",N(t)?new BigNumber(t,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(t,16)},B=function(t){return t=t||"0",new BigNumber(t,16)},A=function(t){return x(t).dividedBy(new BigNumber(2).pow(128))},S=function(t){return B(t).dividedBy(new BigNumber(2).pow(128))},E=function(t){return"0x"+t},O=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},P=function(t){return n.toAscii(t)},F=function(t){return"0x"+t.slice(t.length-40,t.length)},T=function(t){return h(t)||"string"===t?2*r:0},k=function(){return[{type:l("uint"),format:B},{type:l("int"),format:x},{type:l("hash"),format:E},{type:l("string"),format:P},{type:l("real"),format:A},{type:l("ureal"),format:S},{type:p("address"),format:F},{type:p("bool"),format:O}]},M=k(),D=function(t,e,n){n=n.slice(2);var i=[],o=u(t,e),a=2*r,f=o.outputs.reduce(function(t,e){return t+T(e.type)},0),s=n.slice(0,f);return n=n.slice(f),o.outputs.forEach(function(t,e){for(var r=!1,u=0;u<M.length&&!r;u++)r=M[u].type(o.outputs[e].type);r||console.error("output parser does not support type: "+o.outputs[e].type);var f=M[u-1].format;if(h(o.outputs[e].type)){var c=B(s.slice(0,a));s=s.slice(a);for(var p=[],d=0;c>d;d++)p.push(f(n.slice(0,a))),n=n.slice(a);i.push(p)}else l("string")(o.outputs[e].type)?(s=s.slice(a),i.push(f(n.slice(0,a))),n=n.slice(a)):(i.push(f(n.slice(0,a))),n=n.slice(a))}),i},C=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},q=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)):""},I=function(t){var e={};return f(t).forEach(function(n){var r=C(n.name),i=q(n.name),o=function(){var e=Array.prototype.slice.call(arguments);return w(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},G=function(t){var e={};return f(t).forEach(function(n){var r=C(n.name),i=q(n.name),o=function(e){return D(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},H=function(t){return n.sha3(n.fromAscii(t)).slice(0,2+2*i)};e.exports={inputParser:I,outputParser:G,methodSignature:H,methodDisplayName:C,methodTypeName:q,getMethodWithName:u,filterFunctions:f,filterEvents:s}},{"./web3":8}],2:[function(t,e){var n=t("./web3"),r=t("./abi"),i=t("./event"),o=function(t){t.call=function(e){return t._isTransact=!1,t._options=e,t},t.transact=function(e){return t._isTransact=!0,t._options=e,t},t._options={},["gas","gasPrice","value","from"].forEach(function(e){t[e]=function(n){return t._options[e]=n,t}})},a=function(t,e,i){var o=r.inputParser(e),a=r.outputParser(e);r.filterFunctions(e).forEach(function(u){var f=r.methodDisplayName(u.name),s=r.methodTypeName(u.name),c=function(){var c=Array.prototype.slice.call(arguments),l=r.methodSignature(u.name),p=o[f][s].apply(null,c),h=t._options||{};h.to=i,h.data=l+p;var d=t._isTransact===!0||t._isTransact!==!1&&!u.constant,m=h.collapse!==!1;if(t._options={},t._isTransact=null,d)return n._currentContractAbi=e,n._currentContractAddress=i,n._currentContractMethodName=u.name,n._currentContractMethodParams=c,void n.eth.transact(h);var g=n.eth.call(h),v=a[f][s](g);return m&&(1===v.length?v=v[0]:0===v.length&&(v=null)),v};void 0===t[f]&&(t[f]=c),t[f][s]=c})},u=function(t,e,n){t.address=n,Object.defineProperty(t,"topics",{get:function(){return r.filterEvents(e).map(function(t){return r.methodSignature(t.name)})}})},f=function(t,e,o){r.filterEvents(e).forEach(function(e){var a=function(){var t=Array.prototype.slice.call(arguments),a=r.methodSignature(e.name),u=i(o,a),f=u.apply(null,t);return n.eth.watch(f)},u=r.methodDisplayName(e.name),f=r.methodTypeName(e.name);void 0===t[u]&&(t[u]=a),t[u][f]=a})},s=function(t,e){e.forEach(function(t){if(-1===t.name.indexOf("(")){var e=t.name,n=t.inputs.map(function(t){return t.type}).join();t.name=e+"("+n+")"}});var n={};return o(n),a(n,e,t),u(n,e,t),f(n,e,t),n};e.exports=s},{"./abi":1,"./event":3,"./web3":8}],3:[function(t,e){var n=(t("./abi"),function(t,e){return function(n){var r=n||{};return r.address=r.address||t,r.topics=r.topics||[],r.topics.push(e),r}});e.exports=n},{"./abi":1}],4:[function(t,e){var n=t("./web3"),r=function(t,e){this.impl=e,this.callbacks=[],this.id=e.newFilter(t),n.provider.startPolling({call:e.changed,args:[this.id]},this.id,this.trigger.bind(this))};r.prototype.arrived=function(t){this.changed(t)},r.prototype.changed=function(t){this.callbacks.push(t)},r.prototype.trigger=function(t){for(var e=0;e<this.callbacks.length;e++)for(var n=0;n<t.length;n++)this.callbacks[e].call(this,t[n])},r.prototype.uninstall=function(){this.impl.uninstallFilter(this.id),n.provider.stopPolling(this.id)},r.prototype.messages=function(){return this.impl.getMessages(this.id)},r.prototype.logs=function(){return this.messages()},e.exports=r},{"./web3":8}],5:[function(t,e){function n(t){return{jsonrpc:"2.0",method:t.call,params:t.args,id:t._id}}var r=function(t){this.handlers=[],this.host=t||"http://localhost:8080"};r.prototype.send=function(t){var e=n(t),r=new XMLHttpRequest;return r.open("POST",this.host,!1),r.send(JSON.stringify(e)),r.responseText},e.exports=r},{}],6:[function(t,e){var n=(t("./web3"),function(){this.polls=[],this.provider=void 0,this.id=1;var t=this,e=function(){t.provider&&t.polls.forEach(function(e){e.data._id=t.id,t.id++;var n=t.provider.send(e.data);n=JSON.parse(n),!n.error&&n.result instanceof Array&&0!==n.result.length&&e.callback(n.result)}),setTimeout(e,1e3)};e()});n.prototype.send=function(t){if(t.args=t.args||[],t._id=this.id++,void 0===this.provider)return console.error("provider is not set"),null;var e=this.provider.send(t);return e=JSON.parse(e),e.error?(console.log(e.error),null):e.result},n.prototype.set=function(t){this.provider=t},n.prototype.startPolling=function(t,e,n){this.polls.push({data:t,id:e,callback:n})},n.prototype.stopPolling=function(t){for(var e=this.polls.length;e--;){var n=this.polls[e];n.id===t&&this.polls.splice(e,1)}},e.exports=n},{"./web3":8}],7:[function(t,e){var n=function(){};n.prototype.send=function(t){return navigator.qt.callMethod(JSON.stringify(t))},e.exports=n},{}],8:[function(t,e){var n=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"],r=function(){return[{name:"sha3",call:"web3_sha3"}]},i=function(){var t=function(t){return"string"==typeof t[0]?"eth_blockByHash":"eth_blockByNumber"},e=function(t){return"string"==typeof t[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(t){return"string"==typeof t[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:e},{name:"uncle",call:n},{name:"compilers",call:"eth_compilers"},{name:"flush",call:"eth_flush"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"}];return r},o=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"accounts",getter:"eth_accounts"},{name:"peerCount",getter:"eth_peerCount"},{name:"defaultBlock",getter:"eth_defaultBlock",setter:"eth_setDefaultBlock"},{name:"number",getter:"eth_number"}]},a=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]},u=function(){return[{name:"post",call:"shh_post"},{name:"newIdentity",call:"shh_newIdentity"},{name:"haveIdentity",call:"shh_haveIdentity"},{name:"newGroup",call:"shh_newGroup"},{name:"addToGroup",call:"shh_addToGroup"}]},f=function(){var t=function(t){return"string"==typeof t[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:t},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},s=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessages",call:"shh_getMessages"}]},c=function(t,e){e.forEach(function(e){t[e.name]=function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof e.call?e.call(t):e.call;return p.provider.send({call:n,args:t})}})},l=function(t,e){e.forEach(function(e){var n={};n.get=function(){return p.provider.send({call:e.getter})},e.setter&&(n.set=function(t){return p.provider.send({call:e.setter,args:[t]})}),Object.defineProperty(t,e.name,n)})},p={_callbacks:{},_events:{},providers:{},toHex:function(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}return e},toAscii:function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},fromAscii:function(t,e){e=void 0===e?0:e;for(var n=this.toHex(t);n.length<2*e;)n+="00";return"0x"+n},toDecimal:function(t){return t=t.length>2?t.substring(2):"0",new BigNumber(t,16).toString(10)},fromDecimal:function(t){return"0x"+new BigNumber(t).toString(16)},toEth:function(t){for(var e="string"==typeof t?0===t.indexOf("0x")?parseInt(t.substr(2),16):parseInt(t):t,r=0,i=n;e>3e3&&r<i.length-1;)e/=1e3,r++;for(var o=e.toString().length<e.toFixed(2).length?e.toString():e.toFixed(2),a=function(t,e,n){return e+","+n};;){var u=o;if(o=o.replace(/(\d)(\d\d\d[\.\,])/,a),u===o)break}return o+" "+i[r]},eth:{contractFromAbi:function(t){return function(e){e=e||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";var n=p.eth.contract(e,t);return n.address=e,n}},watch:function(t){return new p.filter(t,h)}},db:{},shh:{watch:function(t){return new p.filter(t,d)}},haveProvider:function(){return!!p.provider.provider}};c(p,r()),c(p.eth,i()),l(p.eth,o()),c(p.db,a()),c(p.shh,u());var h={changed:"eth_changed"};c(h,f());var d={changed:"shh_changed"};c(d,s()),p.setProvider=function(t){p.provider.set(t)},e.exports=p},{}],web3:[function(t,e){var n=t("./lib/web3"),r=t("./lib/providermanager");n.provider=new r,n.filter=t("./lib/filter"),n.providers.HttpSyncProvider=t("./lib/httpsync"),n.providers.QtSyncProvider=t("./lib/qtsync"),n.eth.contract=t("./lib/contract"),n.abi=t("./lib/abi"),e.exports=n},{"./lib/abi":1,"./lib/contract":2,"./lib/filter":4,"./lib/httpsync":5,"./lib/providermanager":6,"./lib/qtsync":7,"./lib/web3":8}]},{},["web3"]);
\ No newline at end of file
+require=function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return i(n?n:t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e){var n=t("./web3");BigNumber.config({ROUNDING_MODE:BigNumber.ROUND_DOWN});var r=32,i=4,o=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},a=function(t,e){return o(t,function(t){return t.name===e})},u=function(t,e){var n=a(t,e);return-1===n?void console.error("method "+e+" not found in the abi"):t[n]},s=function(t){return t.filter(function(t){return"function"===t.type})},f=function(t){return t.filter(function(t){return"event"===t.type})},c=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},l=function(t){return function(e){return 0===e.indexOf(t)}},p=function(t){return function(e){return t===e}},h=function(t){return"[]"===t.slice(-2)},d=function(t){var e=2*r;return t instanceof BigNumber||"number"==typeof t?("number"==typeof t&&(t=new BigNumber(t)),t=t.round(),t.lessThan(0)&&(t=new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?d(new BigNumber(t)):(+t).toString(16),c(t,e)},m=function(t){return n.fromAscii(t,r).substr(2)},g=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},v=function(t){return d(new BigNumber(t).times(new BigNumber(2).pow(128)))},b=function(t,e){return h(t)||"string"===t?d(e.length):""},y=function(){return[{type:l("uint"),format:d},{type:l("int"),format:d},{type:l("hash"),format:d},{type:l("string"),format:m},{type:l("real"),format:v},{type:l("ureal"),format:v},{type:p("address"),format:d},{type:p("bool"),format:g}]},_=y(),w=function(t,e,n){var r="",i=u(t,e);return i.inputs.forEach(function(t,e){r+=b(t.type,n[e])}),i.inputs.forEach(function(t,e){for(var o=!1,a=0;a<_.length&&!o;a++)o=_[a].type(i.inputs[e].type,n[e]);o||console.error("input parser does not support type: "+i.inputs[e].type);var u=_[a-1].format,s="";s=h(i.inputs[e].type)?n[e].reduce(function(t,e){return t+u(e)},""):u(n[e]),r+=s}),r},N=function(t){return"1"===new BigNumber(t.substr(0,1),16).toString(2).substr(0,1)},x=function(t){return t=t||"0",N(t)?new BigNumber(t,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(t,16)},B=function(t){return t=t||"0",new BigNumber(t,16)},S=function(t){return x(t).dividedBy(new BigNumber(2).pow(128))},A=function(t){return B(t).dividedBy(new BigNumber(2).pow(128))},O=function(t){return"0x"+t},P=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},E=function(t){return n.toAscii(t)},k=function(t){return"0x"+t.slice(t.length-40,t.length)},F=function(t){return h(t)||"string"===t?2*r:0},T=function(){return[{type:l("uint"),format:B},{type:l("int"),format:x},{type:l("hash"),format:O},{type:l("string"),format:E},{type:l("real"),format:S},{type:l("ureal"),format:A},{type:p("address"),format:k},{type:p("bool"),format:P}]},M=T(),D=function(t,e,n){n=n.slice(2);var i=[],o=u(t,e),a=2*r,s=o.outputs.reduce(function(t,e){return t+F(e.type)},0),f=n.slice(0,s);return n=n.slice(s),o.outputs.forEach(function(t,e){for(var r=!1,u=0;u<M.length&&!r;u++)r=M[u].type(o.outputs[e].type);r||console.error("output parser does not support type: "+o.outputs[e].type);var s=M[u-1].format;if(h(o.outputs[e].type)){var c=B(f.slice(0,a));f=f.slice(a);for(var p=[],d=0;c>d;d++)p.push(s(n.slice(0,a))),n=n.slice(a);i.push(p)}else l("string")(o.outputs[e].type)?(f=f.slice(a),i.push(s(n.slice(0,a))),n=n.slice(a)):(i.push(s(n.slice(0,a))),n=n.slice(a))}),i},C=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},q=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)):""},I=function(t){var e={};return s(t).forEach(function(n){var r=C(n.name),i=q(n.name),o=function(){var e=Array.prototype.slice.call(arguments);return w(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},G=function(t){var e={};return s(t).forEach(function(n){var r=C(n.name),i=q(n.name),o=function(e){return D(t,n.name,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},H=function(t){return n.sha3(n.fromAscii(t)).slice(0,2+2*i)};e.exports={inputParser:I,outputParser:G,methodSignature:H,methodDisplayName:C,methodTypeName:q,getMethodWithName:u,filterFunctions:s,filterEvents:f}},{"./web3":8}],2:[function(t,e){var n=t("./web3"),r=t("./abi"),i=t("./event"),o=function(t){t.call=function(e){return t._isTransact=!1,t._options=e,t},t.transact=function(e){return t._isTransact=!0,t._options=e,t},t._options={},["gas","gasPrice","value","from"].forEach(function(e){t[e]=function(n){return t._options[e]=n,t}})},a=function(t,e,i){var o=r.inputParser(e),a=r.outputParser(e);r.filterFunctions(e).forEach(function(u){var s=r.methodDisplayName(u.name),f=r.methodTypeName(u.name),c=function(){var c=Array.prototype.slice.call(arguments),l=r.methodSignature(u.name),p=o[s][f].apply(null,c),h=t._options||{};h.to=i,h.data=l+p;var d=t._isTransact===!0||t._isTransact!==!1&&!u.constant,m=h.collapse!==!1;if(t._options={},t._isTransact=null,d)return n._currentContractAbi=e,n._currentContractAddress=i,n._currentContractMethodName=u.name,n._currentContractMethodParams=c,void n.eth.transact(h);var g=n.eth.call(h),v=a[s][f](g);return m&&(1===v.length?v=v[0]:0===v.length&&(v=null)),v};void 0===t[s]&&(t[s]=c),t[s][f]=c})},u=function(t,e,n){t.address=n,Object.defineProperty(t,"topics",{get:function(){return r.filterEvents(e).map(function(t){return r.methodSignature(t.name)})}})},s=function(t,e,o){r.filterEvents(e).forEach(function(e){var a=function(){var t=Array.prototype.slice.call(arguments),a=r.methodSignature(e.name),u=i(o,a),s=u.apply(null,t);return n.eth.watch(s)};a.address=o,Object.defineProperty(a,"topics",{get:function(){return[r.methodSignature(e.name)]}});var u=r.methodDisplayName(e.name),s=r.methodTypeName(e.name);void 0===t[u]&&(t[u]=a),t[u][s]=a})},f=function(t,e){e.forEach(function(t){if(-1===t.name.indexOf("(")){var e=t.name,n=t.inputs.map(function(t){return t.type}).join();t.name=e+"("+n+")"}});var n={};return o(n),a(n,e,t),u(n,e,t),s(n,e,t),n};e.exports=f},{"./abi":1,"./event":3,"./web3":8}],3:[function(t,e){var n=function(t,e){return function(n){var r=n||{};return r.address=r.address||t,r.topics=r.topics||[],r.topics.push(e),r}};e.exports=n},{}],4:[function(t,e){var n=t("./web3"),r=function(t,e){this.impl=e,this.callbacks=[],"string"!=typeof t&&(t={to:t.to,topics:t.topics,earliest:t.earliest,latest:t.latest,max:t.max,skip:t.skip,address:t.address}),this.id=e.newFilter(t),n.provider.startPolling({call:e.changed,args:[this.id]},this.id,this.trigger.bind(this))};r.prototype.arrived=function(t){this.changed(t)},r.prototype.changed=function(t){this.callbacks.push(t)},r.prototype.trigger=function(t){for(var e=0;e<this.callbacks.length;e++)for(var n=0;n<t.length;n++)this.callbacks[e].call(this,t[n])},r.prototype.uninstall=function(){this.impl.uninstallFilter(this.id),n.provider.stopPolling(this.id)},r.prototype.messages=function(){return this.impl.getMessages(this.id)},r.prototype.logs=function(){return this.messages()},e.exports=r},{"./web3":8}],5:[function(t,e){function n(t){return{jsonrpc:"2.0",method:t.call,params:t.args,id:t._id}}var r=function(t){this.handlers=[],this.host=t||"http://localhost:8080"};r.prototype.send=function(t){var e=n(t),r=new XMLHttpRequest;return r.open("POST",this.host,!1),r.send(JSON.stringify(e)),r.responseText},e.exports=r},{}],6:[function(t,e){var n=(t("./web3"),function(){this.polls=[],this.provider=void 0,this.id=1;var t=this,e=function(){t.provider&&t.polls.forEach(function(e){e.data._id=t.id,t.id++;var n=t.provider.send(e.data);n=JSON.parse(n),!n.error&&n.result instanceof Array&&0!==n.result.length&&e.callback(n.result)}),setTimeout(e,1e3)};e()});n.prototype.send=function(t){if(t.args=t.args||[],t._id=this.id++,void 0===this.provider)return console.error("provider is not set"),null;var e=this.provider.send(t);return e=JSON.parse(e),e.error?(console.log(e.error),null):e.result},n.prototype.set=function(t){this.provider=t},n.prototype.startPolling=function(t,e,n){this.polls.push({data:t,id:e,callback:n})},n.prototype.stopPolling=function(t){for(var e=this.polls.length;e--;){var n=this.polls[e];n.id===t&&this.polls.splice(e,1)}},e.exports=n},{"./web3":8}],7:[function(t,e){var n=function(){};n.prototype.send=function(t){return navigator.qt.callMethod(JSON.stringify(t))},e.exports=n},{}],8:[function(t,e){var n=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"],r=function(){return[{name:"sha3",call:"web3_sha3"}]},i=function(){var t=function(t){return"string"==typeof t[0]?"eth_blockByHash":"eth_blockByNumber"},e=function(t){return"string"==typeof t[0]?"eth_transactionByHash":"eth_transactionByNumber"},n=function(t){return"string"==typeof t[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:e},{name:"uncle",call:n},{name:"compilers",call:"eth_compilers"},{name:"flush",call:"eth_flush"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"}];return r},o=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"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"}]},s=function(){var t=function(t){return"string"==typeof t[0]?"eth_newFilterString":"eth_newFilter"};return[{name:"newFilter",call:t},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getMessages",call:"eth_filterLogs"}]},f=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getMessages",call:"shh_getMessages"}]},c=function(t,e){e.forEach(function(e){t[e.name]=function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof e.call?e.call(t):e.call;return p.provider.send({call:n,args:t})}})},l=function(t,e){e.forEach(function(e){var n={};n.get=function(){return p.provider.send({call:e.getter})},e.setter&&(n.set=function(t){return p.provider.send({call:e.setter,args:[t]})}),Object.defineProperty(t,e.name,n)})},p={_callbacks:{},_events:{},providers:{},toHex:function(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}return e},toAscii:function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},fromAscii:function(t,e){e=void 0===e?0:e;for(var n=this.toHex(t);n.length<2*e;)n+="00";return"0x"+n},toDecimal:function(t){return t=t.length>2?t.substring(2):"0",new BigNumber(t,16).toString(10)},fromDecimal:function(t){return"0x"+new BigNumber(t).toString(16)},toEth:function(t){for(var e="string"==typeof t?0===t.indexOf("0x")?parseInt(t.substr(2),16):parseInt(t):t,r=0,i=n;e>3e3&&r<i.length-1;)e/=1e3,r++;for(var o=e.toString().length<e.toFixed(2).length?e.toString():e.toFixed(2),a=function(t,e,n){return e+","+n};;){var u=o;if(o=o.replace(/(\d)(\d\d\d[\.\,])/,a),u===o)break}return o+" "+i[r]},eth:{contractFromAbi:function(t){return function(e){e=e||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";var n=p.eth.contract(e,t);return n.address=e,n}},watch:function(t){return new p.filter(t,h)}},db:{},shh:{watch:function(t){return new p.filter(t,d)}},haveProvider:function(){return!!p.provider.provider}};c(p,r()),c(p.eth,i()),l(p.eth,o()),c(p.db,a()),c(p.shh,u());var h={changed:"eth_changed"};c(h,s());var d={changed:"shh_changed"};c(d,f()),p.setProvider=function(t){p.provider.set(t)},e.exports=p},{}],web3:[function(t,e){var n=t("./lib/web3"),r=t("./lib/providermanager");n.provider=new r,n.filter=t("./lib/filter"),n.providers.HttpSyncProvider=t("./lib/httpsync"),n.providers.QtSyncProvider=t("./lib/qtsync"),n.eth.contract=t("./lib/contract"),n.abi=t("./lib/abi"),e.exports=n},{"./lib/abi":1,"./lib/contract":2,"./lib/filter":4,"./lib/httpsync":5,"./lib/providermanager":6,"./lib/qtsync":7,"./lib/web3":8}]},{},["web3"]);
\ No newline at end of file
diff --git a/example/balance.html b/example/balance.html
index 88f55315a..0563cc3df 100644
--- a/example/balance.html
+++ b/example/balance.html
@@ -17,7 +17,7 @@
         var originalBalance = web3.toDecimal(balance);
         document.getElementById('original').innerText = 'original balance: ' + originalBalance + '    watching...';
 
-        web3.eth.watch({altered: coinbase}).changed(function() {
+        web3.eth.watch({address: coinbase}).changed(function() {
             balance = web3.eth.balanceAt(coinbase)
             var currentBalance = web3.toDecimal(balance);
             document.getElementById("current").innerText = 'current: ' + currentBalance;
diff --git a/example/event.html b/example/event.html
new file mode 100644
index 000000000..8191dfd8f
--- /dev/null
+++ b/example/event.html
@@ -0,0 +1,67 @@
+<!doctype>
+<html>
+    <head>
+    <script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
+    <script type="text/javascript" src="../dist/ethereum.js"></script>
+    <script type="text/javascript">
+        var web3 = require('web3');
+        web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
+
+        var desc = [{
+            "type":"event",
+            "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}],
+            "name":"Event"
+        }, {
+            "type":"event",
+            "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}],
+            "name":"Event2"
+        }, {
+            "type":"function",
+            "inputs": [{"name":"a","type":"uint256"}],
+            "name":"foo",
+            "outputs": []
+        }];
+
+        var address = '0x01';
+
+        var contract = web3.eth.contract(address, desc); 
+
+        function test1() {
+            web3.eth.watch(contract).changed(function (res) {
+                
+            });
+        };
+
+        function test2() {
+            web3.eth.watch(contract.Event).changed(function (res) {
+                
+            });
+        };
+
+        function test3() {
+            contract.Event().changed(function (res) {
+                
+            });
+        };
+
+        // not valid
+        // function test4() {
+        //    web3.eth.watch([contract.Event, contract.Event2]).changed(function (res) {
+        //    });
+        // };
+
+    </script>
+    </head>
+
+    <body>
+        <div>
+            <button type="button" onClick="test1();">test1</button>
+        </div>
+        <div>
+            <button type="button" onClick="test2();">test2</button>
+        </div>
+        <div>
+            <button type="button" onClick="test3();">test3</button>
+        </div>
+    </body>
+</html>
diff --git a/lib/contract.js b/lib/contract.js
index 58a67efe6..13c48ca10 100644
--- a/lib/contract.js
+++ b/lib/contract.js
@@ -22,7 +22,7 @@
 
 var web3 = require('./web3'); 
 var abi = require('./abi');
-var eventImplementation = require('./event');
+var eventImpl = require('./event');
 
 var addFunctionRelatedPropertiesToContract = function (contract) {
     
@@ -127,10 +127,18 @@ var addEventsToContract = function (contract, desc, address) {
         var impl = function () {
             var params = Array.prototype.slice.call(arguments);
             var signature = abi.methodSignature(e.name);
-            var eventImpl = eventImplementation(address, signature);
-            var o = eventImpl.apply(null, params);
+            var event = eventImpl(address, signature);
+            var o = event.apply(null, params);
             return web3.eth.watch(o);  
         };
+
+        impl.address = address;
+
+        Object.defineProperty(impl, 'topics', {
+            get: function() {
+                return [abi.methodSignature(e.name)];
+            }
+        });
         
         // TODO: rename these methods, cause they are used not only for methods
         var displayName = abi.methodDisplayName(e.name);
diff --git a/lib/event.js b/lib/event.js
index e8312ccdb..ae2195381 100644
--- a/lib/event.js
+++ b/lib/event.js
@@ -1,5 +1,24 @@
+/*
+    This file is part of ethereum.js.
 
-var abi = require('./abi');
+    ethereum.js is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Lesser General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    ethereum.js is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public License
+    along with ethereum.js.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/** @file event.js
+ * @authors:
+ *   Marek Kotewicz <marek@ethdev.com>
+ * @date 2014
+ */
 
 var implementationOfEvent = function (address, signature) {
     
diff --git a/lib/filter.js b/lib/filter.js
index d93064b58..677b0657c 100644
--- a/lib/filter.js
+++ b/lib/filter.js
@@ -31,6 +31,19 @@ var Filter = function(options, impl) {
     this.impl = impl;
     this.callbacks = [];
 
+    if (typeof options !== "string") {
+        // evaluate lazy properties
+        options = {
+            to: options.to,
+            topics: options.topics,
+            earliest: options.earliest,
+            latest: options.latest,
+            max: options.max,
+            skip: options.skip,
+            address: options.address
+        };
+    }
+
     this.id = impl.newFilter(options);
     web3.provider.startPolling({call: impl.changed, args: [this.id]}, this.id, this.trigger.bind(this));
 };
-- 
cgit v1.2.3