blob: 2aa1cc2b787640c1ff8fe85f67c623b7066a9337 (
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
|
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import {BalanceAndAllowanceFetcher} from '../abstract/balance_and_allowance_fetcher';
import {TokenWrapper} from '../contract_wrappers/token_wrapper';
export class SimpleBalanceAndAllowanceFetcher implements BalanceAndAllowanceFetcher {
private _token: TokenWrapper;
private _defaultBlock: BlockParamLiteral;
constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) {
this._token = token;
this._defaultBlock = defaultBlock;
}
public async getBalanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> {
const methodOpts = {
defaultBlock: this._defaultBlock,
};
return this._token.getBalanceAsync(tokenAddress, userAddress, methodOpts);
}
public async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> {
const methodOpts = {
defaultBlock: this._defaultBlock,
};
return this._token.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts);
}
}
|