From a76ae0ade66a2fa32c7a688a0a4e69064a4bc2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Mon, 21 Oct 2024 15:40:14 +0200 Subject: [PATCH] isCompressedPubKey moved from Utils to UtilsStore --- .../Communities/stores/CommunitiesStore.qml | 16 +++++----------- .../shared/popups/ImportCommunityPopup.qml | 2 +- ui/imports/shared/stores/UtilsStore.qml | 4 ++++ ui/imports/utils/Utils.qml | 4 ---- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/ui/app/AppLayouts/Communities/stores/CommunitiesStore.qml b/ui/app/AppLayouts/Communities/stores/CommunitiesStore.qml index aac9cb3498..6d52c6258d 100644 --- a/ui/app/AppLayouts/Communities/stores/CommunitiesStore.qml +++ b/ui/app/AppLayouts/Communities/stores/CommunitiesStore.qml @@ -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) { diff --git a/ui/imports/shared/popups/ImportCommunityPopup.qml b/ui/imports/shared/popups/ImportCommunityPopup.qml index b8d67d2d49..8c43e8d76f 100644 --- a/ui/imports/shared/popups/ImportCommunityPopup.qml +++ b/ui/imports/shared/popups/ImportCommunityPopup.qml @@ -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) } diff --git a/ui/imports/shared/stores/UtilsStore.qml b/ui/imports/shared/stores/UtilsStore.qml index f178d93fb3..166446a22a 100644 --- a/ui/imports/shared/stores/UtilsStore.qml +++ b/ui/imports/shared/stores/UtilsStore.qml @@ -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) + } } diff --git a/ui/imports/utils/Utils.qml b/ui/imports/utils/Utils.qml index 04d0f95550..f1b21f1ac2 100644 --- a/ui/imports/utils/Utils.qml +++ b/ui/imports/utils/Utils.qml @@ -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) }