aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/send.utils.js
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-10-17 02:01:54 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-10-17 02:01:54 +0800
commit13820b6cc1801a420f39cdfecd7ccb5309dc597b (patch)
treec79832d7077ab03e0afe0c322cb32b204865d8b5 /ui/app/components/send/send.utils.js
parenteeecee01540fbad50c4c463a3b1a54142a63f168 (diff)
parent07ab613d4c647e3fe554bc06eab8cfb833315a88 (diff)
downloadtangerine-wallet-browser-13820b6cc1801a420f39cdfecd7ccb5309dc597b.tar
tangerine-wallet-browser-13820b6cc1801a420f39cdfecd7ccb5309dc597b.tar.gz
tangerine-wallet-browser-13820b6cc1801a420f39cdfecd7ccb5309dc597b.tar.bz2
tangerine-wallet-browser-13820b6cc1801a420f39cdfecd7ccb5309dc597b.tar.lz
tangerine-wallet-browser-13820b6cc1801a420f39cdfecd7ccb5309dc597b.tar.xz
tangerine-wallet-browser-13820b6cc1801a420f39cdfecd7ccb5309dc597b.tar.zst
tangerine-wallet-browser-13820b6cc1801a420f39cdfecd7ccb5309dc597b.zip
fix conflicts
Diffstat (limited to 'ui/app/components/send/send.utils.js')
-rw-r--r--ui/app/components/send/send.utils.js32
1 files changed, 24 insertions, 8 deletions
diff --git a/ui/app/components/send/send.utils.js b/ui/app/components/send/send.utils.js
index aa255c3d4..a18a9e4b3 100644
--- a/ui/app/components/send/send.utils.js
+++ b/ui/app/components/send/send.utils.js
@@ -200,16 +200,20 @@ function doesAmountErrorRequireUpdate ({
return amountErrorRequiresUpdate
}
-async function estimateGas ({ selectedAddress, selectedToken, blockGasLimit, to, value, gasPrice, estimateGasMethod }) {
+async function estimateGas ({
+ selectedAddress,
+ selectedToken,
+ blockGasLimit,
+ to,
+ value,
+ data,
+ gasPrice,
+ estimateGasMethod,
+}) {
const paramsForGasEstimate = { from: selectedAddress, value, gasPrice }
- if (selectedToken) {
- paramsForGasEstimate.value = '0x0'
- paramsForGasEstimate.data = generateTokenTransferData({ toAddress: to, amount: value, selectedToken })
- }
-
// if recipient has no code, gas is 21k max:
- if (!selectedToken) {
+ if (!selectedToken && !data) {
const code = Boolean(to) && await global.eth.getCode(to)
if (!code || code === '0x') {
return SIMPLE_GAS_COST
@@ -218,7 +222,19 @@ async function estimateGas ({ selectedAddress, selectedToken, blockGasLimit, to,
return BASE_TOKEN_GAS_COST
}
- paramsForGasEstimate.to = selectedToken ? selectedToken.address : to
+ if (selectedToken) {
+ paramsForGasEstimate.value = '0x0'
+ paramsForGasEstimate.data = generateTokenTransferData({ toAddress: to, amount: value, selectedToken })
+ paramsForGasEstimate.to = selectedToken.address
+ } else {
+ if (data) {
+ paramsForGasEstimate.data = data
+ }
+
+ if (to) {
+ paramsForGasEstimate.to = to
+ }
+ }
// if not, fall back to block gasLimit
paramsForGasEstimate.gas = ethUtil.addHexPrefix(multiplyCurrencies(blockGasLimit, 0.95, {