Skip to content

Commit

Permalink
merged develop
Browse files Browse the repository at this point in the history
  • Loading branch information
frozeman committed Apr 22, 2015
2 parents c9cd31b + e21ee7a commit 40c5c9e
Show file tree
Hide file tree
Showing 26 changed files with 1,661 additions and 1,407 deletions.
752 changes: 384 additions & 368 deletions dist/web3-light.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/web3-light.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/web3-light.min.js

Large diffs are not rendered by default.

752 changes: 384 additions & 368 deletions dist/web3.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/web3.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web3.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/event_inc.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
var contract;

var update = function (err, x) {
document.getElementById('result').innerText = JSON.stringify(x);
document.getElementById('result').innerText = JSON.stringify(x, null, 2);
};

var createContract = function () {
Expand Down
4 changes: 2 additions & 2 deletions lib/solidity/coder.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ var coder = new SolidityCoder([
name: 'bytes',
match: 'prefix',
mode: 'bytes',
inputFormatter: f.formatInputString,
outputFormatter: f.formatOutputString
inputFormatter: f.formatInputBytes,
outputFormatter: f.formatOutputBytes
}),
new SolidityType({
name: 'real',
Expand Down
24 changes: 6 additions & 18 deletions lib/solidity/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ var formatInputInt = function (value) {
/**
* Formats input value to byte representation of string
*
* @method formatInputString
* @method formatInputBytes
* @param {String}
* @returns {SolidityParam}
*/
var formatInputString = function (value) {
var formatInputBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam('', formatInputInt(value.length).value, result);
};
Expand Down Expand Up @@ -141,17 +141,6 @@ var formatOutputUReal = function (param) {
return formatOutputUInt(param).dividedBy(new BigNumber(2).pow(128));
};

/**
* Should be used to format output hash
*
* @method formatOutputHash
* @param {SolidityParam}
* @returns {String} right-aligned output bytes formatted to hex
*/
var formatOutputHash = function (param) {
return "0x" + param.value;
};

/**
* Should be used to format output bool
*
Expand All @@ -166,11 +155,11 @@ var formatOutputBool = function (param) {
/**
* Should be used to format output string
*
* @method formatOutputString
* @method formatOutputBytes
* @param {SolidityParam} left-aligned hex representation of string
* @returns {String} ascii string
*/
var formatOutputString = function (param) {
var formatOutputBytes = function (param) {
// length might also be important!
return utils.toAscii(param.suffix);
};
Expand All @@ -189,16 +178,15 @@ var formatOutputAddress = function (param) {

module.exports = {
formatInputInt: formatInputInt,
formatInputString: formatInputString,
formatInputBytes: formatInputBytes,
formatInputBool: formatInputBool,
formatInputReal: formatInputReal,
formatOutputInt: formatOutputInt,
formatOutputUInt: formatOutputUInt,
formatOutputReal: formatOutputReal,
formatOutputUReal: formatOutputUReal,
formatOutputHash: formatOutputHash,
formatOutputBool: formatOutputBool,
formatOutputString: formatOutputString,
formatOutputBytes: formatOutputBytes,
formatOutputAddress: formatOutputAddress
};

10 changes: 0 additions & 10 deletions lib/solidity/param.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,5 @@ SolidityParam.prototype.shiftArray = function (length) {
return new SolidityParam('', prefix, suffix);
};

/**
* This method should be used to check if param is empty
*
* @method empty
* @return {Bool} true if is empty, otherwise false
*/
SolidityParam.prototype.empty = function () {
return !this.value.length && !this.prefix.length && !this.suffix.length;
};

module.exports = SolidityParam;

30 changes: 1 addition & 29 deletions lib/solidity/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,7 @@ var getConstructor = function (abi, numberOfArgs) {
})[0];
};

/**
* Filters all functions from input abi
*
* @method filterFunctions
* @param {Array} abi
* @returns {Array} abi array with filtered objects of type 'function'
*/
var filterFunctions = function (json) {
return json.filter(function (current) {
return current.type === 'function';
});
};

/**
* Filters all events from input abi
*
* @method filterEvents
* @param {Array} abi
* @returns {Array} abi array with filtered objects of type 'event'
*/
var filterEvents = function (json) {
return json.filter(function (current) {
return current.type === 'event';
});
};

module.exports = {
getConstructor: getConstructor,
filterFunctions: filterFunctions,
filterEvents: filterEvents
getConstructor: getConstructor
};

40 changes: 20 additions & 20 deletions lib/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
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 utils.js
* @authors:
* Marek Kotewicz <marek@ethdev.com>
/**
* @file utils.js
* @author Marek Kotewicz <marek@ethdev.com>
* @date 2015
*/

Expand Down Expand Up @@ -67,22 +67,6 @@ var padLeft = function (string, chars, sign) {
return new Array(chars - string.length + 1).join(sign ? sign : "0") + string;
};

/** Finds first index of array element matching pattern
*
* @method findIndex
* @param {Array}
* @param {Function} pattern
* @returns {Number} index of element
*/
var findIndex = function (array, callback) {
var end = false;
var i = 0;
for (; i < array.length && !end; i++) {
end = callback(array[i]);
}
return end ? i - 1 : -1;
};

/**
* Should be called to get sting from it's hex representation
*
Expand Down Expand Up @@ -142,6 +126,22 @@ var fromAscii = function(str, pad) {
return "0x" + hex;
};

/**
* Should be used to create full function/event name from json abi
*
* @method transformToFullName
* @param {Object} json-abi
* @return {String} full fnction/event name
*/
var transformToFullName = function (json) {
if (json.name.indexOf('(') !== -1) {
return json.name;
}

var typeName = json.inputs.map(function(i){return i.type; }).join();
return json.name + '(' + typeName + ')';
};

/**
* Should be called to get display name of contract function
*
Expand Down Expand Up @@ -448,12 +448,12 @@ var isJson = function (str) {

module.exports = {
padLeft: padLeft,
findIndex: findIndex,
toHex: toHex,
toDecimal: toDecimal,
fromDecimal: fromDecimal,
toAscii: toAscii,
fromAscii: fromAscii,
transformToFullName: transformToFullName,
extractDisplayName: extractDisplayName,
extractTypeName: extractTypeName,
toWei: toWei,
Expand Down
Loading

0 comments on commit 40c5c9e

Please sign in to comment.