diff options
Diffstat (limited to 'src/utils/assert.ts')
-rw-r--r-- | src/utils/assert.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts index 406f2b149..5a31e1b16 100644 --- a/src/utils/assert.ts +++ b/src/utils/assert.ts @@ -1,6 +1,7 @@ import * as _ from 'lodash'; import * as BigNumber from 'bignumber.js'; import * as Web3 from 'web3'; +import {Web3Wrapper} from '../web3_wrapper'; import {SchemaValidator} from './schema_validator'; import {utils} from './utils'; @@ -25,6 +26,11 @@ export const assert = { const web3 = new Web3(); this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value)); }, + async isSenderAddressAvailableAsync(web3Wrapper: Web3Wrapper, senderAddress: string) { + const isSenderAddressAvailable = await web3Wrapper.isSenderAddressAvailableAsync(senderAddress); + assert.assert(isSenderAddressAvailable, 'Specified senderAddress isn\'t available through the \ + supplied web3 instance'); + }, isNumber(variableName: string, value: number): void { this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value)); }, |