This commit is contained in:
Marek Kotewicz 2015-03-13 16:09:33 +01:00
parent cc3e373081
commit eceeda7d08
3 changed files with 10 additions and 12 deletions

14
dist/ethereum.js vendored
View File

@ -58,7 +58,7 @@ var isArrayType = function (type) {
*/ */
var dynamicTypeBytes = function (type, value) { var dynamicTypeBytes = function (type, value) {
// TODO: decide what to do with array of strings // TODO: decide what to do with array of strings
if (isArrayType(type) || type === 'string') // only string itself that is dynamic; stringX is static length. if (isArrayType(type) || type === 'bytes')
return f.formatInputInt(value.length); return f.formatInputInt(value.length);
return ""; return "";
}; };
@ -99,7 +99,7 @@ var formatInput = function (inputs, params) {
toAppendArrayContent += params[i].reduce(function (acc, curr) { toAppendArrayContent += params[i].reduce(function (acc, curr) {
return acc + formatter(curr); return acc + formatter(curr);
}, ""); }, "");
else if (inputs[i].type === 'string') else if (inputs[i].type === 'bytes')
toAppendArrayContent += formatter(params[i]); toAppendArrayContent += formatter(params[i]);
else else
toAppendConstant += formatter(params[i]); toAppendConstant += formatter(params[i]);
@ -118,7 +118,7 @@ var formatInput = function (inputs, params) {
* @returns {Number} length of dynamic type, 0 or multiplication of ETH_PADDING (32) * @returns {Number} length of dynamic type, 0 or multiplication of ETH_PADDING (32)
*/ */
var dynamicBytesLength = function (type) { var dynamicBytesLength = function (type) {
if (isArrayType(type) || type === 'string') // only string itself that is dynamic; stringX is static length. if (isArrayType(type) || type === 'bytes')
return c.ETH_PADDING * 2; return c.ETH_PADDING * 2;
return 0; return 0;
}; };
@ -168,7 +168,7 @@ var formatOutput = function (outs, output) {
} }
result.push(array); result.push(array);
} }
else if (types.prefixedType('string')(outs[i].type)) { else if (types.prefixedType('bytes')(outs[i].type)) {
dynamicPart = dynamicPart.slice(padding); dynamicPart = dynamicPart.slice(padding);
result.push(formatter(output.slice(0, padding))); result.push(formatter(output.slice(0, padding)));
output = output.slice(padding); output = output.slice(padding);
@ -509,8 +509,7 @@ var inputTypes = function () {
return [ return [
{ type: prefixedType('uint'), format: f.formatInputInt }, { type: prefixedType('uint'), format: f.formatInputInt },
{ type: prefixedType('int'), format: f.formatInputInt }, { type: prefixedType('int'), format: f.formatInputInt },
{ type: prefixedType('hash'), format: f.formatInputInt }, { type: prefixedType('bytes'), format: f.formatInputString },
{ type: prefixedType('string'), format: f.formatInputString },
{ type: prefixedType('real'), format: f.formatInputReal }, { type: prefixedType('real'), format: f.formatInputReal },
{ type: prefixedType('ureal'), format: f.formatInputReal }, { type: prefixedType('ureal'), format: f.formatInputReal },
{ type: namedType('address'), format: f.formatInputInt }, { type: namedType('address'), format: f.formatInputInt },
@ -525,8 +524,7 @@ var outputTypes = function () {
return [ return [
{ type: prefixedType('uint'), format: f.formatOutputUInt }, { type: prefixedType('uint'), format: f.formatOutputUInt },
{ type: prefixedType('int'), format: f.formatOutputInt }, { type: prefixedType('int'), format: f.formatOutputInt },
{ type: prefixedType('hash'), format: f.formatOutputHash }, { type: prefixedType('bytes'), format: f.formatOutputString },
{ type: prefixedType('string'), format: f.formatOutputString },
{ type: prefixedType('real'), format: f.formatOutputReal }, { type: prefixedType('real'), format: f.formatOutputReal },
{ type: prefixedType('ureal'), format: f.formatOutputUReal }, { type: prefixedType('ureal'), format: f.formatOutputUReal },
{ type: namedType('address'), format: f.formatOutputAddress }, { type: namedType('address'), format: f.formatOutputAddress },

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long