diff options
author | Jacob Evans <jacob@dekz.net> | 2018-02-27 05:41:03 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-02-27 10:10:27 +0800 |
commit | 3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b (patch) | |
tree | b95fa26a1b8f8b22a792038502374f0a09624240 /packages/web3-wrapper/src | |
parent | eabe96fd194f21b1c670381506b115589a37eff5 (diff) | |
download | dexon-0x-contracts-3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b.tar dexon-0x-contracts-3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b.tar.gz dexon-0x-contracts-3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b.tar.bz2 dexon-0x-contracts-3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b.tar.lz dexon-0x-contracts-3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b.tar.xz dexon-0x-contracts-3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b.tar.zst dexon-0x-contracts-3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b.zip |
Lowercase web3 wrapper addresses
Ensure all of the user account addresses are lower case when returned from web3wrapper
Diffstat (limited to 'packages/web3-wrapper/src')
-rw-r--r-- | packages/web3-wrapper/src/index.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index a2878fc2a..7f3452c98 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -41,7 +41,8 @@ export class Web3Wrapper { } public async isSenderAddressAvailableAsync(senderAddress: string): Promise<boolean> { const addresses = await this.getAvailableAddressesAsync(); - return _.includes(addresses, senderAddress); + const normalizedAddress = senderAddress.toLowerCase(); + return _.includes(addresses, normalizedAddress); } public async getNodeVersionAsync(): Promise<string> { const nodeVersion = await promisify<string>(this._web3.version.getNode)(); @@ -96,7 +97,8 @@ export class Web3Wrapper { } public async getAvailableAddressesAsync(): Promise<string[]> { 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[]> { let fromBlock = filter.fromBlock; |