aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/assert.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-08-31 01:47:14 +0800
committerFabio Berger <me@fabioberger.com>2017-08-31 01:47:14 +0800
commit4620c1c818e6d54741b262e2100d2731dae16dda (patch)
tree2bb1e842a02780ec009995e1481997895885ff7b /src/utils/assert.ts
parent4370e19880966cf00726a6fae41cfaa5f751e881 (diff)
parent5f44b5f7111873a3958050503fff0ed098b65b04 (diff)
downloaddexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar
dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.gz
dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.bz2
dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.lz
dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.xz
dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.zst
dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.zip
Merge branch 'development' of github.com:0xProject/0x.js into development
* 'development' of github.com:0xProject/0x.js: Improve the comment Add assert.isWeb3Provider Use more concise dep pointing Don't create whole web3 object in beta tests Improve the comment Add tests for web3@1.0 Use zeroEx.getAvailableAddressesAsync instead of web3.eth.getAccounts Add web3@1.0 to web3Factory Support web3@1.0 providers Define web3@1.0 types ;) Install web3@1.0.0 as web3_beta
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 a26b19311..eb084129c 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -61,6 +61,10 @@ export const assert = {
isBoolean(variableName: string, value: boolean): void {
this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
},
+ isWeb3Provider(variableName: string, value: Web3.Provider): void {
+ const isWeb3Provider = _.isFunction((value as any).send) || _.isFunction((value as any).sendAsync);
+ this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Web3.Provider', value));
+ },
doesConformToSchema(variableName: string, value: any, schema: Schema): void {
const schemaValidator = new SchemaValidator();
const validationResult = schemaValidator.validate(value, schema);