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 {
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
}
}

View File

@ -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,

View File

@ -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 {

View File

@ -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)

View File

@ -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)
}
}

View File

@ -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")
}