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;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: refactor whole encoding!
|
|
||||||
SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded, offset) {
|
SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded, offset) {
|
||||||
|
/* jshint maxcomplexity: 17 */
|
||||||
|
/* jshint maxdepth: 5 */
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
if (solidityType.isDynamicArray(type)) {
|
var encodingMode={dynamic:1,static:2,other:3};
|
||||||
return (function () {
|
|
||||||
// offset was already set
|
|
||||||
var nestedName = solidityType.nestedName(type);
|
|
||||||
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
|
|
||||||
var result = encoded[0];
|
|
||||||
|
|
||||||
(function () {
|
var mode=(solidityType.isDynamicArray(type)?encodingMode.dynamic:(solidityType.isStaticArray(type)?encodingMode.static:encodingMode.other));
|
||||||
var previousLength = 2; // in int
|
|
||||||
if (solidityType.isDynamicArray(nestedName)) {
|
if(mode !== encodingMode.other){
|
||||||
for (var i = 1; i < encoded.length; i++) {
|
var nestedName = solidityType.nestedName(type);
|
||||||
previousLength += +(encoded[i - 1])[0] || 0;
|
var nestedStaticPartLength = solidityType.staticPartLength(nestedName);
|
||||||
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
|
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;
|
||||||
}
|
}
|
||||||
})();
|
else if(mode === encodingMode.static){
|
||||||
|
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);
|
|
||||||
}
|
}
|
||||||
})();
|
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode();
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(function () {
|
var len= (mode === encodingMode.dynamic ? encoded.length-1 : encoded.length);
|
||||||
for (var i = 0; i < encoded.length; i++) {
|
for (var c = 0; c < len; c++) {
|
||||||
var additionalOffset = result / 2;
|
var additionalOffset = result / 2;
|
||||||
result += self.encodeWithOffset(nestedName, solidityType, encoded[i], offset + additionalOffset);
|
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;
|
return encoded;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be used to decode bytes to plain param
|
* 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){
|
},{"../utils/utils":20,"./formatters":30}],30:[function(require,module,exports){
|
||||||
'use strict'
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file is part of web3.js.
|
This file is part of web3.js.
|
||||||
|
|
||||||
@ -3680,6 +3662,9 @@ module.exports = Filter;
|
|||||||
* @date 2015
|
* @date 2015
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
var utils = require('../utils/utils');
|
var utils = require('../utils/utils');
|
||||||
var config = require('../utils/config');
|
var config = require('../utils/config');
|
||||||
var Iban = require('./iban');
|
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"
|
"lib": "./lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"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",
|
"crypto-js": "^3.1.4",
|
||||||
"utf8": "^2.1.1",
|
"utf8": "^2.1.1",
|
||||||
"xhr2": "*",
|
"xhr2": "*",
|
||||||
@ -84,6 +84,5 @@
|
|||||||
"url": "https://github.com/obscuren"
|
"url": "https://github.com/obscuren"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"license": "LGPL-3.0"
|
"license": "LGPL-3.0"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user