aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/assert.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-06 20:56:54 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-06 20:56:54 +0800
commit0dfc2b5f3b81e034a9c939f667383eb03c9a5561 (patch)
treec1ad14d297cb6c03d4b3b73668a467c4cd81f549 /src/utils/assert.ts
parentef57dd22e29057e5bd84b9a0ad36a123126695df (diff)
downloaddexon-0x-contracts-0dfc2b5f3b81e034a9c939f667383eb03c9a5561.tar.gz
dexon-0x-contracts-0dfc2b5f3b81e034a9c939f667383eb03c9a5561.tar.zst
dexon-0x-contracts-0dfc2b5f3b81e034a9c939f667383eb03c9a5561.zip
Add isAnyAddressAvailableAsync
Diffstat (limited to 'src/utils/assert.ts')
-rw-r--r--src/utils/assert.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts
index 621c11eda..7ab1b7c62 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -37,6 +37,10 @@ export const assert = {
assert.assert(isSenderAddressAvailable, `Specified ${variableName} ${senderAddressHex} isn't available \
through the supplied web3 instance`);
},
+ async isAnyAddressAvailableAsync(web3Wrapper: Web3Wrapper): Promise<void> {
+ const availableAddresses = await web3Wrapper.getAvailableAddressesAsync();
+ this.assert(!_.isEmpty(availableAddresses), 'No addresses are available on the provided web3 instance');
+ },
isNumber(variableName: string, value: number): void {
this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
},