mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 19:48:13 +00:00
changed isChecksumAddress to checkAddressChecksum
This commit is contained in:
parent
dedc8407b7
commit
15e4643bfb
@ -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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user