aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
blob: a295a40c46093646b25a481fdfb1857c37b2d6d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { AbstractBalanceAndProxyAllowanceFetcher } from '@0xproject/order-utils';
import { BigNumber } from '@0xproject/utils';

import { AssetWrapper } from './asset_wrapper';

export class SimpleAssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher {
    private _assetWrapper: AssetWrapper;
    constructor(assetWrapper: AssetWrapper) {
        this._assetWrapper = assetWrapper;
    }
    public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
        const balance = await this._assetWrapper.getBalanceAsync(userAddress, assetData);
        return balance;
    }
    public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
        const proxyAllowance = await this._assetWrapper.getProxyAllowanceAsync(userAddress, assetData);
        return proxyAllowance;
    }
}