aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/assert.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-08-22 01:06:13 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-08-22 17:00:44 +0800
commit52ac8c225181a3252553b3c47d61719542a5e319 (patch)
tree6ea90fdc6141af00e73c23fc5c3d77dbd16e8907 /src/utils/assert.ts
parente376189bc69682b2445f344966332c63d8e9fa4d (diff)
downloaddexon-0x-contracts-52ac8c225181a3252553b3c47d61719542a5e319.tar
dexon-0x-contracts-52ac8c225181a3252553b3c47d61719542a5e319.tar.gz
dexon-0x-contracts-52ac8c225181a3252553b3c47d61719542a5e319.tar.bz2
dexon-0x-contracts-52ac8c225181a3252553b3c47d61719542a5e319.tar.lz
dexon-0x-contracts-52ac8c225181a3252553b3c47d61719542a5e319.tar.xz
dexon-0x-contracts-52ac8c225181a3252553b3c47d61719542a5e319.tar.zst
dexon-0x-contracts-52ac8c225181a3252553b3c47d61719542a5e319.zip
Reject checksummed addresses
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 969209208..d835d85c5 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -24,6 +24,10 @@ export const assert = {
isETHAddressHex(variableName: string, value: string): void {
const web3 = new Web3();
this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
+ this.assert(
+ web3.isAddress(value) && !web3.isChecksumAddress(value),
+ 'Checksummed addresses are not supported. Convert to lower case before passing',
+ );
},
doesBelongToStringEnum(variableName: string, value: string,
stringEnum: any /* There is no base type for every string enum */): void {