chore(CommunityTokensMinting): TokenObject - property-by-property assignment removed, retry flow simplified
Closes: #11050
This commit is contained in:
parent
8cd6de5013
commit
9f262a648c
|
@ -48,29 +48,5 @@ QtObject {
|
||||||
property int remotelyDestructState: Constants.ContractTransactionStatus.None
|
property int remotelyDestructState: Constants.ContractTransactionStatus.None
|
||||||
|
|
||||||
// Asset-specific properties:
|
// Asset-specific properties:
|
||||||
property int decimals: 2 // Default value
|
property int decimals: 2
|
||||||
|
|
||||||
function copyToken(tokenObject) {
|
|
||||||
type = tokenObject.type
|
|
||||||
key = tokenObject.key
|
|
||||||
name = tokenObject.name
|
|
||||||
symbol = tokenObject.symbol
|
|
||||||
description = tokenObject.description
|
|
||||||
infiniteSupply = tokenObject.infiniteSupply
|
|
||||||
supply = tokenObject.supply
|
|
||||||
remainingTokens = tokenObject.remainingTokens
|
|
||||||
artworkSource = tokenObject.artworkSource
|
|
||||||
artworkCropRect = tokenObject.artworkCropRect
|
|
||||||
chainId = tokenObject.chainId
|
|
||||||
chainName = tokenObject.chainName
|
|
||||||
chainIcon = tokenObject.chainIcon
|
|
||||||
accountAddress = tokenObject.accountAddress
|
|
||||||
accountName = tokenObject.accountName
|
|
||||||
deployState = tokenObject.deployState
|
|
||||||
burnState = tokenObject.burnState
|
|
||||||
transferable = tokenObject.transferable
|
|
||||||
remotelyDestruct = tokenObject.remotelyDestruct
|
|
||||||
remotelyDestructState = tokenObject.remotelyDestructState
|
|
||||||
decimals = tokenObject.decimals
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,12 +119,6 @@ SettingsPageLayout {
|
||||||
onInitialItemChanged: updateInitialStackView()
|
onInitialItemChanged: updateInitialStackView()
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: temp_
|
|
||||||
|
|
||||||
readonly property TokenObject token: TokenObject {}
|
|
||||||
}
|
|
||||||
|
|
||||||
secondaryHeaderButton.type: StatusBaseButton.Type.Danger
|
secondaryHeaderButton.type: StatusBaseButton.Type.Danger
|
||||||
|
|
||||||
content: StackView {
|
content: StackView {
|
||||||
|
@ -167,6 +161,12 @@ SettingsPageLayout {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: tokenObjectComponent
|
||||||
|
|
||||||
|
TokenObject {}
|
||||||
|
}
|
||||||
|
|
||||||
onPrimaryHeaderButtonClicked: {
|
onPrimaryHeaderButtonClicked: {
|
||||||
if(root.state == d.initialViewState) {
|
if(root.state == d.initialViewState) {
|
||||||
// Then move on to the new token view, with the specific tab selected:
|
// Then move on to the new token view, with the specific tab selected:
|
||||||
|
@ -183,28 +183,30 @@ SettingsPageLayout {
|
||||||
console.warn("Mint Token Settings - Trying to retry undefined token object.")
|
console.warn("Mint Token Settings - Trying to retry undefined token object.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const isAssetView = d.currentToken.type === TokenObject.Type.Asset
|
||||||
|
|
||||||
// Copy current data:
|
// copy TokenObject
|
||||||
temp_.token.copyToken(d.currentToken)
|
const tokenObject = tokenObjectComponent.createObject(
|
||||||
|
null, d.currentToken)
|
||||||
// Update to point to new instance
|
|
||||||
d.currentToken = temp_.token
|
|
||||||
|
|
||||||
// Reset the stack:
|
// Reset the stack:
|
||||||
root.resetNavigation(true)
|
root.resetNavigation(isAssetView)
|
||||||
|
|
||||||
// Then move on to the new token view, but asset pre-filled:
|
// Then move on to the new token view, but token pre-filled:
|
||||||
const properties = {
|
const properties = {
|
||||||
isAssetView: d.currentToken.type === TokenObject.Type.Asset,
|
isAssetView,
|
||||||
referenceName: d.currentToken.name,
|
referenceName: tokenObject.name,
|
||||||
referenceSymbol: d.currentToken.symbol,
|
referenceSymbol: tokenObject.symbol,
|
||||||
validationMode: StatusInput.ValidationMode.Always,
|
validationMode: StatusInput.ValidationMode.Always,
|
||||||
asset: d.currentToken,
|
[isAssetView ? "asset" : "collectible"]: tokenObject
|
||||||
collectible: d.currentToken
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stackManager.push(d.newTokenViewState, newTokenView, properties,
|
const tokenView = stackManager.push(d.newTokenViewState,
|
||||||
|
newTokenView, properties,
|
||||||
StackView.Immediate)
|
StackView.Immediate)
|
||||||
|
|
||||||
|
// cleanup dynamically created TokenObject
|
||||||
|
tokenView.Component.destruction.connect(() => tokenObject.destroy())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue