fix rpc_sim receipt unmarshalling
This commit is contained in:
parent
39402ea8d3
commit
f8c1a7f0a8
|
@ -46,6 +46,20 @@ proc nonceAt*(client: RpcClient, address: EthAddress): Future[AccountNonce] {.as
|
|||
let hex = await client.eth_getTransactionCount(ethAddressStr(address), "latest")
|
||||
result = parseHexInt(hex.string).AccountNonce
|
||||
|
||||
func toTopics(list: openArray[Hash256]): seq[Topic] =
|
||||
result = newSeqOfCap[Topic](list.len)
|
||||
for x in list:
|
||||
result.add x.data
|
||||
|
||||
func toLogs(list: openArray[FilterLog]): seq[Log] =
|
||||
result = newSeqOfCap[Log](list.len)
|
||||
for x in list:
|
||||
result.add Log(
|
||||
address: x.address,
|
||||
data: x.data,
|
||||
topics: toTopics(x.topics)
|
||||
)
|
||||
|
||||
proc txReceipt*(client: RpcClient, txHash: Hash256): Future[Option[Receipt]] {.async.} =
|
||||
let rr = await client.eth_getTransactionReceipt(txHash)
|
||||
if rr.isNone:
|
||||
|
@ -59,7 +73,7 @@ proc txReceipt*(client: RpcClient, txHash: Hash256): Future[Option[Receipt]] {.a
|
|||
hash : rc.root.get(Hash256()),
|
||||
cumulativeGasUsed: parseHexInt(rc.cumulativeGasUsed.string).GasInt,
|
||||
bloom : BloomFilter(rc.logsBloom),
|
||||
logs : rc.logs
|
||||
logs : toLogs(rc.logs)
|
||||
)
|
||||
result = some(rec)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import
|
|||
../premix/regress,
|
||||
./tracerTestGen,
|
||||
./persistBlockTestGen,
|
||||
../hive_integration/nodocker/consensus/extract_consensus_data,
|
||||
../hive_integration/nodocker/rpc/rpc_sim,
|
||||
../hive_integration/nodocker/consensus/consensus_sim,
|
||||
../hive_integration/nodocker/graphql/graphql_sim,
|
||||
../hive_integration/nodocker/engine/engine_sim,
|
||||
|
|
Loading…
Reference in New Issue