changed isChecksumAddress to checkAddressChecksum

This commit is contained in:
Fabian Vogelsteller 2017-03-10 10:28:16 +01:00
parent dedc8407b7
commit 15e4643bfb
No known key found for this signature in database
GPG Key ID: E51EADA77F1A4124
2 changed files with 8 additions and 8 deletions

View File

@ -450,7 +450,7 @@ var isAddress = function (address) {
return true; return true;
// Otherwise check each case // Otherwise check each case
} else { } else {
return isChecksumAddress(address); return checkAddressChecksum(address);
} }
}; };
@ -459,11 +459,11 @@ var isAddress = function (address) {
/** /**
* Checks if the given string is a checksummed address * Checks if the given string is a checksummed address
* *
* @method isChecksumAddress * @method checkAddressChecksum
* @param {String} address the given HEX adress * @param {String} address the given HEX adress
* @return {Boolean} * @return {Boolean}
*/ */
var isChecksumAddress = function (address) { var checkAddressChecksum = function (address) {
// Check each case // Check each case
address = address.replace('0x',''); address = address.replace('0x','');
var addressHash = sha3(address.toLowerCase()).replace('0x',''); var addressHash = sha3(address.toLowerCase()).replace('0x','');
@ -562,6 +562,9 @@ module.exports = {
padLeft: padLeft, padLeft: padLeft,
padRight: padRight, padRight: padRight,
toAddress: toAddress, toAddress: toAddress,
isAddress: isAddress,
checkAddressChecksum: checkAddressChecksum,
toChecksumAddress: toChecksumAddress,
toHex: toHex, toHex: toHex,
toBN: toBN, toBN: toBN,
toNumberString: toNumberString, toNumberString: toNumberString,
@ -577,9 +580,6 @@ module.exports = {
fromWei: fromWei, fromWei: fromWei,
isBN: isBN, isBN: isBN,
isBigNumber: isBigNumber, isBigNumber: isBigNumber,
isAddress: isAddress,
isChecksumAddress: isChecksumAddress,
toChecksumAddress: toChecksumAddress,
sha3: sha3 sha3: sha3
}; };

View File

@ -17,10 +17,10 @@ var tests = [
]; ];
describe('lib/utils/utils', function () { describe('lib/utils/utils', function () {
describe('isChecksumAddress', function () { describe('checkAddressChecksum', function () {
tests.forEach(function (test) { tests.forEach(function (test) {
it('shoud test if address ' + test.value + ' passes checksum: ' + test.is, function () { it('shoud test if address ' + test.value + ' passes checksum: ' + test.is, function () {
assert.equal(utils.isChecksumAddress(test.value), test.is); assert.equal(utils.checkAddressChecksum(test.value), test.is);
}); });
}); });
}); });