diff options
Diffstat (limited to 'packages')
32 files changed, 222 insertions, 111 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 5250402c6..54c06444a 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -1,8 +1,13 @@ # CHANGELOG +## v0.32.0 - _February 5, 2018_ + + * Add `zeroEx.etherToken.getContractAddressIfExists` (#350) + * Fixed the bug causing order watcher to throw if there is an event with the same signature but different indexed fields (#366) + ## v0.31.1 - _February 1, 2018_ - * Fix the bug causing order watcher to throw is makerToken === zrx (#357) + * Fix the bug causing order watcher to throw if makerToken === zrx (#357) ## v0.31.0 - _January 30, 2018_ diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index e56c9963e..013b4ae6e 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "0.31.1", + "version": "0.32.0", "description": "A javascript library for interacting with the 0x protocol", "keywords": [ "0x.js", @@ -12,6 +12,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { + "build:watch": "tsc -w", "prebuild": "run-s clean generate_contract_wrappers", "build": "run-p build:umd:prod build:commonjs; exit 0;", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_DIR", @@ -41,9 +42,9 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^0.1.6", - "@0xproject/dev-utils": "^0.0.9", - "@0xproject/tslint-config": "^0.4.6", + "@0xproject/abi-gen": "^0.1.7", + "@0xproject/dev-utils": "^0.0.10", + "@0xproject/tslint-config": "^0.4.7", "@types/bintrees": "^1.0.2", "@types/jsonschema": "^1.1.1", "@types/lodash": "^4.14.86", @@ -73,17 +74,17 @@ "truffle-hdwallet-provider": "^0.0.3", "tslint": "5.8.0", "typedoc": "~0.8.0", - "typescript": "~2.6.1", + "typescript": "2.7.1", "web3-provider-engine": "^13.0.1", - "web3-typescript-typings": "^0.9.8", + "web3-typescript-typings": "^0.9.9", "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^0.0.15", - "@0xproject/json-schemas": "^0.7.7", - "@0xproject/types": "^0.1.8", - "@0xproject/utils": "^0.2.4", - "@0xproject/web3-wrapper": "^0.1.9", + "@0xproject/assert": "^0.0.16", + "@0xproject/json-schemas": "^0.7.8", + "@0xproject/types": "^0.1.9", + "@0xproject/utils": "^0.3.0", + "@0xproject/web3-wrapper": "^0.1.10", "bintrees": "^1.0.2", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts index 873489dc9..d913e8d9b 100644 --- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts @@ -32,10 +32,10 @@ const CONTRACT_NAME_TO_NOT_FOUND_ERROR: { export class ContractWrapper { protected _web3Wrapper: Web3Wrapper; - private _networkId: number; + protected _networkId: number; private _abiDecoder?: AbiDecoder; - private _blockAndLogStreamerIfExists: BlockAndLogStreamer | undefined; - private _blockAndLogStreamInterval: NodeJS.Timer; + private _blockAndLogStreamerIfExists?: BlockAndLogStreamer; + private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer; private _filters: { [filterToken: string]: Web3.FilterObject }; private _filterCallbacks: { [filterToken: string]: EventCallback<ContractEventArgs>; @@ -162,7 +162,7 @@ export class ContractWrapper { ); const catchAllLogFilter = {}; this._blockAndLogStreamerIfExists.addLogFilter(catchAllLogFilter); - this._blockAndLogStreamInterval = intervalUtils.setAsyncExcludingInterval( + this._blockAndLogStreamIntervalIfExists = intervalUtils.setAsyncExcludingInterval( this._reconcileBlockAsync.bind(this), constants.DEFAULT_BLOCK_POLLING_INTERVAL, this._onReconcileBlockError.bind(this), @@ -191,7 +191,7 @@ export class ContractWrapper { } this._blockAndLogStreamerIfExists.unsubscribeFromOnLogAdded(this._onLogAddedSubscriptionToken as string); this._blockAndLogStreamerIfExists.unsubscribeFromOnLogRemoved(this._onLogRemovedSubscriptionToken as string); - intervalUtils.clearAsyncExcludingInterval(this._blockAndLogStreamInterval); + intervalUtils.clearAsyncExcludingInterval(this._blockAndLogStreamIntervalIfExists as NodeJS.Timer); delete this._blockAndLogStreamerIfExists; } private async _reconcileBlockAsync(): Promise<void> { diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts index cbafcfe94..32c9ae6a9 100644 --- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts @@ -162,6 +162,19 @@ export class EtherTokenWrapper extends ContractWrapper { public _unsubscribeAll(): void { super._unsubscribeAll(); } + /** + * Retrieves the Ethereum address of the EtherToken contract deployed on the network + * that the user-passed web3 provider is connected to. If it's not Kovan, Ropsten, Rinkeby, Mainnet or TestRPC + * (networkId: 50), it will return undefined (e.g a private network). + * @returns The Ethereum address of the EtherToken contract or undefined. + */ + public getContractAddressIfExists(): string | undefined { + const networkSpecificArtifact = artifacts.EtherTokenArtifact.networks[this._networkId]; + const contractAddressIfExists = _.isUndefined(networkSpecificArtifact) + ? undefined + : networkSpecificArtifact.address; + return contractAddressIfExists; + } private _invalidateContractInstance(): void { this._unsubscribeAll(); this._etherTokenContractsByAddress = {}; diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/0x.js/test/ether_token_wrapper_test.ts index 9716abab8..da49ec467 100644 --- a/packages/0x.js/test/ether_token_wrapper_test.ts +++ b/packages/0x.js/test/ether_token_wrapper_test.ts @@ -17,7 +17,6 @@ import { ZeroEx, ZeroExError, } from '../src'; -import { artifacts } from '../src/artifacts'; import { DoneCallback } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; @@ -60,7 +59,7 @@ describe('EtherTokenWrapper', () => { tokens = await zeroEx.tokenRegistry.getTokensAsync(); userAddresses = await zeroEx.getAvailableAddressesAsync(); addressWithETH = userAddresses[0]; - wethContractAddress = (zeroEx.etherToken as any)._getContractAddress(artifacts.EtherTokenArtifact); + wethContractAddress = zeroEx.etherToken.getContractAddressIfExists() as string; depositWeiAmount = (zeroEx as any)._web3Wrapper.toWei(new BigNumber(5)); decimalPlaces = 7; addressWithoutFunds = userAddresses[1]; @@ -71,6 +70,18 @@ describe('EtherTokenWrapper', () => { afterEach(async () => { await blockchainLifecycle.revertAsync(); }); + describe('#getContractAddressIfExists', async () => { + it('should return contract address if connected to a known network', () => { + const contractAddressIfExists = zeroEx.etherToken.getContractAddressIfExists(); + expect(contractAddressIfExists).to.not.be.undefined(); + }); + it('should return undefined if connected to an unknown network', () => { + const UNKNOWN_NETWORK_NETWORK_ID = 10; + const unknownNetworkZeroEx = new ZeroEx(web3.currentProvider, { networkId: UNKNOWN_NETWORK_NETWORK_ID }); + const contractAddressIfExists = unknownNetworkZeroEx.etherToken.getContractAddressIfExists(); + expect(contractAddressIfExists).to.be.undefined(); + }); + }); describe('#depositAsync', () => { it('should successfully deposit ETH and issue Wrapped ETH tokens', async () => { const preETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH); diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index e04b53282..10bd7e712 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/abi-gen", - "version": "0.1.6", + "version": "0.1.7", "description": "Generate contract wrappers from ABI and handlebars templates", "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { + "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts'", "clean": "shx rm -rf lib", "build": "tsc" @@ -22,7 +23,7 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/abi-gen/README.md", "dependencies": { - "@0xproject/utils": "^0.2.4", + "@0xproject/utils": "^0.3.0", "chalk": "^2.3.0", "glob": "^7.1.2", "handlebars": "^4.0.11", @@ -33,7 +34,7 @@ "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", + "@0xproject/tslint-config": "^0.4.7", "@types/glob": "^5.0.33", "@types/handlebars": "^4.0.36", "@types/mkdirp": "^0.5.1", @@ -42,7 +43,7 @@ "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8" + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9" } } diff --git a/packages/assert/package.json b/packages/assert/package.json index 01c3d9509..b8da740d6 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/assert", - "version": "0.0.15", + "version": "0.0.16", "description": "Provides a standard way of performing type and schema validation across 0x projects", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { + "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf _bundles lib test_temp", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", @@ -23,7 +24,7 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/assert/README.md", "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", + "@0xproject/tslint-config": "^0.4.7", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/valid-url": "^1.0.2", @@ -34,11 +35,11 @@ "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", - "typescript": "~2.6.1" + "typescript": "2.7.1" }, "dependencies": { - "@0xproject/json-schemas": "^0.7.7", - "@0xproject/utils": "^0.2.4", + "@0xproject/json-schemas": "^0.7.8", + "@0xproject/utils": "^0.3.0", "lodash": "^4.17.4", "valid-url": "^1.0.9" } diff --git a/packages/connect/package.json b/packages/connect/package.json index 71595d798..d892e2d04 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/connect", - "version": "0.5.4", + "version": "0.5.5", "description": "A javascript library for interacting with the standard relayer api", "keywords": [ "connect", @@ -12,6 +12,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { + "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf _bundles lib test_temp", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_DIR", @@ -36,16 +37,16 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/connect/README.md", "dependencies": { - "@0xproject/assert": "^0.0.15", - "@0xproject/json-schemas": "^0.7.7", - "@0xproject/utils": "^0.2.4", + "@0xproject/assert": "^0.0.16", + "@0xproject/json-schemas": "^0.7.8", + "@0xproject/utils": "^0.3.0", "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.4", "query-string": "^5.0.1", "websocket": "^1.0.25" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", + "@0xproject/tslint-config": "^0.4.7", "@types/fetch-mock": "^5.12.1", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", @@ -63,7 +64,7 @@ "shx": "^0.2.2", "tslint": "5.8.0", "typedoc": "~0.8.0", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8" + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9" } } diff --git a/packages/contracts/README.md b/packages/contracts/README.md index 0a1c272ab..11b9e5056 100644 --- a/packages/contracts/README.md +++ b/packages/contracts/README.md @@ -38,6 +38,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Clean ```bash diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 3f54e15c3..894a3e0a4 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,13 +1,14 @@ { "private": true, "name": "contracts", - "version": "2.1.8", + "version": "2.1.9", "description": "Smart contract components of 0x protocol", "main": "index.js", "directories": { "test": "test" }, "scripts": { + "build:watch": "tsc -w", "prebuild": "run-s clean copy_artifacts", "copy_artifacts": "copyfiles './artifacts/**/*' ./lib", "build": "tsc", @@ -31,9 +32,9 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/contracts/README.md", "devDependencies": { - "@0xproject/dev-utils": "^0.0.9", - "@0xproject/tslint-config": "^0.4.6", - "@0xproject/types": "^0.1.8", + "@0xproject/dev-utils": "^0.0.10", + "@0xproject/tslint-config": "^0.4.7", + "@0xproject/types": "^0.1.9", "@types/bluebird": "^3.5.3", "@types/lodash": "^4.14.86", "@types/node": "^8.0.53", @@ -52,16 +53,16 @@ "tslint": "5.8.0", "types-bn": "^0.0.1", "types-ethereumjs-util": "0xproject/types-ethereumjs-util", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8", + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9", "yargs": "^10.0.3" }, "dependencies": { - "0x.js": "^0.31.1", - "@0xproject/deployer": "^0.0.5", - "@0xproject/json-schemas": "^0.7.7", - "@0xproject/utils": "^0.2.4", - "@0xproject/web3-wrapper": "^0.1.9", + "0x.js": "^0.32.0", + "@0xproject/deployer": "^0.0.6", + "@0xproject/json-schemas": "^0.7.8", + "@0xproject/utils": "^0.3.0", + "@0xproject/web3-wrapper": "^0.1.10", "bluebird": "^3.5.0", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", diff --git a/packages/deployer/README.md b/packages/deployer/README.md index 4293f82d4..f4e688fd7 100644 --- a/packages/deployer/README.md +++ b/packages/deployer/README.md @@ -60,6 +60,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Lint ```bash diff --git a/packages/deployer/package.json b/packages/deployer/package.json index be940f164..49e0ec26a 100644 --- a/packages/deployer/package.json +++ b/packages/deployer/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/deployer", - "version": "0.0.5", + "version": "0.0.6", "description": "Smart contract deployer of 0x protocol", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { + "build:watch": "tsc -w", "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' src/solc/solc_bin/* ./lib && tsc", "test": "npm run build; mocha lib/test/*_test.js", "compile": "npm run build; node lib/src/cli.js compile", @@ -29,12 +30,12 @@ "devDependencies": { "copyfiles": "^1.2.0", "types-bn": "^0.0.1", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8" + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9" }, "dependencies": { - "@0xproject/utils": "^0.2.4", - "@0xproject/web3-wrapper": "^0.1.9", + "@0xproject/utils": "^0.3.0", + "@0xproject/web3-wrapper": "^0.1.10", "lodash": "^4.17.4", "solc": "^0.4.18", "web3": "^0.20.0", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 719426491..51b33b7da 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/dev-utils", - "version": "0.0.9", + "version": "0.0.10", "description": "0x dev TS utils", "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { + "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf lib", "lint": "tslint --project . 'src/**/*.ts'" @@ -19,18 +20,18 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/dev-utils/README.md", "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", - "@0xproject/types": "^0.1.8", + "@0xproject/tslint-config": "^0.4.7", + "@0xproject/types": "^0.1.9", "@types/lodash": "^4.14.86", "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", "types-bn": "^0.0.1", "types-ethereumjs-util": "0xproject/types-ethereumjs-util", - "typescript": "~2.6.1" + "typescript": "2.7.1" }, "dependencies": { - "@0xproject/utils": "^0.2.4", + "@0xproject/utils": "^0.3.0", "ethereumjs-util": "^5.1.2", "lodash": "^4.17.4", "request-promise-native": "^1.0.5", diff --git a/packages/json-schemas/README.md b/packages/json-schemas/README.md index 9166f50c1..754ce4e95 100644 --- a/packages/json-schemas/README.md +++ b/packages/json-schemas/README.md @@ -49,6 +49,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Lint ```bash diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 017dddd1d..02a8c1994 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/json-schemas", - "version": "0.7.7", + "version": "0.7.8", "description": "0x-related json schemas", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { + "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "test": "run-s clean build run_mocha", "test:circleci": "yarn test", @@ -27,8 +28,8 @@ "lodash.values": "^4.3.0" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", - "@0xproject/utils": "^0.2.4", + "@0xproject/tslint-config": "^0.4.7", + "@0xproject/utils": "^0.3.0", "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", @@ -40,6 +41,6 @@ "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", - "typescript": "~2.6.1" + "typescript": "2.7.1" } } diff --git a/packages/monorepo-scripts/README.md b/packages/monorepo-scripts/README.md index bed9bd6a6..ea1d43bd5 100644 --- a/packages/monorepo-scripts/README.md +++ b/packages/monorepo-scripts/README.md @@ -40,6 +40,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Clean ```bash diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index af40a995e..cbc3daad2 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,9 +1,10 @@ { "name": "@0xproject/monorepo-scripts", - "version": "0.1.8", + "version": "0.1.9", "private": true, "description": "Helper scripts for the monorepo", "scripts": { + "build:watch": "tsc -w", "deps_versions": "node ./lib/deps_versions.js", "lint": "tslint --project . 'src/**/*.ts'", "clean": "shx rm -rf lib", @@ -19,12 +20,12 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/monorepo-scripts/README.md", "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", + "@0xproject/tslint-config": "^0.4.7", "@types/glob": "^5.0.33", "@types/node": "^8.0.53", "shx": "^0.2.2", "tslint": "5.8.0", - "typescript": "~2.6.1" + "typescript": "2.7.1" }, "dependencies": { "chalk": "^2.3.0", diff --git a/packages/subproviders/README.md b/packages/subproviders/README.md index 84cab5601..0d8f85910 100644 --- a/packages/subproviders/README.md +++ b/packages/subproviders/README.md @@ -66,6 +66,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Clean ```bash diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 6d52393e9..4310f8d4a 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/subproviders", - "version": "0.3.5", + "version": "0.3.6", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "license": "Apache-2.0", "scripts": { + "build:watch": "tsc -w", "clean": "shx rm -rf lib", "build": "tsc", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", @@ -17,8 +18,8 @@ "test:integration": "run-s clean build run_mocha_integration" }, "dependencies": { - "@0xproject/assert": "^0.0.15", - "@0xproject/utils": "^0.2.4", + "@0xproject/assert": "^0.0.16", + "@0xproject/utils": "^0.3.0", "bn.js": "^4.11.8", "es6-promisify": "^5.0.0", "ethereumjs-tx": "^1.3.3", @@ -31,8 +32,8 @@ "web3-provider-engine": "^13.0.1" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", - "@0xproject/utils": "^0.2.4", + "@0xproject/tslint-config": "^0.4.7", + "@0xproject/utils": "^0.3.0", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", @@ -48,8 +49,8 @@ "tslint": "5.8.0", "types-bn": "^0.0.1", "types-ethereumjs-util": "0xproject/types-ethereumjs-util", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8", + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9", "webpack": "^3.1.0" } } diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index f05899896..5a6230bfe 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -1,10 +1,11 @@ { "private": true, "name": "@0xproject/testnet-faucets", - "version": "1.0.9", + "version": "1.0.10", "description": "A faucet micro-service that dispenses test ERC20 tokens or Ether", "main": "server.js", "scripts": { + "build:watch": "tsc -w", "build": "node ../../node_modules/gulp/bin/gulp.js build", "dev": "node ../../node_modules/gulp/bin/gulp.js run", "start": "node ./bin/server.js", @@ -14,8 +15,8 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^0.31.1", - "@0xproject/utils": "^0.2.4", + "0x.js": "^0.32.0", + "@0xproject/utils": "^0.3.0", "body-parser": "^1.17.1", "ethereumjs-tx": "^1.3.3", "express": "^4.15.2", @@ -25,7 +26,7 @@ "web3-provider-engine": "^13.0.1" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", + "@0xproject/tslint-config": "^0.4.7", "@types/body-parser": "^1.16.1", "@types/express": "^4.0.35", "@types/lodash": "^4.14.86", @@ -35,8 +36,8 @@ "shx": "^0.2.2", "source-map-loader": "^0.1.6", "tslint": "5.8.0", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8", + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9", "webpack": "^3.1.0", "webpack-node-externals": "^1.6.0" } diff --git a/packages/tslint-config/README.md b/packages/tslint-config/README.md index 8a6fa8a2f..b517f2d95 100644 --- a/packages/tslint-config/README.md +++ b/packages/tslint-config/README.md @@ -44,6 +44,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Lint ```bash diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index 47b286e64..d48f17954 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -1,9 +1,10 @@ { "name": "@0xproject/tslint-config", - "version": "0.4.6", + "version": "0.4.7", "description": "Lint rules related to 0xProject for TSLint", "main": "tslint.json", "scripts": { + "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf lib", "lint": "tslint --project . 'rules/**/*.ts'" @@ -38,7 +39,7 @@ "shx": "^0.2.2", "tslint": "5.8.0", "tslint-eslint-rules": "^4.1.1", - "typescript": "~2.6.1" + "typescript": "2.7.1" }, "dependencies": { "lodash": "^4.17.4", diff --git a/packages/types/README.md b/packages/types/README.md index d63970150..d2fa33c8f 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -40,6 +40,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Lint ```bash diff --git a/packages/types/package.json b/packages/types/package.json index 7bbf858f3..6d8e93cfd 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/types", - "version": "0.1.8", + "version": "0.1.9", "description": "0x types", "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { + "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf lib", "lint": "tslint --project . 'src/**/*.ts'" @@ -19,11 +20,11 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/types/README.md", "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", + "@0xproject/tslint-config": "^0.4.7", "shx": "^0.2.2", "tslint": "5.8.0", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8" + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9" }, "dependencies": { "bignumber.js": "~4.1.0", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index efee30dd1..b94e2ccee 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,6 +1,10 @@ # CHANGELOG +## v0.3.0 - _February 5, 2018_ + + * Fix a bug related to event signature collisions (argument indexes aren't included in event signatures) in the abi_decoder. The decoder used to throw on unknown events with identical signatures as a known event (except indexes). (#366) + ## v0.2.0 - _January 17, 2018_ -* Add `onError` parameter to `intervalUtils.setAsyncExcludingInterval` (#312) -* Add `intervalUtils.setInterval` (#312) + * Add `onError` parameter to `intervalUtils.setAsyncExcludingInterval` (#312) + * Add `intervalUtils.setInterval` (#312) diff --git a/packages/utils/README.md b/packages/utils/README.md index d6cacfa11..ffb0d0190 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -40,6 +40,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Lint ```bash diff --git a/packages/utils/package.json b/packages/utils/package.json index 5c03826ba..2a434d79a 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/utils", - "version": "0.2.4", + "version": "0.3.0", "description": "0x TS utils", "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { + "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf lib", "lint": "tslint --project . 'src/**/*.ts'" @@ -19,14 +20,14 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/utils/README.md", "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", - "@0xproject/types": "^0.1.8", + "@0xproject/tslint-config": "^0.4.7", + "@0xproject/types": "^0.1.9", "@types/lodash": "^4.14.86", "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8" + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9" }, "dependencies": { "bignumber.js": "~4.1.0", diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index f96ee2edb..368973b1b 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -18,7 +18,7 @@ export class AbiDecoder { return `0x${formatted}`; } constructor(abiArrays: Web3.AbiDefinition[][]) { - _.map(abiArrays, this._addABI.bind(this)); + _.forEach(abiArrays, this._addABI.bind(this)); } // This method can only decode logs from the 0x & ERC20 smart contracts public tryToDecodeLogOrNoop<ArgsType>(log: Web3.LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { @@ -36,9 +36,14 @@ export class AbiDecoder { const dataTypes = _.map(nonIndexedInputs, input => input.type); const decodedData = SolidityCoder.decodeParams(dataTypes, logData.slice('0x'.length)); - _.map(event.inputs, (param: Web3.EventParameter) => { + let failedToDecode = false; + _.forEach(event.inputs, (param: Web3.EventParameter) => { // Indexed parameters are stored in topics. Non-indexed ones in decodedData let value: BigNumber | string = param.indexed ? log.topics[topicsIndex++] : decodedData[dataIndex++]; + if (_.isUndefined(value)) { + failedToDecode = true; + return; + } if (param.type === SolidityTypes.Address) { value = AbiDecoder._padZeros(new BigNumber(value).toString(16)); } else if ( @@ -51,11 +56,15 @@ export class AbiDecoder { decodedParams[param.name] = value; }); - return { - ...log, - event: event.name, - args: decodedParams, - }; + if (failedToDecode) { + return log; + } else { + return { + ...log, + event: event.name, + args: decodedParams, + }; + } } private _addABI(abiArray: Web3.AbiDefinition[]): void { _.map(abiArray, (abi: Web3.AbiDefinition) => { diff --git a/packages/web3-typescript-typings/package.json b/packages/web3-typescript-typings/package.json index fce928498..6f7106b56 100644 --- a/packages/web3-typescript-typings/package.json +++ b/packages/web3-typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "web3-typescript-typings", - "version": "0.9.8", + "version": "0.9.9", "description": "Typescript type definitions for web3", "main": "index.d.ts", "types": "index.d.ts", @@ -24,7 +24,7 @@ "@types/bignumber.js": "^4.0.2", "tslint": "5.8.0", "tslint-config-0xproject": "^0.0.2", - "typescript": "~2.6.1" + "typescript": "2.7.1" }, "dependencies": { "bignumber.js": "~4.1.0" diff --git a/packages/web3-wrapper/README.md b/packages/web3-wrapper/README.md index 5b22aefd4..7ed66ca41 100644 --- a/packages/web3-wrapper/README.md +++ b/packages/web3-wrapper/README.md @@ -44,6 +44,12 @@ yarn install yarn build ``` +or + +```bash +yarn build:watch +``` + ### Lint ```bash diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 6e542124e..33d2fde20 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,10 +1,11 @@ { "name": "@0xproject/web3-wrapper", - "version": "0.1.9", + "version": "0.1.10", "description": "Wraps around web3 and gives a nicer interface", "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { + "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf lib", "lint": "tslint --project . 'src/**/*.ts'" @@ -19,17 +20,17 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/web3-wrapper/README.md", "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", - "@0xproject/types": "^0.1.8", + "@0xproject/tslint-config": "^0.4.7", + "@0xproject/types": "^0.1.9", "@types/lodash": "^4.14.86", "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8" + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9" }, "dependencies": { - "@0xproject/utils": "^0.2.4", + "@0xproject/utils": "^0.3.0", "lodash": "^4.17.4", "web3": "^0.20.0" } diff --git a/packages/website/package.json b/packages/website/package.json index ee853615b..e13c4d44c 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.11", + "version": "0.0.12", "private": true, "description": "Website and 0x portal dapp", "scripts": { @@ -18,9 +18,9 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^0.31.1", - "@0xproject/subproviders": "^0.3.5", - "@0xproject/utils": "^0.2.4", + "0x.js": "^0.32.0", + "@0xproject/subproviders": "^0.3.6", + "@0xproject/utils": "^0.3.0", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", @@ -96,8 +96,8 @@ "source-map-loader": "^0.1.6", "style-loader": "0.13.x", "tslint": "5.8.0", - "typescript": "~2.6.1", - "web3-typescript-typings": "^0.9.8", + "typescript": "2.7.1", + "web3-typescript-typings": "^0.9.9", "webpack": "^3.1.0", "webpack-dev-middleware": "^1.10.0", "webpack-dev-server": "^2.5.0" |