aboutsummaryrefslogtreecommitdiffstats
path: root/dist/ethereum.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-29 22:05:43 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-29 22:05:43 +0800
commitdf17c338988260aab4db8f946076a67f3323caba (patch)
treeb89a71830e9bcd1cd3f13ffad25df04513d2143f /dist/ethereum.js
parentc8ee08c24bee9ab994822066f9abe94448c4ae89 (diff)
downloadgo-tangerine-df17c338988260aab4db8f946076a67f3323caba.tar.gz
go-tangerine-df17c338988260aab4db8f946076a67f3323caba.tar.zst
go-tangerine-df17c338988260aab4db8f946076a67f3323caba.zip
event example
Diffstat (limited to 'dist/ethereum.js')
-rw-r--r--dist/ethereum.js50
1 files changed, 45 insertions, 5 deletions
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));
};