From 0aabade166be563753bed3bb9ffb64f8a02e0ee8 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 26 May 2017 17:49:16 +0200 Subject: return undefined if not address found --- src/ts/web3_wrapper.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ts/web3_wrapper.ts') diff --git a/src/ts/web3_wrapper.ts b/src/ts/web3_wrapper.ts index 969c2c040..2f082c9ac 100644 --- a/src/ts/web3_wrapper.ts +++ b/src/ts/web3_wrapper.ts @@ -12,7 +12,7 @@ export class Web3Wrapper { public isAddress(address: string): boolean { return this.web3.isAddress(address); } - public async getSenderAddressIfExistsAsync(): Promise { + public async getSenderAddressIfExistsAsync(): Promise { const defaultAccount = this.web3.eth.defaultAccount; if (!_.isUndefined(defaultAccount)) { return defaultAccount; @@ -20,10 +20,10 @@ export class Web3Wrapper { const firstAccount = await this.getFirstAddressIfExistsAsync(); return firstAccount; } - public async getFirstAddressIfExistsAsync(): Promise { + public async getFirstAddressIfExistsAsync(): Promise { const addresses = await promisify(this.web3.eth.getAccounts)(); if (_.isEmpty(addresses)) { - return ''; + return undefined; } return (addresses as string[])[0]; } -- cgit v1.2.3