From 968923e8bebd828a9af9a01993e064f854ba7ff7 Mon Sep 17 00:00:00 2001 From: hydr063n Date: Mon, 28 Sep 2020 15:47:15 +0200 Subject: [PATCH] chore: refactor ensRegisterAddress too and update the ui to use utilsModel --- src/app/profile/views/ens_manager.nim | 8 +------- src/app/utilsView/view.nim | 7 +++++++ .../AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml | 2 +- ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/profile/views/ens_manager.nim b/src/app/profile/views/ens_manager.nim index 9b26a28e8f..dcc1e58b6a 100644 --- a/src/app/profile/views/ens_manager.nim +++ b/src/app/profile/views/ens_manager.nim @@ -200,12 +200,6 @@ QtObject: self.endResetModel() self.transactionCompleted(false, transactionHash, ensUsername, $trxType, revertReason) - proc getEnsRegisterAddress(self: EnsManager): QVariant {.slot.} = - newQVariant($statusRegistrarAddress()) - - QtProperty[QVariant] ensRegisterAddress: - read = getEnsRegisterAddress - proc registerENSGasEstimate(self: EnsManager, ensUsername: string, address: string): int {.slot.} = var success: bool let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0") @@ -240,4 +234,4 @@ QtObject: if success: self.transactionWasSent(response) self.pendingUsernames.incl(username) - self.add username \ No newline at end of file + self.add username diff --git a/src/app/utilsView/view.nim b/src/app/utilsView/view.nim index 3055fc80f9..3986e09d09 100644 --- a/src/app/utilsView/view.nim +++ b/src/app/utilsView/view.nim @@ -5,6 +5,7 @@ import ../../status/libstatus/accounts/constants as accountConstants import ../../status/libstatus/tokens import ../../status/libstatus/wallet as status_wallet import ../../status/libstatus/utils as status_utils +import ../../status/ens as status_ens QtObject: type UtilsView* = ref object of QObject @@ -49,3 +50,9 @@ QtObject: QtProperty[QVariant] stickerMarketAddress: read = getStickerMarketAddress + + proc getEnsRegisterAddress(self: UtilsView): QVariant {.slot.} = + newQVariant($statusRegistrarAddress()) + + QtProperty[QVariant] ensRegisterAddress: + read = getEnsRegisterAddress diff --git a/ui/app/AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml b/ui/app/AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml index 96301ea769..600b7eed89 100644 --- a/ui/app/AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml +++ b/ui/app/AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml @@ -87,7 +87,7 @@ ModalPopup { visible: false accounts: walletModel.accounts contacts: profileModel.addedContacts - selectedRecipient: { "address": profileModel.ens.ensRegisterAddress, "type": RecipientSelector.Type.Address } + selectedRecipient: { "address": utilsModel.ensRegisterAddress, "type": RecipientSelector.Type.Address } readOnly: true onSelectedRecipientChanged: gasSelector.estimateGas() } diff --git a/ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml b/ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml index 5a1d615cdd..891f46d41f 100644 --- a/ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml +++ b/ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml @@ -92,7 +92,7 @@ ModalPopup { visible: false accounts: walletModel.accounts contacts: profileModel.addedContacts - selectedRecipient: { "address": profileModel.ens.ensRegisterAddress, "type": RecipientSelector.Type.Address } + selectedRecipient: { "address": utilsModel.ensRegisterAddress, "type": RecipientSelector.Type.Address } readOnly: true onSelectedRecipientChanged: gasSelector.estimateGas() }