fix(@desktop/communities): Upgrade pending transaction types for community token operations

Issue #11565
This commit is contained in:
Michal Iskierko 2023-07-18 15:40:23 +02:00 committed by Michał Iskierko
parent a30678f5ec
commit d022d4ff8d
2 changed files with 13 additions and 12 deletions

View File

@ -214,7 +214,7 @@ QtObject:
self.fetchAllTokenOwners() self.fetchAllTokenOwners()
self.tokenOwnersTimer.start() self.tokenOwnersTimer.start()
self.events.on(PendingTransactionTypeDto.CollectibleDeployment.event) do(e: Args): self.events.on(PendingTransactionTypeDto.DeployCommunityToken.event) do(e: Args):
var receivedData = TransactionMinedArgs(e) var receivedData = TransactionMinedArgs(e)
try: try:
let deployState = if receivedData.success: DeployState.Deployed else: DeployState.Failed let deployState = if receivedData.success: DeployState.Deployed else: DeployState.Failed
@ -233,7 +233,7 @@ QtObject:
error "Error processing Collectible deployment pending transaction event", msg=e.msg, receivedData error "Error processing Collectible deployment pending transaction event", msg=e.msg, receivedData
self.events.on(PendingTransactionTypeDto.CollectibleAirdrop.event) do(e: Args): self.events.on(PendingTransactionTypeDto.AirdropCommunityToken.event) do(e: Args):
let receivedData = TransactionMinedArgs(e) let receivedData = TransactionMinedArgs(e)
try: try:
let tokenDto = toCommunityTokenDto(parseJson(receivedData.data)) let tokenDto = toCommunityTokenDto(parseJson(receivedData.data))
@ -248,7 +248,7 @@ QtObject:
except Exception as e: except Exception as e:
error "Error processing Collectible airdrop pending transaction event", msg=e.msg, receivedData error "Error processing Collectible airdrop pending transaction event", msg=e.msg, receivedData
self.events.on(PendingTransactionTypeDto.CollectibleRemoteSelfDestruct.event) do(e: Args): self.events.on(PendingTransactionTypeDto.RemoteDestructCollectible.event) do(e: Args):
let receivedData = TransactionMinedArgs(e) let receivedData = TransactionMinedArgs(e)
try: try:
let tokenDto = toCommunityTokenDto(parseJson(receivedData.data)) let tokenDto = toCommunityTokenDto(parseJson(receivedData.data))
@ -263,7 +263,7 @@ QtObject:
except Exception as e: except Exception as e:
error "Error processing Collectible self destruct pending transaction event", msg=e.msg, receivedData error "Error processing Collectible self destruct pending transaction event", msg=e.msg, receivedData
self.events.on(PendingTransactionTypeDto.CollectibleBurn.event) do(e: Args): self.events.on(PendingTransactionTypeDto.BurnCommunityToken.event) do(e: Args):
let receivedData = TransactionMinedArgs(e) let receivedData = TransactionMinedArgs(e)
try: try:
let tokenDto = toCommunityTokenDto(parseJson(receivedData.data)) let tokenDto = toCommunityTokenDto(parseJson(receivedData.data))
@ -340,7 +340,7 @@ QtObject:
transactionHash, transactionHash,
addressFrom, addressFrom,
contractAddress, contractAddress,
$PendingTransactionTypeDto.CollectibleDeployment, $PendingTransactionTypeDto.DeployCommunityToken,
$communityToken.toJsonNode(), $communityToken.toJsonNode(),
chainId, chainId,
) )
@ -409,7 +409,7 @@ QtObject:
transactionHash, transactionHash,
addressFrom, addressFrom,
collectibleAndAmount.communityToken.address, collectibleAndAmount.communityToken.address,
$PendingTransactionTypeDto.CollectibleAirdrop, $PendingTransactionTypeDto.AirdropCommunityToken,
$collectibleAndAmount.communityToken.toJsonNode(), $collectibleAndAmount.communityToken.toJsonNode(),
collectibleAndAmount.communityToken.chainId, collectibleAndAmount.communityToken.chainId,
) )
@ -509,7 +509,7 @@ QtObject:
transactionHash, transactionHash,
addressFrom, addressFrom,
contract.address, contract.address,
$PendingTransactionTypeDto.CollectibleRemoteSelfDestruct, $PendingTransactionTypeDto.RemoteDestructCollectible,
$contract.toJsonNode(), $contract.toJsonNode(),
contract.chainId, contract.chainId,
) )
@ -572,7 +572,7 @@ QtObject:
transactionHash, transactionHash,
addressFrom, addressFrom,
contract.address, contract.address,
$PendingTransactionTypeDto.CollectibleBurn, $PendingTransactionTypeDto.BurnCommunityToken,
$contract.toJsonNode(), $contract.toJsonNode(),
contract.chainId, contract.chainId,
) )
@ -631,6 +631,7 @@ QtObject:
proc createComputeFeeArgs(self: Service, gasUnits: int, suggestedFees: SuggestedFeesDto, chainId: int, walletAddress: string): ComputeFeeArgs = proc createComputeFeeArgs(self: Service, gasUnits: int, suggestedFees: SuggestedFeesDto, chainId: int, walletAddress: string): ComputeFeeArgs =
let ethValue = self.computeEthValue(gasUnits, suggestedFees) let ethValue = self.computeEthValue(gasUnits, suggestedFees)
let balance = self.getWalletBalanceForChain(walletAddress, chainId) let balance = self.getWalletBalanceForChain(walletAddress, chainId)
debug "computing fees", walletBalance=balance, ethValue=ethValue
return self.createComputeFeeArgsFromEthAndBalance(ethValue, balance) return self.createComputeFeeArgsFromEthAndBalance(ethValue, balance)
# convert json returned from async task into gas table # convert json returned from async task into gas table

View File

@ -16,10 +16,10 @@ type
ReleaseENS = "ReleaseENS", ReleaseENS = "ReleaseENS",
BuyStickerPack = "BuyStickerPack" BuyStickerPack = "BuyStickerPack"
WalletTransfer = "WalletTransfer" WalletTransfer = "WalletTransfer"
CollectibleDeployment = "CollectibleDeployment" DeployCommunityToken = "DeployCommunityToken"
CollectibleAirdrop = "CollectibleAirdrop" AirdropCommunityToken = "AirdropCommunityToken"
CollectibleRemoteSelfDestruct = "CollectibleRemoteSelfDestruct" RemoteDestructCollectible = "RemoteDestructCollectible"
CollectibleBurn = "CollectibleBurn" BurnCommunityToken = "BurnCommunityToken"
proc event*(self:PendingTransactionTypeDto):string = proc event*(self:PendingTransactionTypeDto):string =
result = "transaction:" & $self result = "transaction:" & $self