status-desktop/ui/app/AppLayouts/Profile/stores/EnsUsernamesStore.qml

136 lines
4.4 KiB
QML
Raw Normal View History

import QtQuick 2.13
import utils 1.0
2023-01-11 16:10:13 +00:00
import SortFilterProxyModel 0.2
QtObject {
id: root
property var ensUsernamesModule
property var ensUsernamesModel: root.ensUsernamesModule ? ensUsernamesModule.model : []
2023-01-11 16:10:13 +00:00
readonly property QtObject currentChainEnsUsernamesModel: SortFilterProxyModel {
sourceModel: root.ensUsernamesModel
filters: ValueFilter {
roleName: "chainId"
value: root.chainId
}
}
property string pubkey: !!Global.userProfile? Global.userProfile.pubKey : ""
property string icon: !!Global.userProfile? Global.userProfile.icon : ""
property string preferredUsername: !!Global.userProfile? Global.userProfile.preferredName : ""
readonly property string chainId: mainModule.appNetworkId
property string username: !!Global.userProfile? Global.userProfile.username : ""
function setPrefferedEnsUsername(ensName) {
if(!root.ensUsernamesModule)
return
ensUsernamesModule.setPrefferedEnsUsername(ensName)
}
function checkEnsUsernameAvailability(ensName, isStatus) {
if(!root.ensUsernamesModule)
return
ensUsernamesModule.checkEnsUsernameAvailability(ensName, isStatus)
}
function numOfPendingEnsUsernames() {
if(!root.ensUsernamesModule)
return 0
return ensUsernamesModule.numOfPendingEnsUsernames()
}
2023-01-11 16:10:13 +00:00
function ensDetails(chainId, ensUsername) {
if(!root.ensUsernamesModule)
return ""
2023-01-11 16:10:13 +00:00
ensUsernamesModule.fetchDetailsForEnsUsername(chainId, ensUsername)
}
2023-01-11 16:10:13 +00:00
function setPubKeyGasEstimate(chainId, ensUsername, address) {
if(!root.ensUsernamesModule)
return 0
2023-01-11 16:10:13 +00:00
return ensUsernamesModule.setPubKeyGasEstimate(chainId, ensUsername, address)
}
2023-01-11 16:10:13 +00:00
function authenticateAndSetPubKey(chainId, ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, eip1559Enabled) {
if(!root.ensUsernamesModule)
return ""
2023-01-11 16:10:13 +00:00
return ensUsernamesModule.authenticateAndSetPubKey(chainId, ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, eip1559Enabled)
}
function getEtherscanLink() {
if(!root.ensUsernamesModule)
return ""
return ensUsernamesModule.getEtherscanLink()
}
function getSigningPhrase() {
if(!root.ensUsernamesModule)
return ""
return ensUsernamesModule.getSigningPhrase()
}
2023-01-11 16:10:13 +00:00
function authenticateAndReleaseEns(chainId, ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, eip1559Enabled) {
if(!root.ensUsernamesModule)
return ""
2023-01-11 16:10:13 +00:00
return ensUsernamesModule.authenticateAndReleaseEns(chainId, ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, eip1559Enabled)
}
function ensConnectOwnedUsername(name, isStatus) {
if(!root.ensUsernamesModule)
return
ensUsernamesModule.connectOwnedUsername(name, isStatus)
}
function getEnsRegisteredAddress() {
if(!root.ensUsernamesModule)
return ""
return ensUsernamesModule.getEnsRegisteredAddress()
}
2023-01-11 16:10:13 +00:00
function authenticateAndRegisterEns(chainId, ensUsername, address, gasLimit, gasPrice, tipLimit, overallLimit, eip1559Enabled) {
if(!root.ensUsernamesModule)
return
2023-01-11 16:10:13 +00:00
ensUsernamesModule.authenticateAndRegisterEns(chainId, ensUsername, address, gasLimit, gasPrice, tipLimit, overallLimit, eip1559Enabled)
}
function getEnsRegistry() {
if(!root.ensUsernamesModule)
return ""
return ensUsernamesModule.getEnsRegistry()
}
function getWalletDefaultAddress() {
if(!root.ensUsernamesModule)
return ""
return ensUsernamesModule.getWalletDefaultAddress()
}
function getCurrentCurrency() {
if(!root.ensUsernamesModule)
return ""
return ensUsernamesModule.getCurrentCurrency()
}
function getGasEthValue(gweiValue, gasLimit) {
if(!root.ensUsernamesModule)
return ""
return ensUsernamesModule.getGasEthValue(gweiValue, gasLimit)
}
function getStatusTokenKey() {
if(!root.ensUsernamesModule)
return ""
return ensUsernamesModule.getStatusTokenKey()
}
2023-01-11 16:10:13 +00:00
function removeEnsUsername(chainId, ensUsername) {
2022-12-06 21:12:09 +00:00
if(!root.ensUsernamesModule)
return ""
2023-01-11 16:10:13 +00:00
return ensUsernamesModule.removeEnsUsername(chainId, ensUsername)
2022-12-06 21:12:09 +00:00
}
}