mirror of https://github.com/status-im/web3.js.git
solve travis test issues
This commit is contained in:
parent
c6c344d7d8
commit
2caadc4495
|
@ -35,6 +35,7 @@
|
|||
|
||||
|
||||
var BigNumber = require('bignumber.js');
|
||||
var sha3 = require('sha3.js');
|
||||
var utf8 = require('utf8');
|
||||
|
||||
var unitMap = {
|
||||
|
@ -421,11 +422,11 @@ var isAddress = function (address) {
|
|||
var isChecksumAddress = function (address) {
|
||||
// Check each case
|
||||
address = address.replace('0x','');
|
||||
var addressHash = web3.sha3(address.toLowerCase());
|
||||
var addressHash = sha3(address.toLowerCase());
|
||||
|
||||
for (var i = 0; i < 40; i++ ) {
|
||||
// the nth letter should be uppercase if the nth digit of casemap is 1
|
||||
if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() != address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() != address[i])) {
|
||||
if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -442,10 +443,10 @@ var isChecksumAddress = function (address) {
|
|||
* @return {String}
|
||||
*/
|
||||
var toChecksumAddress = function (address) {
|
||||
if (typeof address == 'undefined') return '';
|
||||
if (typeof address === 'undefined') return '';
|
||||
|
||||
address = address.toLowerCase().replace('0x','');
|
||||
var addressHash = web3.sha3(address);
|
||||
var addressHash = sha3(address);
|
||||
var checksumAddress = '0x';
|
||||
|
||||
for (var i = 0; i < address.length; i++ ) {
|
||||
|
|
Loading…
Reference in New Issue