aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/fetchers/simple_order_filled_cancelled_fetcher.ts
blob: b7548d54d99bd5ab071a599f4fbd54b9d9bbd8bf (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 { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';

import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';

export class SimpleOrderFilledCancelledFetcher implements OrderFilledCancelledFetcher {
    private _exchangeWrapper: ExchangeWrapper;
    private _defaultBlock: BlockParamLiteral;
    constructor(exchange: ExchangeWrapper, defaultBlock: BlockParamLiteral) {
        this._exchangeWrapper = exchange;
        this._defaultBlock = defaultBlock;
    }
    public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber> {
        const methodOpts = {
            defaultBlock: this._defaultBlock,
        };
        const filledTakerAmount = this._exchangeWrapper.getFilledTakerAmountAsync(orderHash, methodOpts);
        return filledTakerAmount;
    }
    public async getCancelledTakerAmountAsync(orderHash: string): Promise<BigNumber> {
        const methodOpts = {
            defaultBlock: this._defaultBlock,
        };
        const cancelledTakerAmount = this._exchangeWrapper.getCancelledTakerAmountAsync(orderHash, methodOpts);
        return cancelledTakerAmount;
    }
}