upgrade bignumber.js

This commit is contained in:
Roman Volosovskyi 2017-08-13 11:24:35 +03:00
parent 530c4a3b1d
commit 17b13f2604
No known key found for this signature in database
GPG Key ID: 37135489EAE4B2D7
5 changed files with 2813 additions and 2842 deletions

89
dist/web3-light.js vendored
View File

@ -735,69 +735,53 @@ SolidityCoder.prototype.encodeMultiWithOffset = function (types, solidityTypes,
return result;
};
// TODO: refactor whole encoding!
SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded, offset) {
/* jshint maxcomplexity: 17 */
/* jshint maxdepth: 5 */
var self = this;
if (solidityType.isDynamicArray(type)) {
return (function () {
// offset was already set
var nestedName = solidityType.nestedName(type);
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
var result = encoded[0];
var encodingMode={dynamic:1,static:2,other:3};
(function () {
var previousLength = 2; // in int
if (solidityType.isDynamicArray(nestedName)) {
for (var i = 1; i < encoded.length; i++) {
previousLength += +(encoded[i - 1])[0] || 0;
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
}
var mode=(solidityType.isDynamicArray(type)?encodingMode.dynamic:(solidityType.isStaticArray(type)?encodingMode.static:encodingMode.other));
if(mode !== encodingMode.other){
var nestedName = solidityType.nestedName(type);
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
var result = (mode === encodingMode.dynamic ? encoded[0] : '');
if (solidityType.isDynamicArray(nestedName)) {
var previousLength = (mode === encodingMode.dynamic ? 2 : 0);
for (var i = 0; i < encoded.length; i++) {
// calculate length of previous item
if(mode === encodingMode.dynamic){
previousLength += +(encoded[i - 1])[0] || 0;
}
})();
// first element is length, skip it
(function () {
for (var i = 0; i < encoded.length - 1; i++) {
var additionalOffset = result / 2;
result += self.encodeWithOffset(nestedName, solidityType, encoded[i + 1], offset + additionalOffset);
else if(mode === encodingMode.static){
previousLength += +(encoded[i - 1] || [])[0] || 0;
}
})();
return result;
})();
} else if (solidityType.isStaticArray(type)) {
return (function () {
var nestedName = solidityType.nestedName(type);
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
var result = "";
if (solidityType.isDynamicArray(nestedName)) {
(function () {
var previousLength = 0; // in int
for (var i = 0; i < encoded.length; i++) {
// calculate length of previous item
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 () {
for (var i = 0; i < encoded.length; i++) {
var additionalOffset = result / 2;
result += self.encodeWithOffset(nestedName, solidityType, encoded[i], offset + additionalOffset);
}
})();
var len= (mode === encodingMode.dynamic ? encoded.length-1 : encoded.length);
for (var c = 0; c < len; c++) {
var additionalOffset = result / 2;
if(mode === encodingMode.dynamic){
result += self.encodeWithOffset(nestedName, solidityType, encoded[c + 1], offset + additionalOffset);
}
else if(mode === encodingMode.static){
result += self.encodeWithOffset(nestedName, solidityType, encoded[c], offset + additionalOffset);
}
}
return result;
})();
return result;
}
return encoded;
};
/**
* Should be used to decode bytes to plain param
*
@ -3655,8 +3639,6 @@ module.exports = Filter;
},{"../utils/utils":20,"./formatters":30}],30:[function(require,module,exports){
'use strict'
/*
This file is part of web3.js.
@ -3680,6 +3662,9 @@ module.exports = Filter;
* @date 2015
*/
'use strict';
var utils = require('../utils/utils');
var config = require('../utils/config');
var Iban = require('./iban');

File diff suppressed because one or more lines are too long

5559
dist/web3.js vendored

File diff suppressed because it is too large Load Diff

2
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@
"lib": "./lib"
},
"dependencies": {
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git",
"bignumber.js": "github:status-im/bignumber.js#master",
"crypto-js": "^3.1.4",
"utf8": "^2.1.1",
"xhr2": "*",
@ -84,6 +84,5 @@
"url": "https://github.com/obscuren"
}
],
"license": "LGPL-3.0"
}