mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 03:28:07 +00:00
upgrade bignumber.js
This commit is contained in:
parent
530c4a3b1d
commit
17b13f2604
89
dist/web3-light.js
vendored
89
dist/web3-light.js
vendored
@ -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');
|
||||
|
2
dist/web3-light.min.js
vendored
2
dist/web3-light.min.js
vendored
File diff suppressed because one or more lines are too long
5559
dist/web3.js
vendored
5559
dist/web3.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/web3.min.js
vendored
2
dist/web3.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user