aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-05-26 23:49:16 +0800
committerFabio Berger <me@fabioberger.com>2017-05-26 23:49:16 +0800
commit0aabade166be563753bed3bb9ffb64f8a02e0ee8 (patch)
treea944649844dbe44f1d6e3e6ea37c331d51903e4e
parenta6da9cd07389b317624ad00a3cb73b75820687e1 (diff)
downloaddexon-sol-tools-0aabade166be563753bed3bb9ffb64f8a02e0ee8.tar
dexon-sol-tools-0aabade166be563753bed3bb9ffb64f8a02e0ee8.tar.gz
dexon-sol-tools-0aabade166be563753bed3bb9ffb64f8a02e0ee8.tar.bz2
dexon-sol-tools-0aabade166be563753bed3bb9ffb64f8a02e0ee8.tar.lz
dexon-sol-tools-0aabade166be563753bed3bb9ffb64f8a02e0ee8.tar.xz
dexon-sol-tools-0aabade166be563753bed3bb9ffb64f8a02e0ee8.tar.zst
dexon-sol-tools-0aabade166be563753bed3bb9ffb64f8a02e0ee8.zip
return undefined if not address found
-rw-r--r--src/ts/web3_wrapper.ts6
1 files changed, 3 insertions, 3 deletions
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<string> {
+ public async getSenderAddressIfExistsAsync(): Promise<string|undefined> {
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<string> {
+ public async getFirstAddressIfExistsAsync(): Promise<string|undefined> {
const addresses = await promisify(this.web3.eth.getAccounts)();
if (_.isEmpty(addresses)) {
- return '';
+ return undefined;
}
return (addresses as string[])[0];
}