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
|
||||
|
||||
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
|
||||
collectibleName: editorCollectible.text
|
||||
tokenName: editorCollectible.text
|
||||
networkName: editorNetwork.text
|
||||
feeText: editorFee.text
|
||||
isFeeLoading: editorFeeLoader.checked
|
||||
|
|
|
@ -53,6 +53,18 @@ SettingsPageLayout {
|
|||
string accountAddress,
|
||||
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 signSelfDestructTransactionOpened(int chainId)
|
||||
|
@ -84,7 +96,7 @@ SettingsPageLayout {
|
|||
|
||||
readonly property string initialViewState: "WELCOME_OR_LIST_TOKENS"
|
||||
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 welcomePageTitle: qsTr("Tokens")
|
||||
|
@ -148,7 +160,7 @@ SettingsPageLayout {
|
|||
PropertyChanges {target: root; headerWidth: 0}
|
||||
},
|
||||
State {
|
||||
name: d.previewCollectibleViewState
|
||||
name: d.previewTokenViewState
|
||||
PropertyChanges {target: root; previousPageName: d.backButtonText}
|
||||
PropertyChanges {target: root; headerButtonVisible: false}
|
||||
PropertyChanges {target: root; headerWidth: 0}
|
||||
|
@ -236,10 +248,11 @@ SettingsPageLayout {
|
|||
|
||||
onPreviewClicked: {
|
||||
d.accountAddress = accountAddress
|
||||
stackManager.push(d.previewCollectibleViewState,
|
||||
previewCollectibleView,
|
||||
stackManager.push(d.previewTokenViewState,
|
||||
previewTokenView,
|
||||
{
|
||||
preview: true,
|
||||
isAssetView: false,
|
||||
name,
|
||||
artworkSource,
|
||||
artworkCropRect,
|
||||
|
@ -269,20 +282,54 @@ SettingsPageLayout {
|
|||
tokensModel: root.tokensModel
|
||||
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 {
|
||||
id: previewCollectibleView
|
||||
id: previewTokenView
|
||||
|
||||
CommunityTokenView {
|
||||
id: preview
|
||||
|
||||
function signMintTransaction() {
|
||||
root.setFeeLoading()
|
||||
if(preview.isAssetView) {
|
||||
root.mintAsset(artworkSource,
|
||||
name,
|
||||
symbol,
|
||||
description,
|
||||
supplyAmount,
|
||||
infiniteSupply,
|
||||
assetDecimals,
|
||||
chainId,
|
||||
accountName,
|
||||
d.accountAddress,
|
||||
artworkCropRect)
|
||||
} else {
|
||||
root.mintCollectible(artworkSource,
|
||||
name,
|
||||
symbol,
|
||||
|
@ -295,6 +342,7 @@ SettingsPageLayout {
|
|||
accountName,
|
||||
d.accountAddress,
|
||||
artworkCropRect)
|
||||
}
|
||||
|
||||
stackManager.clear(d.initialViewState, StackView.Immediate)
|
||||
}
|
||||
|
@ -302,6 +350,7 @@ SettingsPageLayout {
|
|||
viewWidth: root.viewWidth
|
||||
|
||||
onMintCollectible: popup.open()
|
||||
onMintAsset: popup.open()
|
||||
|
||||
Binding {
|
||||
target: root
|
||||
|
@ -320,8 +369,8 @@ SettingsPageLayout {
|
|||
id: popup
|
||||
|
||||
anchors.centerIn: Overlay.overlay
|
||||
title: qsTr("Sign transaction - Mint %1 token").arg(popup.collectibleName)
|
||||
collectibleName: parent.name
|
||||
title: qsTr("Sign transaction - Mint %1 token").arg(popup.tokenName)
|
||||
tokenName: parent.name
|
||||
accountName: parent.accountName
|
||||
networkName: parent.chainName
|
||||
feeText: root.feeText
|
||||
|
@ -403,7 +452,7 @@ SettingsPageLayout {
|
|||
|
||||
title: signTransactionPopup.isRemotelyDestructTransaction ? qsTr("Sign transaction - Self-destruct %1 tokens").arg(root.title) :
|
||||
qsTr("Sign transaction - Burn %1 tokens").arg(root.title)
|
||||
collectibleName: root.title
|
||||
tokenName: root.title
|
||||
accountName: d.accountName
|
||||
networkName: d.chainName
|
||||
feeText: root.feeText
|
||||
|
|
|
@ -18,7 +18,7 @@ StatusDialog {
|
|||
property alias errorText: errorTxt.text
|
||||
property alias isFeeLoading: feeLoading.visible
|
||||
|
||||
property string collectibleName
|
||||
property string tokenName
|
||||
property string networkName
|
||||
|
||||
signal signTransactionClicked()
|
||||
|
|
|
@ -301,6 +301,20 @@ StatusSectionLayout {
|
|||
accountName,
|
||||
artworkCropRect)
|
||||
}
|
||||
onMintAsset: {
|
||||
communityTokensStore.deployAsset(root.community.id,
|
||||
accountAddress,
|
||||
name,
|
||||
symbol,
|
||||
description,
|
||||
supply,
|
||||
infiniteSupply,
|
||||
decimals,
|
||||
chainId,
|
||||
artworkSource,
|
||||
accountName,
|
||||
artworkCropRect)
|
||||
}
|
||||
onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(chainId)
|
||||
onRemoteSelfDestructCollectibles: {
|
||||
communityTokensStore.remoteSelfDestructCollectibles(selfDestructTokensList,
|
||||
|
|
|
@ -29,6 +29,15 @@ QtObject {
|
|||
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 {
|
||||
target: communityTokensModuleInst
|
||||
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
||||
|
|
Loading…
Reference in New Issue