aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-03 02:39:02 +0800
committerFabio Berger <me@fabioberger.com>2017-06-03 02:39:02 +0800
commit36e937f8de348cfdb35ff8f72504aed1dfab07b2 (patch)
treee8e0ba5b603f07bddf6cd01329e001b06b5987dd /src/utils
parentc6ceb44682a19c9f53505803547fcb2012691b5b (diff)
parent5925f81fe185a90efaa82dd90bd8d65d74326f11 (diff)
downloaddexon-sol-tools-36e937f8de348cfdb35ff8f72504aed1dfab07b2.tar
dexon-sol-tools-36e937f8de348cfdb35ff8f72504aed1dfab07b2.tar.gz
dexon-sol-tools-36e937f8de348cfdb35ff8f72504aed1dfab07b2.tar.bz2
dexon-sol-tools-36e937f8de348cfdb35ff8f72504aed1dfab07b2.tar.lz
dexon-sol-tools-36e937f8de348cfdb35ff8f72504aed1dfab07b2.tar.xz
dexon-sol-tools-36e937f8de348cfdb35ff8f72504aed1dfab07b2.tar.zst
dexon-sol-tools-36e937f8de348cfdb35ff8f72504aed1dfab07b2.zip
Merge branch 'master' into remainingTokenMethods
# Conflicts: # src/contract_wrappers/token_wrapper.ts
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/assert.ts4
-rw-r--r--src/utils/utils.ts4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts
index 446974b10..5a31e1b16 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -3,6 +3,7 @@ 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';
const HEX_REGEX = /^0x[0-9A-F]*$/i;
@@ -33,6 +34,9 @@ export const assert = {
isNumber(variableName: string, value: number): void {
this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
},
+ isValidOrderHash(variableName: string, value: string): void {
+ this.assert(utils.isValidOrderHash(value), this.typeAssertionMessage(variableName, 'orderHash', value));
+ },
isBoolean(variableName: string, value: boolean): void {
this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
},
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index 336eaf7bb..e6840a624 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -18,4 +18,8 @@ export const utils = {
isParityNode(nodeVersion: string): boolean {
return _.includes(nodeVersion, 'Parity');
},
+ isValidOrderHash(orderHashHex: string) {
+ const isValid = /^0x[0-9A-F]{64}$/i.test(orderHashHex);
+ return isValid;
+ },
};