Lowercase web3 wrapper addresses

Ensure all of the user account addresses are lower case when returned from web3wrapper
This commit is contained in:
Jacob Evans 2018-02-26 13:41:03 -08:00
parent eabe96fd19
commit 3d66feb89f
No known key found for this signature in database
GPG Key ID: 2036DA2ADDFB0842
2 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,9 @@
# CHANGELOG # CHANGELOG
## v0.1.12 _February 9, 2018_ ## v0.2.XX - _TBD_ 2018
* Ensure all returned user addresses are lowercase (#373)
## v0.1.12 - _February 9, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389) * Fix publishing issue where .npmignore was not properly excluding undesired content (#389)

View File

@ -41,7 +41,8 @@ export class Web3Wrapper {
} }
public async isSenderAddressAvailableAsync(senderAddress: string): Promise<boolean> { public async isSenderAddressAvailableAsync(senderAddress: string): Promise<boolean> {
const addresses = await this.getAvailableAddressesAsync(); const addresses = await this.getAvailableAddressesAsync();
return _.includes(addresses, senderAddress); const normalizedAddress = senderAddress.toLowerCase();
return _.includes(addresses, normalizedAddress);
} }
public async getNodeVersionAsync(): Promise<string> { public async getNodeVersionAsync(): Promise<string> {
const nodeVersion = await promisify<string>(this._web3.version.getNode)(); const nodeVersion = await promisify<string>(this._web3.version.getNode)();
@ -96,7 +97,8 @@ export class Web3Wrapper {
} }
public async getAvailableAddressesAsync(): Promise<string[]> { public async getAvailableAddressesAsync(): Promise<string[]> {
const addresses = await promisify<string[]>(this._web3.eth.getAccounts)(); const addresses = await promisify<string[]>(this._web3.eth.getAccounts)();
return addresses; const normalizedAddresses = _.map(addresses, address => address.toLowerCase());
return normalizedAddresses;
} }
public async getLogsAsync(filter: Web3.FilterObject): Promise<Web3.LogEntry[]> { public async getLogsAsync(filter: Web3.FilterObject): Promise<Web3.LogEntry[]> {
let fromBlock = filter.fromBlock; let fromBlock = filter.fromBlock;