aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-13 23:45:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-13 23:45:25 +0800
commit95e9f33f6aa5fa7849279062b008afa763a465d8 (patch)
tree085b1303c0576a1bafe471191253a416cbd939d2 /packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts
parentc599a20b34331c6481318d3cd3b01855444f339d (diff)
downloaddexon-0x-contracts-95e9f33f6aa5fa7849279062b008afa763a465d8.tar
dexon-0x-contracts-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.gz
dexon-0x-contracts-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.bz2
dexon-0x-contracts-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.lz
dexon-0x-contracts-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.xz
dexon-0x-contracts-95e9f33f6aa5fa7849279062b008afa763a465d8.tar.zst
dexon-0x-contracts-95e9f33f6aa5fa7849279062b008afa763a465d8.zip
Migrate order-watcher to v2
Diffstat (limited to 'packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts')
-rw-r--r--packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts b/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts
new file mode 100644
index 000000000..bfad1a48c
--- /dev/null
+++ b/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts
@@ -0,0 +1,27 @@
+// tslint:disable:no-unnecessary-type-assertion
+import { BlockParamLiteral, ExchangeWrapper } from '@0xproject/contract-wrappers';
+import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
+import { BigNumber } from '@0xproject/utils';
+
+export class OrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher {
+ private readonly _exchange: ExchangeWrapper;
+ private readonly _stateLayer: BlockParamLiteral;
+ constructor(exchange: ExchangeWrapper, stateLayer: BlockParamLiteral) {
+ this._exchange = exchange;
+ this._stateLayer = stateLayer;
+ }
+ public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber> {
+ const filledTakerAmount = this._exchange.getFilledTakerAssetAmountAsync(orderHash, {
+ defaultBlock: this._stateLayer,
+ });
+ return filledTakerAmount;
+ }
+ public async isOrderCancelledAsync(orderHash: string): Promise<boolean> {
+ const isCancelled = await this._exchange.isCancelledAsync(orderHash);
+ return isCancelled;
+ }
+ public getZRXAssetData(): string {
+ const zrxAssetData = this._exchange.getZRXAssetData();
+ return zrxAssetData;
+ }
+}