From fa8d4c1087bf8236c8a1930f00a0c3e2cfc2092b Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 28 Jul 2015 01:43:28 +0200 Subject: [PATCH] step by step encoding --- lib/solidity/coder.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/solidity/coder.js b/lib/solidity/coder.js index 05a07c59..acb2e054 100644 --- a/lib/solidity/coder.js +++ b/lib/solidity/coder.js @@ -244,18 +244,20 @@ SolidityCoder.prototype.encodeParams = function (types, params) { return acc + f.formatInputInt(totalOffset + offsets[index]).encode(); } else if (solidityType.isStaticArray(types[index])) { var offset = acc.length / 2; - return acc + encodeds[index].join(''); + //return acc + encodeds[index].join(''); + return acc + self.encodeWithOffset(types[index], solidityType, encodeds[index], offset); } return acc + encodeds[index]; }, ""); console.log(result); var self = this; - result = solidityTypes.filter(function (solidityType, index) { - return solidityType.isDynamicArray(types[index]); - }).reduce(function (acc, solidityType, index) { - var offset = acc.length / 2; - return acc + self.encodeWithOffset(types[index], solidityType, encodeds[index], offset); + result = solidityTypes.reduce(function (acc, solidityType, index) { + if (solidityType.isDynamicArray(types[index])) { + var offset = acc.length / 2; + return acc + self.encodeWithOffset(types[index], solidityType, encodeds[index], offset); + } + return acc; }, result); console.log(result);