mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-02 13:43:06 +00:00
15 lines
364 B
Nim
15 lines
364 B
Nim
import pkg/questionable
|
|
import pkg/stew/byteutils
|
|
|
|
export questionable
|
|
|
|
type EthAddress* = distinct array[20, byte]
|
|
|
|
proc toArray*(address: EthAddress): array[20, byte] =
|
|
array[20, byte](address)
|
|
|
|
proc parse*(_: type EthAddress, hex: string): ?EthAddress =
|
|
EthAddress(array[20, byte].fromHex(hex)).catch.toOption
|
|
|
|
proc `==`*(a, b: EthAddress): bool {.borrow.}
|