aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts')
-rw-r--r--packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts b/packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts
new file mode 100644
index 000000000..24afe36b7
--- /dev/null
+++ b/packages/contracts/src/utils/simple_order_filled_cancelled_fetcher.ts
@@ -0,0 +1,24 @@
+import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
+import { BigNumber } from '@0xproject/utils';
+
+import { ExchangeWrapper } from './exchange_wrapper';
+
+export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher {
+ private _exchangeWrapper: ExchangeWrapper;
+ private _zrxAssetData: string;
+ constructor(exchange: ExchangeWrapper, zrxAssetData: string) {
+ this._exchangeWrapper = exchange;
+ this._zrxAssetData = zrxAssetData;
+ }
+ public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber> {
+ const filledTakerAmount = new BigNumber(await this._exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash));
+ return filledTakerAmount;
+ }
+ public async isOrderCancelledAsync(orderHash: string): Promise<boolean> {
+ const isCancelled = await this._exchangeWrapper.isCancelledAsync(orderHash);
+ return isCancelled;
+ }
+ public getZRXAssetData(): string {
+ return this._zrxAssetData;
+ }
+}