From a12069f03fb1c1c93884c2e168917d229f7864e9 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 14 Nov 2017 10:56:57 -0500 Subject: Callback for subscribe no longer supports an Async Callback --- packages/0x.js/src/contract_wrappers/contract_wrapper.ts | 3 +-- packages/0x.js/src/index.ts | 2 -- packages/0x.js/src/order_watcher/event_watcher.ts | 2 +- packages/0x.js/src/types.ts | 9 ++------- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts index 7997b1647..bd65c8eb3 100644 --- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts @@ -52,8 +52,7 @@ export class ContractWrapper { throw new Error(ZeroExError.SubscriptionNotFound); } if (!_.isUndefined(err)) { - const callback = this._filterCallbacks[filterToken]; - callback(err, undefined); + this._filterCallbacks[filterToken](err, undefined); } delete this._filters[filterToken]; delete this._filterCallbacks[filterToken]; diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 1b3e893ba..e529e2858 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -6,8 +6,6 @@ export { ECSignature, ZeroExError, EventCallback, - EventCallbackAsync, - EventCallbackSync, ExchangeContractErrs, ContractEvent, Token, diff --git a/packages/0x.js/src/order_watcher/event_watcher.ts b/packages/0x.js/src/order_watcher/event_watcher.ts index 81529a98c..c39431f6d 100644 --- a/packages/0x.js/src/order_watcher/event_watcher.ts +++ b/packages/0x.js/src/order_watcher/event_watcher.ts @@ -81,7 +81,7 @@ export class EventWatcher { ...log, }; if (!_.isUndefined(this._intervalIdIfExists)) { - await callback(logEvent); + callback(logEvent); } } } diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index 11b5d8569..04dfe3b0d 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -42,13 +42,8 @@ export type OrderValues = [BigNumber, BigNumber, BigNumber, export type LogEvent = Web3.LogEntryEvent; export type DecodedLogEvent = Web3.DecodedLogEntryEvent; -export type EventCallbackAsync = (err: null|Error, log?: DecodedLogEvent) => Promise; -export type EventCallbackSync = (err: null|Error, log?: DecodedLogEvent) => void; -export type EventCallback = EventCallbackSync|EventCallbackAsync; - -export type EventWatcherCallbackSync = (log: LogEvent) => void; -export type EventWatcherCallbackAsync = (log: LogEvent) => Promise; -export type EventWatcherCallback = EventWatcherCallbackSync|EventWatcherCallbackAsync; +export type EventCallback = (err: null|Error, log?: DecodedLogEvent) => void; +export type EventWatcherCallback = (log: LogEvent) => void; export interface ExchangeContract extends Web3.ContractInstance { isValidSignature: { -- cgit v1.2.3 From 8f4be963b2f16351b6f55513e190e1e287328911 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 14 Nov 2017 11:09:37 -0500 Subject: Update changelog --- packages/0x.js/CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index a9362151c..9c795cf5a 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +v0.25.0 - _November 14, 2017_ +------------------------ + * Remove support for Async callback types when used in Subscribe functions + v0.24.0 - _November 13, 2017_ ------------------------ * Standardise on Cancelled over Canceled @@ -7,7 +11,7 @@ v0.24.0 - _November 13, 2017_ v0.23.0 - _November 12, 2017_ ------------------------ * Fixed unhandled promise rejection error in subscribe methods (#209) - * Subscribe callbacks now receive an error object as their first argument + * Subscribe callbacks now receive an error object as their first argument v0.22.6 - _November 10, 2017_ ------------------------ -- cgit v1.2.3 From 752603284de28f8d966fe61a52d0ffe5dd8afd6a Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 14 Nov 2017 11:21:00 -0500 Subject: Remove Async subscribe callbacks from OrderWatcher --- packages/0x.js/src/order_watcher/order_state_watcher.ts | 14 +++++++------- packages/0x.js/src/types.ts | 4 +--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/0x.js/src/order_watcher/order_state_watcher.ts b/packages/0x.js/src/order_watcher/order_state_watcher.ts index 2b9d7997e..80f323017 100644 --- a/packages/0x.js/src/order_watcher/order_state_watcher.ts +++ b/packages/0x.js/src/order_watcher/order_state_watcher.ts @@ -52,7 +52,7 @@ interface OrderByOrderHash { export class OrderStateWatcher { private _orderByOrderHash: OrderByOrderHash = {}; private _dependentOrderHashes: DependentOrderHashes = {}; - private _callbackIfExistsAsync?: OnOrderStateChangeCallback; + private _callbackIfExists?: OnOrderStateChangeCallback; private _eventWatcher: EventWatcher; private _web3Wrapper: Web3Wrapper; private _abiDecoder: AbiDecoder; @@ -106,22 +106,22 @@ export class OrderStateWatcher { */ public subscribe(callback: OnOrderStateChangeCallback): void { assert.isFunction('callback', callback); - if (!_.isUndefined(this._callbackIfExistsAsync)) { + if (!_.isUndefined(this._callbackIfExists)) { throw new Error(ZeroExError.SubscriptionAlreadyPresent); } - this._callbackIfExistsAsync = callback; + this._callbackIfExists = callback; this._eventWatcher.subscribe(this._onEventWatcherCallbackAsync.bind(this)); } /** * Ends an orderStateWatcher subscription. */ public unsubscribe(): void { - if (_.isUndefined(this._callbackIfExistsAsync)) { + if (_.isUndefined(this._callbackIfExists)) { throw new Error(ZeroExError.SubscriptionNotFound); } this._balanceAndProxyAllowanceLazyStore.deleteAll(); this._orderFilledCancelledLazyStore.deleteAll(); - delete this._callbackIfExistsAsync; + delete this._callbackIfExists; this._eventWatcher.unsubscribe(); } private async _onEventWatcherCallbackAsync(log: LogEvent): Promise { @@ -204,10 +204,10 @@ export class OrderStateWatcher { // Most of these calls will never reach the network because the data is fetched from stores // and only updated when cache is invalidated const orderState = await this._orderStateUtils.getOrderStateAsync(signedOrder); - if (_.isUndefined(this._callbackIfExistsAsync)) { + if (_.isUndefined(this._callbackIfExists)) { break; // Unsubscribe was called } - await this._callbackIfExistsAsync(orderState); + this._callbackIfExists(orderState); } } private addToDependentOrderHashes(signedOrder: SignedOrder, orderHash: string) { diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index 04dfe3b0d..91e3c0f20 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -501,9 +501,7 @@ export interface OrderStateInvalid { export type OrderState = OrderStateValid|OrderStateInvalid; -export type OnOrderStateChangeCallbackSync = (orderState: OrderState) => void; -export type OnOrderStateChangeCallbackAsync = (orderState: OrderState) => Promise; -export type OnOrderStateChangeCallback = OnOrderStateChangeCallbackAsync|OnOrderStateChangeCallbackSync; +export type OnOrderStateChangeCallback = (orderState: OrderState) => void; export interface TransactionReceipt { blockHash: string; -- cgit v1.2.3 From 3f39b22a680958988fbd7a8382dcd8d26420307f Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 14 Nov 2017 21:20:31 -0500 Subject: separate assignment and call --- packages/0x.js/src/contract_wrappers/contract_wrapper.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts index bd65c8eb3..7997b1647 100644 --- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts @@ -52,7 +52,8 @@ export class ContractWrapper { throw new Error(ZeroExError.SubscriptionNotFound); } if (!_.isUndefined(err)) { - this._filterCallbacks[filterToken](err, undefined); + const callback = this._filterCallbacks[filterToken]; + callback(err, undefined); } delete this._filters[filterToken]; delete this._filterCallbacks[filterToken]; -- cgit v1.2.3 From 24117495943088bb5f6eb3e7bd7933990a06abc6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Nov 2017 10:10:45 -0500 Subject: Fix 0x.js CHANGELOG --- packages/0x.js/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index b31e05923..892a0863e 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -v0.24.0 - _November 13, 2017_ +v0.25.1 - _November 13, 2017_ ------------------------ * Standardise on Cancelled over Canceled * Add missing `DecodedLogEvent` type to exported types -- cgit v1.2.3 From 557faba31b149ab52f6cc4b1930f457205b00229 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Nov 2017 10:11:04 -0500 Subject: Add CHANGELOG files to each sub-package --- packages/assert/CHANGELOG.md | 6 ++++++ packages/connect/CHANGELOG.md | 4 ++++ packages/json-schemas/CHANGELOG.md | 5 +++++ packages/tslint-config/CHANGELOG.md | 6 ++++++ 4 files changed, 21 insertions(+) create mode 100644 packages/assert/CHANGELOG.md create mode 100644 packages/connect/CHANGELOG.md create mode 100644 packages/json-schemas/CHANGELOG.md create mode 100644 packages/tslint-config/CHANGELOG.md diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md new file mode 100644 index 000000000..fd6bec3f4 --- /dev/null +++ b/packages/assert/CHANGELOG.md @@ -0,0 +1,6 @@ +# CHANGELOG + +v0.0.4 - _Nov. 14, 2017_ +------------------------ + * Re-publish Assert previously published under NPM package @0xproject/0x-assert + * Added assertion isValidBaseUnitAmount which checks both that the value is a valid bigNumber and that it does not contain decimals. diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md new file mode 100644 index 000000000..f3367f4ce --- /dev/null +++ b/packages/connect/CHANGELOG.md @@ -0,0 +1,4 @@ +# CHANGELOG + +v0.0.0 - _Nov. 15, 2017_ +------------------------ diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md new file mode 100644 index 000000000..9f080adeb --- /dev/null +++ b/packages/json-schemas/CHANGELOG.md @@ -0,0 +1,5 @@ +# CHANGELOG + +v0.6.7 - _Nov. 14, 2017_ +------------------------ + * Re-publish JSON-schema previously published under NPM package 0x-json-schemas diff --git a/packages/tslint-config/CHANGELOG.md b/packages/tslint-config/CHANGELOG.md new file mode 100644 index 000000000..7a6ba41c0 --- /dev/null +++ b/packages/tslint-config/CHANGELOG.md @@ -0,0 +1,6 @@ +# CHANGELOG + +v0.1.0 - _Nov. 14, 2017_ +------------------------ + * Re-published TsLintConfig previously published under NPM package `tslint-config-0xproject` + * Updated to TSLint v5.8.0, requiring several rule additions to keep our conventions aligned. -- cgit v1.2.3 From 85c3b2996d7097f8d390f4b8f6199b983928defb Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Wed, 15 Nov 2017 16:48:30 -0500 Subject: vx.x.x --- packages/0x.js/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 9c795cf5a..d5e965ed7 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -v0.25.0 - _November 14, 2017_ +vx.x.x ------------------------ * Remove support for Async callback types when used in Subscribe functions -- cgit v1.2.3 From 741774c4a776af719c3a013b35bd9cf4f4c1c169 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 12:13:40 -0500 Subject: Update CHANGELOG.md --- packages/0x.js/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 0112ca33f..69fd7661b 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -7,6 +7,7 @@ v0.25.1 - _November 13, 2017_ ------------------------ * Standardise on Cancelled over Canceled * Add missing `DecodedLogEvent` type to exported types + * Normalized the transactionReceipt status to be `null|0|1`, 1 meaning transaction execution successful, 0 unsuccessful and `null` if it is a pre-byzantinium transaction. v0.23.0 - _November 12, 2017_ ------------------------ -- cgit v1.2.3 From 5042b85d218bd17dcf0ebf9b3127dd30c5bb5962 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 17 Nov 2017 12:32:39 -0800 Subject: Remove clean step from test_umd.sh --- packages/0x.js/scripts/test_umd.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/0x.js/scripts/test_umd.sh b/packages/0x.js/scripts/test_umd.sh index d200c76d0..e3eba088a 100755 --- a/packages/0x.js/scripts/test_umd.sh +++ b/packages/0x.js/scripts/test_umd.sh @@ -3,5 +3,4 @@ # UMD tests should only be run after building the commonjs because they reuse some of the commonjs build artifacts run-s substitute_umd_bundle run_mocha return_code=$? -npm run clean exit $return_code -- cgit v1.2.3