diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-06-27 04:23:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-27 04:23:02 +0800 |
commit | 73eb78d7934008647eb40d5c1bd16686ea15e229 (patch) | |
tree | 15f9138d7f271264baf10ed8c4b8ba25ff83775d /src/web3_wrapper.ts | |
parent | d5ed5865ca7ca5697795896d1853e313093d327a (diff) | |
parent | f15451ebfd956c159f376dcf9686f48eafcfe65c (diff) | |
download | dexon-sol-tools-73eb78d7934008647eb40d5c1bd16686ea15e229.tar dexon-sol-tools-73eb78d7934008647eb40d5c1bd16686ea15e229.tar.gz dexon-sol-tools-73eb78d7934008647eb40d5c1bd16686ea15e229.tar.bz2 dexon-sol-tools-73eb78d7934008647eb40d5c1bd16686ea15e229.tar.lz dexon-sol-tools-73eb78d7934008647eb40d5c1bd16686ea15e229.tar.xz dexon-sol-tools-73eb78d7934008647eb40d5c1bd16686ea15e229.tar.zst dexon-sol-tools-73eb78d7934008647eb40d5c1bd16686ea15e229.zip |
Merge pull request #81 from 0xProject/addWrappedETHSupport
Add Wrapped ETH Support
Diffstat (limited to 'src/web3_wrapper.ts')
-rw-r--r-- | src/web3_wrapper.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts index 6bdca499f..630f0bef3 100644 --- a/src/web3_wrapper.ts +++ b/src/web3_wrapper.ts @@ -34,10 +34,14 @@ export class Web3Wrapper { return undefined; } } - public async getBalanceInEthAsync(owner: string): Promise<BigNumber.BigNumber> { - const balanceInWei = await promisify(this.web3.eth.getBalance)(owner); - const balanceEth = this.web3.fromWei(balanceInWei, 'ether'); - return balanceEth; + public toWei(ethAmount: BigNumber.BigNumber): BigNumber.BigNumber { + const balanceWei = this.web3.toWei(ethAmount, 'ether'); + return balanceWei; + } + public async getBalanceInWeiAsync(owner: string): Promise<BigNumber.BigNumber> { + let balanceInWei = await promisify(this.web3.eth.getBalance)(owner); + balanceInWei = new BigNumber(balanceInWei); + return balanceInWei; } public async doesContractExistAtAddressAsync(address: string): Promise<boolean> { const code = await promisify(this.web3.eth.getCode)(address); |