aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--src/schemas/basic_type_schemas.ts2
-rw-r--r--src/utils/assert.ts4
-rw-r--r--test/0x.js_test.ts2
-rw-r--r--test/schema_test.ts10
-rw-r--r--yarn.lock6
6 files changed, 17 insertions, 9 deletions
diff --git a/package.json b/package.json
index 021c9fc1a..ec4b11b3e 100644
--- a/package.json
+++ b/package.json
@@ -87,7 +87,7 @@
"types-ethereumjs-util": "^0.0.5",
"typescript": "^2.4.1",
"web3-provider-engine": "^13.0.1",
- "web3-typescript-typings": "^0.3.0",
+ "web3-typescript-typings": "^0.3.2",
"webpack": "^3.1.0"
},
"dependencies": {
diff --git a/src/schemas/basic_type_schemas.ts b/src/schemas/basic_type_schemas.ts
index c3b81185d..5d66cf79b 100644
--- a/src/schemas/basic_type_schemas.ts
+++ b/src/schemas/basic_type_schemas.ts
@@ -1,7 +1,7 @@
export const addressSchema = {
id: '/addressSchema',
type: 'string',
- pattern: '^0[xX][0-9A-Fa-f]{40}$',
+ pattern: '^0x[0-9a-f]{40}$',
};
export const numberSchema = {
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 {
diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts
index 03bf21e96..2b4e80ea3 100644
--- a/test/0x.js_test.ts
+++ b/test/0x.js_test.ts
@@ -57,7 +57,7 @@ describe('ZeroEx library', () => {
).to.become(false);
});
it('should return false if the address doesn\'t pertain to the signature & data', async () => {
- const validUnrelatedAddress = '0x8b0292B11a196601eD2ce54B665CaFEca0347D42';
+ const validUnrelatedAddress = '0x8b0292b11a196601ed2ce54b665cafeca0347d42';
expect(ZeroEx.isValidSignature(dataHex, signature, validUnrelatedAddress)).to.be.false();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(dataHex, signature,
diff --git a/test/schema_test.ts b/test/schema_test.ts
index 1fac2b380..d791ece24 100644
--- a/test/schema_test.ts
+++ b/test/schema_test.ts
@@ -42,11 +42,15 @@ describe('Schema', () => {
});
describe('#addressSchema', () => {
it('should validate valid addresses', () => {
- const testCases = ['0x8b0292B11a196601eD2ce54B665CaFEca0347D42', constants.NULL_ADDRESS];
+ const testCases = ['0x8b0292b11a196601ed2ce54b665cafeca0347d42', constants.NULL_ADDRESS];
validateAgainstSchema(testCases, addressSchema);
});
it('should fail for invalid addresses', () => {
- const testCases = ['0x', '0', '0x00', '0xzzzzzzB11a196601eD2ce54B665CaFEca0347D42'];
+ const testCases = [
+ '0x',
+ '0',
+ '0x00',
+ '0xzzzzzzB11a196601eD2ce54B665CaFEca0347D42', '0x8b0292B11a196601eD2ce54B665CaFEca0347D42'];
const shouldFail = true;
validateAgainstSchema(testCases, addressSchema, shouldFail);
});
@@ -159,7 +163,7 @@ describe('Schema', () => {
name: 'Zero Ex',
symbol: 'ZRX',
decimals: 100500,
- address: '0x8b0292B11a196601eD2ce54B665CaFEca0347D42',
+ address: '0x8b0292b11a196601ed2ce54b665cafeca0347d42',
url: 'https://0xproject.com',
};
it('should validate valid token', () => {
diff --git a/yarn.lock b/yarn.lock
index e3efc988f..60f921342 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5047,9 +5047,9 @@ web3-provider-engine@^8.4.0:
xhr "^2.2.0"
xtend "^4.0.1"
-web3-typescript-typings@^0.3.0:
- version "0.3.0"
- resolved "https://registry.yarnpkg.com/web3-typescript-typings/-/web3-typescript-typings-0.3.0.tgz#1df583d8d9012059802dee90f72144576e0ab4fe"
+web3-typescript-typings@^0.3.2:
+ version "0.3.2"
+ resolved "https://registry.yarnpkg.com/web3-typescript-typings/-/web3-typescript-typings-0.3.2.tgz#75f65fe452e35e2b96192908199dbb7a9ab5bcc3"
dependencies:
bignumber.js "^4.0.2"