mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-17 18:11:54 +00:00
fix(@desktop/wallet): Send Modal doesn't fill available height and Drop Shadow missing in Send Modal Footer
Also fixed a crash found while fixing the above bugs fixed #7133, #7134
This commit is contained in:
parent
8b02d8df01
commit
8c4ce7bc29
@ -130,7 +130,7 @@ QtObject:
|
|||||||
proc confirmTransactionStatus(self: Service, pendingTransactions: JsonNode) =
|
proc confirmTransactionStatus(self: Service, pendingTransactions: JsonNode) =
|
||||||
for trx in pendingTransactions.getElems():
|
for trx in pendingTransactions.getElems():
|
||||||
let transactionReceipt = self.getTransactionReceipt(trx["network_id"].getInt, trx["hash"].getStr)
|
let transactionReceipt = self.getTransactionReceipt(trx["network_id"].getInt, trx["hash"].getStr)
|
||||||
if transactionReceipt.kind != JNull:
|
if transactionReceipt != nil and transactionReceipt.kind != JNull:
|
||||||
self.deletePendingTransaction(trx["network_id"].getInt, trx["hash"].getStr)
|
self.deletePendingTransaction(trx["network_id"].getInt, trx["hash"].getStr)
|
||||||
let ev = TransactionMinedArgs(
|
let ev = TransactionMinedArgs(
|
||||||
data: trx["additionalData"].getStr,
|
data: trx["additionalData"].getStr,
|
||||||
|
@ -172,7 +172,7 @@ Item {
|
|||||||
tokenAssetSourceFn: function (symbol) {
|
tokenAssetSourceFn: function (symbol) {
|
||||||
return symbol ? Style.png("tokens/" + symbol) : defaultToken
|
return symbol ? Style.png("tokens/" + symbol) : defaultToken
|
||||||
}
|
}
|
||||||
searchTokenSymbolByAddress: function (address) {
|
searchTokenSymbolByAddressFn: function (address) {
|
||||||
if(popup.selectedAccount) {
|
if(popup.selectedAccount) {
|
||||||
return popup.selectedAccount.findTokenSymbolByAddress(address)
|
return popup.selectedAccount.findTokenSymbolByAddress(address)
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ Item {
|
|||||||
property var tokenAssetSourceFn: function (symbol) {
|
property var tokenAssetSourceFn: function (symbol) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
property var searchTokenSymbolByAddress: function (address) {
|
property var searchTokenSymbolByAddressFn: function (address) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ Item {
|
|||||||
filters: [
|
filters: [
|
||||||
ExpressionFilter {
|
ExpressionFilter {
|
||||||
expression: {
|
expression: {
|
||||||
var tokenSymbolByAddress = searchTokenSymbolByAddress(d.searchString)
|
var tokenSymbolByAddress = searchTokenSymbolByAddressFn(d.searchString)
|
||||||
return symbol.startsWith(d.searchString.toUpperCase()) || name.toUpperCase().startsWith(d.searchString.toUpperCase()) || (tokenSymbolByAddress!=="" && symbol.startsWith(tokenSymbolByAddress))
|
return symbol.startsWith(d.searchString.toUpperCase()) || name.toUpperCase().startsWith(d.searchString.toUpperCase()) || (tokenSymbolByAddress!=="" && symbol.startsWith(tokenSymbolByAddress))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ import "../views"
|
|||||||
StatusDialog {
|
StatusDialog {
|
||||||
id: popup
|
id: popup
|
||||||
|
|
||||||
property alias stack: stack
|
|
||||||
property alias addressText: recipientSelector.input.text
|
property alias addressText: recipientSelector.input.text
|
||||||
|
|
||||||
property var store
|
property var store
|
||||||
@ -39,29 +38,29 @@ StatusDialog {
|
|||||||
|
|
||||||
function sendTransaction() {
|
function sendTransaction() {
|
||||||
let recipientAddress = Utils.isValidAddress(popup.addressText) ? popup.addressText : d.resolvedENSAddress
|
let recipientAddress = Utils.isValidAddress(popup.addressText) ? popup.addressText : d.resolvedENSAddress
|
||||||
stack.currentGroup.isPending = true
|
|
||||||
let success = false
|
let success = false
|
||||||
|
d.isPending = true
|
||||||
success = popup.store.transfer(
|
success = popup.store.transfer(
|
||||||
popup.selectedAccount.address,
|
popup.selectedAccount.address,
|
||||||
recipientAddress,
|
recipientAddress,
|
||||||
assetSelector.selectedAsset.symbol,
|
assetSelector.selectedAsset.symbol,
|
||||||
amountToSendInput.text,
|
amountToSendInput.text,
|
||||||
gasSelector.selectedGasLimit,
|
gasSelector.selectedGasLimit,
|
||||||
gasSelector.suggestedFees.eip1559Enabled ? "" : gasSelector.selectedGasPrice,
|
gasSelector.suggestedFees.eip1559Enabled ? "" : gasSelector.selectedGasPrice,
|
||||||
gasSelector.selectedTipLimit,
|
gasSelector.selectedTipLimit,
|
||||||
gasSelector.selectedOverallLimit,
|
gasSelector.selectedOverallLimit,
|
||||||
transactionSigner.enteredPassword,
|
transactionSigner.enteredPassword,
|
||||||
networkSelector.selectedNetwork.chainId,
|
networkSelector.selectedNetwork.chainId,
|
||||||
stack.uuid,
|
d.uuid,
|
||||||
gasSelector.suggestedFees.eip1559Enabled,
|
gasSelector.suggestedFees.eip1559Enabled,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
property var recalculateRoutesAndFees: Backpressure.debounce(popup, 600, function(disabledChainIds) {
|
property var recalculateRoutesAndFees: Backpressure.debounce(popup, 600, function(disabledChainIds) {
|
||||||
if (disabledChainIds === undefined) disabledChainIds = []
|
if (disabledChainIds === undefined) disabledChainIds = []
|
||||||
networkSelector.suggestedRoutes = popup.store.suggestedRoutes(
|
networkSelector.suggestedRoutes = popup.store.suggestedRoutes(
|
||||||
popup.selectedAccount.address, amountToSendInput.text, assetSelector.selectedAsset.symbol, disabledChainIds
|
popup.selectedAccount.address, amountToSendInput.text, assetSelector.selectedAsset.symbol, disabledChainIds
|
||||||
)
|
)
|
||||||
if (networkSelector.suggestedRoutes.length) {
|
if (networkSelector.suggestedRoutes.length) {
|
||||||
networkSelector.selectedNetwork = networkSelector.suggestedRoutes[0]
|
networkSelector.selectedNetwork = networkSelector.suggestedRoutes[0]
|
||||||
gasSelector.suggestedFees = popup.store.suggestedFees(networkSelector.suggestedRoutes[0].chainId)
|
gasSelector.suggestedFees = popup.store.suggestedFees(networkSelector.suggestedRoutes[0].chainId)
|
||||||
@ -73,6 +72,11 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
enum StackGroup {
|
||||||
|
SendDetailsGroup = 0,
|
||||||
|
AuthenticationGroup = 1
|
||||||
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
readonly property string maxFiatBalance: Utils.stripTrailingZeros(parseFloat(assetSelector.selectedAsset.totalBalance).toFixed(4))
|
readonly property string maxFiatBalance: Utils.stripTrailingZeros(parseFloat(assetSelector.selectedAsset.totalBalance).toFixed(4))
|
||||||
@ -86,13 +90,16 @@ StatusDialog {
|
|||||||
})
|
})
|
||||||
property string resolvedENSAddress
|
property string resolvedENSAddress
|
||||||
onIsReadyChanged: {
|
onIsReadyChanged: {
|
||||||
if(!isReady && stack.isLastGroup)
|
if(!isReady && isLastGroup)
|
||||||
stack.back()
|
stack.currentIndex = SendModal.StackGroup.SendDetailsGroup
|
||||||
}
|
}
|
||||||
|
readonly property string uuid: Utils.uuid()
|
||||||
|
readonly property bool isLastGroup: stack.currentIndex === (stack.count - 1)
|
||||||
|
property bool isPending: false
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 556
|
width: 556
|
||||||
height: 595
|
topMargin: 64 + header.height
|
||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
background: StatusDialogBackground {
|
background: StatusDialogBackground {
|
||||||
@ -125,121 +132,148 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TransactionStackView {
|
StackLayout {
|
||||||
id: stack
|
id: stack
|
||||||
property alias currentGroup: stack.currentGroup
|
anchors.fill: parent
|
||||||
TransactionFormGroup {
|
currentIndex: 0
|
||||||
|
clip: true
|
||||||
|
ColumnLayout {
|
||||||
id: group1
|
id: group1
|
||||||
anchors.fill: parent
|
Layout.preferredWidth: parent.width
|
||||||
color: Theme.palette.baseColor3
|
spacing: Style.current.padding
|
||||||
|
|
||||||
ColumnLayout {
|
Rectangle {
|
||||||
id: assetAndAmmountSelector
|
Layout.preferredWidth: parent.width
|
||||||
anchors.top: parent.top
|
Layout.preferredHeight: assetAndAmmountSelector.height + Style.current.padding
|
||||||
anchors.right: parent.right
|
color: Theme.palette.baseColor3
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Style.current.xlPadding
|
|
||||||
anchors.rightMargin: Style.current.xlPadding
|
|
||||||
z: 1
|
|
||||||
|
|
||||||
RowLayout {
|
layer.enabled: scrollView.contentY > -8
|
||||||
spacing: 16
|
layer.effect: DropShadow {
|
||||||
StatusBaseText {
|
verticalOffset: 2
|
||||||
text: qsTr("Send")
|
radius: 16
|
||||||
font.pixelSize: 15
|
samples: 17
|
||||||
color: Theme.palette.directColor1
|
color: Theme.palette.dropShadow
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
}
|
|
||||||
StatusListItemTag {
|
|
||||||
title: assetSelector.selectedAsset.totalBalance > 0 ? qsTr("Max: ") + (assetSelector.selectedAsset ? d.maxFiatBalance : "0.00") : qsTr("No balances active")
|
|
||||||
closeButtonVisible: false
|
|
||||||
titleText.font.pixelSize: 12
|
|
||||||
Layout.preferredHeight: 22
|
|
||||||
Layout.preferredWidth: childrenRect.width
|
|
||||||
color: d.errorMode ? Theme.palette.dangerColor2 : Theme.palette.primaryColor3
|
|
||||||
titleText.color: d.errorMode ? Theme.palette.dangerColor1 : Theme.palette.primaryColor1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: childrenRect.height
|
|
||||||
AmountInputWithCursor {
|
|
||||||
id: amountToSendInput
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: -Style.current.padding
|
|
||||||
width: parent.width - assetSelector.width
|
|
||||||
placeholderText: "0.00" + " " + assetSelector.selectedAsset.symbol
|
|
||||||
errorMessageCmp.anchors.rightMargin: -100
|
|
||||||
input.edit.color: d.errorMode ? Theme.palette.dangerColor1 : Theme.palette.directColor1
|
|
||||||
validators: [
|
|
||||||
StatusFloatValidator{
|
|
||||||
id: floatValidator
|
|
||||||
bottom: 0
|
|
||||||
top: d.maxFiatBalance
|
|
||||||
errorMessage: qsTr("Please enter a valid amount")
|
|
||||||
}
|
|
||||||
]
|
|
||||||
Keys.onReleased: {
|
|
||||||
let amount = amountToSendInput.text.trim()
|
|
||||||
|
|
||||||
if (!Utils.containsOnlyDigits(amount) || isNaN(amount)) {
|
|
||||||
return
|
Column {
|
||||||
}
|
id: assetAndAmmountSelector
|
||||||
if (amount === "") {
|
anchors.left: parent.left
|
||||||
txtFiatBalance.text = "0.00"
|
anchors.right: parent.right
|
||||||
} else {
|
anchors.leftMargin: Style.current.xlPadding
|
||||||
txtFiatBalance.text = popup.store.getFiatValue(amount, assetSelector.selectedAsset.symbol, popup.store.currentCurrency)
|
anchors.rightMargin: Style.current.xlPadding
|
||||||
}
|
z: 1
|
||||||
gasSelector.estimateGas()
|
|
||||||
popup.recalculateRoutesAndFees()
|
Row {
|
||||||
|
spacing: 16
|
||||||
|
StatusBaseText {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: qsTr("Send")
|
||||||
|
font.pixelSize: 15
|
||||||
|
color: Theme.palette.directColor1
|
||||||
|
}
|
||||||
|
StatusListItemTag {
|
||||||
|
height: 22
|
||||||
|
width: childrenRect.width
|
||||||
|
title: assetSelector.selectedAsset.totalBalance > 0 ? qsTr("Max: %1").arg(assetSelector.selectedAsset ? d.maxFiatBalance : "0.00") : qsTr("No balances active")
|
||||||
|
closeButtonVisible: false
|
||||||
|
titleText.font.pixelSize: 12
|
||||||
|
color: d.errorMode ? Theme.palette.dangerColor2 : Theme.palette.primaryColor3
|
||||||
|
titleText.color: d.errorMode ? Theme.palette.dangerColor1 : Theme.palette.primaryColor1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatusAssetSelector {
|
Item {
|
||||||
id: assetSelector
|
width: parent.width
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
height: amountToSendInput.height
|
||||||
anchors.right: parent.right
|
AmountInputWithCursor {
|
||||||
assets: popup.selectedAccount.assets
|
id: amountToSendInput
|
||||||
defaultToken: Style.png("tokens/DEFAULT-TOKEN@3x")
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
getCurrencyBalanceString: function (currencyBalance) {
|
anchors.left: parent.left
|
||||||
return Utils.toLocaleString(currencyBalance.toFixed(2), popup.store.locale, {"currency": true}) + " " + popup.store.currentCurrency.toUpperCase()
|
anchors.leftMargin: -Style.current.padding
|
||||||
}
|
width: parent.width - assetSelector.width
|
||||||
tokenAssetSourceFn: function (symbol) {
|
placeholderText: "0.00 %1".arg(assetSelector.selectedAsset.symbol)
|
||||||
return symbol ? Style.png("tokens/" + symbol) : defaultToken
|
input.edit.color: d.errorMode ? Theme.palette.dangerColor1 : Theme.palette.directColor1
|
||||||
}
|
validators: [
|
||||||
searchTokenSymbolByAddress: function (address) {
|
StatusFloatValidator{
|
||||||
if(popup.selectedAccount) {
|
id: floatValidator
|
||||||
return popup.selectedAccount.findTokenSymbolByAddress(address)
|
bottom: 0
|
||||||
|
top: d.maxFiatBalance
|
||||||
|
errorMessage: ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Keys.onReleased: {
|
||||||
|
let amount = amountToSendInput.text.trim()
|
||||||
|
|
||||||
|
if (!Utils.containsOnlyDigits(amount) || isNaN(amount)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (amount === "") {
|
||||||
|
txtFiatBalance.text = "0.00"
|
||||||
|
} else {
|
||||||
|
txtFiatBalance.text = popup.store.getFiatValue(amount, assetSelector.selectedAsset.symbol, popup.store.currentCurrency)
|
||||||
|
}
|
||||||
|
gasSelector.estimateGas()
|
||||||
|
popup.recalculateRoutesAndFees()
|
||||||
}
|
}
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
onSelectedAssetChanged: {
|
StatusAssetSelector {
|
||||||
if (!assetSelector.selectedAsset) {
|
id: assetSelector
|
||||||
return
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
assets: popup.selectedAccount.assets
|
||||||
|
defaultToken: Style.png("tokens/DEFAULT-TOKEN@3x")
|
||||||
|
getCurrencyBalanceString: function (currencyBalance) {
|
||||||
|
return "%1 %2".arg(Utils.toLocaleString(currencyBalance.toFixed(2), popup.store.locale, {"currency": true})).arg(popup.store.currentCurrency.toUpperCase())
|
||||||
}
|
}
|
||||||
if (amountToSendInput.text === "" || isNaN(amountToSendInput.text)) {
|
tokenAssetSourceFn: function (symbol) {
|
||||||
return
|
return symbol ? Style.png("tokens/%1".arg(symbol)) : defaultToken
|
||||||
|
}
|
||||||
|
searchTokenSymbolByAddressFn: function (address) {
|
||||||
|
if(popup.selectedAccount) {
|
||||||
|
return popup.selectedAccount.findTokenSymbolByAddress(address)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
onSelectedAssetChanged: {
|
||||||
|
if (!assetSelector.selectedAsset) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (amountToSendInput.text === "" || isNaN(amountToSendInput.text)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
txtFiatBalance.text = popup.store.getFiatValue(amountToSendInput.text, assetSelector.selectedAsset.symbol, popup.store.currentCurrency)
|
||||||
|
gasSelector.estimateGas()
|
||||||
|
popup.recalculateRoutesAndFees()
|
||||||
}
|
}
|
||||||
txtFiatBalance.text = popup.store.getFiatValue(amountToSendInput.text, assetSelector.selectedAsset.symbol, popup.store.currentCurrency)
|
|
||||||
gasSelector.estimateGas()
|
|
||||||
popup.recalculateRoutesAndFees()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
StatusInput {
|
||||||
RowLayout {
|
|
||||||
Layout.alignment: Qt.AlignLeft
|
|
||||||
StyledTextField {
|
|
||||||
id: txtFiatBalance
|
id: txtFiatBalance
|
||||||
color: txtFiatBalance.activeFocus ? Style.current.textColor : Style.current.secondaryText
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: -12
|
||||||
|
leftPadding: 0
|
||||||
|
rightPadding: 0
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
font.pixelSize: 12
|
font.pixelSize: 13
|
||||||
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
input.placeholderFont.pixelSize: 13
|
||||||
|
input.leftPadding: 0
|
||||||
|
input.rightPadding: 0
|
||||||
|
input.topPadding: 0
|
||||||
|
input.bottomPadding: 0
|
||||||
|
input.edit.padding: 0
|
||||||
|
input.background.color: "transparent"
|
||||||
|
input.background.border.width: 0
|
||||||
|
input.edit.color: txtFiatBalance.input.edit.activeFocus ? Theme.palette.directColor1 : Theme.palette.baseColor1
|
||||||
text: "0.00"
|
text: "0.00"
|
||||||
selectByMouse: true
|
placeholderText: "0.00"
|
||||||
background: Rectangle {
|
input.implicitHeight: 15
|
||||||
color: Style.current.transparent
|
implicitWidth: txtFiatBalance.input.edit.contentWidth + 50
|
||||||
|
input.rightComponent: StatusBaseText {
|
||||||
|
id: currencyText
|
||||||
|
text: popup.store.currentCurrency.toUpperCase()
|
||||||
|
font.pixelSize: 13
|
||||||
|
color: Theme.palette.directColor5
|
||||||
}
|
}
|
||||||
padding: 0
|
|
||||||
Keys.onReleased: {
|
Keys.onReleased: {
|
||||||
let balance = txtFiatBalance.text.trim()
|
let balance = txtFiatBalance.text.trim()
|
||||||
if (balance === "" || isNaN(balance)) {
|
if (balance === "" || isNaN(balance)) {
|
||||||
@ -249,47 +283,20 @@ StatusDialog {
|
|||||||
// amountToSendInput.text = root.getCryptoValue(balance, popup.store.currentCurrency, assetSelector.selectedAsset.symbol)
|
// amountToSendInput.text = root.getCryptoValue(balance, popup.store.currentCurrency, assetSelector.selectedAsset.symbol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatusBaseText {
|
|
||||||
id: currencyText
|
|
||||||
text: popup.store.currentCurrency.toUpperCase()
|
|
||||||
font.pixelSize: 13
|
|
||||||
color: Theme.palette.directColor5
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: border
|
|
||||||
anchors.top: assetAndAmmountSelector.bottom
|
|
||||||
anchors.topMargin: Style.current.padding
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
height: 1
|
|
||||||
color: Theme.palette.directColor8
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
|
|
||||||
DropShadow {
|
|
||||||
anchors.fill: border
|
|
||||||
horizontalOffset: 0
|
|
||||||
verticalOffset: 2
|
|
||||||
radius: 8.0
|
|
||||||
samples: 17
|
|
||||||
color: Theme.palette.directColor1
|
|
||||||
source: border
|
|
||||||
}
|
|
||||||
|
|
||||||
StatusScrollView {
|
StatusScrollView {
|
||||||
id: scrollView
|
id: scrollView
|
||||||
height: stack.height - assetAndAmmountSelector.height - Style.current.bigPadding
|
Layout.fillHeight: true
|
||||||
width: parent.width
|
Layout.preferredWidth: parent.width
|
||||||
anchors.top: border.bottom
|
contentHeight: layout.height
|
||||||
anchors.left: parent.left
|
contentWidth: parent.width
|
||||||
z: 0
|
z: 0
|
||||||
objectName: "sendModalScroll"
|
objectName: "sendModalScroll"
|
||||||
|
|
||||||
ColumnLayout {
|
Column {
|
||||||
|
id: layout
|
||||||
width: scrollView.availableWidth
|
width: scrollView.availableWidth
|
||||||
spacing: Style.current.halfPadding
|
spacing: Style.current.halfPadding
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@ -298,9 +305,11 @@ StatusDialog {
|
|||||||
id: recipientSelector
|
id: recipientSelector
|
||||||
property bool isPending: false
|
property bool isPending: false
|
||||||
|
|
||||||
Layout.fillWidth: true
|
width: parent.width
|
||||||
Layout.leftMargin: Style.current.bigPadding
|
anchors.left: parent.left
|
||||||
Layout.rightMargin: Style.current.bigPadding
|
anchors.right: parent.right
|
||||||
|
anchors.leftMargin: Style.current.bigPadding
|
||||||
|
anchors.rightMargin: Style.current.bigPadding
|
||||||
|
|
||||||
label: qsTr("To")
|
label: qsTr("To")
|
||||||
placeholderText: qsTr("Enter an ENS name or address")
|
placeholderText: qsTr("Enter an ENS name or address")
|
||||||
@ -351,18 +360,25 @@ StatusDialog {
|
|||||||
|
|
||||||
TabAddressSelectorView {
|
TabAddressSelectorView {
|
||||||
id: addressSelector
|
id: addressSelector
|
||||||
|
width: parent.width
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.leftMargin: Style.current.bigPadding
|
||||||
|
anchors.rightMargin: Style.current.bigPadding
|
||||||
store: popup.store
|
store: popup.store
|
||||||
onContactSelected: {
|
onContactSelected: {
|
||||||
recipientSelector.input.text = address
|
recipientSelector.input.text = address
|
||||||
}
|
}
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.leftMargin: Style.current.bigPadding
|
|
||||||
Layout.rightMargin: Style.current.bigPadding
|
|
||||||
visible: !d.recipientReady
|
visible: !d.recipientReady
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkSelector {
|
NetworkSelector {
|
||||||
id: networkSelector
|
id: networkSelector
|
||||||
|
width: parent.width
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.leftMargin: Style.current.bigPadding
|
||||||
|
anchors.rightMargin: Style.current.bigPadding
|
||||||
store: popup.store
|
store: popup.store
|
||||||
selectedAccount: popup.selectedAccount
|
selectedAccount: popup.selectedAccount
|
||||||
amountToSend: isNaN(parseFloat(amountToSendInput.text)) ? 0 : parseFloat(amountToSendInput.text)
|
amountToSend: isNaN(parseFloat(amountToSendInput.text)) ? 0 : parseFloat(amountToSendInput.text)
|
||||||
@ -374,9 +390,6 @@ StatusDialog {
|
|||||||
gasSelector.updateGasEthValue()
|
gasSelector.updateGasEthValue()
|
||||||
}
|
}
|
||||||
onReCalculateSuggestedRoute: popup.recalculateRoutesAndFees(disabledChainIds)
|
onReCalculateSuggestedRoute: popup.recalculateRoutesAndFees(disabledChainIds)
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.leftMargin: Style.current.bigPadding
|
|
||||||
Layout.rightMargin: Style.current.bigPadding
|
|
||||||
visible: d.recipientReady
|
visible: d.recipientReady
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,10 +397,12 @@ StatusDialog {
|
|||||||
id: fees
|
id: fees
|
||||||
radius: 13
|
radius: 13
|
||||||
color: Theme.palette.indirectColor1
|
color: Theme.palette.indirectColor1
|
||||||
Layout.preferredHeight: text.height + gasSelector.height + gasValidator.height + Style.current.xlPadding
|
height: text.height + gasSelector.height + gasValidator.height + Style.current.xlPadding
|
||||||
Layout.fillWidth: true
|
width: parent.width
|
||||||
Layout.leftMargin: Style.current.bigPadding
|
anchors.left: parent.left
|
||||||
Layout.rightMargin: Style.current.bigPadding
|
anchors.right: parent.right
|
||||||
|
anchors.leftMargin: Style.current.bigPadding
|
||||||
|
anchors.rightMargin: Style.current.bigPadding
|
||||||
visible: d.recipientReady
|
visible: d.recipientReady
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
@ -403,12 +418,12 @@ StatusDialog {
|
|||||||
radius: 8
|
radius: 8
|
||||||
asset.name: "fees"
|
asset.name: "fees"
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
Column {
|
||||||
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
||||||
Layout.preferredWidth: fees.width - feesIcon.width - Style.current.xlPadding
|
Layout.preferredWidth: fees.width - feesIcon.width - Style.current.xlPadding
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
id: text
|
id: text
|
||||||
Layout.maximumWidth: 410
|
width: 410
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.palette.directColor1
|
color: Theme.palette.directColor1
|
||||||
@ -417,7 +432,7 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
GasSelector {
|
GasSelector {
|
||||||
id: gasSelector
|
id: gasSelector
|
||||||
Layout.fillWidth: true
|
width: parent.width
|
||||||
getGasEthValue: popup.store.getGasEthValue
|
getGasEthValue: popup.store.getGasEthValue
|
||||||
getFiatValue: popup.store.getFiatValue
|
getFiatValue: popup.store.getFiatValue
|
||||||
getEstimatedTime: popup.store.getEstimatedTime
|
getEstimatedTime: popup.store.getEstimatedTime
|
||||||
@ -437,12 +452,12 @@ StatusDialog {
|
|||||||
var recipientAddress = popup.launchedFromChat ? popup.preSelectedRecipient.address : popup.addressText
|
var recipientAddress = popup.launchedFromChat ? popup.preSelectedRecipient.address : popup.addressText
|
||||||
|
|
||||||
let gasEstimate = JSON.parse(popup.store.estimateGas(
|
let gasEstimate = JSON.parse(popup.store.estimateGas(
|
||||||
popup.selectedAccount.address,
|
popup.selectedAccount.address,
|
||||||
recipientAddress,
|
recipientAddress,
|
||||||
assetSelector.selectedAsset.symbol,
|
assetSelector.selectedAsset.symbol,
|
||||||
amountToSendInput.text,
|
amountToSendInput.text,
|
||||||
chainID,
|
chainID,
|
||||||
""))
|
""))
|
||||||
|
|
||||||
if (!gasEstimate.success) {
|
if (!gasEstimate.success) {
|
||||||
console.warn("error estimating gas: ", gasEstimate.error.message)
|
console.warn("error estimating gas: ", gasEstimate.error.message)
|
||||||
@ -455,10 +470,10 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
GasValidator {
|
GasValidator {
|
||||||
id: gasValidator
|
id: gasValidator
|
||||||
Layout.fillWidth: true
|
width: parent.width
|
||||||
selectedAccount: popup.selectedAccount
|
selectedAccount: popup.selectedAccount
|
||||||
selectedAmount: amountToSendInput.text === "" ? 0.0 :
|
selectedAmount: amountToSendInput.text === "" ? 0.0 :
|
||||||
parseFloat(amountToSendInput.text)
|
parseFloat(amountToSendInput.text)
|
||||||
selectedAsset: assetSelector.selectedAsset
|
selectedAsset: assetSelector.selectedAsset
|
||||||
selectedGasEthValue: gasSelector.selectedGasEthValue
|
selectedGasEthValue: gasSelector.selectedGasEthValue
|
||||||
selectedNetwork: networkSelector.selectedNetwork ? networkSelector.selectedNetwork: null
|
selectedNetwork: networkSelector.selectedNetwork ? networkSelector.selectedNetwork: null
|
||||||
@ -469,15 +484,10 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TransactionFormGroup {
|
|
||||||
id: group4
|
|
||||||
|
|
||||||
color: Theme.palette.baseColor3
|
|
||||||
|
|
||||||
StackView.onActivated: {
|
|
||||||
transactionSigner.forceActiveFocus(Qt.MouseFocusReason)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Column{
|
||||||
|
id: group2
|
||||||
|
Layout.preferredWidth: parent.width
|
||||||
TransactionSigner {
|
TransactionSigner {
|
||||||
id: transactionSigner
|
id: transactionSigner
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@ -492,39 +502,34 @@ StatusDialog {
|
|||||||
footer: SendModalFooter {
|
footer: SendModalFooter {
|
||||||
maxFiatFees: gasSelector.maxFiatFees
|
maxFiatFees: gasSelector.maxFiatFees
|
||||||
estimatedTxTimeFlag: gasSelector.estimatedTxTimeFlag
|
estimatedTxTimeFlag: gasSelector.estimatedTxTimeFlag
|
||||||
currentGroupPending: stack.currentGroup.isPending
|
pending: d.isPending
|
||||||
currentGroupValid: stack.currentGroup.isValid
|
isLastGroup: d.isLastGroup
|
||||||
isLastGroup: stack.isLastGroup
|
|
||||||
visible: d.isReady && !isNaN(parseFloat(amountToSendInput.text)) && gasValidator.isValid
|
visible: d.isReady && !isNaN(parseFloat(amountToSendInput.text)) && gasValidator.isValid
|
||||||
onNextButtonClicked: {
|
onNextButtonClicked: {
|
||||||
const validity = stack.currentGroup.validate()
|
if (isLastGroup) {
|
||||||
if (validity.isValid && !validity.isPending) {
|
return popup.sendTransaction()
|
||||||
if (stack.isLastGroup) {
|
|
||||||
return popup.sendTransaction()
|
|
||||||
}
|
|
||||||
|
|
||||||
if(gasSelector.suggestedFees.eip1559Enabled && stack.currentGroup === group1 && gasSelector.advancedMode){
|
|
||||||
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
|
|
||||||
Global.openPopup(transactionSettingsConfirmationPopupComponent, {
|
|
||||||
currentBaseFee: gasSelector.suggestedFees.baseFee,
|
|
||||||
currentMinimumTip: gasSelector.perGasTipLimitFloor,
|
|
||||||
currentAverageTip: gasSelector.perGasTipLimitAverage,
|
|
||||||
tipLimit: gasSelector.selectedTipLimit,
|
|
||||||
suggestedTipLimit: gasSelector.perGasTipLimitFloor,
|
|
||||||
priceLimit: gasSelector.selectedOverallLimit,
|
|
||||||
suggestedPriceLimit: gasSelector.suggestedFees.baseFee + gasSelector.perGasTipLimitFloor,
|
|
||||||
showPriceLimitWarning: gasSelector.showPriceLimitWarning,
|
|
||||||
showTipLimitWarning: gasSelector.showTipLimitWarning,
|
|
||||||
onConfirm: function(){
|
|
||||||
stack.next();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stack.next()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(gasSelector.suggestedFees.eip1559Enabled && gasSelector.advancedMode){
|
||||||
|
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
|
||||||
|
Global.openPopup(transactionSettingsConfirmationPopupComponent, {
|
||||||
|
currentBaseFee: gasSelector.suggestedFees.baseFee,
|
||||||
|
currentMinimumTip: gasSelector.perGasTipLimitFloor,
|
||||||
|
currentAverageTip: gasSelector.perGasTipLimitAverage,
|
||||||
|
tipLimit: gasSelector.selectedTipLimit,
|
||||||
|
suggestedTipLimit: gasSelector.perGasTipLimitFloor,
|
||||||
|
priceLimit: gasSelector.selectedOverallLimit,
|
||||||
|
suggestedPriceLimit: gasSelector.suggestedFees.baseFee + gasSelector.perGasTipLimitFloor,
|
||||||
|
showPriceLimitWarning: gasSelector.showPriceLimitWarning,
|
||||||
|
showTipLimitWarning: gasSelector.showTipLimitWarning,
|
||||||
|
onConfirm: function(){
|
||||||
|
stack.currentIndex = SendModal.StackGroup.AuthenticationGroup
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stack.currentIndex = SendModal.StackGroup.AuthenticationGroup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,11 +541,10 @@ StatusDialog {
|
|||||||
Connections {
|
Connections {
|
||||||
target: popup.store.walletSectionTransactionsInst
|
target: popup.store.walletSectionTransactionsInst
|
||||||
onTransactionSent: {
|
onTransactionSent: {
|
||||||
|
d.isPending = false
|
||||||
try {
|
try {
|
||||||
let response = JSON.parse(txResult)
|
let response = JSON.parse(txResult)
|
||||||
if (response.uuid !== stack.uuid) return
|
if (response.uuid !== d.uuid) return
|
||||||
|
|
||||||
stack.currentGroup.isPending = false
|
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
if (Utils.isInvalidPasswordMessage(response.result)){
|
if (Utils.isInvalidPasswordMessage(response.result)){
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import QtQuick 2.13
|
import QtQuick 2.13
|
||||||
import QtQuick.Controls 2.13
|
import QtQuick.Controls 2.13
|
||||||
import QtQuick.Layouts 1.13
|
import QtQuick.Layouts 1.13
|
||||||
|
import QtGraphicalEffects 1.13
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
@ -14,8 +15,7 @@ Rectangle {
|
|||||||
|
|
||||||
property string maxFiatFees: ""
|
property string maxFiatFees: ""
|
||||||
property int estimatedTxTimeFlag: Constants.transactionEstimatedTime.unknown
|
property int estimatedTxTimeFlag: Constants.transactionEstimatedTime.unknown
|
||||||
property bool currentGroupPending: true
|
property bool pending: true
|
||||||
property bool currentGroupValid: false
|
|
||||||
property bool isLastGroup: false
|
property bool isLastGroup: false
|
||||||
|
|
||||||
signal nextButtonClicked()
|
signal nextButtonClicked()
|
||||||
@ -29,16 +29,12 @@ Rectangle {
|
|||||||
radius: 8
|
radius: 8
|
||||||
color: Theme.palette.baseColor3
|
color: Theme.palette.baseColor3
|
||||||
|
|
||||||
Rectangle {
|
layer.enabled: true
|
||||||
anchors.top: parent.top
|
layer.effect: DropShadow {
|
||||||
width: parent.width
|
verticalOffset: 2
|
||||||
height: parent.radius
|
radius: 16
|
||||||
color: parent.color
|
samples: 17
|
||||||
|
color: Theme.palette.dropShadow
|
||||||
StatusModalDivider {
|
|
||||||
anchors.top: parent.top
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
@ -95,8 +91,8 @@ Rectangle {
|
|||||||
size: StatusBaseButton.Size.Large
|
size: StatusBaseButton.Size.Large
|
||||||
normalColor: Theme.palette.primaryColor2
|
normalColor: Theme.palette.primaryColor2
|
||||||
disabledColor: Theme.palette.baseColor2
|
disabledColor: Theme.palette.baseColor2
|
||||||
enabled: currentGroupValid && !currentGroupPending
|
enabled: !footer.pending
|
||||||
loading: currentGroupPending
|
loading: footer.pending
|
||||||
onClicked: nextButtonClicked()
|
onClicked: nextButtonClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,7 +714,7 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function containsOnlyDigits(msg) {
|
function containsOnlyDigits(msg) {
|
||||||
var reg = new RegExp('^[0-9]$')
|
var reg = new RegExp('[+-]?([0-9]*[.])?[0-9]+')
|
||||||
return reg.test(msg)
|
return reg.test(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user