aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts')
-rw-r--r--packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
index 3cd2f0224..7a3f2bc52 100644
--- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
@@ -1,11 +1,13 @@
-import * as _ from 'lodash';
import BigNumber from 'bignumber.js';
+import * as _ from 'lodash';
+
+import {artifacts} from '../artifacts';
+import {EtherTokenContract, ZeroExError} from '../types';
+import {assert} from '../utils/assert';
import {Web3Wrapper} from '../web3_wrapper';
+
import {ContractWrapper} from './contract_wrapper';
import {TokenWrapper} from './token_wrapper';
-import {EtherTokenContract, ZeroExError} from '../types';
-import {assert} from '../utils/assert';
-import {artifacts} from '../artifacts';
/**
* This class includes all the functionality related to interacting with a wrapped Ether ERC20 token contract.
@@ -53,7 +55,7 @@ export class EtherTokenWrapper extends ContractWrapper {
assert.isValidBaseUnitAmount('amountInWei', amountInWei);
await assert.isSenderAddressAsync('withdrawer', withdrawer, this._web3Wrapper);
- const wethContractAddress = await this.getContractAddressAsync();
+ const wethContractAddress = this.getContractAddress();
const WETHBalanceInBaseUnits = await this._tokenWrapper.getBalanceAsync(wethContractAddress, withdrawer);
assert.assert(WETHBalanceInBaseUnits.gte(amountInWei), ZeroExError.InsufficientWEthBalanceForWithdrawal);
@@ -67,9 +69,11 @@ export class EtherTokenWrapper extends ContractWrapper {
* Retrieves the Wrapped Ether token contract address
* @return The Wrapped Ether token contract address
*/
- public async getContractAddressAsync(): Promise<string> {
- const wethContract = await this._getEtherTokenContractAsync();
- return wethContract.address;
+ public getContractAddress(): string {
+ const contractAddress = this._getContractAddress(
+ artifacts.EtherTokenArtifact, this._contractAddressIfExists,
+ );
+ return contractAddress;
}
private _invalidateContractInstance(): void {
delete this._etherTokenContractIfExists;
@@ -81,7 +85,7 @@ export class EtherTokenWrapper extends ContractWrapper {
const contractInstance = await this._instantiateContractIfExistsAsync<EtherTokenContract>(
artifacts.EtherTokenArtifact, this._contractAddressIfExists,
);
- this._etherTokenContractIfExists = contractInstance as EtherTokenContract;
+ this._etherTokenContractIfExists = contractInstance;
return this._etherTokenContractIfExists;
}
}