aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/utils/assert.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src/utils/assert.ts')
-rw-r--r--packages/0x.js/src/utils/assert.ts28
1 files changed, 16 insertions, 12 deletions
diff --git a/packages/0x.js/src/utils/assert.ts b/packages/0x.js/src/utils/assert.ts
index 4cf6caf77..c21f2dbca 100644
--- a/packages/0x.js/src/utils/assert.ts
+++ b/packages/0x.js/src/utils/assert.ts
@@ -1,14 +1,14 @@
-import {assert as sharedAssert} from '@0xproject/assert';
-import {Schema, SchemaValidator} from '@0xproject/json-schemas';
-import {Web3Wrapper} from '@0xproject/web3-wrapper';
-import BigNumber from 'bignumber.js';
+import { assert as sharedAssert } from '@0xproject/assert';
+// We need those two unused imports because they're actually used by sharedAssert which gets injected here
+// tslint:disable-next-line:no-unused-variable
+import { Schema } from '@0xproject/json-schemas';
+// tslint:disable-next-line:no-unused-variable
+import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
-import * as Web3 from 'web3';
-import {ECSignature} from '../types';
-import {signatureUtils} from '../utils/signature_utils';
-
-const HEX_REGEX = /^0x[0-9A-F]*$/i;
+import { ECSignature } from '../types';
+import { signatureUtils } from '../utils/signature_utils';
export const assert = {
...sharedAssert,
@@ -16,11 +16,15 @@ export const assert = {
const isValidSignature = signatureUtils.isValidSignature(orderHash, ecSignature, signerAddress);
this.assert(isValidSignature, `Expected order with hash '${orderHash}' to have a valid signature`);
},
- async isSenderAddressAsync(variableName: string, senderAddressHex: string,
- web3Wrapper: Web3Wrapper): Promise<void> {
+ async isSenderAddressAsync(
+ variableName: string,
+ senderAddressHex: string,
+ web3Wrapper: Web3Wrapper,
+ ): Promise<void> {
sharedAssert.isETHAddressHex(variableName, senderAddressHex);
const isSenderAddressAvailable = await web3Wrapper.isSenderAddressAvailableAsync(senderAddressHex);
- sharedAssert.assert(isSenderAddressAvailable,
+ sharedAssert.assert(
+ isSenderAddressAvailable,
`Specified ${variableName} ${senderAddressHex} isn't available through the supplied web3 provider`,
);
},