merged with solved conflicts
This commit is contained in:
commit
84900e6463
63
.jshintrc
63
.jshintrc
|
@ -1,50 +1,19 @@
|
|||
{
|
||||
"predef": [
|
||||
"console",
|
||||
"require",
|
||||
"equal",
|
||||
"test",
|
||||
"testBoth",
|
||||
"testWithDefault",
|
||||
"raises",
|
||||
"deepEqual",
|
||||
"start",
|
||||
"stop",
|
||||
"ok",
|
||||
"strictEqual",
|
||||
"module",
|
||||
"expect",
|
||||
"reject",
|
||||
"impl"
|
||||
],
|
||||
|
||||
"esnext": true,
|
||||
"proto": true,
|
||||
"node" : true,
|
||||
"browser" : true,
|
||||
"browserify" : true,
|
||||
|
||||
"boss" : true,
|
||||
"curly": false,
|
||||
"debug": true,
|
||||
"devel": true,
|
||||
"browserify": true,
|
||||
"bitwise": true,
|
||||
"camelcase": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"freeze": true,
|
||||
"funcscope": false,
|
||||
"maxcomplexity": 4, /* our target is 3! */
|
||||
"maxdepth": 3,
|
||||
"maxerr": 50,
|
||||
/*"maxlen": 80*/ /*this should be our goal*/
|
||||
"maxparams": 3,
|
||||
"nonew": true,
|
||||
"unused": true,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"shadow": true,
|
||||
"eqnull": true
|
||||
}
|
||||
"predef": [
|
||||
"console"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
"namespace": "ethereum",
|
||||
"version": "0.0.15",
|
||||
"description": "Ethereum Compatible JavaScript API",
|
||||
"main": ["./dist/ethereum.js", "./dist/ethereum.min.js"],
|
||||
"main": [
|
||||
"./dist/ethereum.js",
|
||||
"./dist/ethereum.min.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"bignumber.js": ">=2.0.0"
|
||||
},
|
||||
|
|
|
@ -53,7 +53,6 @@ var inputTypes = types.inputTypes();
|
|||
/// @returns bytes representation of input params
|
||||
var formatInput = function (inputs, params) {
|
||||
var bytes = "";
|
||||
var padding = c.ETH_PADDING * 2;
|
||||
|
||||
/// first we iterate in search for dynamic
|
||||
inputs.forEach(function (input, index) {
|
||||
|
@ -110,6 +109,7 @@ var formatOutput = function (outs, output) {
|
|||
output = output.slice(dynamicPartLength);
|
||||
|
||||
outs.forEach(function (out, i) {
|
||||
/*jshint maxcomplexity:6 */
|
||||
var typeMatch = false;
|
||||
for (var j = 0; j < outputTypes.length && !typeMatch; j++) {
|
||||
typeMatch = outputTypes[j].type(outs[i].type);
|
||||
|
@ -296,7 +296,6 @@ var web3 = require('./web3');
|
|||
var abi = require('./abi');
|
||||
var utils = require('./utils');
|
||||
var eventImpl = require('./event');
|
||||
var filter = require('./filter');
|
||||
|
||||
var exportNatspecGlobals = function (vars) {
|
||||
// it's used byt natspec.js
|
||||
|
@ -350,6 +349,7 @@ var addFunctionsToContract = function (contract, desc, address) {
|
|||
var typeName = utils.extractTypeName(method.name);
|
||||
|
||||
var impl = function () {
|
||||
/*jshint maxcomplexity:7 */
|
||||
var params = Array.prototype.slice.call(arguments);
|
||||
var signature = abi.signatureFromAscii(method.name);
|
||||
var parsed = inputParser[displayName][typeName].apply(null, params);
|
||||
|
@ -513,7 +513,7 @@ function Contract(abi, address) {
|
|||
module.exports = contract;
|
||||
|
||||
|
||||
},{"./abi":1,"./event":6,"./filter":7,"./utils":15,"./web3":17}],4:[function(require,module,exports){
|
||||
},{"./abi":1,"./event":6,"./utils":15,"./web3":17}],4:[function(require,module,exports){
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
|
@ -741,9 +741,9 @@ var getArgumentsObject = function (inputs, indexed, notIndexed) {
|
|||
return inputs.reduce(function (acc, current) {
|
||||
var value;
|
||||
if (current.indexed)
|
||||
value = indexed.splice(0, 1)[0];
|
||||
value = indexedCopy.splice(0, 1)[0];
|
||||
else
|
||||
value = notIndexed.splice(0, 1)[0];
|
||||
value = notIndexedCopy.splice(0, 1)[0];
|
||||
|
||||
acc[current.name] = value;
|
||||
return acc;
|
||||
|
@ -886,7 +886,16 @@ var filter = function(options, implementation, formatter) {
|
|||
var watch = function(callback) {
|
||||
callbacks.push(callback);
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
var stopWatching = function() {
|
||||
=======
|
||||
|
||||
var messages = function () {
|
||||
return implementation.getMessages(filterId);
|
||||
};
|
||||
|
||||
var uninstall = function () {
|
||||
>>>>>>> 72d7a0c7ac38b99d248a64ab3c02f76bea72c766
|
||||
implementation.stopPolling(filterId);
|
||||
implementation.uninstallFilter(filterId);
|
||||
callbacks = [];
|
||||
|
@ -975,6 +984,7 @@ var padLeft = function (string, chars, sign) {
|
|||
/// If the value is floating point, round it down
|
||||
/// @returns right-aligned byte representation of int
|
||||
var formatInputInt = function (value) {
|
||||
/*jshint maxcomplexity:7 */
|
||||
var padding = c.ETH_PADDING * 2;
|
||||
if (value instanceof BigNumber || typeof value === 'number') {
|
||||
if (typeof value === 'number')
|
||||
|
@ -1448,9 +1458,11 @@ var requestManager = function() {
|
|||
provider = p;
|
||||
};
|
||||
|
||||
/*jshint maxparams:4 */
|
||||
var startPolling = function (data, pollId, callback, uninstall) {
|
||||
polls.push({data: data, id: pollId, callback: callback, uninstall: uninstall});
|
||||
};
|
||||
/*jshint maxparams:3 */
|
||||
|
||||
var stopPolling = function (pollId) {
|
||||
for (var i = polls.length; i--;) {
|
||||
|
@ -1730,9 +1742,13 @@ var filterEvents = function (json) {
|
|||
/// TODO: use BigNumber.js to parse int
|
||||
/// TODO: add tests for it!
|
||||
var toEth = function (str) {
|
||||
<<<<<<< HEAD
|
||||
|
||||
console.warn('This method is deprecated please use eth.fromWei(number, unit) instead.');
|
||||
|
||||
=======
|
||||
/*jshint maxcomplexity:7 */
|
||||
>>>>>>> 72d7a0c7ac38b99d248a64ab3c02f76bea72c766
|
||||
var val = typeof str === "string" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
|
||||
var unit = 0;
|
||||
var units = c.ETH_UNITS;
|
||||
|
@ -2134,12 +2150,14 @@ var setupProperties = function (obj, properties) {
|
|||
});
|
||||
};
|
||||
|
||||
/*jshint maxparams:4 */
|
||||
var startPolling = function (method, id, callback, uninstall) {
|
||||
web3.manager.startPolling({
|
||||
method: method,
|
||||
params: [id]
|
||||
}, id, callback, uninstall);
|
||||
};
|
||||
/*jshint maxparams:3 */
|
||||
|
||||
var stopPolling = function (id) {
|
||||
web3.manager.stopPolling(id);
|
||||
|
@ -2209,12 +2227,20 @@ var web3 = {
|
|||
/// @param eventParams is optional, this is an object with optional event eventParams params
|
||||
/// @param options is optional, this is an object with optional event options ('max'...)
|
||||
/// TODO: fix it, 4 params? no way
|
||||
<<<<<<< HEAD
|
||||
filter: function (fil, eventParams, options, formatter) {
|
||||
|
||||
// if its event, treat it differently
|
||||
if (fil._isEvent)
|
||||
return fil(eventParams, options);
|
||||
|
||||
=======
|
||||
/*jshint maxparams:4 */
|
||||
watch: function (fil, indexed, options, formatter) {
|
||||
if (fil._isEvent) {
|
||||
return fil(indexed, options);
|
||||
}
|
||||
>>>>>>> 72d7a0c7ac38b99d248a64ab3c02f76bea72c766
|
||||
return filter(fil, ethWatch, formatter);
|
||||
},
|
||||
// DEPRECATED
|
||||
|
@ -2222,6 +2248,7 @@ var web3 = {
|
|||
console.warn('eth.watch() is deprecated please use eth.filter() instead.');
|
||||
return this.filter(fil, eventParams, options, formatter);
|
||||
}
|
||||
/*jshint maxparams:3 */
|
||||
},
|
||||
|
||||
/// db object prototype
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -10,8 +10,6 @@ var browserify = require('browserify');
|
|||
var jshint = require('gulp-jshint');
|
||||
var uglify = require('gulp-uglify');
|
||||
var rename = require('gulp-rename');
|
||||
var envify = require('envify/custom');
|
||||
var unreach = require('unreachable-branch-transform');
|
||||
var source = require('vinyl-source-stream');
|
||||
var exorcist = require('exorcist');
|
||||
var bower = require('bower');
|
||||
|
@ -23,7 +21,7 @@ var dst = 'ethereum';
|
|||
|
||||
var browserifyOptions = {
|
||||
debug: true,
|
||||
insert_global_vars: false,
|
||||
insert_global_vars: false, // jshint ignore:line
|
||||
detectGlobals: false,
|
||||
bundleExternal: false
|
||||
};
|
||||
|
|
|
@ -52,7 +52,6 @@ var inputTypes = types.inputTypes();
|
|||
/// @returns bytes representation of input params
|
||||
var formatInput = function (inputs, params) {
|
||||
var bytes = "";
|
||||
var padding = c.ETH_PADDING * 2;
|
||||
|
||||
/// first we iterate in search for dynamic
|
||||
inputs.forEach(function (input, index) {
|
||||
|
@ -109,6 +108,7 @@ var formatOutput = function (outs, output) {
|
|||
output = output.slice(dynamicPartLength);
|
||||
|
||||
outs.forEach(function (out, i) {
|
||||
/*jshint maxcomplexity:6 */
|
||||
var typeMatch = false;
|
||||
for (var j = 0; j < outputTypes.length && !typeMatch; j++) {
|
||||
typeMatch = outputTypes[j].type(outs[i].type);
|
||||
|
|
|
@ -24,7 +24,6 @@ var web3 = require('./web3');
|
|||
var abi = require('./abi');
|
||||
var utils = require('./utils');
|
||||
var eventImpl = require('./event');
|
||||
var filter = require('./filter');
|
||||
|
||||
var exportNatspecGlobals = function (vars) {
|
||||
// it's used byt natspec.js
|
||||
|
@ -78,6 +77,7 @@ var addFunctionsToContract = function (contract, desc, address) {
|
|||
var typeName = utils.extractTypeName(method.name);
|
||||
|
||||
var impl = function () {
|
||||
/*jshint maxcomplexity:7 */
|
||||
var params = Array.prototype.slice.call(arguments);
|
||||
var signature = abi.signatureFromAscii(method.name);
|
||||
var parsed = inputParser[displayName][typeName].apply(null, params);
|
||||
|
|
|
@ -81,9 +81,9 @@ var getArgumentsObject = function (inputs, indexed, notIndexed) {
|
|||
return inputs.reduce(function (acc, current) {
|
||||
var value;
|
||||
if (current.indexed)
|
||||
value = indexed.splice(0, 1)[0];
|
||||
value = indexedCopy.splice(0, 1)[0];
|
||||
else
|
||||
value = notIndexed.splice(0, 1)[0];
|
||||
value = notIndexedCopy.splice(0, 1)[0];
|
||||
|
||||
acc[current.name] = value;
|
||||
return acc;
|
||||
|
|
|
@ -88,6 +88,7 @@ var filter = function(options, implementation, formatter) {
|
|||
var watch = function(callback) {
|
||||
callbacks.push(callback);
|
||||
};
|
||||
|
||||
var stopWatching = function() {
|
||||
implementation.stopPolling(filterId);
|
||||
implementation.uninstallFilter(filterId);
|
||||
|
@ -105,27 +106,27 @@ var filter = function(options, implementation, formatter) {
|
|||
|
||||
// DEPRECATED methods
|
||||
changed: function(){
|
||||
console.warn('eth.watch().changed() is deprecated please use eth.filter().watch() instead.');
|
||||
console.warn('watch().changed() is deprecated please use filter().watch() instead.');
|
||||
return watch.apply(this, arguments);
|
||||
},
|
||||
arrived: function(){
|
||||
console.warn('eth.watch().arrived() is deprecated please use eth.filter().watch() instead.');
|
||||
console.warn('watch().arrived() is deprecated please use filter().watch() instead.');
|
||||
return watch.apply(this, arguments);
|
||||
},
|
||||
happened: function(){
|
||||
console.warn('eth.watch().happened() is deprecated please use eth.filter().watch() instead.');
|
||||
console.warn('watch().happened() is deprecated please use filter().watch() instead.');
|
||||
return watch.apply(this, arguments);
|
||||
},
|
||||
uninstall: function(){
|
||||
console.warn('eth.watch().uninstall() is deprecated please use eth.filter().stopWatching() instead.');
|
||||
console.warn('watch().uninstall() is deprecated please use filter().stopWatching() instead.');
|
||||
return stopWatching.apply(this, arguments);
|
||||
},
|
||||
messages: function(){
|
||||
console.warn('eth.watch().messages() is deprecated please use eth.filter().get() instead.');
|
||||
console.warn('watch().messages() is deprecated please use filter().get() instead.');
|
||||
return get.apply(this, arguments);
|
||||
},
|
||||
logs: function(){
|
||||
console.warn('eth.watch().logs() is deprecated please use eth.filter().get() instead.');
|
||||
console.warn('watch().logs() is deprecated please use filter().get() instead.');
|
||||
return get.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -40,6 +40,7 @@ var padLeft = function (string, chars, sign) {
|
|||
/// If the value is floating point, round it down
|
||||
/// @returns right-aligned byte representation of int
|
||||
var formatInputInt = function (value) {
|
||||
/*jshint maxcomplexity:7 */
|
||||
var padding = c.ETH_PADDING * 2;
|
||||
if (value instanceof BigNumber || typeof value === 'number') {
|
||||
if (typeof value === 'number')
|
||||
|
|
|
@ -69,9 +69,11 @@ var requestManager = function() {
|
|||
provider = p;
|
||||
};
|
||||
|
||||
/*jshint maxparams:4 */
|
||||
var startPolling = function (data, pollId, callback, uninstall) {
|
||||
polls.push({data: data, id: pollId, callback: callback, uninstall: uninstall});
|
||||
};
|
||||
/*jshint maxparams:3 */
|
||||
|
||||
var stopPolling = function (pollId) {
|
||||
for (var i = polls.length; i--;) {
|
||||
|
|
|
@ -112,8 +112,9 @@ var filterEvents = function (json) {
|
|||
/// TODO: add tests for it!
|
||||
var toEth = function (str) {
|
||||
|
||||
console.warn('This method is deprecated please use eth.fromWei(number, unit) instead.');
|
||||
console.warn('This method is deprecated please use eth.fromWei(BigNumberOrNumber, unit) instead.');
|
||||
|
||||
/*jshint maxcomplexity:7 */
|
||||
var val = typeof str === "string" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
|
||||
var unit = 0;
|
||||
var units = c.ETH_UNITS;
|
||||
|
|
|
@ -117,12 +117,14 @@ var setupProperties = function (obj, properties) {
|
|||
});
|
||||
};
|
||||
|
||||
/*jshint maxparams:4 */
|
||||
var startPolling = function (method, id, callback, uninstall) {
|
||||
web3.manager.startPolling({
|
||||
method: method,
|
||||
params: [id]
|
||||
}, id, callback, uninstall);
|
||||
};
|
||||
/*jshint maxparams:3 */
|
||||
|
||||
var stopPolling = function (id) {
|
||||
web3.manager.stopPolling(id);
|
||||
|
@ -192,6 +194,7 @@ var web3 = {
|
|||
/// @param eventParams is optional, this is an object with optional event eventParams params
|
||||
/// @param options is optional, this is an object with optional event options ('max'...)
|
||||
/// TODO: fix it, 4 params? no way
|
||||
/*jshint maxparams:4 */
|
||||
filter: function (fil, eventParams, options, formatter) {
|
||||
|
||||
// if its event, treat it differently
|
||||
|
@ -205,6 +208,7 @@ var web3 = {
|
|||
console.warn('eth.watch() is deprecated please use eth.filter() instead.');
|
||||
return this.filter(fil, eventParams, options, formatter);
|
||||
}
|
||||
/*jshint maxparams:3 */
|
||||
},
|
||||
|
||||
/// db object prototype
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"bignumber.js": ">=2.0.0",
|
||||
"ws": "*",
|
||||
"xmlhttprequest": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
Loading…
Reference in New Issue