status-lib/status/types/transaction.nim

30 lines
696 B
Nim
Raw Normal View History

2021-09-08 18:05:39 +00:00
{.used.}
import strutils
include pending_transaction_type
type
Transaction* = ref object
id*: string
typeValue*: string
address*: string
blockNumber*: string
blockHash*: string
contract*: string
timestamp*: string
gasPrice*: string
gasLimit*: string
gasUsed*: string
nonce*: string
txStatus*: string
value*: string
fromAddress*: string
to*: string
proc cmpTransactions*(x, y: Transaction): int =
# Sort proc to compare transactions from a single account.
# Compares first by block number, then by nonce
result = cmp(x.blockNumber.parseHexInt, y.blockNumber.parseHexInt)
if result == 0:
result = cmp(x.nonce, y.nonce)