Check isETHAddressHex before lowercase

Flip the check so assertion happens before lowercase
This commit is contained in:
Jacob Evans
2018-02-23 10:36:16 -08:00
parent f689d335c0
commit eabe96fd19
9 changed files with 60 additions and 67 deletions

View File

@@ -57,8 +57,8 @@ export class TokenRegistryWrapper extends ContractWrapper {
* @return An object that conforms to the Token interface or undefined if token not found.
*/
public async getTokenIfExistsAsync(address: string): Promise<Token | undefined> {
assert.isETHAddressHex('address', address);
const normalizedAddress = address.toLowerCase();
assert.isETHAddressHex('address', normalizedAddress);
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const metadata = await tokenRegistryContract.getTokenMetaData.callAsync(normalizedAddress);