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 // Add SendModal here as it is used by the Wallet as well as the Browser
Loader { Loader {
id: sendModal id: sendModal
active: false
function open() { function open() {
this.active = true this.active = true

View File

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