From b773e5749077447718b12dc815a4794b0dc699b3 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 2 Nov 2014 21:35:28 -0500 Subject: [PATCH 1/3] Enable Travis CI --- .travis.yml | 7 +++++++ README.md | 2 ++ 2 files changed, 9 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..b2c4e591e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.11" +before_install: + - "npm install jshint" +install: + - "jshint *.js" diff --git a/README.md b/README.md index 86e2969be..7ff5cbb88 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Ethereum JavaScript API +[![Build Status](https://travis-ci.org/ethereum/ethereum.js.svg?branch=master)](https://travis-ci.org/ethereum/ethereum.js) + This is the Ethereum compatible JavaScript API using `Promise`s which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec. From 51d79f3e3b4876dd3b8925e8f10cc2f10aa16ff9 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 2 Nov 2014 21:56:45 -0500 Subject: [PATCH 2/3] Fix JSHint errors --- httprpc.js | 8 ++++---- main.js | 26 +++++++++++--------------- qt.js | 2 +- websocket.js | 2 +- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/httprpc.js b/httprpc.js index 085b4693d..f7f870d9d 100644 --- a/httprpc.js +++ b/httprpc.js @@ -10,8 +10,8 @@ method: object.call, params: object.args, id: object._id - } - }; + }; + } function formatJsonRpcMessage(message) { var object = JSON.parse(message); @@ -20,7 +20,7 @@ _id: object.id, data: object.result }; - }; + } HttpRpcProvider.prototype.sendRequest = function (payload, cb) { var data = formatJsonRpcObject(payload); @@ -32,7 +32,7 @@ if (request.readyState === 4 && cb) { cb(request); } - } + }; }; HttpRpcProvider.prototype.send = function (payload) { diff --git a/main.js b/main.js index 1f609220b..320c4e1a2 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,6 @@ (function(window) { function isPromise(o) { - return o instanceof Promise + return o instanceof Promise; } function flattenPromise (obj) { @@ -40,7 +40,7 @@ } return Promise.resolve(obj); - }; + } var ethMethods = function () { var blockCall = function (args) { @@ -171,7 +171,7 @@ }).catch(function (err) { console.error(err); }); - } + }; } Object.defineProperty(obj, property.name, proto); }); @@ -196,8 +196,8 @@ var str = ""; var i = 0, l = hex.length; for(; i < l; i+=2) { - var code = hex.charCodeAt(i) - if(code == 0) { + var code = hex.charCodeAt(i); + if(code === 0) { break; } @@ -216,22 +216,18 @@ var hex = this.toHex(str); while(hex.length < pad*2) hex += "00"; - return hex + return hex; }, eth: { - prototype: Object(), watch: function (params) { return new Filter(params, ethWatch); }, }, - db: { - prototype: Object() - }, + db: {}, shh: { - prototype: Object(), watch: function (params) { return new Filter(params, shhWatch); } @@ -243,7 +239,7 @@ } web3._events[event][id] = cb; - return this + return this; }, off: function(event, id) { @@ -251,7 +247,7 @@ delete web3._events[event][id]; } - return this + return this; }, trigger: function(event, id, data) { @@ -376,7 +372,7 @@ Filter.prototype.arrived = function(callback) { this.changed(callback); - } + }; Filter.prototype.changed = function(callback) { var self = this; @@ -416,7 +412,7 @@ if(data._id) { var cb = web3._callbacks[data._id]; if (cb) { - cb.call(this, data.data) + cb.call(this, data.data); delete web3._callbacks[data._id]; } } diff --git a/qt.js b/qt.js index 644c37737..2f532f942 100644 --- a/qt.js +++ b/qt.js @@ -7,7 +7,7 @@ self.handlers.forEach(function (handler) { handler.call(self, JSON.parse(message.data)); }); - } + }; }; QtProvider.prototype.send = function(payload) { diff --git a/websocket.js b/websocket.js index 732a086f2..63855ade1 100644 --- a/websocket.js +++ b/websocket.js @@ -11,7 +11,7 @@ var self = this; this.ws.onmessage = function(event) { for(var i = 0; i < self.handlers.length; i++) { - self.handlers[i].call(self, JSON.parse(event.data), event) + self.handlers[i].call(self, JSON.parse(event.data), event); } }; From e3998e30bab6152c48a6c5f6092ee8de830e9aea Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 2 Nov 2014 22:00:13 -0500 Subject: [PATCH 3/3] Don't run 'npm test' --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2c4e591e..294073ce0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js node_js: - "0.11" -before_install: - - "npm install jshint" install: + - "npm install jshint" +script: - "jshint *.js"