feat: implement retrying deploying community contracts

Ultimately, this means deleting/removing the entry of the previously
failed deployment, then performing a new transaction.

Closes #11186
This commit is contained in:
Pascal Precht 2023-07-25 16:11:10 +02:00 committed by r4bbit
parent 57fc600d5e
commit 5351f2b694
3 changed files with 9 additions and 7 deletions

View File

@ -379,7 +379,6 @@ QtObject:
if response.error != nil: if response.error != nil:
let error = Json.decode($response.error, RpcError) let error = Json.decode($response.error, RpcError)
raise newException(RpcException, "error removing community token: " & error.message) raise newException(RpcException, "error removing community token: " & error.message)
return
self.events.emit(SIGNAL_COMMUNITY_TOKEN_REMOVED, CommunityTokenRemovedArgs(communityId: communityId, contractAddress: address, chainId: chainId)) self.events.emit(SIGNAL_COMMUNITY_TOKEN_REMOVED, CommunityTokenRemovedArgs(communityId: communityId, contractAddress: address, chainId: chainId))
except RpcException as e: except RpcException as e:

View File

@ -497,12 +497,13 @@ StackView {
(!tokenViewPage.isPrivilegedTokenItem && !root.isAdminOnly && tokenViewPage.deploymentFailed) (!tokenViewPage.isPrivilegedTokenItem && !root.isAdminOnly && tokenViewPage.deploymentFailed)
onClicked: { onClicked: {
if(tokenViewPage.isPrivilegedTokenItem) if(tokenViewPage.isPrivilegedTokenItem) {
retryPrivilegedToken() retryPrivilegedToken()
else } else {
retryAssetOrCollectible() retryAssetOrCollectible()
} }
} }
}
] ]
contentItem: CommunityTokenView { contentItem: CommunityTokenView {

View File

@ -26,8 +26,9 @@ QtObject {
// Minting tokens: // Minting tokens:
function deployCollectible(communityId, collectibleItem) function deployCollectible(communityId, collectibleItem)
{ {
// TODO: Backend will need to check if the collectibleItem has a valid tokenKey, so it means a deployment retry, if (collectibleItem.key !== "") {
// otherwise, it is a new deployment. deleteToken(communityId, collectibleItem.key)
}
const jsonArtworkFile = Utils.getImageAndCropInfoJson(collectibleItem.artworkSource, collectibleItem.artworkCropRect) const jsonArtworkFile = Utils.getImageAndCropInfoJson(collectibleItem.artworkSource, collectibleItem.artworkCropRect)
communityTokensModuleInst.deployCollectible(communityId, collectibleItem.accountAddress, collectibleItem.name, communityTokensModuleInst.deployCollectible(communityId, collectibleItem.accountAddress, collectibleItem.name,
collectibleItem.symbol, collectibleItem.description, collectibleItem.supply, collectibleItem.symbol, collectibleItem.description, collectibleItem.supply,
@ -37,8 +38,9 @@ QtObject {
function deployAsset(communityId, assetItem) function deployAsset(communityId, assetItem)
{ {
// TODO: Backend will need to check if the collectibleItem has a valid tokenKey, so it means a deployment retry, if (assetItem.key !== "") {
// otherwise, it is a new deployment. deleteToken(communityId, assetItem.key)
}
const jsonArtworkFile = Utils.getImageAndCropInfoJson(assetItem.artworkSource, assetItem.artworkCropRect) const jsonArtworkFile = Utils.getImageAndCropInfoJson(assetItem.artworkSource, assetItem.artworkCropRect)
communityTokensModuleInst.deployAssets(communityId, assetItem.accountAddress, assetItem.name, communityTokensModuleInst.deployAssets(communityId, assetItem.accountAddress, assetItem.name,
assetItem.symbol, assetItem.description, assetItem.supply, assetItem.symbol, assetItem.description, assetItem.supply,