fix: fix not enough ETH for gas validation error on open

This commit is contained in:
Jonathan Rainville 2021-05-25 10:58:53 -04:00 committed by Iuri Matias
parent cbdbb6eb8b
commit 4a407d9204
3 changed files with 6 additions and 6 deletions

View File

@ -287,6 +287,7 @@ RowLayout {
// Add SendModal here as it is used by the Wallet as well as the Browser
Loader {
id: sendModal
active: false
function open() {
this.active = true

View File

@ -32,10 +32,6 @@ Item {
property bool advancedMode: false
function defaultGasPrice() {
return ((50 * (root.fastestGasPrice - root.slowestGasPrice) / 100) + root.slowestGasPrice)
}
function updateGasEthValue() {
// causes error on application load without this null check
if (!inputGasPrice || !inputGasLimit) {
@ -48,6 +44,8 @@ Item {
selectedGasFiatValue = fiatValue
}
Component.onCompleted: updateGasEthValue()
function validate() {
// causes error on application load without a null check
if (!inputGasLimit || !inputGasPrice) {
@ -125,6 +123,7 @@ Item {
onChecked: inputGasPrice.text = price
}
GasSelectorButton {
id: optimalGasButton
buttonGroup: gasGroup
checkedByDefault: true
text: qsTr("Optimal")
@ -183,7 +182,7 @@ Item {
anchors.right: parent.right
width: 130
customHeight: 56
text: root.defaultGasPrice()
text: optimalGasButton.price
placeholderText: "20"
onTextChanged: {
if (root.validate()) {

View File

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