isCompressedPubKey moved from Utils to UtilsStore

This commit is contained in:
Michał Cieślak 2024-10-21 15:40:14 +02:00 committed by Michał
parent 356275f2b3
commit a76ae0ade6
4 changed files with 10 additions and 16 deletions

View File

@ -99,13 +99,10 @@ QtObject {
return root.communitiesModuleInst.getCommunityPublicKeyFromPrivateKey(privateKey);
}
function requestCommunityInfo(communityKey, shardCluster, shardIndex, importing = false) {
const publicKey = Utils.isCompressedPubKey(communityKey)
? Utils.changeCommunityKeyCompression(communityKey)
: communityKey
function requestCommunityInfo(communityPubKey, shardCluster, shardIndex, importing = false) {
if (importing)
root.mainModuleInst.setCommunityIdToSpectate(publicKey)
root.communitiesModuleInst.requestCommunityInfo(publicKey, shardCluster, shardIndex, importing)
root.mainModuleInst.setCommunityIdToSpectate(communityPubKey)
root.communitiesModuleInst.requestCommunityInfo(communityPubKey, shardCluster, shardIndex, importing)
}
property var communitiesList: communitiesModuleInst.model
@ -119,12 +116,9 @@ QtObject {
root.communitiesModuleInst.prepareTokenModelForCommunity(publicKey);
}
function getCommunityDetails(communityId) {
const publicKey = Utils.isCompressedPubKey(communityId)
? Utils.changeCommunityKeyCompression(communityId)
: communityId
function getCommunityDetails(communityPubKey) {
try {
const communityJson = root.communitiesList.getSectionByIdJson(publicKey)
const communityJson = root.communitiesList.getSectionByIdJson(communityPubKey)
if (!!communityJson)
return JSON.parse(communityJson)
} catch (e) {

View File

@ -58,7 +58,7 @@ StatusDialog {
}
if (!root.utilsStore.isCommunityPublicKey(inputKey))
return ""
if (!Utils.isCompressedPubKey(inputKey))
if (!root.utilsStore.isCompressedPubKey(inputKey))
return inputKey
return Utils.changeCommunityKeyCompression(inputKey)
}

View File

@ -20,4 +20,8 @@ QtObject {
return (Utils.startsWith0x(value) && Utils.isHex(value) && value.length === Constants.communityIdLength)
|| d.globalUtilsInst.isCompressedPubKey(value)
}
function isCompressedPubKey(pubKey) {
return d.globalUtilsInst.isCompressedPubKey(pubKey)
}
}

View File

@ -725,10 +725,6 @@ QtObject {
return (startsWith0x(value) && isHex(value) && value.length === 132) || globalUtilsInst.isCompressedPubKey(value)
}
function isCompressedPubKey(pubKey) {
return globalUtilsInst.isCompressedPubKey(pubKey)
}
function isAlias(name) {
return globalUtilsInst.isAlias(name)
}