mirror of https://github.com/status-im/web3.js.git
Merge branch 'develop'
This commit is contained in:
commit
b965bd8506
|
@ -780,16 +780,17 @@ SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded
|
||||||
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
|
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
|
||||||
var result = "";
|
var result = "";
|
||||||
|
|
||||||
(function () {
|
|
||||||
var previousLength = 0; // in int
|
if (solidityType.isDynamicArray(nestedName)) {
|
||||||
if (solidityType.isDynamicArray(nestedName)) {
|
(function () {
|
||||||
|
var previousLength = 0; // in int
|
||||||
for (var i = 0; i < encoded.length; i++) {
|
for (var i = 0; i < encoded.length; i++) {
|
||||||
// calculate length of previous item
|
// calculate length of previous item
|
||||||
previousLength += +(encoded[i - 1] || [])[0] || 0;
|
previousLength += +(encoded[i - 1] || [])[0] || 0;
|
||||||
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
|
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
|
||||||
}
|
}
|
||||||
}
|
})();
|
||||||
})();
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
for (var i = 0; i < encoded.length; i++) {
|
for (var i = 0; i < encoded.length; i++) {
|
||||||
|
@ -1966,7 +1967,7 @@ var toAscii = function(hex) {
|
||||||
str += String.fromCharCode(code);
|
str += String.fromCharCode(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
return decodeURIComponent(escape(str));
|
return decodeURIComponent(escape(str)); // jshint ignore:line
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1977,7 +1978,7 @@ var toAscii = function(hex) {
|
||||||
* @returns {String} hex representation of input string
|
* @returns {String} hex representation of input string
|
||||||
*/
|
*/
|
||||||
var toHexNative = function(str) {
|
var toHexNative = function(str) {
|
||||||
str = unescape(encodeURIComponent(str));
|
str = unescape(encodeURIComponent(str)); // jshint ignore:line
|
||||||
var hex = "";
|
var hex = "";
|
||||||
for(var i = 0; i < str.length; i++) {
|
for(var i = 0; i < str.length; i++) {
|
||||||
var n = str.charCodeAt(i).toString(16);
|
var n = str.charCodeAt(i).toString(16);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -780,16 +780,17 @@ SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded
|
||||||
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
|
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
|
||||||
var result = "";
|
var result = "";
|
||||||
|
|
||||||
(function () {
|
|
||||||
var previousLength = 0; // in int
|
if (solidityType.isDynamicArray(nestedName)) {
|
||||||
if (solidityType.isDynamicArray(nestedName)) {
|
(function () {
|
||||||
|
var previousLength = 0; // in int
|
||||||
for (var i = 0; i < encoded.length; i++) {
|
for (var i = 0; i < encoded.length; i++) {
|
||||||
// calculate length of previous item
|
// calculate length of previous item
|
||||||
previousLength += +(encoded[i - 1] || [])[0] || 0;
|
previousLength += +(encoded[i - 1] || [])[0] || 0;
|
||||||
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
|
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
|
||||||
}
|
}
|
||||||
}
|
})();
|
||||||
})();
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
for (var i = 0; i < encoded.length; i++) {
|
for (var i = 0; i < encoded.length; i++) {
|
||||||
|
@ -1966,7 +1967,7 @@ var toAscii = function(hex) {
|
||||||
str += String.fromCharCode(code);
|
str += String.fromCharCode(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
return decodeURIComponent(escape(str));
|
return decodeURIComponent(escape(str)); // jshint ignore:line
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1977,7 +1978,7 @@ var toAscii = function(hex) {
|
||||||
* @returns {String} hex representation of input string
|
* @returns {String} hex representation of input string
|
||||||
*/
|
*/
|
||||||
var toHexNative = function(str) {
|
var toHexNative = function(str) {
|
||||||
str = unescape(encodeURIComponent(str));
|
str = unescape(encodeURIComponent(str)); // jshint ignore:line
|
||||||
var hex = "";
|
var hex = "";
|
||||||
for(var i = 0; i < str.length; i++) {
|
for(var i = 0; i < str.length; i++) {
|
||||||
var n = str.charCodeAt(i).toString(16);
|
var n = str.charCodeAt(i).toString(16);
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -163,16 +163,17 @@ SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded
|
||||||
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
|
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
|
||||||
var result = "";
|
var result = "";
|
||||||
|
|
||||||
(function () {
|
|
||||||
var previousLength = 0; // in int
|
if (solidityType.isDynamicArray(nestedName)) {
|
||||||
if (solidityType.isDynamicArray(nestedName)) {
|
(function () {
|
||||||
|
var previousLength = 0; // in int
|
||||||
for (var i = 0; i < encoded.length; i++) {
|
for (var i = 0; i < encoded.length; i++) {
|
||||||
// calculate length of previous item
|
// calculate length of previous item
|
||||||
previousLength += +(encoded[i - 1] || [])[0] || 0;
|
previousLength += +(encoded[i - 1] || [])[0] || 0;
|
||||||
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
|
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
|
||||||
}
|
}
|
||||||
}
|
})();
|
||||||
})();
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
for (var i = 0; i < encoded.length; i++) {
|
for (var i = 0; i < encoded.length; i++) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ var toAscii = function(hex) {
|
||||||
str += String.fromCharCode(code);
|
str += String.fromCharCode(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
return decodeURIComponent(escape(str));
|
return decodeURIComponent(escape(str)); // jshint ignore:line
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,7 +120,7 @@ var toAscii = function(hex) {
|
||||||
* @returns {String} hex representation of input string
|
* @returns {String} hex representation of input string
|
||||||
*/
|
*/
|
||||||
var toHexNative = function(str) {
|
var toHexNative = function(str) {
|
||||||
str = unescape(encodeURIComponent(str));
|
str = unescape(encodeURIComponent(str)); // jshint ignore:line
|
||||||
var hex = "";
|
var hex = "";
|
||||||
for(var i = 0; i < str.length; i++) {
|
for(var i = 0; i < str.length; i++) {
|
||||||
var n = str.charCodeAt(i).toString(16);
|
var n = str.charCodeAt(i).toString(16);
|
||||||
|
|
Loading…
Reference in New Issue