fix(wallet): fix gas price being 0 and add back validation

Fixes #2668
This commit is contained in:
Jonathan Rainville 2021-06-22 13:17:37 -04:00 committed by Iuri Matias
parent 557c068983
commit f71870cb8f
2 changed files with 7 additions and 3 deletions

View File

@ -127,7 +127,12 @@ Item {
buttonGroup: gasGroup buttonGroup: gasGroup
checkedByDefault: true checkedByDefault: true
text: qsTr("Optimal") text: qsTr("Optimal")
price: (fastestGasPrice + slowestGasPrice) / 2 price: {
const price = (fastestGasPrice + slowestGasPrice) / 2
// Setting the gas price field here because the binding didn't work
inputGasPrice.text = price
return price
}
gasLimit: inputGasLimit ? inputGasLimit.text : "" gasLimit: inputGasLimit ? inputGasLimit.text : ""
getGasEthValue: root.getGasEthValue getGasEthValue: root.getGasEthValue
getFiatValue: root.getFiatValue getFiatValue: root.getFiatValue
@ -182,7 +187,6 @@ Item {
anchors.right: parent.right anchors.right: parent.right
width: 130 width: 130
customHeight: 56 customHeight: 56
text: optimalGasButton.price
placeholderText: "20" placeholderText: "20"
onTextChanged: { onTextChanged: {
if (root.validate()) { if (root.validate()) {

View File

@ -24,7 +24,7 @@ Column {
function validate() { function validate() {
let isValid = true let isValid = true
if (!(selectedAccount && selectedAccount.assets && selectedAsset && selectedGasEthValue >= 0)) { if (!(selectedAccount && selectedAccount.assets && selectedAsset && selectedGasEthValue > 0)) {
return root.isValid return root.isValid
} }
isValid = true isValid = true