mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 03:28:07 +00:00
step by step encoding
This commit is contained in:
parent
b043832cfd
commit
fa8d4c1087
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user