aboutsummaryrefslogtreecommitdiffstats
path: root/src/web3_wrapper.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-27 02:20:16 +0800
committerFabio Berger <me@fabioberger.com>2017-06-27 02:20:16 +0800
commit41098c6a35cc483b30ddc0566ca18c98b1548364 (patch)
tree60423f854104469db396e113f50cb69988fec560 /src/web3_wrapper.ts
parent0f413febd3cf2798a9be1149b1ef7ddd3550f7d0 (diff)
downloaddexon-sol-tools-41098c6a35cc483b30ddc0566ca18c98b1548364.tar
dexon-sol-tools-41098c6a35cc483b30ddc0566ca18c98b1548364.tar.gz
dexon-sol-tools-41098c6a35cc483b30ddc0566ca18c98b1548364.tar.bz2
dexon-sol-tools-41098c6a35cc483b30ddc0566ca18c98b1548364.tar.lz
dexon-sol-tools-41098c6a35cc483b30ddc0566ca18c98b1548364.tar.xz
dexon-sol-tools-41098c6a35cc483b30ddc0566ca18c98b1548364.tar.zst
dexon-sol-tools-41098c6a35cc483b30ddc0566ca18c98b1548364.zip
refactor getBalanceInEthAsync to getBalanceInWeiAsync and change the test assertions to check if the discrepancy between the existing ETH balance and expected balance is small enough to simply be the gas cost used by the transaction.
Diffstat (limited to 'src/web3_wrapper.ts')
-rw-r--r--src/web3_wrapper.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts
index 0a310aeee..630f0bef3 100644
--- a/src/web3_wrapper.ts
+++ b/src/web3_wrapper.ts
@@ -38,11 +38,10 @@ export class Web3Wrapper {
const balanceWei = this.web3.toWei(ethAmount, 'ether');
return balanceWei;
}
- public async getBalanceInEthAsync(owner: string): Promise<BigNumber.BigNumber> {
- const balanceInWei = await promisify(this.web3.eth.getBalance)(owner);
- let balanceEth = this.web3.fromWei(balanceInWei, 'ether');
- balanceEth = new BigNumber(balanceEth);
- return balanceEth;
+ 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);