aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-30 16:54:28 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 03:11:45 +0800
commit247eefc33a3c936158c4d71e3cea905635d27a9b (patch)
treece2de8dbd8e639470c65d96c78b51cd560d9d143
parentfd54a6a3ad91a6aaff0e2a81f4fd9856b02ff320 (diff)
downloaddexon-sol-tools-247eefc33a3c936158c4d71e3cea905635d27a9b.tar
dexon-sol-tools-247eefc33a3c936158c4d71e3cea905635d27a9b.tar.gz
dexon-sol-tools-247eefc33a3c936158c4d71e3cea905635d27a9b.tar.bz2
dexon-sol-tools-247eefc33a3c936158c4d71e3cea905635d27a9b.tar.lz
dexon-sol-tools-247eefc33a3c936158c4d71e3cea905635d27a9b.tar.xz
dexon-sol-tools-247eefc33a3c936158c4d71e3cea905635d27a9b.tar.zst
dexon-sol-tools-247eefc33a3c936158c4d71e3cea905635d27a9b.zip
Add initial interface of an OrderWatcher
-rw-r--r--src/mempool/order_watcher.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mempool/order_watcher.ts b/src/mempool/order_watcher.ts
new file mode 100644
index 000000000..90c15cd34
--- /dev/null
+++ b/src/mempool/order_watcher.ts
@@ -0,0 +1,27 @@
+import * as Web3 from 'web3';
+import * as _ from 'lodash';
+import {Web3Provider, SignedOrder} from '../types';
+import {Web3Wrapper} from '../web3_wrapper';
+
+export class OrderWatcher {
+ constructor(provider: Web3Provider) {
+ if (_.isUndefined((provider as any).sendAsync)) {
+ // Web3@1.0 provider doesn't support synchronous http requests,
+ // so it only has an async `send` method, instead of a `send` and `sendAsync` in web3@0.x.x`
+ // We re-assign the send method so that Web3@1.0 providers work with 0x.js
+ (provider as any).sendAsync = (provider as any).send;
+ }
+ }
+ public addOrder(signedOrder: SignedOrder): void {
+ //
+ }
+ public removeOrder(signedOrder: SignedOrder): void {
+ //
+ }
+ public subscribe(callback: OnOrderFillabilityStateChangeCallback): void {
+ //
+ }
+ public unsubscribe(): void {
+ //
+ }
+}