fix: cant fetch fees when releasing ens name, token is not set, as well as value
There are a few things improved in this commit: - the account the username was bought with is selected for releasing - if the account was removed in meantime, we warn user displaying a popup message - ETH token is selected - 0 value is set Fixes #16611
This commit is contained in:
parent
ca1182e3f9
commit
54d0d62b37
|
@ -21,16 +21,16 @@ Item {
|
||||||
property EnsUsernamesStore ensUsernamesStore
|
property EnsUsernamesStore ensUsernamesStore
|
||||||
property string username: ""
|
property string username: ""
|
||||||
property string chainId: ""
|
property string chainId: ""
|
||||||
property string walletAddress: "-"
|
|
||||||
property string key: "-"
|
|
||||||
|
|
||||||
signal backBtnClicked()
|
signal backBtnClicked()
|
||||||
signal releaseUsernameRequested()
|
signal releaseUsernameRequested(string senderAddress)
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
|
||||||
property double expirationTimestamp: 0
|
property double expirationTimestamp: 0
|
||||||
|
property string walletAddress: "-"
|
||||||
|
property string key: "-"
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
@ -65,10 +65,14 @@ Item {
|
||||||
function onDetailsObtained(chainId: int, ensName: string, address: string, pubkey: string, isStatus: bool, expirationTime: int) {
|
function onDetailsObtained(chainId: int, ensName: string, address: string, pubkey: string, isStatus: bool, expirationTime: int) {
|
||||||
if(username != (isStatus ? ensName + ".stateofus.eth" : ensName))
|
if(username != (isStatus ? ensName + ".stateofus.eth" : ensName))
|
||||||
return;
|
return;
|
||||||
|
d.walletAddress = address
|
||||||
walletAddressLbl.subTitle = address;
|
walletAddressLbl.subTitle = address;
|
||||||
|
walletAddressLbl.visible = !!address;
|
||||||
|
|
||||||
|
d.key = pubkey
|
||||||
keyLbl.subTitle = pubkey.substring(0, 20) + "..." + pubkey.substring(pubkey.length - 20);
|
keyLbl.subTitle = pubkey.substring(0, 20) + "..." + pubkey.substring(pubkey.length - 20);
|
||||||
walletAddressLbl.visible = true;
|
keyLbl.visible = !!pubkey;
|
||||||
keyLbl.visible = true;
|
|
||||||
releaseBtn.visible = isStatus
|
releaseBtn.visible = isStatus
|
||||||
removeButton.visible = true
|
removeButton.visible = true
|
||||||
releaseBtn.enabled = expirationTime > 0
|
releaseBtn.enabled = expirationTime > 0
|
||||||
|
@ -140,7 +144,7 @@ Item {
|
||||||
enabled: false
|
enabled: false
|
||||||
text: qsTr("Release username")
|
text: qsTr("Release username")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.releaseUsernameRequested()
|
root.releaseUsernameRequested(d.walletAddress)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,6 +156,8 @@ Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 24
|
anchors.leftMargin: 24
|
||||||
text: {
|
text: {
|
||||||
|
if (d.expirationTimestamp === 0)
|
||||||
|
return ""
|
||||||
const formattedDate = LocaleUtils.formatDate(d.expirationTimestamp, Locale.ShortFormat)
|
const formattedDate = LocaleUtils.formatDate(d.expirationTimestamp, Locale.ShortFormat)
|
||||||
return qsTr("Username locked. You won't be able to release it until %1").arg(formattedDate)
|
return qsTr("Username locked. You won't be able to release it until %1").arg(formattedDate)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import QtQml.StateMachine 1.14 as DSM
|
||||||
import StatusQ 0.1
|
import StatusQ 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Utils 0.1
|
import StatusQ.Core.Utils 0.1
|
||||||
|
import StatusQ.Popups.Dialog 0.1
|
||||||
|
import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared 1.0
|
import shared 1.0
|
||||||
|
@ -377,8 +379,15 @@ Item {
|
||||||
onBackBtnClicked: back()
|
onBackBtnClicked: back()
|
||||||
|
|
||||||
onReleaseUsernameRequested: {
|
onReleaseUsernameRequested: {
|
||||||
|
const name = RootStore.getNameForWalletAddress(senderAddress)
|
||||||
|
if (name === "") {
|
||||||
|
Global.openPopup(noAccountPopupComponent)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ensView.sendModalPopup.modalHeaderText = qsTr("Release your username")
|
ensView.sendModalPopup.modalHeaderText = qsTr("Release your username")
|
||||||
ensView.sendModalPopup.interactive = false
|
ensView.sendModalPopup.interactive = false
|
||||||
|
ensView.sendModalPopup.preSelectedAccountAddress = senderAddress
|
||||||
ensView.sendModalPopup.preSelectedRecipient = ensView.ensUsernamesStore.getEnsRegisteredAddress()
|
ensView.sendModalPopup.preSelectedRecipient = ensView.ensUsernamesStore.getEnsRegisteredAddress()
|
||||||
ensView.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address
|
ensView.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address
|
||||||
ensView.sendModalPopup.preSelectedHoldingID = Constants.ethToken
|
ensView.sendModalPopup.preSelectedHoldingID = Constants.ethToken
|
||||||
|
@ -403,6 +412,22 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: noAccountPopupComponent
|
||||||
|
StatusDialog {
|
||||||
|
title: qsTr("Release username")
|
||||||
|
|
||||||
|
StatusBaseText {
|
||||||
|
anchors.fill: parent
|
||||||
|
font.pixelSize: Constants.keycard.general.fontSize2
|
||||||
|
color: Theme.palette.directColor1
|
||||||
|
text: qsTr("The account this username was bought with is no longer among active accounts.\nPlease add it and try again.")
|
||||||
|
}
|
||||||
|
|
||||||
|
standardButtons: Dialog.Ok
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: ensView
|
target: ensView
|
||||||
function onConnect(ensUsername: string) {
|
function onConnect(ensUsername: string) {
|
||||||
|
|
|
@ -229,10 +229,11 @@ StatusDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!popup.preSelectedHoldingID
|
if (!!popup.preSelectedHoldingID
|
||||||
&& popup.preSelectedHoldingType > Constants.TokenType.Native
|
&& popup.preSelectedHoldingType >= Constants.TokenType.Native
|
||||||
&& popup.preSelectedHoldingType < Constants.TokenType.Unknown) {
|
&& popup.preSelectedHoldingType < Constants.TokenType.Unknown) {
|
||||||
|
|
||||||
if (popup.preSelectedHoldingType === Constants.TokenType.ERC20) {
|
if (popup.preSelectedHoldingType === Constants.TokenType.Native
|
||||||
|
|| popup.preSelectedHoldingType === Constants.TokenType.ERC20) {
|
||||||
const entry = SQUtils.ModelUtils.getByKey(
|
const entry = SQUtils.ModelUtils.getByKey(
|
||||||
assetsAdaptor.outputAssetsModel, "tokensKey",
|
assetsAdaptor.outputAssetsModel, "tokensKey",
|
||||||
popup.preSelectedHoldingID)
|
popup.preSelectedHoldingID)
|
||||||
|
|
|
@ -129,7 +129,7 @@ Item {
|
||||||
root.reCalculateSuggestedRoute()
|
root.reCalculateSuggestedRoute()
|
||||||
}
|
}
|
||||||
|
|
||||||
showBetaTag: root.bestRoutes.count > 1
|
showBetaTag: !!root.bestRoutes && root.bestRoutes.count > 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue