feat(wallet): Removed storing/deletion of pending txs.

Closes #10474
This commit is contained in:
Ivan Belyakov 2023-06-26 08:16:53 +02:00 committed by IvanBelyakoff
parent 875e17b061
commit 0d354c8ce1
2 changed files with 0 additions and 37 deletions

View File

@ -98,10 +98,6 @@ type
SuggestedRoutesArgs* = ref object of Args SuggestedRoutesArgs* = ref object of Args
suggestedRoutes*: string suggestedRoutes*: string
type
PendingTxCompletedArgs* = ref object of Args
txHash*: string
type type
CryptoServicesArgs* = ref object of Args CryptoServicesArgs* = ref object of Args
data*: seq[CryptoRampDto] data*: seq[CryptoRampDto]
@ -186,11 +182,6 @@ QtObject:
let address = watchTxResult["address"].getStr let address = watchTxResult["address"].getStr
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:
# Delete pending transaction. Deleting it in status-go didn't work for all the cases
# TODO: make delete pending and save transaction atomc in status-go after fixing the crash
discard transactions.deletePendingTransaction(chainId, hash)
echo watchTxResult["data"].getStr
let ev = TransactionMinedArgs( let ev = TransactionMinedArgs(
data: watchTxResult["data"].getStr, data: watchTxResult["data"].getStr,
transactionHash: hash, transactionHash: hash,
@ -203,13 +194,6 @@ QtObject:
proc watchTransaction*( proc watchTransaction*(
self: Service, hash: string, fromAddress: string, toAddress: string, trxType: string, data: string, chainId: int, track: bool = true self: Service, hash: string, fromAddress: string, toAddress: string, trxType: string, data: string, chainId: int, track: bool = true
) = ) =
if track:
try:
discard transactions.trackPendingTransaction(hash, fromAddress, toAddress, trxType, data, chainId)
except Exception as e:
let errDescription = e.msg
error "error: ", errDescription
let arg = WatchTransactionTaskArg( let arg = WatchTransactionTaskArg(
chainId: chainId, chainId: chainId,
hash: hash, hash: hash,

View File

@ -54,30 +54,9 @@ proc getTransfersByAddress*(chainId: int, address: string, toBlock: Uint256, lim
core.callPrivateRPC("wallet_getTransfersByAddressAndChainID", %* [chainId, address, toBlockParsed, limitAsHexWithoutLeadingZeros, loadMore]) core.callPrivateRPC("wallet_getTransfersByAddressAndChainID", %* [chainId, address, toBlockParsed, limitAsHexWithoutLeadingZeros, loadMore])
proc trackPendingTransaction*(hash: string, fromAddress: string, toAddress: string, trxType: string, data: string, chainId: int):
RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [{
"hash": hash,
"from": fromAddress,
"to": toAddress,
"type": trxType,
"additionalData": data,
"data": "",
"value": 0,
"timestamp": 0,
"gasPrice": 0,
"gasLimit": 0,
"network_id": chainId
}]
core.callPrivateRPC("wallet_storePendingTransaction", payload)
proc getTransactionReceipt*(chainId: int, transactionHash: string): RpcResponse[JsonNode] {.raises: [Exception].} = proc getTransactionReceipt*(chainId: int, transactionHash: string): RpcResponse[JsonNode] {.raises: [Exception].} =
core.callPrivateRPCWithChainId("eth_getTransactionReceipt", chainId, %* [transactionHash]) core.callPrivateRPCWithChainId("eth_getTransactionReceipt", chainId, %* [transactionHash])
proc deletePendingTransaction*(chainId: int, transactionHash: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [chainId, transactionHash]
result = core.callPrivateRPC("wallet_deletePendingTransactionByChainID", payload)
proc fetchCryptoServices*(): RpcResponse[JsonNode] {.raises: [Exception].} = proc fetchCryptoServices*(): RpcResponse[JsonNode] {.raises: [Exception].} =
result = core.callPrivateRPC("wallet_getCryptoOnRamps", %* []) result = core.callPrivateRPC("wallet_getCryptoOnRamps", %* [])