diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-05 16:07:16 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-05 16:07:16 +0800 |
commit | 2b547f94a44dfed029b5559b743344d5998fa3bc (patch) | |
tree | 3c5241ba9cadcfad6ee0290b497ed6780cc9fc8b /src/contract_wrappers/ether_token_wrapper.ts | |
parent | c9e490bdaec53e3a93b5da8daaaf0b1d87d9de76 (diff) | |
download | dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.gz dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.bz2 dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.lz dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.xz dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.zst dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.zip |
Change non-exhange contracts to also return txHash
Diffstat (limited to 'src/contract_wrappers/ether_token_wrapper.ts')
-rw-r--r-- | src/contract_wrappers/ether_token_wrapper.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/contract_wrappers/ether_token_wrapper.ts b/src/contract_wrappers/ether_token_wrapper.ts index a2486b15e..ba0cd05d8 100644 --- a/src/contract_wrappers/ether_token_wrapper.ts +++ b/src/contract_wrappers/ether_token_wrapper.ts @@ -23,8 +23,9 @@ export class EtherTokenWrapper extends ContractWrapper { * for ETH. * @param amountInWei Amount of ETH in Wei the caller wishes to deposit. * @param depositor The hex encoded user Ethereum address that would like to make the deposit. + * @return Transaction hash. */ - public async depositAsync(amountInWei: BigNumber.BigNumber, depositor: string): Promise<void> { + public async depositAsync(amountInWei: BigNumber.BigNumber, depositor: string): Promise<string> { assert.isBigNumber('amountInWei', amountInWei); await assert.isSenderAddressAsync('depositor', depositor, this._web3Wrapper); @@ -32,18 +33,20 @@ export class EtherTokenWrapper extends ContractWrapper { assert.assert(ethBalanceInWei.gte(amountInWei), ZeroExError.InsufficientEthBalanceForDeposit); const wethContract = await this._getEtherTokenContractAsync(); - await wethContract.deposit({ + const txHash = await wethContract.deposit({ from: depositor, value: amountInWei, }); + return txHash; } /** * Withdraw ETH to the withdrawer's address from the wrapped ETH smart contract in exchange for the * equivalent number of wrapped ETH tokens. * @param amountInWei Amount of ETH in Wei the caller wishes to withdraw. * @param withdrawer The hex encoded user Ethereum address that would like to make the withdrawl. + * @return Transaction hash. */ - public async withdrawAsync(amountInWei: BigNumber.BigNumber, withdrawer: string): Promise<void> { + public async withdrawAsync(amountInWei: BigNumber.BigNumber, withdrawer: string): Promise<string> { assert.isBigNumber('amountInWei', amountInWei); await assert.isSenderAddressAsync('withdrawer', withdrawer, this._web3Wrapper); @@ -52,9 +55,10 @@ export class EtherTokenWrapper extends ContractWrapper { assert.assert(WETHBalanceInBaseUnits.gte(amountInWei), ZeroExError.InsufficientWEthBalanceForWithdrawal); const wethContract = await this._getEtherTokenContractAsync(); - await wethContract.withdraw(amountInWei, { + const txHash = await wethContract.withdraw(amountInWei, { from: withdrawer, }); + return txHash; } /** * Retrieves the Wrapped Ether token contract address |