mirror of https://github.com/status-im/web3.js.git
fixed some of the jshint issues
This commit is contained in:
parent
55240b2ca1
commit
492f0e224f
|
@ -20,12 +20,8 @@
|
|||
* @date 2015
|
||||
*/
|
||||
|
||||
var BigNumber = require('bignumber.js');
|
||||
var utils = require('../utils/utils');
|
||||
var SolidityParam = require('./param');
|
||||
var f = require('./formatters');
|
||||
|
||||
var SolidityType = require('./type');
|
||||
var SolidityTypeAddress = require('./address');
|
||||
var SolidityTypeBool = require('./bool');
|
||||
var SolidityTypeInt = require('./int');
|
||||
|
@ -101,32 +97,32 @@ SolidityCoder.prototype.encodeParams = function (types, params) {
|
|||
|
||||
SolidityCoder.prototype.encodeMultiWithOffset = function (types, solidityTypes, encodeds, dynamicOffset) {
|
||||
var result = "";
|
||||
var self = this;
|
||||
|
||||
var isDynamic = function (i) {
|
||||
return solidityTypes[i].isDynamicArray(types[i]) || solidityTypes[i].isDynamicType(types[i]);
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types.forEach(function (type, i) {
|
||||
if (isDynamic(i)) {
|
||||
result += f.formatInputInt(dynamicOffset).encode();
|
||||
var e = this.encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset);
|
||||
var e = self.encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset);
|
||||
dynamicOffset += e.length / 2;
|
||||
} else {
|
||||
var e = this.encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset);
|
||||
//dynamicOffset += e.length / 2; // don't add this. it's already counted
|
||||
result += e;
|
||||
// don't add length to dynamicOffset. it's already counted
|
||||
result += self.encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset);
|
||||
}
|
||||
|
||||
// TODO: figure out nested arrays
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types.forEach(function (type, i) {
|
||||
if (isDynamic(i)) {
|
||||
var e = this.encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset);
|
||||
var e = self.encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset);
|
||||
dynamicOffset += e.length / 2;
|
||||
result += e;
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
|
@ -211,7 +207,7 @@ SolidityCoder.prototype.getOffsets = function (types, solidityTypes) {
|
|||
var lengths = solidityTypes.map(function (solidityType, index) {
|
||||
return solidityType.staticPartLength(types[index]);
|
||||
// get length
|
||||
})
|
||||
});
|
||||
|
||||
for (var i = 0; i < lengths.length; i++) {
|
||||
// sum with length of previous element
|
||||
|
|
|
@ -17,7 +17,7 @@ SolidityTypeDynamicBytes.prototype.staticPartLength = function (name) {
|
|||
return 32 * this.staticArrayLength(name);
|
||||
};
|
||||
|
||||
SolidityTypeDynamicBytes.prototype.isDynamicType = function (name) {
|
||||
SolidityTypeDynamicBytes.prototype.isDynamicType = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ SolidityTypeString.prototype.staticPartLength = function (name) {
|
|||
return 32 * this.staticArrayLength(name);
|
||||
};
|
||||
|
||||
SolidityTypeString.prototype.isDynamicType = function (name) {
|
||||
SolidityTypeString.prototype.isDynamicType = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ var SolidityType = function (config) {
|
|||
* @return {Bool} true if type match this SolidityType, otherwise false
|
||||
*/
|
||||
SolidityType.prototype.isType = function (name) {
|
||||
throw "this method should be overrwritten!";
|
||||
throw "this method should be overrwritten for type " + name;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ SolidityType.prototype.isType = function (name) {
|
|||
* @return {Number} length of static part in bytes
|
||||
*/
|
||||
SolidityType.prototype.staticPartLength = function (name) {
|
||||
throw "this method should be overrwritten!";
|
||||
throw "this method should be overrwritten for type: " + name;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -114,7 +114,7 @@ SolidityType.prototype.nestedName = function (name) {
|
|||
* @param {String} name
|
||||
* @return {Bool} true if is dynamic, otherwise false
|
||||
*/
|
||||
SolidityType.prototype.isDynamicType = function (name) {
|
||||
SolidityType.prototype.isDynamicType = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue