mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-18 10:32:53 +00:00
fix(MintTokensSettingsPanel): Improved binding from token model to CommunityTokenView instance, Constants.TokenType used consistently
Closes: #11387 Closes: #11384
This commit is contained in:
parent
42e0751e83
commit
235c3d778b
@ -111,14 +111,14 @@ SplitView {
|
|||||||
id: isAssetRadioButton
|
id: isAssetRadioButton
|
||||||
|
|
||||||
readonly property int type:
|
readonly property int type:
|
||||||
TokenObject.Type.Asset
|
Constants.TokenType.ERC20
|
||||||
|
|
||||||
text: "Asset"
|
text: "Asset"
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioButton {
|
RadioButton {
|
||||||
readonly property int type:
|
readonly property int type:
|
||||||
TokenObject.Type.Collectible
|
Constants.TokenType.ERC721
|
||||||
|
|
||||||
checked: true
|
checked: true
|
||||||
text: "Collectible"
|
text: "Collectible"
|
||||||
|
@ -8,11 +8,7 @@ import utils 1.0
|
|||||||
\brief Token object properties definition.
|
\brief Token object properties definition.
|
||||||
*/
|
*/
|
||||||
QtObject {
|
QtObject {
|
||||||
enum Type {
|
property int type: Constants.TokenType.ERC20
|
||||||
Asset, Collectible
|
|
||||||
}
|
|
||||||
|
|
||||||
property int type: TokenObject.Type.Asset
|
|
||||||
|
|
||||||
// Unique identifier:
|
// Unique identifier:
|
||||||
property string key
|
property string key
|
||||||
|
@ -70,7 +70,7 @@ StackView {
|
|||||||
resetNavigation()
|
resetNavigation()
|
||||||
|
|
||||||
const properties = { isAssetView }
|
const properties = { isAssetView }
|
||||||
root.push(newTokenView, properties, StackView.Immediate)
|
root.push(newTokenViewComponent, properties, StackView.Immediate)
|
||||||
}
|
}
|
||||||
|
|
||||||
property string previousPageName: depth > 1 ? qsTr("Back") : ""
|
property string previousPageName: depth > 1 ? qsTr("Back") : ""
|
||||||
@ -84,15 +84,14 @@ StackView {
|
|||||||
|
|
||||||
text: qsTr("Mint token")
|
text: qsTr("Mint token")
|
||||||
|
|
||||||
onClicked: root.push(newTokenView, StackView.Immediate)
|
onClicked: root.push(newTokenViewComponent, StackView.Immediate)
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: MintedTokensView {
|
contentItem: MintedTokensView {
|
||||||
model: root.tokensModel
|
model: root.tokensModel
|
||||||
|
|
||||||
onItemClicked: {
|
onItemClicked: {
|
||||||
const properties = { preview: false, tokenKey }
|
root.push(tokenViewComponent, { tokenKey }, StackView.Immediate)
|
||||||
root.push(tokenView, properties, StackView.Immediate)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,17 +104,17 @@ StackView {
|
|||||||
|
|
||||||
// Mint tokens possible view contents:
|
// Mint tokens possible view contents:
|
||||||
Component {
|
Component {
|
||||||
id: newTokenView
|
id: newTokenViewComponent
|
||||||
|
|
||||||
SettingsPage {
|
SettingsPage {
|
||||||
id: newTokenPage
|
id: newTokenPage
|
||||||
|
|
||||||
property TokenObject asset: TokenObject{
|
property TokenObject asset: TokenObject{
|
||||||
type: TokenObject.Type.Asset
|
type: Constants.TokenType.ERC20
|
||||||
}
|
}
|
||||||
|
|
||||||
property TokenObject collectible: TokenObject {
|
property TokenObject collectible: TokenObject {
|
||||||
type: TokenObject.Type.Collectible
|
type: Constants.TokenType.ERC721
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool isAssetView: false
|
property bool isAssetView: false
|
||||||
@ -193,7 +192,7 @@ StackView {
|
|||||||
token: isAssetView ? asset : collectible
|
token: isAssetView ? asset : collectible
|
||||||
}
|
}
|
||||||
|
|
||||||
root.push(previewTokenView, properties,
|
root.push(previewTokenViewComponent, properties,
|
||||||
StackView.Immediate)
|
StackView.Immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +202,7 @@ StackView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: previewTokenView
|
id: previewTokenViewComponent
|
||||||
|
|
||||||
SettingsPage {
|
SettingsPage {
|
||||||
id: tokenPreviewPage
|
id: tokenPreviewPage
|
||||||
@ -236,7 +235,8 @@ StackView {
|
|||||||
id: signMintPopup
|
id: signMintPopup
|
||||||
|
|
||||||
anchors.centerIn: Overlay.overlay
|
anchors.centerIn: Overlay.overlay
|
||||||
title: qsTr("Sign transaction - Mint %1 token").arg(signMintPopup.tokenName)
|
title: qsTr("Sign transaction - Mint %1 token").arg(
|
||||||
|
signMintPopup.tokenName)
|
||||||
tokenName: preview.name
|
tokenName: preview.name
|
||||||
accountName: preview.accountName
|
accountName: preview.accountName
|
||||||
networkName: preview.chainName
|
networkName: preview.chainName
|
||||||
@ -246,9 +246,10 @@ StackView {
|
|||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
root.setFeeLoading()
|
root.setFeeLoading()
|
||||||
root.signMintTransactionOpened(preview.chainId, preview.accountAddress,
|
root.signMintTransactionOpened(
|
||||||
preview.isAssetView ? Constants.TokenType.ERC20
|
preview.chainId, preview.accountAddress,
|
||||||
: Constants.TokenType.ERC721)
|
preview.isAssetView ? Constants.TokenType.ERC20
|
||||||
|
: Constants.TokenType.ERC721)
|
||||||
}
|
}
|
||||||
onCancelClicked: close()
|
onCancelClicked: close()
|
||||||
onSignTransactionClicked: preview.signMintTransaction()
|
onSignTransactionClicked: preview.signMintTransaction()
|
||||||
@ -257,265 +258,274 @@ StackView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
component TokenViewPage: SettingsPage {
|
||||||
id: tokenView
|
id: tokenViewPage
|
||||||
|
|
||||||
SettingsPage {
|
readonly property alias token: view.token
|
||||||
id: tokenViewPage
|
|
||||||
|
|
||||||
property string tokenKey
|
property alias tokenOwnersModel: view.tokenOwnersModel
|
||||||
|
property alias airdropKey: view.airdropKey
|
||||||
|
|
||||||
title: view.name
|
title: view.name
|
||||||
subtitle: view.symbol
|
subtitle: view.symbol
|
||||||
|
|
||||||
buttons: [
|
buttons: [
|
||||||
StatusButton {
|
StatusButton {
|
||||||
text: qsTr("Delete")
|
text: qsTr("Delete")
|
||||||
type: StatusBaseButton.Type.Danger
|
type: StatusBaseButton.Type.Danger
|
||||||
|
|
||||||
visible: view.deployState === Constants.ContractTransactionStatus.Failed
|
visible: view.deployState === Constants.ContractTransactionStatus.Failed
|
||||||
|
|
||||||
onClicked: deleteTokenAlertPopup.open()
|
onClicked: deleteTokenAlertPopup.open()
|
||||||
},
|
},
|
||||||
StatusButton {
|
StatusButton {
|
||||||
text: qsTr("Retry mint")
|
text: qsTr("Retry mint")
|
||||||
|
|
||||||
visible: view.deployState === Constants.ContractTransactionStatus.Failed
|
visible: view.deployState === Constants.ContractTransactionStatus.Failed
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const isAssetView = view.isAssetView
|
// https://bugreports.qt.io/browse/QTBUG-91917
|
||||||
|
var isAssetView = tokenViewPage.token.type === Constants.TokenType.ERC20
|
||||||
|
|
||||||
// copy TokenObject
|
// copy TokenObject
|
||||||
const tokenObject = tokenObjectComponent.createObject(
|
var tokenObject = tokenObjectComponent.createObject(
|
||||||
null, view.token)
|
null, view.token)
|
||||||
|
|
||||||
// Then move on to the new token view, but token pre-filled:
|
// Then move on to the new token view, but token pre-filled:
|
||||||
const properties = {
|
var properties = {
|
||||||
isAssetView,
|
isAssetView,
|
||||||
referenceName: tokenObject.name,
|
referenceName: tokenObject.name,
|
||||||
referenceSymbol: tokenObject.symbol,
|
referenceSymbol: tokenObject.symbol,
|
||||||
validationMode: StatusInput.ValidationMode.Always,
|
validationMode: StatusInput.ValidationMode.Always,
|
||||||
[isAssetView ? "asset" : "collectible"]: tokenObject
|
[isAssetView ? "asset" : "collectible"]: tokenObject
|
||||||
}
|
|
||||||
|
|
||||||
const tokenView = root.push(newTokenView, properties,
|
|
||||||
StackView.Immediate)
|
|
||||||
|
|
||||||
// cleanup dynamically created TokenObject
|
|
||||||
tokenView.Component.destruction.connect(() => tokenObject.destroy())
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
Instantiator {
|
var tokenView = root.push(newTokenViewComponent, properties,
|
||||||
id: instantiator
|
StackView.Immediate)
|
||||||
|
|
||||||
model: SortFilterProxyModel {
|
// cleanup dynamically created TokenObject
|
||||||
sourceModel: root.tokensModel
|
tokenView.Component.destruction.connect(() => tokenObject.destroy())
|
||||||
filters: ValueFilter {
|
|
||||||
roleName: "contractUniqueKey"
|
|
||||||
value: tokenViewPage.tokenKey
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate: QtObject {
|
|
||||||
component Bind: Binding { target: view }
|
|
||||||
readonly property list<Binding> bindings: [
|
|
||||||
Bind { property: "tokenOwnersModel"; value: model.tokenOwnersModel },
|
|
||||||
Bind { property: "tokenType"; value: model.tokenType },
|
|
||||||
Bind { property: "airdropKey"; value: model.symbol } // TO BE REMOVED: When airdrop backend is ready to use token key instead of symbol
|
|
||||||
]
|
|
||||||
|
|
||||||
component BindToken: Binding { target: view.token }
|
|
||||||
readonly property list<Binding> tokenBindings: [
|
|
||||||
BindToken { property: "type"; value: model.tokenType === Constants.TokenType.ERC20
|
|
||||||
? TokenObject.Type.Asset : TokenObject.Type.Collectible},
|
|
||||||
BindToken { property: "key"; value: model.contractUniqueKey },
|
|
||||||
BindToken { property: "deployState"; value: model.deployState },
|
|
||||||
BindToken { property: "burnState"; value: model.burnState },
|
|
||||||
BindToken { property: "name"; value: model.name },
|
|
||||||
BindToken { property: "artworkSource"; value: model.image },
|
|
||||||
BindToken { property: "symbol"; value: model.symbol },
|
|
||||||
BindToken { property: "description"; value: model.description },
|
|
||||||
BindToken { property: "supply"; value: model.supply },
|
|
||||||
BindToken { property: "infiniteSupply"; value: model.infiniteSupply },
|
|
||||||
BindToken { property: "remainingTokens"; value: model.remainingSupply },
|
|
||||||
BindToken { property: "chainId"; value: model.chainId },
|
|
||||||
BindToken { property: "chainName"; value: model.chainName },
|
|
||||||
BindToken { property: "chainIcon"; value: model.chainIcon },
|
|
||||||
BindToken { property: "accountName"; value: model.accountName },
|
|
||||||
BindToken { property: "accountAddress"; value: model.accountAddress }, // TODO: Backend
|
|
||||||
BindToken { property: "transferable"; value: model.transferable },
|
|
||||||
BindToken { property: "remotelyDestructState"; value: model.remotelyDestructState },
|
|
||||||
BindToken { property: "remotelyDestruct"; value: model.remoteSelfDestruct },
|
|
||||||
BindToken { property: "decimals"; value: model.decimals }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
|
||||||
contentItem: CommunityTokenView {
|
contentItem: CommunityTokenView {
|
||||||
id: view
|
id: view
|
||||||
|
|
||||||
property string airdropKey // TO REMOVE: Temporal property until airdrop backend is not ready to use token key instead of symbol
|
property string airdropKey // TO REMOVE: Temporal property until airdrop backend is not ready to use token key instead of symbol
|
||||||
property int tokenType
|
|
||||||
|
|
||||||
viewWidth: root.viewWidth
|
viewWidth: root.viewWidth
|
||||||
|
|
||||||
token: TokenObject {}
|
token: TokenObject {}
|
||||||
|
|
||||||
onGeneralAirdropRequested: {
|
onGeneralAirdropRequested: {
|
||||||
root.airdropToken(view.airdropKey, view.tokenType, []) // tokenKey instead when backend airdrop ready to use key instead of symbol
|
root.airdropToken(view.airdropKey, view.token.type, []) // tokenKey instead when backend airdrop ready to use key instead of symbol
|
||||||
}
|
|
||||||
|
|
||||||
onAirdropRequested: {
|
|
||||||
root.airdropToken(view.airdropKey, view.tokenType, [address]) // tokenKey instead when backend airdrop ready to use key instead of symbol
|
|
||||||
}
|
|
||||||
|
|
||||||
onRemoteDestructRequested: {
|
|
||||||
remotelyDestructPopup.open()
|
|
||||||
// TODO: set the address selected in the popup's list
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: MintTokensFooterPanel {
|
onAirdropRequested: {
|
||||||
id: footer
|
root.airdropToken(view.airdropKey, view.token.type, [address]) // tokenKey instead when backend airdrop ready to use key instead of symbol
|
||||||
|
}
|
||||||
|
|
||||||
readonly property TokenObject token: view.token
|
onRemoteDestructRequested: {
|
||||||
|
remotelyDestructPopup.open()
|
||||||
|
// TODO: set the address selected in the popup's list
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
readonly property bool deployStateCompleted:
|
footer: MintTokensFooterPanel {
|
||||||
token.deployState === Constants.ContractTransactionStatus.Completed
|
id: footer
|
||||||
|
|
||||||
function closePopups() {
|
readonly property TokenObject token: view.token
|
||||||
remotelyDestructPopup.close()
|
|
||||||
alertPopup.close()
|
|
||||||
signTransactionPopup.close()
|
|
||||||
burnTokensPopup.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
airdropEnabled: deployStateCompleted &&
|
readonly property bool deployStateCompleted:
|
||||||
(token.infiniteSupply ||
|
token.deployState === Constants.ContractTransactionStatus.Completed
|
||||||
token.remainingTokens !== 0)
|
|
||||||
|
|
||||||
remotelyDestructEnabled: deployStateCompleted &&
|
function closePopups() {
|
||||||
!!view.tokenOwnersModel &&
|
remotelyDestructPopup.close()
|
||||||
view.tokenOwnersModel.count > 0
|
alertPopup.close()
|
||||||
|
signTransactionPopup.close()
|
||||||
|
burnTokensPopup.close()
|
||||||
|
}
|
||||||
|
|
||||||
burnEnabled: deployStateCompleted
|
airdropEnabled: deployStateCompleted &&
|
||||||
|
(token.infiniteSupply ||
|
||||||
|
token.remainingTokens !== 0)
|
||||||
|
|
||||||
remotelyDestructVisible: token.remotelyDestruct
|
remotelyDestructEnabled: deployStateCompleted &&
|
||||||
burnVisible: !token.infiniteSupply
|
!!view.tokenOwnersModel &&
|
||||||
|
view.tokenOwnersModel.count > 0
|
||||||
|
|
||||||
onAirdropClicked:root.airdropToken(view.airdropKey, // tokenKey instead when backend airdrop ready to use key instead of symbol
|
burnEnabled: deployStateCompleted
|
||||||
view.tokenType, [])
|
|
||||||
|
|
||||||
onRemotelyDestructClicked: remotelyDestructPopup.open()
|
remotelyDestructVisible: token.remotelyDestruct
|
||||||
onBurnClicked: burnTokensPopup.open()
|
burnVisible: !token.infiniteSupply
|
||||||
|
|
||||||
// helper properties to pass data through popups
|
onAirdropClicked:root.airdropToken(view.airdropKey, // tokenKey instead when backend airdrop ready to use key instead of symbol
|
||||||
property var remotelyDestructTokensList
|
view.token.type, [])
|
||||||
property int burnAmount
|
|
||||||
|
|
||||||
RemotelyDestructPopup {
|
onRemotelyDestructClicked: remotelyDestructPopup.open()
|
||||||
id: remotelyDestructPopup
|
onBurnClicked: burnTokensPopup.open()
|
||||||
|
|
||||||
collectibleName: view.token.name
|
// helper properties to pass data through popups
|
||||||
model: view.tokenOwnersModel || null
|
property var remotelyDestructTokensList
|
||||||
destroyOnClose: false
|
property int burnAmount
|
||||||
|
|
||||||
onRemotelyDestructClicked: {
|
RemotelyDestructPopup {
|
||||||
footer.remotelyDestructTokensList = remotelyDestructTokensList
|
id: remotelyDestructPopup
|
||||||
alertPopup.tokenCount = tokenCount
|
|
||||||
alertPopup.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AlertPopup {
|
collectibleName: view.token.name
|
||||||
id: alertPopup
|
model: view.tokenOwnersModel || null
|
||||||
|
destroyOnClose: false
|
||||||
|
|
||||||
property int tokenCount
|
onRemotelyDestructClicked: {
|
||||||
|
footer.remotelyDestructTokensList = remotelyDestructTokensList
|
||||||
destroyOnClose: false
|
alertPopup.tokenCount = tokenCount
|
||||||
|
alertPopup.open()
|
||||||
title: qsTr("Remotely destruct %n token(s)", "", tokenCount)
|
|
||||||
acceptBtnText: qsTr("Remotely destruct")
|
|
||||||
alertText: qsTr("Continuing will destroy tokens held by members and revoke any permissions they are given. To undo you will have to issue them new tokens.")
|
|
||||||
|
|
||||||
onAcceptClicked: {
|
|
||||||
signTransactionPopup.isRemotelyDestructTransaction = true
|
|
||||||
signTransactionPopup.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SignTokenTransactionsPopup {
|
|
||||||
id: signTransactionPopup
|
|
||||||
|
|
||||||
property bool isRemotelyDestructTransaction
|
|
||||||
readonly property alias tokenKey: tokenViewPage.tokenKey
|
|
||||||
|
|
||||||
function signTransaction() {
|
|
||||||
root.setFeeLoading()
|
|
||||||
|
|
||||||
if(signTransactionPopup.isRemotelyDestructTransaction)
|
|
||||||
root.remotelyDestructCollectibles(
|
|
||||||
footer.remotelyDestructTokensList, tokenKey)
|
|
||||||
else
|
|
||||||
root.burnToken(tokenKey, footer.burnAmount)
|
|
||||||
|
|
||||||
footerPanel.closePopups()
|
|
||||||
}
|
|
||||||
|
|
||||||
title: signTransactionPopup.isRemotelyDestructTransaction
|
|
||||||
? qsTr("Sign transaction - Self-destruct %1 tokens").arg(root.title)
|
|
||||||
: qsTr("Sign transaction - Burn %1 tokens").arg(root.title)
|
|
||||||
|
|
||||||
tokenName: footer.token.name
|
|
||||||
accountName: footer.token.accountName
|
|
||||||
networkName: footer.token.chainName
|
|
||||||
feeText: root.feeText
|
|
||||||
isFeeLoading: root.isFeeLoading
|
|
||||||
errorText: root.errorText
|
|
||||||
|
|
||||||
onOpened: {
|
|
||||||
root.setFeeLoading()
|
|
||||||
signTransactionPopup.isRemotelyDestructTransaction
|
|
||||||
? root.signRemoteDestructTransactionOpened(footer.remotelyDestructTokensList, tokenKey)
|
|
||||||
: root.signBurnTransactionOpened(tokenKey, footer.burnAmount)
|
|
||||||
}
|
|
||||||
onCancelClicked: close()
|
|
||||||
onSignTransactionClicked: signTransaction()
|
|
||||||
}
|
|
||||||
|
|
||||||
BurnTokensPopup {
|
|
||||||
id: burnTokensPopup
|
|
||||||
|
|
||||||
communityName: root.communityName
|
|
||||||
tokenName: footer.token.name
|
|
||||||
remainingTokens: footer.token.remainingTokens
|
|
||||||
tokenSource: footer.token.artworkSource
|
|
||||||
|
|
||||||
onBurnClicked: {
|
|
||||||
footer.burnAmount = burnAmount
|
|
||||||
signTransactionPopup.isRemotelyDestructTransaction = false
|
|
||||||
signTransactionPopup.open()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertPopup {
|
AlertPopup {
|
||||||
id: deleteTokenAlertPopup
|
id: alertPopup
|
||||||
|
|
||||||
readonly property alias tokenName: view.token.name
|
property int tokenCount
|
||||||
|
|
||||||
width: 521
|
destroyOnClose: false
|
||||||
title: qsTr("Delete %1").arg(tokenName)
|
|
||||||
acceptBtnText: qsTr("Delete %1 token").arg(tokenName)
|
title: qsTr("Remotely destruct %n token(s)", "", tokenCount)
|
||||||
alertText: qsTr("%1 is not yet minted, are you sure you want to delete it? All data associated with this token including its icon and description will be permanently deleted.").arg(tokenName)
|
acceptBtnText: qsTr("Remotely destruct")
|
||||||
|
alertText: qsTr("Continuing will destroy tokens held by members and revoke any permissions they are given. To undo you will have to issue them new tokens.")
|
||||||
|
|
||||||
onAcceptClicked: {
|
onAcceptClicked: {
|
||||||
root.deleteToken(tokenViewPage.tokenKey)
|
signTransactionPopup.isRemotelyDestructTransaction = true
|
||||||
root.navigateBack()
|
signTransactionPopup.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SignTokenTransactionsPopup {
|
||||||
|
id: signTransactionPopup
|
||||||
|
|
||||||
|
property bool isRemotelyDestructTransaction
|
||||||
|
readonly property string tokenKey: tokenViewPage.token.key
|
||||||
|
|
||||||
|
function signTransaction() {
|
||||||
|
root.setFeeLoading()
|
||||||
|
|
||||||
|
if(signTransactionPopup.isRemotelyDestructTransaction)
|
||||||
|
root.remotelyDestructCollectibles(
|
||||||
|
footer.remotelyDestructTokensList, tokenKey)
|
||||||
|
else
|
||||||
|
root.burnToken(tokenKey, footer.burnAmount)
|
||||||
|
|
||||||
|
footerPanel.closePopups()
|
||||||
|
}
|
||||||
|
|
||||||
|
title: signTransactionPopup.isRemotelyDestructTransaction
|
||||||
|
? qsTr("Sign transaction - Self-destruct %1 tokens").arg(root.title)
|
||||||
|
: qsTr("Sign transaction - Burn %1 tokens").arg(root.title)
|
||||||
|
|
||||||
|
tokenName: footer.token.name
|
||||||
|
accountName: footer.token.accountName
|
||||||
|
networkName: footer.token.chainName
|
||||||
|
feeText: root.feeText
|
||||||
|
isFeeLoading: root.isFeeLoading
|
||||||
|
errorText: root.errorText
|
||||||
|
|
||||||
|
onOpened: {
|
||||||
|
root.setFeeLoading()
|
||||||
|
signTransactionPopup.isRemotelyDestructTransaction
|
||||||
|
? root.signRemoteDestructTransactionOpened(footer.remotelyDestructTokensList, tokenKey)
|
||||||
|
: root.signBurnTransactionOpened(tokenKey, footer.burnAmount)
|
||||||
}
|
}
|
||||||
onCancelClicked: close()
|
onCancelClicked: close()
|
||||||
|
onSignTransactionClicked: signTransaction()
|
||||||
|
}
|
||||||
|
|
||||||
|
BurnTokensPopup {
|
||||||
|
id: burnTokensPopup
|
||||||
|
|
||||||
|
communityName: root.communityName
|
||||||
|
tokenName: footer.token.name
|
||||||
|
remainingTokens: footer.token.remainingTokens
|
||||||
|
tokenSource: footer.token.artworkSource
|
||||||
|
|
||||||
|
onBurnClicked: {
|
||||||
|
footer.burnAmount = burnAmount
|
||||||
|
signTransactionPopup.isRemotelyDestructTransaction = false
|
||||||
|
signTransactionPopup.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AlertPopup {
|
||||||
|
id: deleteTokenAlertPopup
|
||||||
|
|
||||||
|
readonly property alias tokenName: view.token.name
|
||||||
|
|
||||||
|
width: 521
|
||||||
|
title: qsTr("Delete %1").arg(tokenName)
|
||||||
|
acceptBtnText: qsTr("Delete %1 token").arg(tokenName)
|
||||||
|
alertText: qsTr("%1 is not yet minted, are you sure you want to delete it? All data associated with this token including its icon and description will be permanently deleted.").arg(tokenName)
|
||||||
|
|
||||||
|
onAcceptClicked: {
|
||||||
|
root.deleteToken(tokenViewPage.token.key)
|
||||||
|
root.navigateBack()
|
||||||
|
}
|
||||||
|
onCancelClicked: close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: tokenViewComponent
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: tokenViewPageWrapper
|
||||||
|
|
||||||
|
property string tokenKey
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: SortFilterProxyModel {
|
||||||
|
sourceModel: root.tokensModel
|
||||||
|
filters: ValueFilter {
|
||||||
|
roleName: "contractUniqueKey"
|
||||||
|
value: tokenViewPageWrapper.tokenKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: TokenViewPage {
|
||||||
|
implicitWidth: 0
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
tokenOwnersModel: model.tokenOwnersModel
|
||||||
|
airdropKey: model.symbol // TO BE REMOVED: When airdrop backend is ready to use token key instead of symbol
|
||||||
|
|
||||||
|
token.accountName: model.accountName
|
||||||
|
token.artworkSource: model.image
|
||||||
|
token.chainIcon: model.chainIcon
|
||||||
|
token.chainId: model.chainId
|
||||||
|
token.chainName: model.chainName
|
||||||
|
token.decimals: model.decimals
|
||||||
|
token.deployState: model.deployState
|
||||||
|
token.description: model.description
|
||||||
|
token.infiniteSupply: model.infiniteSupply
|
||||||
|
token.key: model.contractUniqueKey
|
||||||
|
token.name: model.name
|
||||||
|
token.remainingTokens: model.remainingSupply
|
||||||
|
token.remotelyDestruct: model.remoteSelfDestruct
|
||||||
|
token.supply: model.supply
|
||||||
|
token.symbol: model.symbol
|
||||||
|
token.transferable: model.transferable
|
||||||
|
token.type: model.tokenType
|
||||||
|
|
||||||
|
// TODO: Backend
|
||||||
|
//token.accountAddress: model.accountAddress
|
||||||
|
//token.burnState: model.burnState
|
||||||
|
//token.remotelyDestructState: model.remotelyDestructState
|
||||||
|
}
|
||||||
|
|
||||||
|
onCountChanged: {
|
||||||
|
if (count === 0)
|
||||||
|
root.navigateBack()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ StatusScrollView {
|
|||||||
// https://bugreports.qt.io/browse/QTBUG-84269
|
// https://bugreports.qt.io/browse/QTBUG-84269
|
||||||
/* readonly */ property TokenObject token
|
/* readonly */ property TokenObject token
|
||||||
|
|
||||||
readonly property bool isAssetView: token.type === TokenObject.Type.Asset
|
readonly property bool isAssetView: token.type === Constants.TokenType.ERC20
|
||||||
|
|
||||||
readonly property string name: token.name
|
readonly property string name: token.name
|
||||||
readonly property string description: token.description
|
readonly property string description: token.description
|
||||||
|
@ -27,11 +27,11 @@ StatusScrollView {
|
|||||||
|
|
||||||
|
|
||||||
property TokenObject collectible: TokenObject {
|
property TokenObject collectible: TokenObject {
|
||||||
type: TokenObject.Type.Collectible
|
type: Constants.TokenType.ERC721
|
||||||
}
|
}
|
||||||
|
|
||||||
property TokenObject asset: TokenObject{
|
property TokenObject asset: TokenObject{
|
||||||
type: TokenObject.Type.Asset
|
type: Constants.TokenType.ERC20
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for reference validation when editing a failed deployment
|
// Used for reference validation when editing a failed deployment
|
||||||
|
@ -948,8 +948,8 @@ QtObject {
|
|||||||
|
|
||||||
enum TokenType {
|
enum TokenType {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
ERC20 = 1,
|
ERC20 = 1, // Asset
|
||||||
ERC721 = 2
|
ERC721 = 2 // Collectible
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mirrors src/backend/activity.nim ActivityStatus
|
// Mirrors src/backend/activity.nim ActivityStatus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user