fix(@wallet): add data field in tx event

This commit is contained in:
Anthony Laibe 2023-02-03 16:31:35 +01:00 committed by Anthony Laibe
parent bc353a1ccc
commit 36f562243c
2 changed files with 6 additions and 1 deletions

View File

@ -137,6 +137,7 @@ const getSuggestedRoutesTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall
type type
WatchTransactionTaskArg* = ref object of QObjectTaskArg WatchTransactionTaskArg* = ref object of QObjectTaskArg
data: string
hash: string hash: string
chainId: int chainId: int
address: string address: string
@ -147,6 +148,7 @@ const watchTransactionTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.}
try: try:
let output = %*{ let output = %*{
"hash": arg.hash, "hash": arg.hash,
"data": arg.data,
"address": arg.address, "address": arg.address,
"chainId": arg.chainId, "chainId": arg.chainId,
"trxType": arg.trxType, "trxType": arg.trxType,
@ -156,6 +158,7 @@ const watchTransactionTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.}
except Exception as e: except Exception as e:
let output = %* { let output = %* {
"hash": arg.hash, "hash": arg.hash,
"data": arg.data,
"address": arg.address, "address": arg.address,
"chainId": arg.chainId, "chainId": arg.chainId,
"trxType": arg.trxType, "trxType": arg.trxType,

View File

@ -147,8 +147,9 @@ QtObject:
let transactionReceipt = transactions.getTransactionReceipt(chainId, hash).result let transactionReceipt = transactions.getTransactionReceipt(chainId, hash).result
if transactionReceipt != nil and transactionReceipt.kind != JNull: if transactionReceipt != nil and transactionReceipt.kind != JNull:
discard transactions.deletePendingTransaction(chainId, hash) discard transactions.deletePendingTransaction(chainId, hash)
echo watchTxResult["data"].getStr
let ev = TransactionMinedArgs( let ev = TransactionMinedArgs(
data: "", data: watchTxResult["data"].getStr,
transactionHash: hash, transactionHash: hash,
chainId: chainId, chainId: chainId,
success: transactionReceipt{"status"}.getStr == "0x1", success: transactionReceipt{"status"}.getStr == "0x1",
@ -171,6 +172,7 @@ QtObject:
hash: hash, hash: hash,
address: fromAddress, address: fromAddress,
trxType: trxType, trxType: trxType,
data: data,
tptr: cast[ByteAddress](watchTransactionTask), tptr: cast[ByteAddress](watchTransactionTask),
vptr: cast[ByteAddress](self.vptr), vptr: cast[ByteAddress](self.vptr),
slot: "watchTransactionResult", slot: "watchTransactionResult",