feat(MintToken): Use `contractUniqueKey` instead of index

Updated minting flow to use `contractUniqueKey` instead of `index`.

Closes #10765
This commit is contained in:
Noelia 2023-05-26 17:00:51 +02:00 committed by Noelia
parent 86a0e8b9ec
commit 8ae2d29a1c
6 changed files with 33 additions and 30 deletions

View File

@ -115,20 +115,20 @@ SplitView {
RadioButton { RadioButton {
id: mintingInProgress id: mintingInProgress
text: "In progress" text: "In progress"
onCheckedChanged: if(checked) view.deployState = Constants.BackendProcessState.InProgress onCheckedChanged: if(checked) view.deployState = Constants.ContractTransactionStatus.InProgress
} }
RadioButton { RadioButton {
id: mintingFailed id: mintingFailed
text: "Failed" text: "Failed"
onCheckedChanged: if(checked) view.deployState = Constants.BackendProcessState.Failed onCheckedChanged: if(checked) view.deployState = Constants.ContractTransactionStatus.Failed
} }
RadioButton { RadioButton {
id: mintingCompleted id: mintingCompleted
text: "Completed" text: "Completed"
checked: true checked: true
onCheckedChanged: if(checked) view.deployState = Constants.BackendProcessState.Completed onCheckedChanged: if(checked) view.deployState = Constants.ContractTransactionStatus.Completed
} }
} }

View File

@ -33,6 +33,7 @@ QtObject {
Component.onCompleted: append([ Component.onCompleted: append([
{ {
contractUniqueKey: "0x1726362343",
tokenType: 2, tokenType: 2,
name: "SuperRare artwork", name: "SuperRare artwork",
image: ModelsData.banners.superRare, image: ModelsData.banners.superRare,
@ -50,6 +51,7 @@ QtObject {
accountName: "Status Account" accountName: "Status Account"
}, },
{ {
contractUniqueKey: "0x847843",
tokenType: 2, tokenType: 2,
name: "Kitty artwork", name: "Kitty artwork",
image: ModelsData.collectibles.kitty1Big, image: ModelsData.collectibles.kitty1Big,
@ -67,6 +69,7 @@ QtObject {
accountName: "Status New Account" accountName: "Status New Account"
}, },
{ {
contractUniqueKey: "0x1234525",
tokenType: 2, tokenType: 2,
name: "More artwork", name: "More artwork",
image: ModelsData.banners.status, image: ModelsData.banners.status,
@ -84,6 +87,7 @@ QtObject {
accountName: "Other Account" accountName: "Other Account"
}, },
{ {
contractUniqueKey: "0x38576852",
tokenType: 2, tokenType: 2,
name: "Crypto Punks artwork", name: "Crypto Punks artwork",
image: ModelsData.banners.cryptPunks, image: ModelsData.banners.cryptPunks,
@ -108,6 +112,7 @@ QtObject {
Component.onCompleted: append([ Component.onCompleted: append([
{ {
contractUniqueKey: "0x38745623865",
tokenType: 1, tokenType: 1,
name: "Unisocks", name: "Unisocks",
image: ModelsData.assets.socks, image: ModelsData.assets.socks,
@ -124,6 +129,7 @@ QtObject {
accountName: "Status SNT Account" accountName: "Status SNT Account"
}, },
{ {
contractUniqueKey: "0x872364871623",
tokenType: 1, tokenType: 1,
name: "Dai", name: "Dai",
image: ModelsData.assets.dai, image: ModelsData.assets.dai,

View File

@ -68,17 +68,17 @@ SettingsPageLayout {
signal signMintTransactionOpened(int chainId, string accountAddress) signal signMintTransactionOpened(int chainId, string accountAddress)
signal signSelfDestructTransactionOpened(var selfDestructTokensList, // [key , amount] signal signSelfDestructTransactionOpened(var selfDestructTokensList, // [key , amount]
string contractUniqueKey) string tokenKey)
signal remoteSelfDestructCollectibles(var selfDestructTokensList, // [key , amount] signal remoteSelfDestructCollectibles(var selfDestructTokensList, // [key , amount]
string contractUniqueKey) string tokenKey)
signal signBurnTransactionOpened(int chainId) signal signBurnTransactionOpened(int chainId)
signal burnCollectibles(string tokenKey, signal burnCollectibles(string tokenKey,
int amount) int amount)
signal airdropCollectible(string key) signal airdropCollectible(string tokenKey)
function setFeeLoading() { function setFeeLoading() {
root.isFeeLoading = true root.isFeeLoading = true
@ -114,7 +114,7 @@ SettingsPageLayout {
property var selfDestructTokensList property var selfDestructTokensList
property bool selfDestruct property bool selfDestruct
property bool burnEnabled property bool burnEnabled
//property string tokenKey -- TODO: Backend key role property string tokenKey
property int burnAmount property int burnAmount
property int remainingTokens property int remainingTokens
property url artworkSource property url artworkSource
@ -234,7 +234,7 @@ SettingsPageLayout {
Layout.preferredWidth: root.viewWidth Layout.preferredWidth: root.viewWidth
Layout.fillHeight: true Layout.fillHeight: true
currentIndex: optionsTab.currentItem == collectiblesTab ? 0 : 1 currentIndex: optionsTab.currentItem === collectiblesTab ? 0 : 1
CommunityNewTokenView { CommunityNewTokenView {
viewWidth: root.viewWidth viewWidth: root.viewWidth
@ -438,9 +438,9 @@ SettingsPageLayout {
function signTransaction() { function signTransaction() {
root.setFeeLoading() root.setFeeLoading()
if(signTransactionPopup.isRemotelyDestructTransaction) { if(signTransactionPopup.isRemotelyDestructTransaction) {
root.remoteSelfDestructCollectibles(d.selfDestructTokensList, d.contractUniqueKey) root.remoteSelfDestructCollectibles(d.selfDestructTokensList, d.tokenKey)
} else { } else {
root.burnCollectibles("TODO - KEY"/*d.tokenKey*/, d.burnAmount) root.burnCollectibles(d.tokenKey, d.burnAmount)
} }
footerPanel.closePopups() footerPanel.closePopups()
@ -457,7 +457,7 @@ SettingsPageLayout {
onOpened: { onOpened: {
root.setFeeLoading() root.setFeeLoading()
signTransactionPopup.isRemotelyDestructTransaction ? root.signSelfDestructTransactionOpened(d.selfDestructTokensList, d.contractUniqueKey) : signTransactionPopup.isRemotelyDestructTransaction ? root.signSelfDestructTransactionOpened(d.selfDestructTokensList, d.tokenKey) :
root.signBurnTransactionOpened(d.chainId) root.signBurnTransactionOpened(d.chainId)
} }
onCancelClicked: close() onCancelClicked: close()
@ -490,15 +490,14 @@ SettingsPageLayout {
onItemClicked: { onItemClicked: {
d.accountAddress = accountAddress d.accountAddress = accountAddress
d.chainId = chainId d.chainId = chainId
d.contractUniqueKey = contractUniqueKey
d.chainName = chainName d.chainName = chainName
d.accountName = accountName d.accountName = accountName
//d.tokenKey = key // TODO: Backend key role d.tokenKey = contractUniqueKey
stackManager.push(d.tokenViewState, stackManager.push(d.tokenViewState,
tokenView, tokenView,
{ {
preview: false, preview: false,
index contractUniqueKey
}, },
StackView.Immediate) StackView.Immediate)
} }
@ -511,7 +510,7 @@ SettingsPageLayout {
CommunityTokenView { CommunityTokenView {
id: view id: view
property int index // TODO: Update it to key when model has role key implemented property string contractUniqueKey
viewWidth: root.viewWidth viewWidth: root.viewWidth
@ -562,12 +561,11 @@ SettingsPageLayout {
Instantiator { Instantiator {
id: instantiator id: instantiator
model: SortFilterProxyModel { model: SortFilterProxyModel {
sourceModel: root.tokensModel sourceModel: root.tokensModel
filters: IndexFilter { filters: ValueFilter {
minimumIndex: view.index roleName: "contractUniqueKey"
maximumIndex: view.index value: view.contractUniqueKey
} }
} }
delegate: QtObject { delegate: QtObject {

View File

@ -334,11 +334,11 @@ StatusSectionLayout {
accountName, accountName,
artworkCropRect) artworkCropRect)
} }
onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(selfDestructTokensList, contractUniqueKey) onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(selfDestructTokensList, tokenKey)
onRemoteSelfDestructCollectibles: { onRemoteSelfDestructCollectibles: {
communityTokensStore.remoteSelfDestructCollectibles(root.community.id, communityTokensStore.remoteSelfDestructCollectibles(root.community.id,
selfDestructTokensList, selfDestructTokensList,
contractUniqueKey) tokenKey)
} }
onSignBurnTransactionOpened: communityTokensStore.computeBurnFee(chainId) onSignBurnTransactionOpened: communityTokensStore.computeBurnFee(chainId)
onBurnCollectibles: communityTokensStore.burnCollectibles(tokenKey, amount) onBurnCollectibles: communityTokensStore.burnCollectibles(tokenKey, amount)

View File

@ -17,9 +17,8 @@ StatusScrollView {
property int viewWidth: 560 // by design property int viewWidth: 560 // by design
property var model property var model
signal itemClicked(int index, signal itemClicked(string contractUniqueKey,
int chainId, int chainId,
string contractUniqueKey,
string chainName, string chainName,
string accountName, string accountName,
string accountAddress) string accountAddress)
@ -97,7 +96,7 @@ StatusScrollView {
color: Theme.palette.baseColor1 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 isLoading: false
navigationIconVisible: true 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)
} }
} }

View File

@ -62,12 +62,12 @@ QtObject {
communityTokensModuleInst.computeDeployFee(chainId, accountAddress) communityTokensModuleInst.computeDeployFee(chainId, accountAddress)
} }
function computeSelfDestructFee(selfDestructTokensList, contractUniqueKey) { function computeSelfDestructFee(selfDestructTokensList, tokenKey) {
communityTokensModuleInst.computeSelfDestructFee(JSON.stringify(selfDestructTokensList), contractUniqueKey) communityTokensModuleInst.computeSelfDestructFee(JSON.stringify(selfDestructTokensList), tokenKey)
} }
function remoteSelfDestructCollectibles(communityId, selfDestructTokensList, contractUniqueKey) { function remoteSelfDestructCollectibles(communityId, selfDestructTokensList, tokenKey) {
communityTokensModuleInst.selfDestructCollectibles(communityId, JSON.stringify(selfDestructTokensList), contractUniqueKey) communityTokensModuleInst.selfDestructCollectibles(communityId, JSON.stringify(selfDestructTokensList), tokenKey)
} }
// Burn: // Burn: