aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/contract_wrappers/token_wrapper.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-23 06:19:06 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-24 05:13:37 +0800
commit010e6f8d7f7403cb91c020fc501fdb4f59861c58 (patch)
tree7f854bbf95efed9688f144943df7a8c326c3c65e /packages/0x.js/src/contract_wrappers/token_wrapper.ts
parent3d5b6ec110e32f670920a88939a250479651bb5a (diff)
downloaddexon-0x-contracts-010e6f8d7f7403cb91c020fc501fdb4f59861c58.tar
dexon-0x-contracts-010e6f8d7f7403cb91c020fc501fdb4f59861c58.tar.gz
dexon-0x-contracts-010e6f8d7f7403cb91c020fc501fdb4f59861c58.tar.bz2
dexon-0x-contracts-010e6f8d7f7403cb91c020fc501fdb4f59861c58.tar.lz
dexon-0x-contracts-010e6f8d7f7403cb91c020fc501fdb4f59861c58.tar.xz
dexon-0x-contracts-010e6f8d7f7403cb91c020fc501fdb4f59861c58.tar.zst
dexon-0x-contracts-010e6f8d7f7403cb91c020fc501fdb4f59861c58.zip
Fix the imports order
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/token_wrapper.ts')
-rw-r--r--packages/0x.js/src/contract_wrappers/token_wrapper.ts15
1 files changed, 6 insertions, 9 deletions
diff --git a/packages/0x.js/src/contract_wrappers/token_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_wrapper.ts
index 4b359d069..cd1104580 100644
--- a/packages/0x.js/src/contract_wrappers/token_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/token_wrapper.ts
@@ -20,6 +20,7 @@ import {constants} from '../utils/constants';
import {Web3Wrapper} from '../web3_wrapper';
import {ContractWrapper} from './contract_wrapper';
+import {TokenTransferProxyWrapper} from './token_transfer_proxy_wrapper';
const ALLOWANCE_TO_ZERO_GAS_AMOUNT = 47275;
@@ -31,12 +32,12 @@ const ALLOWANCE_TO_ZERO_GAS_AMOUNT = 47275;
export class TokenWrapper extends ContractWrapper {
public UNLIMITED_ALLOWANCE_IN_BASE_UNITS = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
private _tokenContractsByAddress: {[address: string]: TokenContract};
- private _tokenTransferProxyContractAddressFetcher: () => Promise<string>;
+ private _tokenTransferProxyWrapper: TokenTransferProxyWrapper;
constructor(web3Wrapper: Web3Wrapper, abiDecoder: AbiDecoder,
- tokenTransferProxyContractAddressFetcher: () => Promise<string>) {
+ tokenTransferProxyWrapper: TokenTransferProxyWrapper) {
super(web3Wrapper, abiDecoder);
this._tokenContractsByAddress = {};
- this._tokenTransferProxyContractAddressFetcher = tokenTransferProxyContractAddressFetcher;
+ this._tokenTransferProxyWrapper = tokenTransferProxyWrapper;
}
/**
* Retrieves an owner's ERC20 token balance.
@@ -135,7 +136,7 @@ export class TokenWrapper extends ContractWrapper {
assert.isETHAddressHex('ownerAddress', ownerAddress);
assert.isETHAddressHex('tokenAddress', tokenAddress);
- const proxyAddress = await this._getTokenTransferProxyAddressAsync();
+ const proxyAddress = this._tokenTransferProxyWrapper.getContractAddress();
const allowanceInBaseUnits = await this.getAllowanceAsync(tokenAddress, ownerAddress, proxyAddress, methodOpts);
return allowanceInBaseUnits;
}
@@ -154,7 +155,7 @@ export class TokenWrapper extends ContractWrapper {
assert.isETHAddressHex('tokenAddress', tokenAddress);
assert.isValidBaseUnitAmount('amountInBaseUnits', amountInBaseUnits);
- const proxyAddress = await this._getTokenTransferProxyAddressAsync();
+ const proxyAddress = this._tokenTransferProxyWrapper.getContractAddress();
const txHash = await this.setAllowanceAsync(tokenAddress, ownerAddress, proxyAddress, amountInBaseUnits);
return txHash;
}
@@ -308,8 +309,4 @@ export class TokenWrapper extends ContractWrapper {
this._tokenContractsByAddress[tokenAddress] = tokenContract;
return tokenContract;
}
- private async _getTokenTransferProxyAddressAsync(): Promise<string> {
- const tokenTransferProxyContractAddress = await this._tokenTransferProxyContractAddressFetcher();
- return tokenTransferProxyContractAddress;
- }
}