feat(MintToken): Self destruct flow integration
- Enabled self destruct option. - Added self destruct flow. - Created needed methods in CommunityTokensStore. Closes #10051
This commit is contained in:
parent
5944b529ad
commit
99a9f2ace0
|
@ -57,6 +57,13 @@ SettingsPageLayout {
|
|||
root.errorText = ""
|
||||
}
|
||||
|
||||
signal remoteSelfDestructCollectibles(var holdersModel,
|
||||
int chainId,
|
||||
string accountName,
|
||||
string accountAddress)
|
||||
|
||||
signal signSelfDestructTransactionOpened(int chainId)
|
||||
|
||||
function navigateBack() {
|
||||
stackManager.pop(StackView.Immediate)
|
||||
}
|
||||
|
@ -75,8 +82,11 @@ SettingsPageLayout {
|
|||
readonly property string backButtonText: qsTr("Back")
|
||||
readonly property string backTokensText: qsTr("Tokens")
|
||||
|
||||
property bool preview: false
|
||||
property string accountAddress
|
||||
property string accountName
|
||||
property int chainId
|
||||
property string chainName
|
||||
|
||||
readonly property var initialItem: (root.tokensModel && root.tokensModel.count > 0) ? mintedTokensView : welcomeView
|
||||
onInitialItemChanged: updateInitialStackView()
|
||||
|
||||
|
@ -126,7 +136,6 @@ SettingsPageLayout {
|
|||
PropertyChanges {target: root; headerButtonVisible: false}
|
||||
PropertyChanges {target: root; headerWidth: 0}
|
||||
PropertyChanges {target: root; footer: mintTokenFooter}
|
||||
PropertyChanges {target: d; preview: false}
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -250,10 +259,64 @@ SettingsPageLayout {
|
|||
id: mintTokenFooter
|
||||
|
||||
MintTokensFooterPanel {
|
||||
id: footerPanel
|
||||
|
||||
function closePopups() {
|
||||
remoteSelfdestructPopup.close()
|
||||
alertPopup.close()
|
||||
signSelfDestructPopup.close()
|
||||
}
|
||||
|
||||
airdropEnabled: false
|
||||
retailEnabled: false
|
||||
remotelySelfDestructEnabled: false
|
||||
remotelySelfDestructEnabled: true
|
||||
burnEnabled: false
|
||||
|
||||
onRemotelySelfDestructClicked: remoteSelfdestructPopup.open()
|
||||
|
||||
RemoteSelfDestructPopup {
|
||||
id: remoteSelfdestructPopup
|
||||
|
||||
collectibleName: root.title
|
||||
model: root.holdersModel
|
||||
|
||||
onSelfDestructClicked: {
|
||||
alertPopup.tokenCount = tokenCount
|
||||
alertPopup.open()
|
||||
}
|
||||
}
|
||||
|
||||
SelfDestructAlertPopup {
|
||||
id: alertPopup
|
||||
|
||||
onSelfDestructClicked: signSelfDestructPopup.open()
|
||||
}
|
||||
|
||||
SignMintTokenTransactionPopup {
|
||||
id: signSelfDestructPopup
|
||||
|
||||
function signSelfRemoteDestructTransaction() {
|
||||
root.isFeeLoading = true
|
||||
root.feeText = ""
|
||||
root.remoteSelfDestructCollectibles(root.holdersModel,
|
||||
d.chainId,
|
||||
d.accountName,
|
||||
d.accountAddress)
|
||||
|
||||
footerPanel.closePopups()
|
||||
}
|
||||
|
||||
title: qsTr("Sign transaction - Self-destruct %1 tokens").arg(root.title)
|
||||
collectibleName: root.title
|
||||
accountName: d.accountName
|
||||
networkName: d.chainName
|
||||
feeText: root.feeText
|
||||
isFeeLoading: root.isFeeLoading
|
||||
|
||||
onOpened: root.signSelfDestructTransactionOpened(d.chainId)
|
||||
onCancelClicked: close()
|
||||
onSignTransactionClicked: signSelfRemoteDestructTransaction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,6 +327,10 @@ SettingsPageLayout {
|
|||
viewWidth: root.viewWidth
|
||||
model: root.tokensModel
|
||||
onItemClicked: {
|
||||
d.accountAddress = accountAddress
|
||||
d.chainId = chainId
|
||||
d.chainName = chainName
|
||||
d.accountName = accountName
|
||||
stackManager.push(d.collectibleViewState,
|
||||
collectibleView,
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@ Control {
|
|||
id: retailButton
|
||||
|
||||
icon.name: "token-sale"
|
||||
visible: false // TODO: Milestone 14
|
||||
text: qsTr("Retail")
|
||||
|
||||
onClicked: root.retailClicked()
|
||||
|
@ -61,13 +62,14 @@ Control {
|
|||
type: StatusBaseButton.Type.Danger
|
||||
borderColor: "transparent"
|
||||
|
||||
onClicked: root.remoteSelfDestructClicked()
|
||||
onClicked: root.remotelySelfDestructClicked()
|
||||
}
|
||||
|
||||
StatusFlatButton {
|
||||
id: burnButton
|
||||
|
||||
icon.name: "delete"
|
||||
visible: false // Post MVP
|
||||
text: qsTr("Burn")
|
||||
type: StatusBaseButton.Type.Danger
|
||||
borderColor: "transparent"
|
||||
|
|
|
@ -56,6 +56,9 @@ QtObject {
|
|||
])
|
||||
}
|
||||
|
||||
signal deployFeeUpdated(var ethCurrency, var fiatCurrency, int error)
|
||||
signal selfDestructFeeUpdated(string value) // TO BE REMOVED
|
||||
|
||||
// Minting tokens:
|
||||
function deployCollectible(communityId, accountAddress, name, symbol, description, supply,
|
||||
infiniteSupply, transferable, selfDestruct, chainId, artworkSource, accountName)
|
||||
|
@ -65,8 +68,6 @@ QtObject {
|
|||
infiniteSupply, transferable, selfDestruct, chainId, artworkSource)
|
||||
}
|
||||
|
||||
signal deployFeeUpdated(var ethCurrency, var fiatCurrency, int error)
|
||||
|
||||
readonly property Connections connections: Connections {
|
||||
target: communityTokensModuleInst
|
||||
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
||||
|
@ -78,6 +79,17 @@ QtObject {
|
|||
communityTokensModuleInst.computeDeployFee(chainId, accountAddress)
|
||||
}
|
||||
|
||||
function computeSelfDestructFee(chainId) {
|
||||
// TODO BACKEND
|
||||
root.selfDestructFeeUpdated("0,0005 ETH")
|
||||
console.warn("TODO: Compute self-destruct fee backend")
|
||||
}
|
||||
|
||||
function remoteSelfDestructCollectibles(holdersModel, chainId, accountName, accountAddress) {
|
||||
// TODO BACKEND
|
||||
console.warn("TODO: Remote self-destruct collectible backend")
|
||||
}
|
||||
|
||||
// Airdrop tokens:
|
||||
function airdrop(communityId, airdropTokens, addresses) {
|
||||
const addrArray = []
|
||||
|
|
|
@ -323,6 +323,13 @@ StatusSectionLayout {
|
|||
artworkSource,
|
||||
accountName)
|
||||
}
|
||||
onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(chainId)
|
||||
onRemoteSelfDestructCollectibles: {
|
||||
communityTokensStore.remoteSelfDestructCollectibles(holdersModel,
|
||||
chainId,
|
||||
accountName,
|
||||
accountAddress)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: rootStore.communityTokensStore
|
||||
|
@ -344,6 +351,17 @@ StatusSectionLayout {
|
|||
mintPanel.errorText = qsTr("Unknown error")
|
||||
mintPanel.isFeeLoading = true
|
||||
}
|
||||
|
||||
// TODO: Self-destruct backend
|
||||
function onSelfDestructFeeUpdated(value) {
|
||||
// TODO better error handling
|
||||
if (value === "-") {
|
||||
mintPanel.isFeeLoading = true
|
||||
} else {
|
||||
mintPanel.isFeeLoading = false
|
||||
mintPanel.feeText = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,11 +449,11 @@ StatusSectionLayout {
|
|||
target: root.chatCommunitySectionModule
|
||||
function onOpenNoPermissionsToJoinPopup(communityName: string, userName: string, communityId: string, requestId: string) {
|
||||
Global.openPopup(noPermissionsPopupCmp, {
|
||||
communityName: communityName,
|
||||
userName: userName,
|
||||
communityId: communityId,
|
||||
requestId: requestId
|
||||
})
|
||||
communityName: communityName,
|
||||
userName: userName,
|
||||
communityId: communityId,
|
||||
requestId: requestId
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,11 @@ StatusScrollView {
|
|||
property int viewWidth: 560 // by design
|
||||
property var model
|
||||
|
||||
signal itemClicked(int index)
|
||||
signal itemClicked(int index,
|
||||
int chainId,
|
||||
string chainName,
|
||||
string accountName,
|
||||
string accountAddress)
|
||||
|
||||
enum DeployState {
|
||||
Failed,
|
||||
|
@ -72,7 +76,7 @@ StatusScrollView {
|
|||
isLoading: false
|
||||
navigationIconVisible: true
|
||||
|
||||
onClicked: root.itemClicked(model.index) // TODO: Replace to model.key when role exists in backend
|
||||
onClicked: root.itemClicked(model.index, model.chainId, model.chainName, model.accountName, model.address) // TODO: Replace to model.key when role exists in backend
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue