Merge branch 'master' into fillOrderAsync

This commit is contained in:
Leonid Logvinov 2017-05-30 10:24:45 +02:00
commit cda040ef99
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
3 changed files with 3 additions and 2 deletions

View File

@ -29,7 +29,8 @@
"build:commonjs:dev": "tsc; copyfiles -u 2 ./src/artifacts/*.json ../0x.js/lib/src/artifacts;", "build:commonjs:dev": "tsc; copyfiles -u 2 ./src/artifacts/*.json ../0x.js/lib/src/artifacts;",
"test:commonjs": "run-s build:commonjs:dev run_mocha", "test:commonjs": "run-s build:commonjs:dev run_mocha",
"pretest:umd": "run-s clean build:*:dev", "pretest:umd": "run-s clean build:*:dev",
"substitute_umd_bundle": "shx rm -rf lib/src && shx mv _bundles lib/src", "substitute_umd_bundle": "npm run remove_src_files_not_used_by_tests; shx mv _bundles/* lib/src",
"remove_src_files_not_used_by_tests": "find ./lib/src \\( -path ./lib/src/utils -o -path ./lib/src/schemas -o -path \"./lib/src/types.*\" \\) -prune -o -type f -print | xargs rm",
"run_mocha": "mocha lib/test/**/*_test.js" "run_mocha": "mocha lib/test/**/*_test.js"
}, },
"config": { "config": {

View File

@ -57,7 +57,7 @@ export class Web3Wrapper {
public async doesContractExistAtAddressAsync(address: string): Promise<boolean> { public async doesContractExistAtAddressAsync(address: string): Promise<boolean> {
const code = await promisify(this.web3.eth.getCode)(address); const code = await promisify(this.web3.eth.getCode)(address);
// Regex matches 0x0, 0x00, 0x in order to accomodate poorly implemented clients // Regex matches 0x0, 0x00, 0x in order to accomodate poorly implemented clients
const zeroHexAddressRegex = /^0x0\{0,40\}$/i; const zeroHexAddressRegex = /^0x0*$/i;
const didFindCode = _.isNull(code.match(zeroHexAddressRegex)); const didFindCode = _.isNull(code.match(zeroHexAddressRegex));
return didFindCode; return didFindCode;
} }