mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-11 01:53:07 +00:00
eth_getTransactionByHash responses from geth don't include data, and there was an exception raised, "key not found: data"
25 lines
594 B
Nim
25 lines
594 B
Nim
import std/random
|
|
import std/sequtils
|
|
import pkg/ethers
|
|
|
|
randomize()
|
|
|
|
proc example*[N](_: type array[N, byte]): array[N, byte] =
|
|
var a: array[N, byte]
|
|
for b in a.mitems:
|
|
b = rand(byte)
|
|
a
|
|
|
|
proc example*(_: type seq[byte]): seq[byte] =
|
|
let length = rand(0..<20)
|
|
newSeqWith(length, rand(byte))
|
|
|
|
proc example*(_: type Address): Address =
|
|
Address.init(array[20, byte].example)
|
|
|
|
proc example*(_: type UInt256): UInt256 =
|
|
UInt256.fromBytesBE(array[32, byte].example)
|
|
|
|
proc example*(_: type Transaction): Transaction =
|
|
Transaction(to: Address.example, data: some seq[byte].example)
|