aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src/utils
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-06-29 21:17:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-06-29 22:52:54 +0800
commit3d7bcd7ecbd586e3c78e94b9cfc3d1a004ad86dd (patch)
tree9cc56486fd61d8c2e2624d2195b09849a24c3344 /packages/contract-wrappers/src/utils
parentac9175bf88272f8ea64c74cdf943decf2548c507 (diff)
downloaddexon-0x-contracts-3d7bcd7ecbd586e3c78e94b9cfc3d1a004ad86dd.tar.gz
dexon-0x-contracts-3d7bcd7ecbd586e3c78e94b9cfc3d1a004ad86dd.tar.zst
dexon-0x-contracts-3d7bcd7ecbd586e3c78e94b9cfc3d1a004ad86dd.zip
Add isSubscriptionToken assertion
Diffstat (limited to 'packages/contract-wrappers/src/utils')
-rw-r--r--packages/contract-wrappers/src/utils/assert.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/contract-wrappers/src/utils/assert.ts b/packages/contract-wrappers/src/utils/assert.ts
index 76ad06e91..da6697b08 100644
--- a/packages/contract-wrappers/src/utils/assert.ts
+++ b/packages/contract-wrappers/src/utils/assert.ts
@@ -18,6 +18,11 @@ export const assert = {
const isValid = await isValidSignatureAsync(provider, orderHash, signature, signerAddress);
this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
},
+ isValidSubscriptionToken(variableName: string, subscriptionToken: string): void {
+ const uuidRegex = new RegExp('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$');
+ const isValid = uuidRegex.test(subscriptionToken);
+ this.assert(isValid, `Expected ${variableName} to be a valid subscription token`);
+ },
async isSenderAddressAsync(
variableName: string,
senderAddressHex: string,