30 lines
696 B
Nim
30 lines
696 B
Nim
{.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) |