feat(MintAssets): Create mint assets flow
It creates mint assets flow: - Preview integrated. - Mint call and sign transaction popup added. Closes #10624 a
This commit is contained in:
parent
775a93e82c
commit
9f8275ce5c
|
@ -33,9 +33,9 @@ SplitView {
|
||||||
id: dialog
|
id: dialog
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
title: qsTr("Sign transaction - Self-destruct %1 tokens").arg(dialog.collectibleName)
|
title: qsTr("Sign transaction - Self-destruct %1 tokens").arg(dialog.tokenName)
|
||||||
accountName: editorAccount.text
|
accountName: editorAccount.text
|
||||||
collectibleName: editorCollectible.text
|
tokenName: editorCollectible.text
|
||||||
networkName: editorNetwork.text
|
networkName: editorNetwork.text
|
||||||
feeText: editorFee.text
|
feeText: editorFee.text
|
||||||
isFeeLoading: editorFeeLoader.checked
|
isFeeLoading: editorFeeLoader.checked
|
||||||
|
|
|
@ -53,6 +53,18 @@ SettingsPageLayout {
|
||||||
string accountAddress,
|
string accountAddress,
|
||||||
var artworkCropRect)
|
var artworkCropRect)
|
||||||
|
|
||||||
|
signal mintAsset(url artworkSource,
|
||||||
|
string name,
|
||||||
|
string symbol,
|
||||||
|
string description,
|
||||||
|
int supply,
|
||||||
|
bool infiniteSupply,
|
||||||
|
int decimals,
|
||||||
|
int chainId,
|
||||||
|
string accountName,
|
||||||
|
string accountAddress,
|
||||||
|
var artworkCropRect)
|
||||||
|
|
||||||
signal signMintTransactionOpened(int chainId, string accountAddress)
|
signal signMintTransactionOpened(int chainId, string accountAddress)
|
||||||
|
|
||||||
signal signSelfDestructTransactionOpened(int chainId)
|
signal signSelfDestructTransactionOpened(int chainId)
|
||||||
|
@ -84,7 +96,7 @@ SettingsPageLayout {
|
||||||
|
|
||||||
readonly property string initialViewState: "WELCOME_OR_LIST_TOKENS"
|
readonly property string initialViewState: "WELCOME_OR_LIST_TOKENS"
|
||||||
readonly property string newTokenViewState: "NEW_TOKEN"
|
readonly property string newTokenViewState: "NEW_TOKEN"
|
||||||
readonly property string previewCollectibleViewState: "PREVIEW_COLLECTIBLE"
|
readonly property string previewTokenViewState: "PREVIEW_TOKEN"
|
||||||
readonly property string collectibleViewState: "VIEW_COLLECTIBLE"
|
readonly property string collectibleViewState: "VIEW_COLLECTIBLE"
|
||||||
|
|
||||||
readonly property string welcomePageTitle: qsTr("Tokens")
|
readonly property string welcomePageTitle: qsTr("Tokens")
|
||||||
|
@ -148,7 +160,7 @@ SettingsPageLayout {
|
||||||
PropertyChanges {target: root; headerWidth: 0}
|
PropertyChanges {target: root; headerWidth: 0}
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: d.previewCollectibleViewState
|
name: d.previewTokenViewState
|
||||||
PropertyChanges {target: root; previousPageName: d.backButtonText}
|
PropertyChanges {target: root; previousPageName: d.backButtonText}
|
||||||
PropertyChanges {target: root; headerButtonVisible: false}
|
PropertyChanges {target: root; headerButtonVisible: false}
|
||||||
PropertyChanges {target: root; headerWidth: 0}
|
PropertyChanges {target: root; headerWidth: 0}
|
||||||
|
@ -236,10 +248,11 @@ SettingsPageLayout {
|
||||||
|
|
||||||
onPreviewClicked: {
|
onPreviewClicked: {
|
||||||
d.accountAddress = accountAddress
|
d.accountAddress = accountAddress
|
||||||
stackManager.push(d.previewCollectibleViewState,
|
stackManager.push(d.previewTokenViewState,
|
||||||
previewCollectibleView,
|
previewTokenView,
|
||||||
{
|
{
|
||||||
preview: true,
|
preview: true,
|
||||||
|
isAssetView: false,
|
||||||
name,
|
name,
|
||||||
artworkSource,
|
artworkSource,
|
||||||
artworkCropRect,
|
artworkCropRect,
|
||||||
|
@ -269,32 +282,67 @@ SettingsPageLayout {
|
||||||
tokensModel: root.tokensModel
|
tokensModel: root.tokensModel
|
||||||
isAssetView: true
|
isAssetView: true
|
||||||
|
|
||||||
onPreviewClicked: console.log("TODO: Assets preview!")
|
onPreviewClicked: {
|
||||||
|
d.accountAddress = accountAddress
|
||||||
|
stackManager.push(d.previewTokenViewState,
|
||||||
|
previewTokenView,
|
||||||
|
{
|
||||||
|
preview: true,
|
||||||
|
isAssetView: true,
|
||||||
|
name,
|
||||||
|
artworkSource,
|
||||||
|
artworkCropRect,
|
||||||
|
symbol,
|
||||||
|
description,
|
||||||
|
supplyAmount,
|
||||||
|
infiniteSupply,
|
||||||
|
assetDecimals,
|
||||||
|
chainId,
|
||||||
|
chainName,
|
||||||
|
chainIcon,
|
||||||
|
accountName
|
||||||
|
},
|
||||||
|
StackView.Immediate)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: previewCollectibleView
|
id: previewTokenView
|
||||||
|
|
||||||
CommunityTokenView {
|
CommunityTokenView {
|
||||||
id: preview
|
id: preview
|
||||||
|
|
||||||
function signMintTransaction() {
|
function signMintTransaction() {
|
||||||
root.setFeeLoading()
|
root.setFeeLoading()
|
||||||
root.mintCollectible(artworkSource,
|
if(preview.isAssetView) {
|
||||||
name,
|
root.mintAsset(artworkSource,
|
||||||
symbol,
|
name,
|
||||||
description,
|
symbol,
|
||||||
supplyAmount,
|
description,
|
||||||
infiniteSupply,
|
supplyAmount,
|
||||||
transferable,
|
infiniteSupply,
|
||||||
selfDestruct,
|
assetDecimals,
|
||||||
chainId,
|
chainId,
|
||||||
accountName,
|
accountName,
|
||||||
d.accountAddress,
|
d.accountAddress,
|
||||||
artworkCropRect)
|
artworkCropRect)
|
||||||
|
} else {
|
||||||
|
root.mintCollectible(artworkSource,
|
||||||
|
name,
|
||||||
|
symbol,
|
||||||
|
description,
|
||||||
|
supplyAmount,
|
||||||
|
infiniteSupply,
|
||||||
|
transferable,
|
||||||
|
selfDestruct,
|
||||||
|
chainId,
|
||||||
|
accountName,
|
||||||
|
d.accountAddress,
|
||||||
|
artworkCropRect)
|
||||||
|
}
|
||||||
|
|
||||||
stackManager.clear(d.initialViewState, StackView.Immediate)
|
stackManager.clear(d.initialViewState, StackView.Immediate)
|
||||||
}
|
}
|
||||||
|
@ -302,6 +350,7 @@ SettingsPageLayout {
|
||||||
viewWidth: root.viewWidth
|
viewWidth: root.viewWidth
|
||||||
|
|
||||||
onMintCollectible: popup.open()
|
onMintCollectible: popup.open()
|
||||||
|
onMintAsset: popup.open()
|
||||||
|
|
||||||
Binding {
|
Binding {
|
||||||
target: root
|
target: root
|
||||||
|
@ -320,8 +369,8 @@ SettingsPageLayout {
|
||||||
id: popup
|
id: popup
|
||||||
|
|
||||||
anchors.centerIn: Overlay.overlay
|
anchors.centerIn: Overlay.overlay
|
||||||
title: qsTr("Sign transaction - Mint %1 token").arg(popup.collectibleName)
|
title: qsTr("Sign transaction - Mint %1 token").arg(popup.tokenName)
|
||||||
collectibleName: parent.name
|
tokenName: parent.name
|
||||||
accountName: parent.accountName
|
accountName: parent.accountName
|
||||||
networkName: parent.chainName
|
networkName: parent.chainName
|
||||||
feeText: root.feeText
|
feeText: root.feeText
|
||||||
|
@ -403,7 +452,7 @@ SettingsPageLayout {
|
||||||
|
|
||||||
title: signTransactionPopup.isRemotelyDestructTransaction ? qsTr("Sign transaction - Self-destruct %1 tokens").arg(root.title) :
|
title: signTransactionPopup.isRemotelyDestructTransaction ? qsTr("Sign transaction - Self-destruct %1 tokens").arg(root.title) :
|
||||||
qsTr("Sign transaction - Burn %1 tokens").arg(root.title)
|
qsTr("Sign transaction - Burn %1 tokens").arg(root.title)
|
||||||
collectibleName: root.title
|
tokenName: root.title
|
||||||
accountName: d.accountName
|
accountName: d.accountName
|
||||||
networkName: d.chainName
|
networkName: d.chainName
|
||||||
feeText: root.feeText
|
feeText: root.feeText
|
||||||
|
|
|
@ -18,7 +18,7 @@ StatusDialog {
|
||||||
property alias errorText: errorTxt.text
|
property alias errorText: errorTxt.text
|
||||||
property alias isFeeLoading: feeLoading.visible
|
property alias isFeeLoading: feeLoading.visible
|
||||||
|
|
||||||
property string collectibleName
|
property string tokenName
|
||||||
property string networkName
|
property string networkName
|
||||||
|
|
||||||
signal signTransactionClicked()
|
signal signTransactionClicked()
|
||||||
|
|
|
@ -301,6 +301,20 @@ StatusSectionLayout {
|
||||||
accountName,
|
accountName,
|
||||||
artworkCropRect)
|
artworkCropRect)
|
||||||
}
|
}
|
||||||
|
onMintAsset: {
|
||||||
|
communityTokensStore.deployAsset(root.community.id,
|
||||||
|
accountAddress,
|
||||||
|
name,
|
||||||
|
symbol,
|
||||||
|
description,
|
||||||
|
supply,
|
||||||
|
infiniteSupply,
|
||||||
|
decimals,
|
||||||
|
chainId,
|
||||||
|
artworkSource,
|
||||||
|
accountName,
|
||||||
|
artworkCropRect)
|
||||||
|
}
|
||||||
onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(chainId)
|
onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(chainId)
|
||||||
onRemoteSelfDestructCollectibles: {
|
onRemoteSelfDestructCollectibles: {
|
||||||
communityTokensStore.remoteSelfDestructCollectibles(selfDestructTokensList,
|
communityTokensStore.remoteSelfDestructCollectibles(selfDestructTokensList,
|
||||||
|
|
|
@ -29,6 +29,15 @@ QtObject {
|
||||||
infiniteSupply, transferable, selfDestruct, chainId, artworkSource/*instead: jsonArtworkFile*/)
|
infiniteSupply, transferable, selfDestruct, chainId, artworkSource/*instead: jsonArtworkFile*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deployAsset(communityId, accountAddress, name, symbol, description, supply,
|
||||||
|
infiniteSupply, decimals, chainId, artworkSource, accountName, artworkCropRect)
|
||||||
|
{
|
||||||
|
// TODO: Backend needs to create new role `accountName` and update this call accordingly
|
||||||
|
// TODO: Backend needs to modify the call to expect an image JSON file with cropped artwork information:
|
||||||
|
const jsonArtworkFile = Utils.getImageAndCropInfoJson(artworkSource, artworkCropRect)
|
||||||
|
console.log("TODO: Deploy Asset backend!")
|
||||||
|
}
|
||||||
|
|
||||||
readonly property Connections connections: Connections {
|
readonly property Connections connections: Connections {
|
||||||
target: communityTokensModuleInst
|
target: communityTokensModuleInst
|
||||||
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
||||||
|
|
Loading…
Reference in New Issue