diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-19 17:23:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 17:23:07 +0800 |
commit | 79bd416c61d9ecabd8fc7903203b5a2cd5ee0936 (patch) | |
tree | 82cd863141547f1e14aeffc2075672dc6449484b /packages/website/ts | |
parent | 1af427e4a777f4e1ee1b689037e8c0c1431619f6 (diff) | |
parent | 7710989dee4b198bd817dca5277fffd77da7ddc4 (diff) | |
download | dexon-sol-tools-79bd416c61d9ecabd8fc7903203b5a2cd5ee0936.tar dexon-sol-tools-79bd416c61d9ecabd8fc7903203b5a2cd5ee0936.tar.gz dexon-sol-tools-79bd416c61d9ecabd8fc7903203b5a2cd5ee0936.tar.bz2 dexon-sol-tools-79bd416c61d9ecabd8fc7903203b5a2cd5ee0936.tar.lz dexon-sol-tools-79bd416c61d9ecabd8fc7903203b5a2cd5ee0936.tar.xz dexon-sol-tools-79bd416c61d9ecabd8fc7903203b5a2cd5ee0936.tar.zst dexon-sol-tools-79bd416c61d9ecabd8fc7903203b5a2cd5ee0936.zip |
Merge pull request #267 from 0xProject/refactor/passInEtherTokenAddress
Refactor EtherToken wrapper to accept address in method args
Diffstat (limited to 'packages/website/ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 8 | ||||
-rw-r--r-- | packages/website/ts/components/eth_weth_conversion_button.tsx | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 6877a301a..a42b19cff 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -388,18 +388,18 @@ export class Blockchain { const balance = await this.web3Wrapper.getBalanceInEthAsync(owner); return balance; } - public async convertEthToWrappedEthTokensAsync(amount: BigNumber): Promise<void> { + public async convertEthToWrappedEthTokensAsync(etherTokenAddress: string, amount: BigNumber): Promise<void> { utils.assert(!_.isUndefined(this.zeroEx), 'ZeroEx must be instantiated.'); utils.assert(this.doesUserAddressExist(), BlockchainCallErrs.USER_HAS_NO_ASSOCIATED_ADDRESSES); - const txHash = await this.zeroEx.etherToken.depositAsync(amount, this.userAddress); + const txHash = await this.zeroEx.etherToken.depositAsync(etherTokenAddress, amount, this.userAddress); await this.showEtherScanLinkAndAwaitTransactionMinedAsync(txHash); } - public async convertWrappedEthTokensToEthAsync(amount: BigNumber): Promise<void> { + public async convertWrappedEthTokensToEthAsync(etherTokenAddress: string, amount: BigNumber): Promise<void> { utils.assert(!_.isUndefined(this.zeroEx), 'ZeroEx must be instantiated.'); utils.assert(this.doesUserAddressExist(), BlockchainCallErrs.USER_HAS_NO_ASSOCIATED_ADDRESSES); - const txHash = await this.zeroEx.etherToken.withdrawAsync(amount, this.userAddress); + const txHash = await this.zeroEx.etherToken.withdrawAsync(etherTokenAddress, amount, this.userAddress); await this.showEtherScanLinkAndAwaitTransactionMinedAsync(txHash); } public async doesContractExistAtAddressAsync(address: string) { diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx index b017de27b..c8a279de9 100644 --- a/packages/website/ts/components/eth_weth_conversion_button.tsx +++ b/packages/website/ts/components/eth_weth_conversion_button.tsx @@ -88,12 +88,12 @@ export class EthWethConversionButton extends let balance = tokenState.balance; try { if (direction === Side.deposit) { - await this.props.blockchain.convertEthToWrappedEthTokensAsync(value); + await this.props.blockchain.convertEthToWrappedEthTokensAsync(token.address, value); const ethAmount = ZeroEx.toUnitAmount(value, constants.ETH_DECIMAL_PLACES); this.props.dispatcher.showFlashMessage(`Successfully wrapped ${ethAmount.toString()} ETH to WETH`); balance = balance.plus(value); } else { - await this.props.blockchain.convertWrappedEthTokensToEthAsync(value); + await this.props.blockchain.convertWrappedEthTokensToEthAsync(token.address, value); const tokenAmount = ZeroEx.toUnitAmount(value, token.decimals); this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount.toString()} WETH to ETH`); balance = balance.minus(value); |