aboutsummaryrefslogblamecommitdiffstats
path: root/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
blob: ed69ecc63f6b3dc0d34c12f712f2b846220776cb (plain) (tree)
1
2
3
4
5
6
7
8





                                                                                               

                                                       















                                                                                                                       
import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
import { BigNumber } from '@0xproject/utils';

import { ExchangeWrapper } from './exchange_wrapper';

export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher {
    private readonly _exchangeWrapper: ExchangeWrapper;
    private readonly _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;
    }
}