chore: refactor ensRegisterAddress too and update the ui to use utilsModel

This commit is contained in:
hydr063n 2020-09-28 15:47:15 +02:00 committed by Iuri Matias
parent 25748ce682
commit 968923e8be
4 changed files with 10 additions and 9 deletions

View File

@ -200,12 +200,6 @@ QtObject:
self.endResetModel() self.endResetModel()
self.transactionCompleted(false, transactionHash, ensUsername, $trxType, revertReason) 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.} = proc registerENSGasEstimate(self: EnsManager, ensUsername: string, address: string): int {.slot.} =
var success: bool var success: bool
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0") let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
@ -240,4 +234,4 @@ QtObject:
if success: if success:
self.transactionWasSent(response) self.transactionWasSent(response)
self.pendingUsernames.incl(username) self.pendingUsernames.incl(username)
self.add username self.add username

View File

@ -5,6 +5,7 @@ import ../../status/libstatus/accounts/constants as accountConstants
import ../../status/libstatus/tokens import ../../status/libstatus/tokens
import ../../status/libstatus/wallet as status_wallet import ../../status/libstatus/wallet as status_wallet
import ../../status/libstatus/utils as status_utils import ../../status/libstatus/utils as status_utils
import ../../status/ens as status_ens
QtObject: QtObject:
type UtilsView* = ref object of QObject type UtilsView* = ref object of QObject
@ -49,3 +50,9 @@ QtObject:
QtProperty[QVariant] stickerMarketAddress: QtProperty[QVariant] stickerMarketAddress:
read = getStickerMarketAddress read = getStickerMarketAddress
proc getEnsRegisterAddress(self: UtilsView): QVariant {.slot.} =
newQVariant($statusRegistrarAddress())
QtProperty[QVariant] ensRegisterAddress:
read = getEnsRegisterAddress

View File

@ -87,7 +87,7 @@ ModalPopup {
visible: false visible: false
accounts: walletModel.accounts accounts: walletModel.accounts
contacts: profileModel.addedContacts contacts: profileModel.addedContacts
selectedRecipient: { "address": profileModel.ens.ensRegisterAddress, "type": RecipientSelector.Type.Address } selectedRecipient: { "address": utilsModel.ensRegisterAddress, "type": RecipientSelector.Type.Address }
readOnly: true readOnly: true
onSelectedRecipientChanged: gasSelector.estimateGas() onSelectedRecipientChanged: gasSelector.estimateGas()
} }

View File

@ -92,7 +92,7 @@ ModalPopup {
visible: false visible: false
accounts: walletModel.accounts accounts: walletModel.accounts
contacts: profileModel.addedContacts contacts: profileModel.addedContacts
selectedRecipient: { "address": profileModel.ens.ensRegisterAddress, "type": RecipientSelector.Type.Address } selectedRecipient: { "address": utilsModel.ensRegisterAddress, "type": RecipientSelector.Type.Address }
readOnly: true readOnly: true
onSelectedRecipientChanged: gasSelector.estimateGas() onSelectedRecipientChanged: gasSelector.estimateGas()
} }