aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/assert.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts
index aeed1c6dc..7dffcd98e 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';
const HEX_REGEX = /^0x[0-9A-F]*$/i;
@@ -24,6 +25,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.isSenderAddressAvailable(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));
},