diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-05 19:43:46 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-05 19:43:46 +0800 |
commit | 9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2 (patch) | |
tree | 1bcb6a3c80c15ea7bfe6755a97ac9fb8760da953 /src/contract_wrappers/token_wrapper.ts | |
parent | e05dfab1fca9eb108848c98da9dbf671a59d17f3 (diff) | |
download | dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.gz dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.bz2 dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.lz dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.xz dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.zst dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.zip |
Rename x.call -> x.callAsync x() -> x.sendTransactionAsync() x.estimateGas() -> x.estimateGasAsync()
Diffstat (limited to 'src/contract_wrappers/token_wrapper.ts')
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 944f0fb42..db1ce22b2 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -47,7 +47,7 @@ export class TokenWrapper extends ContractWrapper { assert.isETHAddressHex('tokenAddress', tokenAddress); const tokenContract = await this._getTokenContractAsync(tokenAddress); - let balance = await tokenContract.balanceOf.call(ownerAddress); + let balance = await tokenContract.balanceOf.callAsync(ownerAddress); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber balance = new BigNumber(balance); return balance; @@ -75,7 +75,7 @@ export class TokenWrapper extends ContractWrapper { // TODO: Debug issue in testrpc and submit a PR, then remove this hack const networkIdIfExists = await this._web3Wrapper.getNetworkIdIfExistsAsync(); const gas = networkIdIfExists === constants.TESTRPC_NETWORK_ID ? ALLOWANCE_TO_ZERO_GAS_AMOUNT : undefined; - const txHash = await tokenContract.approve(spenderAddress, amountInBaseUnits, { + const txHash = await tokenContract.approve.sendTransactionAsync(spenderAddress, amountInBaseUnits, { from: ownerAddress, gas, }); @@ -112,7 +112,7 @@ export class TokenWrapper extends ContractWrapper { assert.isETHAddressHex('tokenAddress', tokenAddress); const tokenContract = await this._getTokenContractAsync(tokenAddress); - let allowanceInBaseUnits = await tokenContract.allowance.call(ownerAddress, spenderAddress); + let allowanceInBaseUnits = await tokenContract.allowance.callAsync(ownerAddress, spenderAddress); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber allowanceInBaseUnits = new BigNumber(allowanceInBaseUnits); return allowanceInBaseUnits; @@ -187,7 +187,7 @@ export class TokenWrapper extends ContractWrapper { throw new Error(ZeroExError.InsufficientBalanceForTransfer); } - const txHash = await tokenContract.transfer(toAddress, amountInBaseUnits, { + const txHash = await tokenContract.transfer.sendTransactionAsync(toAddress, amountInBaseUnits, { from: fromAddress, }); return txHash; @@ -226,9 +226,12 @@ export class TokenWrapper extends ContractWrapper { throw new Error(ZeroExError.InsufficientBalanceForTransfer); } - const txHash = await tokenContract.transferFrom(fromAddress, toAddress, amountInBaseUnits, { - from: senderAddress, - }); + const txHash = await tokenContract.transferFrom.sendTransactionAsync( + fromAddress, toAddress, amountInBaseUnits, + { + from: senderAddress, + }, + ); return txHash; } /** |