diff --git a/storybook/pages/CommunityTokenViewPage.qml b/storybook/pages/CommunityTokenViewPage.qml index c61007fe6b..8b6cd68a7d 100644 --- a/storybook/pages/CommunityTokenViewPage.qml +++ b/storybook/pages/CommunityTokenViewPage.qml @@ -115,20 +115,20 @@ SplitView { RadioButton { id: mintingInProgress text: "In progress" - onCheckedChanged: if(checked) view.deployState = Constants.BackendProcessState.InProgress + onCheckedChanged: if(checked) view.deployState = Constants.ContractTransactionStatus.InProgress } RadioButton { id: mintingFailed text: "Failed" - onCheckedChanged: if(checked) view.deployState = Constants.BackendProcessState.Failed + onCheckedChanged: if(checked) view.deployState = Constants.ContractTransactionStatus.Failed } RadioButton { id: mintingCompleted text: "Completed" checked: true - onCheckedChanged: if(checked) view.deployState = Constants.BackendProcessState.Completed + onCheckedChanged: if(checked) view.deployState = Constants.ContractTransactionStatus.Completed } } diff --git a/storybook/src/Models/MintedTokensModel.qml b/storybook/src/Models/MintedTokensModel.qml index c4b9d9bc46..33f1716f4d 100644 --- a/storybook/src/Models/MintedTokensModel.qml +++ b/storybook/src/Models/MintedTokensModel.qml @@ -33,6 +33,7 @@ QtObject { Component.onCompleted: append([ { + contractUniqueKey: "0x1726362343", tokenType: 2, name: "SuperRare artwork", image: ModelsData.banners.superRare, @@ -50,6 +51,7 @@ QtObject { accountName: "Status Account" }, { + contractUniqueKey: "0x847843", tokenType: 2, name: "Kitty artwork", image: ModelsData.collectibles.kitty1Big, @@ -67,6 +69,7 @@ QtObject { accountName: "Status New Account" }, { + contractUniqueKey: "0x1234525", tokenType: 2, name: "More artwork", image: ModelsData.banners.status, @@ -84,6 +87,7 @@ QtObject { accountName: "Other Account" }, { + contractUniqueKey: "0x38576852", tokenType: 2, name: "Crypto Punks artwork", image: ModelsData.banners.cryptPunks, @@ -108,6 +112,7 @@ QtObject { Component.onCompleted: append([ { + contractUniqueKey: "0x38745623865", tokenType: 1, name: "Unisocks", image: ModelsData.assets.socks, @@ -124,6 +129,7 @@ QtObject { accountName: "Status SNT Account" }, { + contractUniqueKey: "0x872364871623", tokenType: 1, name: "Dai", image: ModelsData.assets.dai, diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml index e88e8821f7..6f2e47baca 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml @@ -68,17 +68,17 @@ SettingsPageLayout { signal signMintTransactionOpened(int chainId, string accountAddress) signal signSelfDestructTransactionOpened(var selfDestructTokensList, // [key , amount] - string contractUniqueKey) + string tokenKey) signal remoteSelfDestructCollectibles(var selfDestructTokensList, // [key , amount] - string contractUniqueKey) + string tokenKey) signal signBurnTransactionOpened(int chainId) signal burnCollectibles(string tokenKey, int amount) - signal airdropCollectible(string key) + signal airdropCollectible(string tokenKey) function setFeeLoading() { root.isFeeLoading = true @@ -114,7 +114,7 @@ SettingsPageLayout { property var selfDestructTokensList property bool selfDestruct property bool burnEnabled - //property string tokenKey -- TODO: Backend key role + property string tokenKey property int burnAmount property int remainingTokens property url artworkSource @@ -234,7 +234,7 @@ SettingsPageLayout { Layout.preferredWidth: root.viewWidth Layout.fillHeight: true - currentIndex: optionsTab.currentItem == collectiblesTab ? 0 : 1 + currentIndex: optionsTab.currentItem === collectiblesTab ? 0 : 1 CommunityNewTokenView { viewWidth: root.viewWidth @@ -438,9 +438,9 @@ SettingsPageLayout { function signTransaction() { root.setFeeLoading() if(signTransactionPopup.isRemotelyDestructTransaction) { - root.remoteSelfDestructCollectibles(d.selfDestructTokensList, d.contractUniqueKey) + root.remoteSelfDestructCollectibles(d.selfDestructTokensList, d.tokenKey) } else { - root.burnCollectibles("TODO - KEY"/*d.tokenKey*/, d.burnAmount) + root.burnCollectibles(d.tokenKey, d.burnAmount) } footerPanel.closePopups() @@ -457,7 +457,7 @@ SettingsPageLayout { onOpened: { root.setFeeLoading() - signTransactionPopup.isRemotelyDestructTransaction ? root.signSelfDestructTransactionOpened(d.selfDestructTokensList, d.contractUniqueKey) : + signTransactionPopup.isRemotelyDestructTransaction ? root.signSelfDestructTransactionOpened(d.selfDestructTokensList, d.tokenKey) : root.signBurnTransactionOpened(d.chainId) } onCancelClicked: close() @@ -490,15 +490,14 @@ SettingsPageLayout { onItemClicked: { d.accountAddress = accountAddress d.chainId = chainId - d.contractUniqueKey = contractUniqueKey d.chainName = chainName d.accountName = accountName - //d.tokenKey = key // TODO: Backend key role + d.tokenKey = contractUniqueKey stackManager.push(d.tokenViewState, tokenView, { preview: false, - index + contractUniqueKey }, StackView.Immediate) } @@ -511,7 +510,7 @@ SettingsPageLayout { CommunityTokenView { id: view - property int index // TODO: Update it to key when model has role key implemented + property string contractUniqueKey viewWidth: root.viewWidth @@ -562,12 +561,11 @@ SettingsPageLayout { Instantiator { id: instantiator - model: SortFilterProxyModel { sourceModel: root.tokensModel - filters: IndexFilter { - minimumIndex: view.index - maximumIndex: view.index + filters: ValueFilter { + roleName: "contractUniqueKey" + value: view.contractUniqueKey } } delegate: QtObject { diff --git a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml index bd48dc615c..4c214c0eea 100644 --- a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml @@ -334,11 +334,11 @@ StatusSectionLayout { accountName, artworkCropRect) } - onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(selfDestructTokensList, contractUniqueKey) + onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(selfDestructTokensList, tokenKey) onRemoteSelfDestructCollectibles: { communityTokensStore.remoteSelfDestructCollectibles(root.community.id, selfDestructTokensList, - contractUniqueKey) + tokenKey) } onSignBurnTransactionOpened: communityTokensStore.computeBurnFee(chainId) onBurnCollectibles: communityTokensStore.burnCollectibles(tokenKey, amount) diff --git a/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml b/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml index 207625dbd0..dc22da6313 100644 --- a/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml +++ b/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml @@ -17,9 +17,8 @@ StatusScrollView { property int viewWidth: 560 // by design property var model - signal itemClicked(int index, + signal itemClicked(string contractUniqueKey, int chainId, - string contractUniqueKey, string chainName, string accountName, string accountAddress) @@ -97,7 +96,7 @@ StatusScrollView { color: Theme.palette.baseColor1 } ] - onClicked: root.itemClicked(model.index, model.chainId, model.chainName, model.accountName, model.address) // TODO: Replace to model.key when role exists in backend + onClicked: root.itemClicked(model.contractUniqueKey, model.chainId, model.chainName, model.accountName, model.address) } } @@ -147,7 +146,7 @@ StatusScrollView { isLoading: false navigationIconVisible: true - onClicked: root.itemClicked(model.index, model.chainId, model.contractUniqueKey, model.chainName, model.accountName, model.address) + onClicked: root.itemClicked(model.contractUniqueKey, model.chainId, model.chainName, model.accountName, model.address) } } diff --git a/ui/imports/shared/stores/CommunityTokensStore.qml b/ui/imports/shared/stores/CommunityTokensStore.qml index 124c7cfd9c..b8e0f695b0 100644 --- a/ui/imports/shared/stores/CommunityTokensStore.qml +++ b/ui/imports/shared/stores/CommunityTokensStore.qml @@ -62,12 +62,12 @@ QtObject { communityTokensModuleInst.computeDeployFee(chainId, accountAddress) } - function computeSelfDestructFee(selfDestructTokensList, contractUniqueKey) { - communityTokensModuleInst.computeSelfDestructFee(JSON.stringify(selfDestructTokensList), contractUniqueKey) + function computeSelfDestructFee(selfDestructTokensList, tokenKey) { + communityTokensModuleInst.computeSelfDestructFee(JSON.stringify(selfDestructTokensList), tokenKey) } - function remoteSelfDestructCollectibles(communityId, selfDestructTokensList, contractUniqueKey) { - communityTokensModuleInst.selfDestructCollectibles(communityId, JSON.stringify(selfDestructTokensList), contractUniqueKey) + function remoteSelfDestructCollectibles(communityId, selfDestructTokensList, tokenKey) { + communityTokensModuleInst.selfDestructCollectibles(communityId, JSON.stringify(selfDestructTokensList), tokenKey) } // Burn: @@ -77,7 +77,7 @@ QtObject { console.warn("TODO: Compute burn fee backend") } - function burnCollectibles(tokenKey,burnAmount) { + function burnCollectibles(tokenKey, burnAmount) { // TODO BACKEND console.warn("TODO: Burn collectible backend") }