blob: b2c8598e7806543b36b83f61a690c63ef9def10c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import * as _ from 'lodash';
import {ZeroEx} from '../';
import {assert} from '../utils/assert';
import {Web3Provider, SignedOrder, OnOrderFillabilityStateChangeCallback} from '../types';
import {Web3Wrapper} from '../web3_wrapper';
export class OrderWatcher {
private _orders = new Map<string, SignedOrder>();
private _web3Wrapper: Web3Wrapper;
constructor(provider: Web3Provider) {
assert.isWeb3Provider('provider', provider);
this._web3Wrapper = new Web3Wrapper(provider);
}
public addOrder(signedOrder: SignedOrder): void {
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
this._orders.set(orderHash, signedOrder);
}
public removeOrder(signedOrder: SignedOrder): void {
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
this._orders.delete(orderHash);
}
public subscribe(callback: OnOrderFillabilityStateChangeCallback): void {
//
}
public unsubscribe(): void {
//
}
}
|