fix: optimizes send modal flow for ens usernames
This commit is contained in:
parent
5783e11181
commit
46f34ec8fc
|
@ -127,7 +127,7 @@ method connectOwnedUsername*(self: Module, ensUsername: string, isStatus: bool)
|
||||||
method ensTransactionSent*(self: Module, trxType: string, chainId: int, ensUsername: string, txHash: string, err: string) =
|
method ensTransactionSent*(self: Module, trxType: string, chainId: int, ensUsername: string, txHash: string, err: string) =
|
||||||
var finalError = err
|
var finalError = err
|
||||||
defer:
|
defer:
|
||||||
self.view.emitTransactionWasSentSignal(chainId, txHash, finalError)
|
self.view.emitTransactionWasSentSignal(trxType, chainId, txHash, ensUsername, finalError)
|
||||||
if (err.len != 0):
|
if (err.len != 0):
|
||||||
error "sending ens tx failed", errMsg=err, methodName="ensTransactionSent"
|
error "sending ens tx failed", errMsg=err, methodName="ensTransactionSent"
|
||||||
return
|
return
|
||||||
|
|
|
@ -62,9 +62,9 @@ QtObject:
|
||||||
self.loading(false)
|
self.loading(false)
|
||||||
self.detailsObtained(chainId, ensUsername, address, pubkey, isStatus, expirationTime)
|
self.detailsObtained(chainId, ensUsername, address, pubkey, isStatus, expirationTime)
|
||||||
|
|
||||||
proc transactionWasSent(self: View, chainId: int, txHash: string, error: string) {.signal.}
|
proc transactionWasSent(self: View, trxType: string, chainId: int, txHash: string, username: string, error: string) {.signal.}
|
||||||
proc emitTransactionWasSentSignal*(self: View, chainId: int, txHash: string, error: string) =
|
proc emitTransactionWasSentSignal*(self: View, trxType: string, chainId: int, txHash: string, username: string, error: string) =
|
||||||
self.transactionWasSent(chainId, txHash, error)
|
self.transactionWasSent(trxType, chainId, txHash, username, error)
|
||||||
|
|
||||||
proc getEtherscanLink*(self: View): string {.slot.} =
|
proc getEtherscanLink*(self: View): string {.slot.} =
|
||||||
return self.etherscanLink
|
return self.etherscanLink
|
||||||
|
|
|
@ -47,6 +47,8 @@ const SIGNAL_OWNER_TOKEN_SENT* = "ownerTokenSent"
|
||||||
const SIGNAL_TRANSACTION_SENDING_COMPLETE* = "transactionSendingComplete"
|
const SIGNAL_TRANSACTION_SENDING_COMPLETE* = "transactionSendingComplete"
|
||||||
const SIGNAL_TRANSACTION_STATUS_CHANGED* = "transactionStatusChanged"
|
const SIGNAL_TRANSACTION_STATUS_CHANGED* = "transactionStatusChanged"
|
||||||
|
|
||||||
|
const InternalErrorCode = -1
|
||||||
|
|
||||||
type TokenTransferMetadata* = object
|
type TokenTransferMetadata* = object
|
||||||
tokenName*: string
|
tokenName*: string
|
||||||
isOwnerToken*: bool
|
isOwnerToken*: bool
|
||||||
|
@ -428,6 +430,7 @@ QtObject:
|
||||||
tokenIsOwnerToken, toToken, disabledFromChainIDs, disabledToChainIDs, lockedInAmounts, extraParamsTable)
|
tokenIsOwnerToken, toToken, disabledFromChainIDs, disabledToChainIDs, lockedInAmounts, extraParamsTable)
|
||||||
except CatchableError as e:
|
except CatchableError as e:
|
||||||
error "suggestedRoutes", exception=e.msg
|
error "suggestedRoutes", exception=e.msg
|
||||||
|
self.suggestedRoutesReady(uuid, @[], "", $InternalErrorCode, e.msg)
|
||||||
|
|
||||||
proc stopSuggestedRoutesAsyncCalculation*(self: Service) =
|
proc stopSuggestedRoutesAsyncCalculation*(self: Service) =
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -38,11 +38,11 @@ StatusSectionLayout {
|
||||||
property SharedStores.RootStore sharedRootStore
|
property SharedStores.RootStore sharedRootStore
|
||||||
property ProfileSectionStore store
|
property ProfileSectionStore store
|
||||||
property AppLayoutsStores.RootStore globalStore
|
property AppLayoutsStores.RootStore globalStore
|
||||||
|
required property var sendModalPopup
|
||||||
property var systemPalette
|
property var systemPalette
|
||||||
property var emojiPopup
|
property var emojiPopup
|
||||||
property SharedStores.NetworkConnectionStore networkConnectionStore
|
property SharedStores.NetworkConnectionStore networkConnectionStore
|
||||||
required property TokensStore tokensStore
|
required property TokensStore tokensStore
|
||||||
required property TransactionStore transactionStore
|
|
||||||
required property WalletAssetsStore walletAssetsStore
|
required property WalletAssetsStore walletAssetsStore
|
||||||
required property CollectiblesStore collectiblesStore
|
required property CollectiblesStore collectiblesStore
|
||||||
required property SharedStores.CurrenciesStore currencyStore
|
required property SharedStores.CurrenciesStore currencyStore
|
||||||
|
@ -220,9 +220,9 @@ StatusSectionLayout {
|
||||||
implicitHeight: parent.height
|
implicitHeight: parent.height
|
||||||
ensUsernamesStore: root.store.ensUsernamesStore
|
ensUsernamesStore: root.store.ensUsernamesStore
|
||||||
walletAssetsStore: root.walletAssetsStore
|
walletAssetsStore: root.walletAssetsStore
|
||||||
|
sendModalPopup: root.sendModalPopup
|
||||||
contactsStore: root.store.contactsStore
|
contactsStore: root.store.contactsStore
|
||||||
networkConnectionStore: root.networkConnectionStore
|
networkConnectionStore: root.networkConnectionStore
|
||||||
transactionStore: root.transactionStore
|
|
||||||
profileContentWidth: d.contentWidth
|
profileContentWidth: d.contentWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,13 @@ import AppLayouts.Profile.stores 1.0
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property EnsUsernamesStore ensUsernamesStore
|
property EnsUsernamesStore ensUsernamesStore
|
||||||
property ContactsStore contactsStore
|
|
||||||
required property TransactionStore transactionStore
|
|
||||||
property string username: ""
|
property string username: ""
|
||||||
property string chainId: ""
|
property string chainId: ""
|
||||||
property string walletAddress: "-"
|
property string walletAddress: "-"
|
||||||
property string key: "-"
|
property string key: "-"
|
||||||
|
|
||||||
signal backBtnClicked();
|
signal backBtnClicked()
|
||||||
signal usernameReleased()
|
signal releaseUsernameRequested()
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -117,38 +115,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: transactionDialogComponent
|
|
||||||
SendModal {
|
|
||||||
id: releaseEnsModal
|
|
||||||
modalHeader: qsTr("Release your username")
|
|
||||||
interactive: false
|
|
||||||
store: root.transactionStore
|
|
||||||
preSelectedSendType: Constants.SendType.ENSRelease
|
|
||||||
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
|
||||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
|
|
||||||
preSelectedHoldingID: Constants.ethToken
|
|
||||||
preSelectedHoldingType: Constants.TokenType.ERC20
|
|
||||||
publicKey: root.contactsStore.myPublicKey
|
|
||||||
ensName: root.username
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root.ensUsernamesStore.ensUsernamesModule
|
|
||||||
function onTransactionWasSent(chainId: int, txHash: string, error: string) {
|
|
||||||
if (!!error) {
|
|
||||||
if (error.includes(Constants.walletSection.cancelledMessage)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
releaseEnsModal.sendingError.text = error
|
|
||||||
return releaseEnsModal.sendingError.open()
|
|
||||||
}
|
|
||||||
usernameReleased()
|
|
||||||
releaseEnsModal.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: actionsLayout
|
id: actionsLayout
|
||||||
|
|
||||||
|
@ -174,7 +140,7 @@ Item {
|
||||||
enabled: false
|
enabled: false
|
||||||
text: qsTr("Release username")
|
text: qsTr("Release username")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Global.openPopup(transactionDialogComponent)
|
root.releaseUsernameRequested()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,10 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property EnsUsernamesStore ensUsernamesStore
|
property EnsUsernamesStore ensUsernamesStore
|
||||||
property ContactsStore contactsStore
|
|
||||||
required property TransactionStore transactionStore
|
|
||||||
property int profileContentWidth
|
property int profileContentWidth
|
||||||
|
|
||||||
|
signal connectUsername(string username)
|
||||||
signal continueClicked(string output, string username)
|
signal continueClicked(string output, string username)
|
||||||
signal usernameUpdated(username: string);
|
|
||||||
|
|
||||||
|
|
||||||
property string validationMessage: ""
|
property string validationMessage: ""
|
||||||
property bool valid: false
|
property bool valid: false
|
||||||
|
@ -62,39 +59,6 @@ Item {
|
||||||
Qt.callLater(validateENS, ensUsername, isStatus)
|
Qt.callLater(validateENS, ensUsername, isStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: transactionDialogComponent
|
|
||||||
SendModal {
|
|
||||||
id: connectEnsModal
|
|
||||||
modalHeader: qsTr("Connect username with your pubkey")
|
|
||||||
interactive: false
|
|
||||||
store: root.transactionStore
|
|
||||||
preSelectedSendType: Constants.SendType.ENSSetPubKey
|
|
||||||
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
|
||||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0)
|
|
||||||
preSelectedHoldingID: Constants.ethToken
|
|
||||||
preSelectedHoldingType: Constants.TokenType.ERC20
|
|
||||||
publicKey: root.contactsStore.myPublicKey
|
|
||||||
ensName: ensUsername.text
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root.ensUsernamesStore.ensUsernamesModule
|
|
||||||
function onTransactionWasSent(chainId: int, txHash: string, error: string) {
|
|
||||||
if (!!error) {
|
|
||||||
if (error.includes(Constants.walletSection.cancelledMessage)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
connectEnsModal.sendingError.text = error
|
|
||||||
return connectEnsModal.sendingError.open()
|
|
||||||
}
|
|
||||||
usernameUpdated(ensUsername.text);
|
|
||||||
connectEnsModal.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: ensContainer
|
id: ensContainer
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -206,8 +170,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ensStatus === Constants.ens_connected_dkey || ensStatus === Constants.ens_owned){
|
if(ensStatus === Constants.ens_connected_dkey || ensStatus === Constants.ens_owned){
|
||||||
Global.openPopup(transactionDialogComponent, {ensUsername: ensUsername.text})
|
root.connectUsername(ensUsername.text)
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,30 +16,16 @@ import StatusQ.Core.Utils 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
import StatusQ.Components 0.1
|
import StatusQ.Components 0.1
|
||||||
|
|
||||||
import AppLayouts.Wallet.stores 1.0
|
|
||||||
import AppLayouts.Profile.stores 1.0
|
import AppLayouts.Profile.stores 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property EnsUsernamesStore ensUsernamesStore
|
property EnsUsernamesStore ensUsernamesStore
|
||||||
property ContactsStore contactsStore
|
|
||||||
required property TransactionStore transactionStore
|
|
||||||
property WalletAssetsStore walletAssetsStore
|
|
||||||
property string username: ""
|
property string username: ""
|
||||||
|
|
||||||
signal backBtnClicked()
|
signal backBtnClicked()
|
||||||
signal usernameRegistered(userName: string)
|
signal registerUsername()
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: d
|
|
||||||
readonly property var sntToken: ModelUtils.getByKey(root.walletAssetsStore.groupedAccountAssetsModel, "tokensKey", root.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
|
|
||||||
}
|
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
id: sectionTitle
|
id: sectionTitle
|
||||||
|
@ -59,43 +45,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: transactionDialog
|
|
||||||
function open() {
|
|
||||||
this.active = true
|
|
||||||
this.item.open()
|
|
||||||
}
|
|
||||||
function closed() {
|
|
||||||
this.active = false // kill an opened instance
|
|
||||||
}
|
|
||||||
sourceComponent: SendModal {
|
|
||||||
id: buyEnsModal
|
|
||||||
interactive: false
|
|
||||||
store: root.transactionStore
|
|
||||||
preSelectedSendType: Constants.SendType.ENSRegister
|
|
||||||
preSelectedRecipient: root.ensUsernamesStore.getEnsRegisteredAddress()
|
|
||||||
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(10)
|
|
||||||
preSelectedHoldingID: !!d.sntToken && !!d.sntToken.symbol ? d.sntToken.symbol: ""
|
|
||||||
preSelectedHoldingType: Constants.TokenType.ERC20
|
|
||||||
publicKey: root.contactsStore.myPublicKey
|
|
||||||
ensName: root.username
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root.ensUsernamesStore.ensUsernamesModule
|
|
||||||
function onTransactionWasSent(chainId: int, txHash: string, error: string) {
|
|
||||||
if (!!error) {
|
|
||||||
if (error.includes(Constants.walletSection.cancelledMessage)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
buyEnsModal.sendingError.text = error
|
|
||||||
return buyEnsModal.sendingError.open()
|
|
||||||
}
|
|
||||||
usernameRegistered(username)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Replace with StatusModal
|
// TODO: Replace with StatusModal
|
||||||
ModalPopup {
|
ModalPopup {
|
||||||
id: popup
|
id: popup
|
||||||
|
@ -395,6 +344,6 @@ Item {
|
||||||
qsTr("Not enough SNT") :
|
qsTr("Not enough SNT") :
|
||||||
qsTr("Register")
|
qsTr("Register")
|
||||||
enabled: d.sntBalance >= 10 && termsAndConditionsCheckbox.checked
|
enabled: d.sntBalance >= 10 && termsAndConditionsCheckbox.checked
|
||||||
onClicked: transactionDialog.open()
|
onClicked: root.registerUsername(root.username)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,14 @@ import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.14
|
||||||
import QtQml.StateMachine 1.14 as DSM
|
import QtQml.StateMachine 1.14 as DSM
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
|
import StatusQ.Core 0.1
|
||||||
|
import StatusQ.Core.Utils 0.1
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared 1.0
|
import shared 1.0
|
||||||
import shared.stores 1.0 as SharedStores
|
import shared.stores 1.0 as SharedStores
|
||||||
import shared.stores.send 1.0
|
import shared.popups.send 1.0
|
||||||
|
|
||||||
import AppLayouts.Wallet.stores 1.0
|
import AppLayouts.Wallet.stores 1.0
|
||||||
|
|
||||||
|
@ -18,9 +22,10 @@ Item {
|
||||||
property EnsUsernamesStore ensUsernamesStore
|
property EnsUsernamesStore ensUsernamesStore
|
||||||
property WalletAssetsStore walletAssetsStore
|
property WalletAssetsStore walletAssetsStore
|
||||||
|
|
||||||
|
required property var sendModalPopup
|
||||||
|
|
||||||
property ContactsStore contactsStore
|
property ContactsStore contactsStore
|
||||||
property SharedStores.NetworkConnectionStore networkConnectionStore
|
property SharedStores.NetworkConnectionStore networkConnectionStore
|
||||||
required property TransactionStore transactionStore
|
|
||||||
|
|
||||||
property int profileContentWidth
|
property int profileContentWidth
|
||||||
property bool showSearchScreen: false
|
property bool showSearchScreen: false
|
||||||
|
@ -40,6 +45,21 @@ Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
DSM.StateMachine {
|
DSM.StateMachine {
|
||||||
id: stateMachine
|
id: stateMachine
|
||||||
initialState: ensView.ensUsernamesStore.ensUsernamesModel.count > 0 ? listState : welcomeState
|
initialState: ensView.ensUsernamesStore.ensUsernamesModel.count > 0 ? listState : welcomeState
|
||||||
|
@ -226,9 +246,8 @@ Item {
|
||||||
id: search
|
id: search
|
||||||
EnsSearchView {
|
EnsSearchView {
|
||||||
ensUsernamesStore: ensView.ensUsernamesStore
|
ensUsernamesStore: ensView.ensUsernamesStore
|
||||||
contactsStore: ensView.contactsStore
|
|
||||||
transactionStore: ensView.transactionStore
|
|
||||||
profileContentWidth: ensView.profileContentWidth
|
profileContentWidth: ensView.profileContentWidth
|
||||||
|
|
||||||
onContinueClicked: {
|
onContinueClicked: {
|
||||||
if(output === "connected"){
|
if(output === "connected"){
|
||||||
connect(username)
|
connect(username)
|
||||||
|
@ -237,9 +256,32 @@ Item {
|
||||||
next(output);
|
next(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onUsernameUpdated: {
|
|
||||||
selectedUsername = username;
|
onConnectUsername: {
|
||||||
done(username);
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,12 +290,33 @@ Item {
|
||||||
id: termsAndConditions
|
id: termsAndConditions
|
||||||
EnsTermsAndConditionsView {
|
EnsTermsAndConditionsView {
|
||||||
ensUsernamesStore: ensView.ensUsernamesStore
|
ensUsernamesStore: ensView.ensUsernamesStore
|
||||||
contactsStore: ensView.contactsStore
|
|
||||||
transactionStore: ensView.transactionStore
|
|
||||||
walletAssetsStore: ensView.walletAssetsStore
|
|
||||||
username: selectedUsername
|
username: selectedUsername
|
||||||
|
|
||||||
onBackBtnClicked: back();
|
onBackBtnClicked: back();
|
||||||
onUsernameRegistered: done(userName);
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,15 +371,34 @@ Item {
|
||||||
id: details
|
id: details
|
||||||
EnsDetailsView {
|
EnsDetailsView {
|
||||||
ensUsernamesStore: ensView.ensUsernamesStore
|
ensUsernamesStore: ensView.ensUsernamesStore
|
||||||
contactsStore: ensView.contactsStore
|
|
||||||
transactionStore: ensView.transactionStore
|
|
||||||
username: selectedUsername
|
username: selectedUsername
|
||||||
chainId: selectedChainId
|
chainId: selectedChainId
|
||||||
|
|
||||||
onBackBtnClicked: back()
|
onBackBtnClicked: back()
|
||||||
onUsernameReleased: {
|
|
||||||
selectedUsername = username
|
onReleaseUsernameRequested: {
|
||||||
selectedChainId = chainId
|
ensView.sendModalPopup.modalHeaderText = qsTr("Release your username")
|
||||||
done(username)
|
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.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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,18 +415,24 @@ Item {
|
||||||
function onTransactionCompleted(success: bool, txHash: string, username: string, trxType: string) {
|
function onTransactionCompleted(success: bool, txHash: string, username: string, trxType: string) {
|
||||||
let title = ""
|
let title = ""
|
||||||
switch(trxType){
|
switch(trxType){
|
||||||
case "RegisterENS":
|
case d.registerENS:
|
||||||
title = !success ?
|
title = !success ?
|
||||||
qsTr("ENS Registration failed")
|
qsTr("ENS Registration failed")
|
||||||
:
|
:
|
||||||
qsTr("ENS Registration completed");
|
qsTr("ENS Registration completed");
|
||||||
break;
|
break;
|
||||||
case "SetPubKey":
|
case d.setPubKey:
|
||||||
title = !success ?
|
title = !success ?
|
||||||
qsTr("Updating ENS pubkey failed")
|
qsTr("Updating ENS pubkey failed")
|
||||||
:
|
:
|
||||||
qsTr("Updating ENS pubkey completed");
|
qsTr("Updating ENS pubkey completed");
|
||||||
break;
|
break;
|
||||||
|
case d.releaseENS:
|
||||||
|
title = !success ?
|
||||||
|
qsTr("Releasing ENS name failed")
|
||||||
|
:
|
||||||
|
qsTr("ENS name released");
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
console.error("unknown transaction type: ", trxType);
|
console.error("unknown transaction type: ", trxType);
|
||||||
return
|
return
|
||||||
|
|
|
@ -139,6 +139,8 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(code) {
|
switch(code) {
|
||||||
|
case Constants.routerErrorCodes.errInternal:
|
||||||
|
return qsTr("an internal error occurred")
|
||||||
case Constants.routerErrorCodes.errGeneric:
|
case Constants.routerErrorCodes.errGeneric:
|
||||||
return qsTr("unknown error occurred, try again later")
|
return qsTr("unknown error occurred, try again later")
|
||||||
case Constants.routerErrorCodes.processor.errFailedToParseBaseFee:
|
case Constants.routerErrorCodes.processor.errFailedToParseBaseFee:
|
||||||
|
@ -225,6 +227,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(code) {
|
switch(code) {
|
||||||
|
case Constants.routerErrorCodes.errInternal:
|
||||||
case Constants.routerErrorCodes.errGeneric:
|
case Constants.routerErrorCodes.errGeneric:
|
||||||
return details
|
return details
|
||||||
case Constants.routerErrorCodes.processor.errFailedToParseBaseFee:
|
case Constants.routerErrorCodes.processor.errFailedToParseBaseFee:
|
||||||
|
|
|
@ -1434,11 +1434,11 @@ Item {
|
||||||
sharedRootStore: appMain.sharedRootStore
|
sharedRootStore: appMain.sharedRootStore
|
||||||
store: appMain.rootStore.profileSectionStore
|
store: appMain.rootStore.profileSectionStore
|
||||||
globalStore: appMain.rootStore
|
globalStore: appMain.rootStore
|
||||||
|
sendModalPopup: sendModal
|
||||||
systemPalette: appMain.sysPalette
|
systemPalette: appMain.sysPalette
|
||||||
emojiPopup: statusEmojiPopup.item
|
emojiPopup: statusEmojiPopup.item
|
||||||
networkConnectionStore: appMain.networkConnectionStore
|
networkConnectionStore: appMain.networkConnectionStore
|
||||||
tokensStore: appMain.tokensStore
|
tokensStore: appMain.tokensStore
|
||||||
transactionStore: appMain.transactionStore
|
|
||||||
walletAssetsStore: appMain.walletAssetsStore
|
walletAssetsStore: appMain.walletAssetsStore
|
||||||
collectiblesStore: appMain.walletCollectiblesStore
|
collectiblesStore: appMain.walletCollectiblesStore
|
||||||
currencyStore: appMain.currencyStore
|
currencyStore: appMain.currencyStore
|
||||||
|
@ -1625,6 +1625,8 @@ Item {
|
||||||
this.active = false
|
this.active = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property string modalHeaderText
|
||||||
|
property bool interactive: true
|
||||||
property string preSelectedAccountAddress
|
property string preSelectedAccountAddress
|
||||||
property var preSelectedRecipient
|
property var preSelectedRecipient
|
||||||
property int preSelectedRecipientType
|
property int preSelectedRecipientType
|
||||||
|
@ -1635,7 +1637,12 @@ Item {
|
||||||
property int preSelectedChainId: 0
|
property int preSelectedChainId: 0
|
||||||
property bool onlyAssets: false
|
property bool onlyAssets: false
|
||||||
|
|
||||||
|
property string stickersPackId: ""
|
||||||
|
property string publicKey: ""
|
||||||
|
property string ensName: ""
|
||||||
|
|
||||||
sourceComponent: SendPopups.SendModal {
|
sourceComponent: SendPopups.SendModal {
|
||||||
|
interactive: sendModal.interactive
|
||||||
onlyAssets: sendModal.onlyAssets
|
onlyAssets: sendModal.onlyAssets
|
||||||
|
|
||||||
loginType: appMain.rootStore.loginType
|
loginType: appMain.rootStore.loginType
|
||||||
|
@ -1647,6 +1654,8 @@ Item {
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
sendModal.closed()
|
sendModal.closed()
|
||||||
|
sendModal.modalHeaderText = ""
|
||||||
|
sendModal.interactive = true
|
||||||
sendModal.preSelectedSendType = Constants.SendType.Unknown
|
sendModal.preSelectedSendType = Constants.SendType.Unknown
|
||||||
sendModal.preSelectedHoldingID = ""
|
sendModal.preSelectedHoldingID = ""
|
||||||
sendModal.preSelectedHoldingType = Constants.TokenType.Unknown
|
sendModal.preSelectedHoldingType = Constants.TokenType.Unknown
|
||||||
|
@ -1654,6 +1663,10 @@ Item {
|
||||||
sendModal.preSelectedRecipient = undefined
|
sendModal.preSelectedRecipient = undefined
|
||||||
sendModal.preDefinedAmountToSend = ""
|
sendModal.preDefinedAmountToSend = ""
|
||||||
sendModal.preSelectedChainId = 0
|
sendModal.preSelectedChainId = 0
|
||||||
|
|
||||||
|
sendModal.stickersPackId = ""
|
||||||
|
sendModal.publicKey = ""
|
||||||
|
sendModal.ensName = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
|
@ -1665,19 +1678,29 @@ Item {
|
||||||
item.preSelectedRecipientType = sendModal.preSelectedRecipientType
|
item.preSelectedRecipientType = sendModal.preSelectedRecipientType
|
||||||
item.preSelectedRecipient = sendModal.preSelectedRecipient
|
item.preSelectedRecipient = sendModal.preSelectedRecipient
|
||||||
}
|
}
|
||||||
if(sendModal.preSelectedSendType !== Constants.SendType.Unknown) {
|
if (sendModal.preSelectedSendType !== Constants.SendType.Unknown) {
|
||||||
item.preSelectedSendType = sendModal.preSelectedSendType
|
item.preSelectedSendType = sendModal.preSelectedSendType
|
||||||
}
|
}
|
||||||
if(preSelectedHoldingType !== Constants.TokenType.Unknown) {
|
if (sendModal.preSelectedHoldingType !== Constants.TokenType.Unknown) {
|
||||||
item.preSelectedHoldingID = sendModal.preSelectedHoldingID
|
item.preSelectedHoldingID = sendModal.preSelectedHoldingID
|
||||||
item.preSelectedHoldingType = sendModal.preSelectedHoldingType
|
item.preSelectedHoldingType = sendModal.preSelectedHoldingType
|
||||||
}
|
}
|
||||||
if(preDefinedAmountToSend != "") {
|
if (sendModal.preDefinedAmountToSend != "") {
|
||||||
item.preDefinedAmountToSend = preDefinedAmountToSend
|
item.preDefinedAmountToSend = sendModal.preDefinedAmountToSend
|
||||||
}
|
}
|
||||||
if(!!sendModal.preSelectedChainId) {
|
if (!!sendModal.preSelectedChainId) {
|
||||||
item.preSelectedChainId = sendModal.preSelectedChainId
|
item.preSelectedChainId = sendModal.preSelectedChainId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!!sendModal.stickersPackId) {
|
||||||
|
item.stickersPackId = sendModal.stickersPackId
|
||||||
|
}
|
||||||
|
if (!!sendModal.publicKey) {
|
||||||
|
item.publicKey = sendModal.publicKey
|
||||||
|
}
|
||||||
|
if (!!sendModal.ensName) {
|
||||||
|
item.ensName = sendModal.ensName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1075,6 +1075,7 @@ QtObject {
|
||||||
|
|
||||||
readonly property QtObject routerErrorCodes: QtObject {
|
readonly property QtObject routerErrorCodes: QtObject {
|
||||||
|
|
||||||
|
readonly property string errInternal: "-1" // comes from Nim side
|
||||||
readonly property string errGeneric: "0"
|
readonly property string errGeneric: "0"
|
||||||
|
|
||||||
readonly property QtObject processor: QtObject {
|
readonly property QtObject processor: QtObject {
|
||||||
|
|
Loading…
Reference in New Issue