aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-03-02 05:04:55 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-03-02 05:04:55 +0800
commit0c16f0ea221d65e66942c27a69dda1c54f49e775 (patch)
tree5530d18fcd6e6c5e15272de3cb915fc2025c01bf /packages/assert
parent003d43b03ae373ca24d6d728ffa6b0f2dfcda79a (diff)
parent451a0dacbe85d7a0d16ef007c1eb945a4c1977cb (diff)
downloaddexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar
dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.gz
dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.bz2
dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.lz
dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.xz
dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.tar.zst
dexon-sol-tools-0c16f0ea221d65e66942c27a69dda1c54f49e775.zip
Merge branch 'development' into feature/sra-reporter
* development: (71 commits) Set max to 2 ETH/2 ZRX Add missing types from website Add dependencies Update the README Move BaseContract to its own package Upgrate prettier remove unused import Move more configs into docsInfo and remove logic that does not belong there elsewhere Fix a bug with displaying solidity functions returning multiple return values Add ethers-contracts as a dependency Include types for ethers-contracts Fix the version Include types for ethers-contracts Rename idx to i Remove tslint disable Move BaseContract to web3Wrapper Merge ifs Fix an option description Add link to the docs Improve CHANGELOG entry ...
Diffstat (limited to 'packages/assert')
-rw-r--r--packages/assert/CHANGELOG.md5
-rw-r--r--packages/assert/src/index.ts10
2 files changed, 10 insertions, 5 deletions
diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md
index 23c2c5e56..6721c4cb6 100644
--- a/packages/assert/CHANGELOG.md
+++ b/packages/assert/CHANGELOG.md
@@ -1,5 +1,10 @@
# CHANGELOG
+## v0.1.0 - _TBD, 2018_
+
+ * Remove isETHAddressHex checksum address check and assume address will be lowercased (#373)
+ * Add an optional parameter `subSchemas` to `doesConformToSchema` method (#385)
+
## v0.0.18 - _February 9, 2017_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index 7ad574ec7..40d083cb6 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -33,11 +33,8 @@ export const assert = {
);
},
isETHAddressHex(variableName: string, value: string): void {
+ this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
this.assert(addressUtils.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
- this.assert(
- addressUtils.isAddress(value) && value.toLowerCase() === value,
- `Checksummed addresses are not supported. Convert ${variableName} to lower case before passing`,
- );
},
doesBelongToStringEnum(
variableName: string,
@@ -66,8 +63,11 @@ export const assert = {
const isWeb3Provider = _.isFunction(value.send) || _.isFunction(value.sendAsync);
this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Web3.Provider', value));
},
- doesConformToSchema(variableName: string, value: any, schema: Schema): void {
+ doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
const schemaValidator = new SchemaValidator();
+ if (!_.isUndefined(subSchemas)) {
+ _.map(subSchemas, schemaValidator.addSchema.bind(schemaValidator));
+ }
const validationResult = schemaValidator.validate(value, schema);
const hasValidationErrors = validationResult.errors.length > 0;
const msg = `Expected ${variableName} to conform to schema ${schema.id}