aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-06-29 21:02:10 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-06-29 22:52:54 +0800
commit294d3bbdc1db983701472eafed25dc84a455c0f7 (patch)
treec9eb57e1f263f10c5089e512f65201298219a957 /packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts
parent6db614251e4d1ec7248fd87354bfde8e65d50374 (diff)
downloaddexon-sol-tools-294d3bbdc1db983701472eafed25dc84a455c0f7.tar
dexon-sol-tools-294d3bbdc1db983701472eafed25dc84a455c0f7.tar.gz
dexon-sol-tools-294d3bbdc1db983701472eafed25dc84a455c0f7.tar.bz2
dexon-sol-tools-294d3bbdc1db983701472eafed25dc84a455c0f7.tar.lz
dexon-sol-tools-294d3bbdc1db983701472eafed25dc84a455c0f7.tar.xz
dexon-sol-tools-294d3bbdc1db983701472eafed25dc84a455c0f7.tar.zst
dexon-sol-tools-294d3bbdc1db983701472eafed25dc84a455c0f7.zip
Use removeUndefinedProperties for txOpts
Diffstat (limited to 'packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts')
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts29
1 files changed, 18 insertions, 11 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts
index 15ed0b63c..f8e4a683c 100644
--- a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts
@@ -12,6 +12,8 @@ import { ContractWrapper } from './contract_wrapper';
import { ERC20TokenWrapper } from './erc20_token_wrapper';
import { WETH9Contract, WETH9EventArgs, WETH9Events } from './generated/weth9';
+const removeUndefinedProperties = _.pickBy;
+
/**
* This class includes all the functionality related to interacting with a wrapped Ether ERC20 token contract.
* The caller can convert ETH into the equivalent number of wrapped ETH ERC20 tokens and back.
@@ -52,12 +54,14 @@ export class EtherTokenWrapper extends ContractWrapper {
assert.assert(ethBalanceInWei.gte(amountInWei), ContractWrappersError.InsufficientEthBalanceForDeposit);
const wethContract = await this._getEtherTokenContractAsync(normalizedEtherTokenAddress);
- const txHash = await wethContract.deposit.sendTransactionAsync({
- from: normalizedDepositorAddress,
- value: amountInWei,
- gas: txOpts.gasLimit,
- gasPrice: txOpts.gasPrice,
- });
+ const txHash = await wethContract.deposit.sendTransactionAsync(
+ removeUndefinedProperties({
+ from: normalizedDepositorAddress,
+ value: amountInWei,
+ gas: txOpts.gasLimit,
+ gasPrice: txOpts.gasPrice,
+ }),
+ );
return txHash;
}
/**
@@ -91,11 +95,14 @@ export class EtherTokenWrapper extends ContractWrapper {
);
const wethContract = await this._getEtherTokenContractAsync(normalizedEtherTokenAddress);
- const txHash = await wethContract.withdraw.sendTransactionAsync(amountInWei, {
- from: normalizedWithdrawerAddress,
- gas: txOpts.gasLimit,
- gasPrice: txOpts.gasPrice,
- });
+ const txHash = await wethContract.withdraw.sendTransactionAsync(
+ amountInWei,
+ removeUndefinedProperties({
+ from: normalizedWithdrawerAddress,
+ gas: txOpts.gasLimit,
+ gasPrice: txOpts.gasPrice,
+ }),
+ );
return txHash;
}
/**