From 2caadc44954f91b5d6f1314e76fff00d5b7fdf38 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Thu, 25 Feb 2016 11:10:43 -0300 Subject: [PATCH] solve travis test issues --- lib/utils/utils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/utils/utils.js b/lib/utils/utils.js index fe67d93..43c2203 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -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++ ) {