Merge branch 'development' into feature/publishLifecycleScripts
* development: Remove clean step from test_umd.sh Update CHANGELOG.md vx.x.x Add CHANGELOG files to each sub-package Fix 0x.js CHANGELOG separate assignment and call Remove Async subscribe callbacks from OrderWatcher Update changelog Callback for subscribe no longer supports an Async Callback
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
# CHANGELOG
|
||||
|
||||
v0.24.0 - _November 13, 2017_
|
||||
vx.x.x
|
||||
------------------------
|
||||
* Remove support for Async callback types when used in Subscribe functions
|
||||
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_
|
||||
------------------------
|
||||
* 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_
|
||||
------------------------
|
||||
|
@@ -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
|
||||
|
@@ -6,8 +6,6 @@ export {
|
||||
ECSignature,
|
||||
ZeroExError,
|
||||
EventCallback,
|
||||
EventCallbackAsync,
|
||||
EventCallbackSync,
|
||||
ExchangeContractErrs,
|
||||
ContractEvent,
|
||||
Token,
|
||||
|
@@ -81,7 +81,7 @@ export class EventWatcher {
|
||||
...log,
|
||||
};
|
||||
if (!_.isUndefined(this._intervalIdIfExists)) {
|
||||
await callback(logEvent);
|
||||
callback(logEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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<void> {
|
||||
@@ -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) {
|
||||
|
@@ -42,13 +42,8 @@ export type OrderValues = [BigNumber, BigNumber, BigNumber,
|
||||
export type LogEvent = Web3.LogEntryEvent;
|
||||
export type DecodedLogEvent<ArgsType> = Web3.DecodedLogEntryEvent<ArgsType>;
|
||||
|
||||
export type EventCallbackAsync<ArgsType> = (err: null|Error, log?: DecodedLogEvent<ArgsType>) => Promise<void>;
|
||||
export type EventCallbackSync<ArgsType> = (err: null|Error, log?: DecodedLogEvent<ArgsType>) => void;
|
||||
export type EventCallback<ArgsType> = EventCallbackSync<ArgsType>|EventCallbackAsync<ArgsType>;
|
||||
|
||||
export type EventWatcherCallbackSync = (log: LogEvent) => void;
|
||||
export type EventWatcherCallbackAsync = (log: LogEvent) => Promise<void>;
|
||||
export type EventWatcherCallback = EventWatcherCallbackSync|EventWatcherCallbackAsync;
|
||||
export type EventCallback<ArgsType> = (err: null|Error, log?: DecodedLogEvent<ArgsType>) => void;
|
||||
export type EventWatcherCallback = (log: LogEvent) => void;
|
||||
|
||||
export interface ExchangeContract extends Web3.ContractInstance {
|
||||
isValidSignature: {
|
||||
@@ -507,9 +502,7 @@ export interface OrderStateInvalid {
|
||||
|
||||
export type OrderState = OrderStateValid|OrderStateInvalid;
|
||||
|
||||
export type OnOrderStateChangeCallbackSync = (orderState: OrderState) => void;
|
||||
export type OnOrderStateChangeCallbackAsync = (orderState: OrderState) => Promise<void>;
|
||||
export type OnOrderStateChangeCallback = OnOrderStateChangeCallbackAsync|OnOrderStateChangeCallbackSync;
|
||||
export type OnOrderStateChangeCallback = (orderState: OrderState) => void;
|
||||
|
||||
export interface TransactionReceipt {
|
||||
blockHash: string;
|
||||
|
Reference in New Issue
Block a user