fix(@desktop/wallet): properly handle tx send error

This commit is contained in:
Dario Gabriel Lipicar 2024-11-27 23:48:00 -03:00 committed by dlipicar
parent 3ce2ec82e2
commit 0a358f66bf
2 changed files with 15 additions and 5 deletions

View File

@ -450,11 +450,13 @@ proc sendNotification[T](self: Module[T], status: string, sendDetails: SendDetai
fromAsset = sendDetails.fromToken
toAsset = sendDetails.toToken
error = ""
txHash = ""
isApprovalTx = false
if not sendDetails.errorResponse.isNil:
error = sendDetails.errorResponse.details
if sentTransaction.hash.len > 0:
if not sentTransaction.isNil and sentTransaction.hash.len > 0:
txTo = sentTransaction.toAddress
if sentTransaction.fromChain > 0:
fromChain = sentTransaction.fromChain
@ -471,6 +473,8 @@ proc sendNotification[T](self: Module[T], status: string, sendDetails: SendDetai
fromAsset = sentTransaction.fromToken
if sentTransaction.toToken.len > 0:
toAsset = sentTransaction.toToken
txHash = sentTransaction.hash
isApprovalTx = sentTransaction.approvalTx
var accFromName = ""
@ -505,8 +509,8 @@ proc sendNotification[T](self: Module[T], status: string, sendDetails: SendDetai
accToName,
txTo,
txToName,
sentTransaction.hash,
sentTransaction.approvalTx,
txHash,
isApprovalTx,
fromAmount,
toAmount,
fromAsset,

View File

@ -55,11 +55,17 @@ proc delete*(self: Controller) =
proc init*(self: Controller) =
self.events.on(SIGNAL_TRANSACTION_SENT) do(e:Args):
let args = TransactionArgs(e)
var
txHash = ""
isApprovalTx = false
if not args.sentTransaction.isNil:
txHash = args.sentTransaction.hash
isApprovalTx = args.sentTransaction.approvalTx
self.delegate.transactionWasSent(
args.sendDetails.uuid,
args.sendDetails.fromChain,
args.sentTransaction.approvalTx,
args.sentTransaction.hash,
isApprovalTx,
txHash,
if not args.sendDetails.errorResponse.isNil: args.sendDetails.errorResponse.details else: ""
)