2020-08-03 20:46:37 +00:00
|
|
|
import QtQuick 2.14
|
2020-05-27 21:28:25 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
2020-08-03 20:46:37 +00:00
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQml.StateMachine 1.14 as DSM
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2024-10-03 13:14:27 +00:00
|
|
|
import StatusQ 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1
|
2024-10-29 09:55:46 +00:00
|
|
|
import StatusQ.Popups.Dialog 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2024-10-03 13:14:27 +00:00
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
2024-05-22 08:13:39 +00:00
|
|
|
import shared.stores 1.0 as SharedStores
|
2024-10-03 13:14:27 +00:00
|
|
|
import shared.popups.send 1.0
|
2021-10-06 09:16:39 +00:00
|
|
|
|
2024-02-05 16:44:49 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
import "../stores"
|
2020-05-27 21:28:25 +00:00
|
|
|
|
|
|
|
Item {
|
2021-12-09 13:28:02 +00:00
|
|
|
id: ensView
|
2020-05-27 21:28:25 +00:00
|
|
|
|
2022-01-17 08:56:44 +00:00
|
|
|
property EnsUsernamesStore ensUsernamesStore
|
2024-02-05 16:44:49 +00:00
|
|
|
property WalletAssetsStore walletAssetsStore
|
2022-01-17 08:56:44 +00:00
|
|
|
|
2024-10-03 13:14:27 +00:00
|
|
|
required property var sendModalPopup
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property ContactsStore contactsStore
|
|
|
|
property SharedStores.NetworkConnectionStore networkConnectionStore
|
2022-01-04 12:06:05 +00:00
|
|
|
|
2021-12-09 13:28:02 +00:00
|
|
|
property int profileContentWidth
|
2020-08-03 20:46:37 +00:00
|
|
|
property bool showSearchScreen: false
|
2020-08-04 22:22:51 +00:00
|
|
|
property string addedUsername: ""
|
2020-08-06 19:45:57 +00:00
|
|
|
property string selectedUsername: ""
|
2023-01-11 16:10:13 +00:00
|
|
|
property string selectedChainId: ""
|
2020-08-03 20:46:37 +00:00
|
|
|
|
2020-08-04 22:22:51 +00:00
|
|
|
signal next(output: string)
|
2020-08-06 19:45:57 +00:00
|
|
|
signal back()
|
2020-08-27 16:06:53 +00:00
|
|
|
signal done(ensUsername: string)
|
2020-08-04 22:22:51 +00:00
|
|
|
signal connect(ensUsername: string)
|
2020-08-27 20:18:14 +00:00
|
|
|
signal changePubKey(ensUsername: string)
|
2020-08-04 22:22:51 +00:00
|
|
|
signal goToWelcome();
|
|
|
|
signal goToList();
|
|
|
|
|
2021-12-09 13:28:02 +00:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
clip: true
|
|
|
|
|
2024-10-03 13:14:27 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property string registerENS: "RegisterENS"
|
|
|
|
readonly property string setPubKey: "SetPubKey"
|
|
|
|
readonly property string releaseENS: "ReleaseENS"
|
|
|
|
|
|
|
|
readonly property var sntToken: ModelUtils.getByKey(ensView.walletAssetsStore.groupedAccountAssetsModel, "tokensKey", ensView.ensUsernamesStore.getStatusTokenKey())
|
|
|
|
readonly property SumAggregator aggregator: SumAggregator {
|
|
|
|
model: !!d.sntToken && !!d.sntToken.balances ? d.sntToken.balances: nil
|
|
|
|
roleName: "balance"
|
|
|
|
}
|
|
|
|
property real sntBalance: !!sntToken && !!sntToken.decimals ? aggregator.value/(10 ** sntToken.decimals): 0
|
|
|
|
}
|
|
|
|
|
2020-08-03 20:46:37 +00:00
|
|
|
DSM.StateMachine {
|
|
|
|
id: stateMachine
|
2023-05-01 20:32:36 +00:00
|
|
|
initialState: ensView.ensUsernamesStore.ensUsernamesModel.count > 0 ? listState : welcomeState
|
2020-08-03 20:46:37 +00:00
|
|
|
running: true
|
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: welcomeState
|
|
|
|
onEntered: loader.sourceComponent = welcome
|
2023-05-01 20:32:36 +00:00
|
|
|
|
2020-08-03 20:46:37 +00:00
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: searchState
|
|
|
|
signal: next
|
|
|
|
}
|
2020-08-04 22:22:51 +00:00
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: goToList
|
|
|
|
}
|
2020-08-03 20:46:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: searchState
|
|
|
|
onEntered: loader.sourceComponent = search
|
2020-08-04 22:22:51 +00:00
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: tAndCState
|
|
|
|
signal: next
|
|
|
|
guard: output === "available"
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: addedState
|
|
|
|
signal: connect
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: goToList
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: welcomeState
|
|
|
|
signal: goToWelcome
|
|
|
|
}
|
2020-08-27 20:18:14 +00:00
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: ensConnectedState
|
|
|
|
signal: done
|
|
|
|
}
|
2020-08-04 22:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: addedState
|
|
|
|
onEntered: {
|
|
|
|
loader.sourceComponent = added;
|
|
|
|
loader.item.ensUsername = addedUsername;
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: next
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: goToList
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: welcomeState
|
|
|
|
signal: goToWelcome
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: listState
|
|
|
|
onEntered: {
|
|
|
|
loader.sourceComponent = list;
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: searchState
|
|
|
|
signal: next
|
2020-08-06 19:45:57 +00:00
|
|
|
guard: output === "search"
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: detailsState
|
|
|
|
signal: next
|
|
|
|
guard: output === "details"
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: goToList
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: welcomeState
|
|
|
|
signal: goToWelcome
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: detailsState
|
|
|
|
onEntered: {
|
|
|
|
loader.sourceComponent = details;
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: back
|
2020-08-04 22:22:51 +00:00
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: goToList
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: welcomeState
|
|
|
|
signal: goToWelcome
|
|
|
|
}
|
2021-08-09 22:23:52 +00:00
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: ensReleasedState
|
|
|
|
signal: done
|
|
|
|
}
|
2020-08-03 20:46:37 +00:00
|
|
|
}
|
2020-08-04 22:22:51 +00:00
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: tAndCState
|
|
|
|
onEntered:loader.sourceComponent = termsAndConditions
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: goToList
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: welcomeState
|
|
|
|
signal: goToWelcome
|
|
|
|
}
|
2020-08-26 21:13:26 +00:00
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: back
|
|
|
|
}
|
2020-08-27 16:06:53 +00:00
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: back
|
|
|
|
}
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: ensRegisteredState
|
|
|
|
signal: done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DSM.State {
|
|
|
|
id: ensRegisteredState
|
|
|
|
onEntered:loader.sourceComponent = ensRegistered
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: next
|
|
|
|
}
|
2020-08-03 20:46:37 +00:00
|
|
|
}
|
2020-08-27 20:18:14 +00:00
|
|
|
|
2021-08-09 22:23:52 +00:00
|
|
|
DSM.State {
|
|
|
|
id: ensReleasedState
|
|
|
|
onEntered:loader.sourceComponent = ensReleased
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-27 20:18:14 +00:00
|
|
|
DSM.State {
|
|
|
|
id: ensConnectedState
|
|
|
|
onEntered:loader.sourceComponent = ensConnected
|
|
|
|
DSM.SignalTransition {
|
|
|
|
targetState: listState
|
|
|
|
signal: next
|
|
|
|
}
|
2022-02-09 09:43:23 +00:00
|
|
|
}
|
2020-08-03 20:46:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: loader
|
|
|
|
anchors.fill: parent
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: welcome
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsWelcomeView {
|
2022-01-17 08:56:44 +00:00
|
|
|
username: ensView.ensUsernamesStore.username
|
2020-08-07 16:27:41 +00:00
|
|
|
onStartBtnClicked: next(null)
|
2021-12-09 13:28:02 +00:00
|
|
|
profileContentWidth: ensView.profileContentWidth
|
2023-04-04 11:31:04 +00:00
|
|
|
startButtonEnabled: ensView.networkConnectionStore.ensNetworkAvailable
|
|
|
|
tooltipText: ensView.networkConnectionStore.ensNetworkUnavailableText
|
2020-08-03 20:46:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: search
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsSearchView {
|
2022-01-17 08:56:44 +00:00
|
|
|
ensUsernamesStore: ensView.ensUsernamesStore
|
2021-12-09 13:28:02 +00:00
|
|
|
profileContentWidth: ensView.profileContentWidth
|
2024-10-03 13:14:27 +00:00
|
|
|
|
2020-08-07 16:27:41 +00:00
|
|
|
onContinueClicked: {
|
2020-08-04 22:22:51 +00:00
|
|
|
if(output === "connected"){
|
|
|
|
connect(username)
|
|
|
|
} else {
|
2020-08-26 21:13:26 +00:00
|
|
|
selectedUsername = username;
|
2020-08-04 22:22:51 +00:00
|
|
|
next(output);
|
|
|
|
}
|
|
|
|
}
|
2024-10-03 13:14:27 +00:00
|
|
|
|
|
|
|
onConnectUsername: {
|
|
|
|
ensView.selectedUsername = username
|
|
|
|
|
|
|
|
ensView.sendModalPopup.modalHeaderText = qsTr("Connect username with your pubkey")
|
|
|
|
ensView.sendModalPopup.interactive = false
|
|
|
|
ensView.sendModalPopup.preSelectedRecipient = ensView.ensUsernamesStore.getEnsRegisteredAddress()
|
|
|
|
ensView.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address
|
|
|
|
ensView.sendModalPopup.preSelectedHoldingID = Constants.ethToken
|
|
|
|
ensView.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC20
|
|
|
|
ensView.sendModalPopup.preSelectedSendType = Constants.SendType.ENSSetPubKey
|
|
|
|
ensView.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(0)
|
|
|
|
ensView.sendModalPopup.preSelectedChainId = ensView.selectedChainId
|
|
|
|
ensView.sendModalPopup.publicKey = ensView.contactsStore.myPublicKey
|
|
|
|
ensView.sendModalPopup.ensName = ensView.selectedUsername
|
|
|
|
ensView.sendModalPopup.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: ensView.ensUsernamesStore.ensUsernamesModule
|
|
|
|
function onTransactionWasSent(trxType: string, chainId: int, txHash: string, username: string, error: string) {
|
|
|
|
if (!!error || trxType !== d.setPubKey) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
done(ensView.selectedUsername)
|
|
|
|
}
|
2020-08-27 20:18:14 +00:00
|
|
|
}
|
2020-08-04 22:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: termsAndConditions
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsTermsAndConditionsView {
|
2022-01-17 08:56:44 +00:00
|
|
|
ensUsernamesStore: ensView.ensUsernamesStore
|
2020-08-26 21:13:26 +00:00
|
|
|
username: selectedUsername
|
2024-10-03 13:14:27 +00:00
|
|
|
|
2020-08-26 21:13:26 +00:00
|
|
|
onBackBtnClicked: back();
|
2024-10-03 13:14:27 +00:00
|
|
|
|
|
|
|
onRegisterUsername: {
|
|
|
|
ensView.sendModalPopup.interactive = false
|
|
|
|
ensView.sendModalPopup.preSelectedRecipient = ensView.ensUsernamesStore.getEnsRegisteredAddress()
|
|
|
|
ensView.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address
|
|
|
|
ensView.sendModalPopup.preSelectedHoldingID = !!d.sntToken && !!d.sntToken.symbol ? d.sntToken.symbol: ""
|
|
|
|
ensView.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC20
|
|
|
|
ensView.sendModalPopup.preSelectedSendType = Constants.SendType.ENSRegister
|
|
|
|
ensView.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(10)
|
|
|
|
ensView.sendModalPopup.preSelectedChainId = ensView.selectedChainId
|
|
|
|
ensView.sendModalPopup.publicKey = ensView.contactsStore.myPublicKey
|
|
|
|
ensView.sendModalPopup.ensName = ensView.selectedUsername
|
|
|
|
ensView.sendModalPopup.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: ensView.ensUsernamesStore.ensUsernamesModule
|
|
|
|
function onTransactionWasSent(trxType: string, chainId: int, txHash: string, username: string, error: string) {
|
|
|
|
if (!!error || trxType !== d.registerENS) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
done(ensView.selectedUsername)
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 22:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: added
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsAddedView {
|
2020-08-07 16:27:41 +00:00
|
|
|
onOkBtnClicked: next(null)
|
2020-08-04 22:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-27 16:06:53 +00:00
|
|
|
Component {
|
|
|
|
id: ensRegistered
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsRegisteredView {
|
2020-08-27 16:06:53 +00:00
|
|
|
ensUsername: selectedUsername
|
|
|
|
onOkBtnClicked: next(null)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-09 22:23:52 +00:00
|
|
|
Component {
|
|
|
|
id: ensReleased
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsReleasedView {
|
2021-08-09 22:23:52 +00:00
|
|
|
ensUsername: selectedUsername
|
|
|
|
onOkBtnClicked: next(null)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-27 20:18:14 +00:00
|
|
|
Component {
|
|
|
|
id: ensConnected
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsConnectedView {
|
2020-08-27 20:18:14 +00:00
|
|
|
ensUsername: selectedUsername
|
|
|
|
onOkBtnClicked: next(null)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-04 22:22:51 +00:00
|
|
|
Component {
|
|
|
|
id: list
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsListView {
|
2022-01-17 08:56:44 +00:00
|
|
|
ensUsernamesStore: ensView.ensUsernamesStore
|
|
|
|
|
2021-12-09 13:28:02 +00:00
|
|
|
profileContentWidth: ensView.profileContentWidth
|
2020-08-07 16:27:41 +00:00
|
|
|
onAddBtnClicked: next("search")
|
|
|
|
onSelectEns: {
|
2023-01-11 16:10:13 +00:00
|
|
|
ensView.ensUsernamesStore.ensDetails(chainId, username)
|
|
|
|
selectedUsername = username
|
|
|
|
selectedChainId = chainId
|
2020-08-06 19:45:57 +00:00
|
|
|
next("details")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: details
|
2021-10-06 09:16:39 +00:00
|
|
|
EnsDetailsView {
|
2022-01-17 08:56:44 +00:00
|
|
|
ensUsernamesStore: ensView.ensUsernamesStore
|
2020-08-06 19:45:57 +00:00
|
|
|
username: selectedUsername
|
2023-01-11 16:10:13 +00:00
|
|
|
chainId: selectedChainId
|
2024-10-03 13:14:27 +00:00
|
|
|
|
2023-01-11 16:10:13 +00:00
|
|
|
onBackBtnClicked: back()
|
2024-10-03 13:14:27 +00:00
|
|
|
|
|
|
|
onReleaseUsernameRequested: {
|
2024-10-29 09:55:46 +00:00
|
|
|
const name = RootStore.getNameForWalletAddress(senderAddress)
|
|
|
|
if (name === "") {
|
|
|
|
Global.openPopup(noAccountPopupComponent)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-10-03 13:14:27 +00:00
|
|
|
ensView.sendModalPopup.modalHeaderText = qsTr("Release your username")
|
|
|
|
ensView.sendModalPopup.interactive = false
|
2024-10-29 09:55:46 +00:00
|
|
|
ensView.sendModalPopup.preSelectedAccountAddress = senderAddress
|
2024-10-03 13:14:27 +00:00
|
|
|
ensView.sendModalPopup.preSelectedRecipient = ensView.ensUsernamesStore.getEnsRegisteredAddress()
|
|
|
|
ensView.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address
|
|
|
|
ensView.sendModalPopup.preSelectedHoldingID = Constants.ethToken
|
|
|
|
ensView.sendModalPopup.preSelectedHoldingType = Constants.TokenType.Native
|
|
|
|
ensView.sendModalPopup.preSelectedSendType = Constants.SendType.ENSRelease
|
|
|
|
ensView.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(0)
|
|
|
|
ensView.sendModalPopup.preSelectedChainId = ensView.selectedChainId
|
|
|
|
ensView.sendModalPopup.publicKey = ensView.contactsStore.myPublicKey
|
|
|
|
ensView.sendModalPopup.ensName = ensView.selectedUsername
|
|
|
|
ensView.sendModalPopup.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: ensView.ensUsernamesStore.ensUsernamesModule
|
|
|
|
function onTransactionWasSent(trxType: string, chainId: int, txHash: string, username: string, error: string) {
|
|
|
|
if (!!error || trxType !== d.releaseENS) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
done(ensView.selectedUsername)
|
|
|
|
}
|
2021-08-09 22:23:52 +00:00
|
|
|
}
|
2020-08-04 22:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-29 09:55:46 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-04 22:22:51 +00:00
|
|
|
Connections {
|
2021-12-09 13:28:02 +00:00
|
|
|
target: ensView
|
2023-01-18 09:25:36 +00:00
|
|
|
function onConnect(ensUsername: string) {
|
2020-08-04 22:22:51 +00:00
|
|
|
addedUsername = ensUsername;
|
|
|
|
}
|
2020-05-27 21:28:25 +00:00
|
|
|
}
|
2020-09-14 17:38:23 +00:00
|
|
|
|
|
|
|
Connections {
|
2022-01-17 08:56:44 +00:00
|
|
|
target: ensView.ensUsernamesStore.ensUsernamesModule
|
2023-02-06 12:09:47 +00:00
|
|
|
function onTransactionCompleted(success: bool, txHash: string, username: string, trxType: string) {
|
2022-05-05 10:28:54 +00:00
|
|
|
let title = ""
|
2020-09-14 17:38:23 +00:00
|
|
|
switch(trxType){
|
2024-10-03 13:14:27 +00:00
|
|
|
case d.registerENS:
|
2022-05-05 10:28:54 +00:00
|
|
|
title = !success ?
|
2022-04-04 11:26:30 +00:00
|
|
|
qsTr("ENS Registration failed")
|
2022-05-05 10:28:54 +00:00
|
|
|
:
|
2022-04-04 11:26:30 +00:00
|
|
|
qsTr("ENS Registration completed");
|
2022-05-05 10:28:54 +00:00
|
|
|
break;
|
2024-10-03 13:14:27 +00:00
|
|
|
case d.setPubKey:
|
2022-05-05 10:28:54 +00:00
|
|
|
title = !success ?
|
2022-04-04 11:26:30 +00:00
|
|
|
qsTr("Updating ENS pubkey failed")
|
2022-05-05 10:28:54 +00:00
|
|
|
:
|
2022-04-04 11:26:30 +00:00
|
|
|
qsTr("Updating ENS pubkey completed");
|
2022-05-05 10:28:54 +00:00
|
|
|
break;
|
2024-10-03 13:14:27 +00:00
|
|
|
case d.releaseENS:
|
|
|
|
title = !success ?
|
|
|
|
qsTr("Releasing ENS name failed")
|
|
|
|
:
|
|
|
|
qsTr("ENS name released");
|
|
|
|
break
|
2022-05-05 10:28:54 +00:00
|
|
|
default:
|
|
|
|
console.error("unknown transaction type: ", trxType);
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
let icon = "block-icon";
|
|
|
|
let ephType = Constants.ephemeralNotificationType.normal;
|
|
|
|
if (success) {
|
|
|
|
icon = "check-circle";
|
|
|
|
ephType = Constants.ephemeralNotificationType.success;
|
2020-09-14 17:38:23 +00:00
|
|
|
}
|
|
|
|
|
2024-10-30 08:14:52 +00:00
|
|
|
let url = `${ensView.ensUsernamesStore.getEtherscanTxLink()}/${txHash}`;
|
2022-05-05 10:28:54 +00:00
|
|
|
Global.displayToastMessage(qsTr("Transaction pending..."),
|
2022-05-19 08:53:57 +00:00
|
|
|
qsTr("View on etherscan"),
|
2022-05-05 10:28:54 +00:00
|
|
|
icon,
|
|
|
|
false,
|
|
|
|
ephType,
|
|
|
|
url)
|
2020-09-14 17:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-27 21:28:25 +00:00
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
|