aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js47
1 files changed, 8 insertions, 39 deletions
diff --git a/lib/main.js b/lib/main.js
index 7990691de..697cbdbc3 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -22,8 +22,6 @@
* @date 2014
*/
-var abi = require('./abi');
-
function flattenPromise (obj) {
if (obj instanceof Promise) {
return Promise.resolve(obj);
@@ -89,7 +87,9 @@ var ethMethods = function () {
{ name: 'uncle', call: uncleCall },
{ name: 'compilers', call: 'eth_compilers' },
{ name: 'lll', call: 'eth_lll' },
- { name: 'solidity', call: 'eth_solidity' }
+ { name: 'solidity', call: 'eth_solidity' },
+ { name: 'serpent', call: 'eth_serpent' },
+ { name: 'logs', call: 'eth_logs' }
];
return methods;
};
@@ -135,7 +135,7 @@ var ethWatchMethods = function () {
return [
{ name: 'newFilter', call: newFilter },
{ name: 'uninstallFilter', call: 'eth_uninstallFilter' },
- { name: 'getMessages', call: 'eth_getMessages' }
+ { name: 'getMessages', call: 'eth_filterLogs' }
];
};
@@ -440,6 +440,10 @@ Filter.prototype.messages = function() {
});
};
+Filter.prototype.logs = function () {
+ return this.messages();
+};
+
function messageHandler(data) {
if(data._event !== undefined) {
web3.trigger(data._event, data._id, data.data);
@@ -455,40 +459,5 @@ function messageHandler(data) {
}
}
-web3.contract = function (address, desc) {
- var inputParser = abi.inputParser(desc);
- var outputParser = abi.outputParser(desc);
-
- var contract = {};
-
- desc.forEach(function (method) {
- contract[method.name] = function () {
- var params = Array.prototype.slice.call(arguments);
- var parsed = inputParser[method.name].apply(null, params);
-
- var onSuccess = function (result) {
- return outputParser[method.name](result);
- };
-
- return {
- call: function (extra) {
- extra = extra || {};
- extra.to = address;
- extra.data = parsed;
- return web3.eth.call(extra).then(onSuccess);
- },
- transact: function (extra) {
- extra = extra || {};
- extra.to = address;
- extra.data = parsed;
- return web3.eth.transact(extra).then(onSuccess);
- }
- };
- };
- });
-
- return contract;
-};
-
module.exports = web3;