aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src/abstract/abstract_balance_and_proxy_allowance_fetcher.ts
blob: c7f06abad0d8bc9b1548fefe2dcd321197c6a009 (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
import { BigNumber } from '@0xproject/utils';

/**
 * An abstract class to be implemented in order to use OrderStateUtils. The class that
 * implements this interface must be capable of fetching the balance and proxyAllowance
 * for an Ethereum address and assetData
 */
export abstract class AbstractBalanceAndProxyAllowanceFetcher {
    /**
     * Get balance of assetData for userAddress
     * @param assetData AssetData for which to fetch the balance
     * @param userAddress Ethereum address for which to fetch the balance
     * @return Balance amount in base units
     */
    public abstract async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber>;
    /**
     * Get the 0x asset proxy allowance of assetData for userAddress
     * @param assetData AssetData for which to fetch the allowance
     * @param userAddress Ethereum address for which to fetch the allowance
     * @return Allowance amount in base units
     */
    public abstract async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber>;
}