From 191e5bcc0b90cb75dceab17652408260028a368a Mon Sep 17 00:00:00 2001 From: Goran Jovic Date: Thu, 21 Sep 2017 12:40:05 +0200 Subject: [PATCH] fix #1888 ether amount not updated in /send suggestion on json rpc error in release apk only --- resources/js/bots/wallet/bot.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/resources/js/bots/wallet/bot.js b/resources/js/bots/wallet/bot.js index 194dbfd1ed..07337fc5c7 100644 --- a/resources/js/bots/wallet/bot.js +++ b/resources/js/bots/wallet/bot.js @@ -38,6 +38,7 @@ status.defineSubscription( ) function amountParameterBox(params, context) { + if (!params["bot-db"]) { params["bot-db"] = {}; } @@ -68,12 +69,24 @@ function amountParameterBox(params, context) { var sliderValue = params["bot-db"]["sliderValue"] || 0; - status.setDefaultDb({ - transaction: txData, - calculatedFee: calculateFee(sliderValue, txData), - feeExplanation: getFeeExplanation(sliderValue), - sliderValue: sliderValue - }); + try { + + status.setDefaultDb({ + transaction: txData, + calculatedFee: calculateFee(sliderValue, txData), + feeExplanation: getFeeExplanation(sliderValue), + sliderValue: sliderValue + }); + + }catch (err){ + + status.setDefaultDb({ + transaction: txData, + calculatedFee: "0", + feeExplanation: "", + sliderValue: sliderValue + }); + } return { title: I18n.t('send_title'), @@ -245,6 +258,7 @@ function amountParameterBox(params, context) { )] ) }; + } var paramsSend = [ @@ -335,7 +349,7 @@ function validateSend(params, context) { ) }; } - + var fee = calculateFee( params["bot-db"]["sliderValue"], { @@ -373,7 +387,7 @@ function handleSend(params, context) { web3.eth.sendTransaction(data, function(error, hash) { if (error) { status.sendSignal("handler-result", { - status: "failed", + status: "failed", error: { markup: status.components.validationMessage( I18n.t('validation_tx_title'),