diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-23 02:15:31 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-24 05:13:36 +0800 |
commit | 66aaceea915b6412c8ff8bcb5001363da8aaca39 (patch) | |
tree | a636673a2fef8a6db85918e1b391fe75e3fb0a1d /packages/0x.js/src/order_watcher/order_state_watcher.ts | |
parent | 4fe28ec53c4e84544c3c21853dff57c4c6a4e45d (diff) | |
download | dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.gz dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.bz2 dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.lz dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.xz dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.tar.zst dexon-sol-tools-66aaceea915b6412c8ff8bcb5001363da8aaca39.zip |
Cleanup order watcher from redundant asyncs
Diffstat (limited to 'packages/0x.js/src/order_watcher/order_state_watcher.ts')
-rw-r--r-- | packages/0x.js/src/order_watcher/order_state_watcher.ts | 14 |
1 files changed, 7 insertions, 7 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 870f42650..287172ff1 100644 --- a/packages/0x.js/src/order_watcher/order_state_watcher.ts +++ b/packages/0x.js/src/order_watcher/order_state_watcher.ts @@ -94,12 +94,12 @@ export class OrderStateWatcher { * signature is verified. * @param signedOrder The order you wish to start watching. */ - public async addOrderAsync(signedOrder: SignedOrder): Promise<void> { + public addOrder(signedOrder: SignedOrder): void { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); const orderHash = ZeroEx.getOrderHashHex(signedOrder); assert.isValidSignature(orderHash, signedOrder.ecSignature, signedOrder.maker); this._orderByOrderHash[orderHash] = signedOrder; - await this.addToDependentOrderHashesAsync(signedOrder, orderHash); + this.addToDependentOrderHashes(signedOrder, orderHash); const expirationUnixTimestampMs = signedOrder.expirationUnixTimestampSec.times(1000); this._expirationWatcher.addOrder(orderHash, expirationUnixTimestampMs); } @@ -107,7 +107,7 @@ export class OrderStateWatcher { * Removes an order from the orderStateWatcher * @param orderHash The orderHash of the order you wish to stop watching. */ - public async removeOrderAsync(orderHash: string): Promise<void> { + public removeOrder(orderHash: string): void { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const signedOrder = this._orderByOrderHash[orderHash]; if (_.isUndefined(signedOrder)) { @@ -134,7 +134,7 @@ export class OrderStateWatcher { } this._callbackIfExists = callback; this._eventWatcher.subscribe(this._onEventWatcherCallbackAsync.bind(this)); - this._expirationWatcher.subscribe(this._onOrderExpiredAsync.bind(this)); + this._expirationWatcher.subscribe(this._onOrderExpired.bind(this)); } /** * Ends an orderStateWatcher subscription. @@ -149,14 +149,14 @@ export class OrderStateWatcher { this._eventWatcher.unsubscribe(); this._expirationWatcher.unsubscribe(); } - private async _onOrderExpiredAsync(orderHash: string): Promise<void> { + private _onOrderExpired(orderHash: string): void { const orderState: OrderState = { isValid: false, orderHash, error: ExchangeContractErrs.OrderFillExpired, }; if (!_.isUndefined(this._orderByOrderHash[orderHash])) { - await this.removeOrderAsync(orderHash); + this.removeOrder(orderHash); if (!_.isUndefined(this._callbackIfExists)) { this._callbackIfExists(orderState); } @@ -254,7 +254,7 @@ export class OrderStateWatcher { this._callbackIfExists(orderState); } } - private async addToDependentOrderHashesAsync(signedOrder: SignedOrder, orderHash: string): Promise<void> { + private addToDependentOrderHashes(signedOrder: SignedOrder, orderHash: string): void { if (_.isUndefined(this._dependentOrderHashes[signedOrder.maker])) { this._dependentOrderHashes[signedOrder.maker] = {}; } |