aboutsummaryrefslogtreecommitdiffstats
path: root/src/order_watcher/order_state_watcher.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-11 22:47:32 +0800
committerFabio Berger <me@fabioberger.com>2017-11-11 22:47:32 +0800
commit0db0694aad5396aad3bc295120d45da731c53911 (patch)
tree4e574f3635d8ab364604e96f09edd3c07e2ed5ae /src/order_watcher/order_state_watcher.ts
parentd4f763aa68b62b33e82af438e11b07d0e741973e (diff)
downloaddexon-sol-tools-0db0694aad5396aad3bc295120d45da731c53911.tar
dexon-sol-tools-0db0694aad5396aad3bc295120d45da731c53911.tar.gz
dexon-sol-tools-0db0694aad5396aad3bc295120d45da731c53911.tar.bz2
dexon-sol-tools-0db0694aad5396aad3bc295120d45da731c53911.tar.lz
dexon-sol-tools-0db0694aad5396aad3bc295120d45da731c53911.tar.xz
dexon-sol-tools-0db0694aad5396aad3bc295120d45da731c53911.tar.zst
dexon-sol-tools-0db0694aad5396aad3bc295120d45da731c53911.zip
rename _orders to _orderByOrderhash for clarity
Diffstat (limited to 'src/order_watcher/order_state_watcher.ts')
-rw-r--r--src/order_watcher/order_state_watcher.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/order_watcher/order_state_watcher.ts b/src/order_watcher/order_state_watcher.ts
index f1b757abf..dd5e3f73c 100644
--- a/src/order_watcher/order_state_watcher.ts
+++ b/src/order_watcher/order_state_watcher.ts
@@ -42,7 +42,7 @@ interface OrderByOrderHash {
* the order should be deemed invalid.
*/
export class OrderStateWatcher {
- private _orders: OrderByOrderHash;
+ private _orderByOrderHash: OrderByOrderHash;
private _dependentOrderHashes: DependentOrderHashes;
private _web3Wrapper: Web3Wrapper;
private _callbackIfExistsAsync?: OnOrderStateChangeCallback;
@@ -55,7 +55,7 @@ export class OrderStateWatcher {
config?: OrderStateWatcherConfig,
) {
this._web3Wrapper = web3Wrapper;
- this._orders = {};
+ this._orderByOrderHash = {};
this._dependentOrderHashes = {};
const eventPollingIntervalMs = _.isUndefined(config) ? undefined : config.pollingIntervalMs;
this._numConfirmations = _.isUndefined(config) ?
@@ -75,7 +75,7 @@ export class OrderStateWatcher {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
assert.isValidSignature(orderHash, signedOrder.ecSignature, signedOrder.maker);
- this._orders[orderHash] = signedOrder;
+ this._orderByOrderHash[orderHash] = signedOrder;
this.addToDependentOrderHashes(signedOrder, orderHash);
}
/**
@@ -84,11 +84,11 @@ export class OrderStateWatcher {
*/
public removeOrder(orderHash: string): void {
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
- const signedOrder = this._orders[orderHash];
+ const signedOrder = this._orderByOrderHash[orderHash];
if (_.isUndefined(signedOrder)) {
return; // noop
}
- delete this._orders[orderHash];
+ delete this._orderByOrderHash[orderHash];
this._dependentOrderHashes[signedOrder.maker][signedOrder.makerTokenAddress].delete(orderHash);
// We currently do not remove the maker/makerToken keys from the mapping when all orderHashes removed
}
@@ -153,7 +153,7 @@ export class OrderStateWatcher {
case ExchangeEvents.LogFill:
case ExchangeEvents.LogCancel:
const orderHash = decodedLog.args.orderHash;
- const isOrderWatched = !_.isUndefined(this._orders[orderHash]);
+ const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]);
if (isOrderWatched) {
await this._emitRevalidateOrdersAsync([orderHash], blockNumber);
}
@@ -175,7 +175,7 @@ export class OrderStateWatcher {
};
for (const orderHash of orderHashes) {
- const signedOrder = this._orders[orderHash] as SignedOrder;
+ const signedOrder = this._orderByOrderHash[orderHash] as SignedOrder;
const orderState = await this._orderStateUtils.getOrderStateAsync(signedOrder, methodOpts);
if (!_.isUndefined(this._callbackIfExistsAsync)) {
await this._callbackIfExistsAsync(orderState);