diff --git a/src/utils/processWhitelist.js b/src/utils/processWhitelist.js index cedc29736..6d220e2e0 100644 --- a/src/utils/processWhitelist.js +++ b/src/utils/processWhitelist.js @@ -1,6 +1,5 @@ -import { validateAddress } from './utils' +import Web3 from 'web3' -const isAddress = (address) => validateAddress(address) const isNumber = (number) => !isNaN(parseFloat(number)) /** @@ -18,7 +17,7 @@ export default function (rows, cb) { const [addr, min, max] = row - if (!isAddress(addr) || !isNumber(min) || !isNumber(max)) return + if (!Web3.utils.isAddress(addr) || !isNumber(min) || !isNumber(max)) return cb({ addr, min, max }) diff --git a/src/utils/processWhitelist.spec.js b/src/utils/processWhitelist.spec.js index f7d05f919..b03d9fa42 100644 --- a/src/utils/processWhitelist.spec.js +++ b/src/utils/processWhitelist.spec.js @@ -75,8 +75,10 @@ describe('processWhitelist function', () => { it('should ignore invalid addresses', () => { // Given const rows = [ - ['0x123456789012345678901234567890123456789', '1', '10'], - ['0x12345678901234567890123456789012345678901', '1', '10'] + ['0x123456789012345678901234567890123456789', '1', '10'], // 41 characters + ['0x12345678901234567890123456789012345678901', '1', '10'], // 43 characters + ['0x90F8bf6A479f320ead074411a4B0e7944Ea8c9CG', '1', '10'], // invalid character + ['0x90F8bf6A479f320ead074411a4B0e7944Ea8c9c1', '1', '10'] // invalid checksum ] const cb = jest.fn()