fix(wallet-send): fix send modal estimate gas and other hooks
This commit is contained in:
parent
82fb325dac
commit
f36bee6337
|
@ -56,6 +56,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
property string currentCurrency: walletSection.currentCurrency
|
property string currentCurrency: walletSection.currentCurrency
|
||||||
|
property string signingPhrase: walletSection.signingPhrase
|
||||||
function estimateGas(from_addr, to, assetAddress, value, data) {
|
function estimateGas(from_addr, to, assetAddress, value, data) {
|
||||||
return walletSectionTransactions.estimateGas(from_addr, to, assetAddress, value, data)
|
return walletSectionTransactions.estimateGas(from_addr, to, assetAddress, value, data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,8 +98,7 @@ ModalPopup {
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
// Not Refactored Yet
|
currency: root.store.currentCurrency
|
||||||
// currency: RootStore.defaultCurrency
|
|
||||||
width: stack.width
|
width: stack.width
|
||||||
//% "From account"
|
//% "From account"
|
||||||
label: qsTrId("from-account")
|
label: qsTrId("from-account")
|
||||||
|
@ -132,11 +131,8 @@ ModalPopup {
|
||||||
AssetAndAmountInput {
|
AssetAndAmountInput {
|
||||||
id: txtAmount
|
id: txtAmount
|
||||||
selectedAccount: selectFromAccount.selectedAccount
|
selectedAccount: selectFromAccount.selectedAccount
|
||||||
// Not Refactored Yet
|
currentCurrency: root.store.currentCurrency
|
||||||
// defaultCurrency: RootStore.defaultCurrency
|
getFiatValue: root.store.getFiatValue
|
||||||
// Not Refactored Yet
|
|
||||||
currentCurrency: RootStore.currentCurrency
|
|
||||||
// getFiatValue: RootStore.fiatValue
|
|
||||||
// getCryptoValue: RootStore.cryptoValue
|
// getCryptoValue: RootStore.cryptoValue
|
||||||
width: stack.width
|
width: stack.width
|
||||||
onSelectedAssetChanged: if (isValid) { gasSelector.estimateGas() }
|
onSelectedAssetChanged: if (isValid) { gasSelector.estimateGas() }
|
||||||
|
@ -146,21 +142,23 @@ ModalPopup {
|
||||||
id: gasSelector
|
id: gasSelector
|
||||||
anchors.top: txtAmount.bottom
|
anchors.top: txtAmount.bottom
|
||||||
anchors.topMargin: Style.current.padding
|
anchors.topMargin: Style.current.padding
|
||||||
// Not Refactored Yet
|
gasPrice: parseFloat(root.store.gasPrice)
|
||||||
// gasPrice: parseFloat(RootStore.gasPrice)
|
getGasEthValue: root.store.getGasEthValue
|
||||||
// getGasEthValue: RootStore.gasEthValue
|
getFiatValue: root.store.getFiatValue
|
||||||
// getFiatValue: RootStore.fiatValue
|
defaultCurrency: root.store.currentCurrency
|
||||||
// defaultCurrency: RootStore.defaultCurrency
|
|
||||||
|
|
||||||
width: stack.width
|
width: stack.width
|
||||||
property var estimateGas: Backpressure.debounce(gasSelector, 600, function() {
|
property var estimateGas: Backpressure.debounce(gasSelector, 600, function() {
|
||||||
// Not Refactored Yet
|
|
||||||
if (!(selectFromAccount.selectedAccount && selectFromAccount.selectedAccount.address &&
|
if (!(selectFromAccount.selectedAccount && selectFromAccount.selectedAccount.address &&
|
||||||
selectRecipient.selectedRecipient && selectRecipient.selectedRecipient.address &&
|
selectRecipient.selectedRecipient && selectRecipient.selectedRecipient.address &&
|
||||||
txtAmount.selectedAsset && txtAmount.selectedAsset.address &&
|
txtAmount.selectedAsset && txtAmount.selectedAsset.address &&
|
||||||
txtAmount.selectedAmount)) return
|
txtAmount.selectedAmount)) {
|
||||||
|
selectedGasLimit = 250000
|
||||||
|
defaultGasLimit = selectedGasLimit
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let gasEstimate = JSON.parse(walletModel.gasView.estimateGas(
|
let gasEstimate = JSON.parse(root.store.estimateGas(
|
||||||
selectFromAccount.selectedAccount.address,
|
selectFromAccount.selectedAccount.address,
|
||||||
selectRecipient.selectedRecipient.address,
|
selectRecipient.selectedRecipient.address,
|
||||||
txtAmount.selectedAsset.address,
|
txtAmount.selectedAsset.address,
|
||||||
|
@ -205,8 +203,7 @@ ModalPopup {
|
||||||
toAccount: selectRecipient.selectedRecipient
|
toAccount: selectRecipient.selectedRecipient
|
||||||
asset: txtAmount.selectedAsset
|
asset: txtAmount.selectedAsset
|
||||||
amount: { "value": txtAmount.selectedAmount, "fiatValue": txtAmount.selectedFiatAmount }
|
amount: { "value": txtAmount.selectedAmount, "fiatValue": txtAmount.selectedFiatAmount }
|
||||||
// Not Refactored Yet
|
currency: root.store.currentCurrency
|
||||||
// currency: walletModel.balanceView.defaultCurrency
|
|
||||||
}
|
}
|
||||||
SendToContractWarning {
|
SendToContractWarning {
|
||||||
id: sendToContractWarning
|
id: sendToContractWarning
|
||||||
|
@ -224,8 +221,7 @@ ModalPopup {
|
||||||
TransactionSigner {
|
TransactionSigner {
|
||||||
id: transactionSigner
|
id: transactionSigner
|
||||||
width: stack.width
|
width: stack.width
|
||||||
// Not Refactored Yet
|
signingPhrase: root.store.signingPhrase
|
||||||
// signingPhrase: RootStore.signingPhrase
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,6 +252,7 @@ ModalPopup {
|
||||||
|
|
||||||
StatusButton {
|
StatusButton {
|
||||||
id: btnNext
|
id: btnNext
|
||||||
|
anchors.right: parent.right
|
||||||
//% "Next"
|
//% "Next"
|
||||||
text: qsTrId("next")
|
text: qsTrId("next")
|
||||||
enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
|
enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
|
||||||
|
|
|
@ -176,6 +176,7 @@ StatusModal {
|
||||||
if (!gasEstimate.success) {
|
if (!gasEstimate.success) {
|
||||||
let message = qsTr("Error estimating gas: %1").arg(gasEstimate.error.message)
|
let message = qsTr("Error estimating gas: %1").arg(gasEstimate.error.message)
|
||||||
root.openGasEstimateErrorPopup(message);
|
root.openGasEstimateErrorPopup(message);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
selectedGasLimit = gasEstimate.result
|
selectedGasLimit = gasEstimate.result
|
||||||
defaultGasLimit = selectedGasLimit
|
defaultGasLimit = selectedGasLimit
|
||||||
|
@ -284,7 +285,6 @@ StatusModal {
|
||||||
rightButtons: [
|
rightButtons: [
|
||||||
StatusButton {
|
StatusButton {
|
||||||
id: btnNext
|
id: btnNext
|
||||||
anchors.right: parent.right
|
|
||||||
//% "Next"
|
//% "Next"
|
||||||
text: qsTrId("next")
|
text: qsTrId("next")
|
||||||
enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
|
enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
|
||||||
|
|
Loading…
Reference in New Issue