| "+item+" | "+web3.toDecimal(storage[item])+" |
";
diff --git a/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js b/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
index 5b7d872706..c0b37641c7 100644
--- a/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
+++ b/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
@@ -22,34 +22,57 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requ
* @date 2014
*/
-var utils = require('./utils');
+var utils = require('../utils/utils');
+var c = require('../utils/config');
var types = require('./types');
-var c = require('./const');
var f = require('./formatters');
-var displayTypeError = function (type) {
- console.error('parser does not support type: ' + type);
+/**
+ * throw incorrect type error
+ *
+ * @method throwTypeError
+ * @param {String} type
+ * @throws incorrect type error
+ */
+var throwTypeError = function (type) {
+ throw new Error('parser does not support type: ' + type);
};
-/// This method should be called if we want to check if givent type is an array type
-/// @returns true if it is, otherwise false
-var arrayType = function (type) {
+/** This method should be called if we want to check if givent type is an array type
+ *
+ * @method isArrayType
+ * @param {String} type name
+ * @returns {Boolean} true if it is, otherwise false
+ */
+var isArrayType = function (type) {
return type.slice(-2) === '[]';
};
+/**
+ * This method should be called to return dynamic type length in hex
+ *
+ * @method dynamicTypeBytes
+ * @param {String} type
+ * @param {String|Array} dynamic type
+ * @return {String} length of dynamic type in hex or empty string if type is not dynamic
+ */
var dynamicTypeBytes = function (type, value) {
// TODO: decide what to do with array of strings
- if (arrayType(type) || type === 'string') // only string itself that is dynamic; stringX is static length.
+ if (isArrayType(type) || type === 'string') // only string itself that is dynamic; stringX is static length.
return f.formatInputInt(value.length);
return "";
};
var inputTypes = types.inputTypes();
-/// Formats input params to bytes
-/// @param abi contract method inputs
-/// @param array of params that will be formatted to bytes
-/// @returns bytes representation of input params
+/**
+ * Formats input params to bytes
+ *
+ * @method formatInput
+ * @param {Array} abi inputs of method
+ * @param {Array} params that will be formatted to bytes
+ * @returns bytes representation of input params
+ */
var formatInput = function (inputs, params) {
var bytes = "";
var toAppendConstant = "";
@@ -67,12 +90,12 @@ var formatInput = function (inputs, params) {
typeMatch = inputTypes[j].type(inputs[i].type, params[i]);
}
if (!typeMatch) {
- displayTypeError(inputs[i].type);
+ throwTypeError(inputs[i].type);
}
var formatter = inputTypes[j - 1].format;
- if (arrayType(inputs[i].type))
+ if (isArrayType(inputs[i].type))
toAppendArrayContent += params[i].reduce(function (acc, curr) {
return acc + formatter(curr);
}, "");
@@ -87,18 +110,29 @@ var formatInput = function (inputs, params) {
return bytes;
};
+/**
+ * This method should be called to predict the length of dynamic type
+ *
+ * @method dynamicBytesLength
+ * @param {String} type
+ * @returns {Number} length of dynamic type, 0 or multiplication of ETH_PADDING (32)
+ */
var dynamicBytesLength = function (type) {
- if (arrayType(type) || type === 'string') // only string itself that is dynamic; stringX is static length.
+ if (isArrayType(type) || type === 'string') // only string itself that is dynamic; stringX is static length.
return c.ETH_PADDING * 2;
return 0;
};
var outputTypes = types.outputTypes();
-/// Formats output bytes back to param list
-/// @param contract abi method outputs
-/// @param bytes representtion of output
-/// @returns array of output params
+/**
+ * Formats output bytes back to param list
+ *
+ * @method formatOutput
+ * @param {Array} abi outputs of method
+ * @param {String} bytes represention of output
+ * @returns {Array} output params
+ */
var formatOutput = function (outs, output) {
output = output.slice(2);
@@ -120,11 +154,11 @@ var formatOutput = function (outs, output) {
}
if (!typeMatch) {
- displayTypeError(outs[i].type);
+ throwTypeError(outs[i].type);
}
var formatter = outputTypes[j - 1].format;
- if (arrayType(outs[i].type)) {
+ if (isArrayType(outs[i].type)) {
var size = f.formatOutputUInt(dynamicPart.slice(0, padding));
dynamicPart = dynamicPart.slice(padding);
var array = [];
@@ -147,9 +181,14 @@ var formatOutput = function (outs, output) {
return result;
};
-/// @param json abi for contract
-/// @returns input parser object for given json abi
-/// TODO: refactor creating the parser, do not double logic from contract
+/**
+ * Should be called to create input parser for contract with given abi
+ *
+ * @method inputParser
+ * @param {Array} contract abi
+ * @returns {Object} input parser object for given json abi
+ * TODO: refactor creating the parser, do not double logic from contract
+ */
var inputParser = function (json) {
var parser = {};
json.forEach(function (method) {
@@ -171,8 +210,13 @@ var inputParser = function (json) {
return parser;
};
-/// @param json abi for contract
-/// @returns output parser for given json abi
+/**
+ * Should be called to create output parser for contract with given abi
+ *
+ * @method outputParser
+ * @param {Array} contract abi
+ * @returns {Object} output parser for given json abi
+ */
var outputParser = function (json) {
var parser = {};
json.forEach(function (method) {
@@ -201,7 +245,7 @@ module.exports = {
formatOutput: formatOutput
};
-},{"./const":2,"./formatters":8,"./types":15,"./utils":16}],2:[function(require,module,exports){
+},{"../utils/config":4,"../utils/utils":5,"./formatters":2,"./types":3}],2:[function(require,module,exports){
/*
This file is part of ethereum.js.
@@ -218,12 +262,322 @@ module.exports = {
You should have received a copy of the GNU Lesser General Public License
along with ethereum.js. If not, see