2022-01-17 08:56:44 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import utils 1.0
|
2023-01-11 16:10:13 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
2022-01-17 08:56:44 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-14 09:20:53 +00:00
|
|
|
property string pubkey: !!Global.userProfile? Global.userProfile.pubKey : ""
|
|
|
|
property string icon: !!Global.userProfile? Global.userProfile.icon : ""
|
|
|
|
property string preferredUsername: !!Global.userProfile? Global.userProfile.preferredName : ""
|
2024-01-08 14:47:07 +00:00
|
|
|
readonly property string chainId: mainModule.appNetworkId
|
2022-01-17 08:56:44 +00:00
|
|
|
|
2023-02-14 09:20:53 +00:00
|
|
|
property string username: !!Global.userProfile? Global.userProfile.username : ""
|
2022-01-17 08:56:44 +00:00
|
|
|
|
|
|
|
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
|
2022-12-06 20:42:18 +00:00
|
|
|
return ensUsernamesModule.numOfPendingEnsUsernames()
|
2022-01-17 08:56:44 +00:00
|
|
|
}
|
|
|
|
|
2023-01-11 16:10:13 +00:00
|
|
|
function ensDetails(chainId, ensUsername) {
|
2022-01-17 08:56:44 +00:00
|
|
|
if(!root.ensUsernamesModule)
|
|
|
|
return ""
|
2023-01-11 16:10:13 +00:00
|
|
|
ensUsernamesModule.fetchDetailsForEnsUsername(chainId, ensUsername)
|
2022-01-17 08:56:44 +00:00
|
|
|
}
|
|
|
|
|
2023-01-11 16:10:13 +00:00
|
|
|
function setPubKeyGasEstimate(chainId, ensUsername, address) {
|
2022-01-17 08:56:44 +00:00
|
|
|
if(!root.ensUsernamesModule)
|
|
|
|
return 0
|
2023-01-11 16:10:13 +00:00
|
|
|
return ensUsernamesModule.setPubKeyGasEstimate(chainId, ensUsername, address)
|
2022-01-17 08:56:44 +00:00
|
|
|
}
|
|
|
|
|
2023-01-11 16:10:13 +00:00
|
|
|
function authenticateAndSetPubKey(chainId, ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, eip1559Enabled) {
|
2022-01-17 08:56:44 +00:00
|
|
|
if(!root.ensUsernamesModule)
|
|
|
|
return ""
|
2023-01-11 16:10:13 +00:00
|
|
|
return ensUsernamesModule.authenticateAndSetPubKey(chainId, ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, eip1559Enabled)
|
2022-01-17 08:56:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
2022-01-17 08:56:44 +00:00
|
|
|
if(!root.ensUsernamesModule)
|
|
|
|
return ""
|
2023-01-11 16:10:13 +00:00
|
|
|
return ensUsernamesModule.authenticateAndReleaseEns(chainId, ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, eip1559Enabled)
|
2022-01-17 08:56:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
2022-01-17 08:56:44 +00:00
|
|
|
if(!root.ensUsernamesModule)
|
2022-10-17 10:17:25 +00:00
|
|
|
return
|
2023-01-11 16:10:13 +00:00
|
|
|
ensUsernamesModule.authenticateAndRegisterEns(chainId, ensUsername, address, gasLimit, gasPrice, tipLimit, overallLimit, eip1559Enabled)
|
2022-01-17 08:56:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2024-02-05 16:44:49 +00:00
|
|
|
function getStatusTokenKey() {
|
2022-01-17 08:56:44 +00:00
|
|
|
if(!root.ensUsernamesModule)
|
|
|
|
return ""
|
2024-02-05 16:44:49 +00:00
|
|
|
return ensUsernamesModule.getStatusTokenKey()
|
2022-01-17 08:56:44 +00:00
|
|
|
}
|
2022-04-19 11:13:57 +00:00
|
|
|
|
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
|
|
|
}
|
2022-01-17 08:56:44 +00:00
|
|
|
}
|
|
|
|
|