From 7dd28d6fab1d47a287422a0f51d63ba69d1c4dbc Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 21 Sep 2018 16:37:20 +0200 Subject: Don't depend on a specific version of node types --- packages/order-watcher/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/order-watcher') diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index a07e0f795..53ef64306 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -49,7 +49,7 @@ "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", - "@types/node": "^8.0.53", + "@types/node": "*", "@types/sinon": "^2.2.2", "awesome-typescript-loader": "^3.1.3", "chai": "^4.0.1", -- cgit v1.2.3 From 5446de630886422f1795e06d638a200ab62763ef Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 21 Sep 2018 16:59:16 +0200 Subject: Updated CHANGELOGS --- packages/order-watcher/CHANGELOG.json | 9 +++++++++ packages/order-watcher/CHANGELOG.md | 4 ++++ 2 files changed, 13 insertions(+) (limited to 'packages/order-watcher') diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 8d8aaf702..dec154f0f 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537541580, + "version": "1.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.3", "changes": [ diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md index e79bf638e..a4e1cc79f 100644 --- a/packages/order-watcher/CHANGELOG.md +++ b/packages/order-watcher/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.4 - _September 21, 2018_ + + * Dependencies updated + ## v1.0.3 - _September 19, 2018_ * Drastically reduce the bundle size by removing unused parts of included contract artifacts. -- cgit v1.2.3 From 29f6adc2ed57720d2c2aab7b760a4bcfec5d7b37 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 21 Sep 2018 16:59:27 +0200 Subject: Publish - 0x.js@1.0.4 - @0xproject/abi-gen@1.0.9 - @0xproject/assert@1.0.9 - @0xproject/base-contract@2.0.3 - @0xproject/connect@2.0.2 - @0xproject/contract-wrappers@1.0.4 - contracts@2.1.45 - @0xproject/dev-utils@1.0.8 - ethereum-types@1.0.7 - @0xproject/fill-scenarios@1.0.3 - @0xproject/forwarder-helper@1.0.4 - @0xproject/json-schemas@1.0.2 - @0xproject/metacoin@0.0.19 - @0xproject/migrations@1.0.10 - @0xproject/monorepo-scripts@1.0.9 - @0xproject/order-utils@1.0.3 - @0xproject/order-watcher@1.0.4 - @0xproject/react-docs@1.0.9 - @0xproject/react-shared@1.0.10 - @0xproject/sol-compiler@1.1.3 - @0xproject/sol-cov@2.1.3 - @0xproject/sol-resolver@1.0.9 - @0xproject/sra-report@1.0.9 - @0xproject/sra-spec@1.0.2 - @0xproject/subproviders@2.0.3 - @0xproject/testnet-faucets@1.0.47 - @0xproject/types@1.0.2 - @0xproject/typescript-typings@2.0.1 - @0xproject/utils@1.0.9 - @0xproject/web3-wrapper@2.0.3 - @0xproject/website@0.0.50 --- packages/order-watcher/package.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'packages/order-watcher') diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 53ef64306..8ce57364f 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-watcher", - "version": "1.0.3", + "version": "1.0.4", "description": "An order watcher daemon that watches for order validity", "keywords": [ "0x", @@ -42,9 +42,9 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^1.0.8", - "@0xproject/dev-utils": "^1.0.7", - "@0xproject/migrations": "^1.0.9", + "@0xproject/abi-gen": "^1.0.9", + "@0xproject/dev-utils": "^1.0.8", + "@0xproject/migrations": "^1.0.10", "@0xproject/tslint-config": "^1.0.7", "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", @@ -70,18 +70,18 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.8", - "@0xproject/base-contract": "^2.0.2", - "@0xproject/contract-wrappers": "^1.0.3", - "@0xproject/fill-scenarios": "^1.0.2", - "@0xproject/json-schemas": "^1.0.1", - "@0xproject/order-utils": "^1.0.2", - "@0xproject/types": "^1.0.1", - "@0xproject/typescript-typings": "^2.0.0", - "@0xproject/utils": "^1.0.8", - "@0xproject/web3-wrapper": "^2.0.2", + "@0xproject/assert": "^1.0.9", + "@0xproject/base-contract": "^2.0.3", + "@0xproject/contract-wrappers": "^1.0.4", + "@0xproject/fill-scenarios": "^1.0.3", + "@0xproject/json-schemas": "^1.0.2", + "@0xproject/order-utils": "^1.0.3", + "@0xproject/types": "^1.0.2", + "@0xproject/typescript-typings": "^2.0.1", + "@0xproject/utils": "^1.0.9", + "@0xproject/web3-wrapper": "^2.0.3", "bintrees": "^1.0.2", - "ethereum-types": "^1.0.6", + "ethereum-types": "^1.0.7", "ethereumjs-blockstream": "5.0.0", "ethers": "3.0.22", "lodash": "^4.17.5" -- cgit v1.2.3 From d0448c2bbd90c6c103f07b201886670dc4675a43 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 24 Sep 2018 15:02:06 +0100 Subject: Fix bug where if block wasn't found, getBlockAsync would throw. Now it returns `undefined` --- .../order-watcher/src/order_watcher/event_watcher.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'packages/order-watcher') diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index 9509c75de..fc8dd471d 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -1,6 +1,6 @@ import { intervalUtils, logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { BlockParamLiteral, LogEntry, Provider } from 'ethereum-types'; +import { BlockParamLiteral, BlockWithoutTransactionData, LogEntry, Provider } from 'ethereum-types'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; @@ -62,7 +62,7 @@ export class EventWatcher { throw new Error(OrderWatcherError.SubscriptionAlreadyPresent); } this._blockAndLogStreamerIfExists = new BlockAndLogStreamer( - this._web3Wrapper.getBlockAsync.bind(this._web3Wrapper), + this._getBlockOrNullAsync.bind(this), this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper), this._onBlockAndLogStreamerError.bind(this), ); @@ -82,6 +82,13 @@ export class EventWatcher { this._onLogStateChangedAsync.bind(this, callback, isRemoved), ); } + private async _getBlockOrNullAsync(): Promise { + const blockIfExists = await this._web3Wrapper.getBlockIfExistsAsync.bind(this._web3Wrapper); + if (_.isUndefined(blockIfExists)) { + return null; + } + return blockIfExists; + } private _stopBlockAndLogStream(): void { if (_.isUndefined(this._blockAndLogStreamerIfExists)) { throw new Error(OrderWatcherError.SubscriptionNotFound); @@ -100,11 +107,14 @@ export class EventWatcher { await this._emitDifferencesAsync(log, isRemoved ? LogEventState.Removed : LogEventState.Added, callback); } private async _reconcileBlockAsync(): Promise { - const latestBlock = await this._web3Wrapper.getBlockAsync(this._stateLayer); + const latestBlockIfExists = await this._web3Wrapper.getBlockIfExistsAsync(this._stateLayer); + if (_.isUndefined(latestBlockIfExists)) { + return; // noop + } // We need to coerce to Block type cause Web3.Block includes types for mempool blocks if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined - await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlock as any) as Block); + await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockIfExists as any) as Block); } } private async _emitDifferencesAsync( -- cgit v1.2.3 From 7516959c9f733c0ee73c2551db185a7751d9f94c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 24 Sep 2018 15:14:14 +0100 Subject: Add comments for clarity --- packages/order-watcher/src/order_watcher/event_watcher.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'packages/order-watcher') diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index fc8dd471d..eca235e26 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -82,6 +82,7 @@ export class EventWatcher { this._onLogStateChangedAsync.bind(this, callback, isRemoved), ); } + // This method only exists in order to comply with the expected interface of Blockstream's constructor private async _getBlockOrNullAsync(): Promise { const blockIfExists = await this._web3Wrapper.getBlockIfExistsAsync.bind(this._web3Wrapper); if (_.isUndefined(blockIfExists)) { -- cgit v1.2.3