From 0dfc2b5f3b81e034a9c939f667383eb03c9a5561 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 6 Jun 2017 14:56:54 +0200 Subject: Add isAnyAddressAvailableAsync --- src/utils/assert.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/utils') 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 { + 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)); }, -- cgit