status-lib/status/transactions.nim

29 lines
1.1 KiB
Nim
Raw Permalink Normal View History

import json, stint, chronicles, strutils
2021-09-08 18:05:39 +00:00
import ./core as core
2021-09-08 18:05:39 +00:00
proc checkRecentHistory*(addresses: seq[string]) {.raises: [Exception].} =
let payload = %* [addresses]
discard callPrivateRPC("wallet_checkRecentHistory", payload)
2021-09-08 18:05:39 +00:00
proc getTransfersByAddress*(address: string, toBlock: Uint256, limitAsHexWithoutLeadingZeros: string,
loadMore: bool = false): RpcResponse[JsonNode] {.raises: [Exception].} =
let toBlockParsed = if not loadMore: newJNull() else: %("0x" & stint.toHex(toBlock))
callPrivateRPC("wallet_getTransfersByAddress", %* [address, toBlockParsed, limitAsHexWithoutLeadingZeros, loadMore])
proc trackPendingTransaction*(hash: string, fromAddress: string, toAddress: string, trxType: string, data: string):
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
}]
callPrivateRPC("wallet_storePendingTransaction", payload)