Updated hexstrings to translate common Nimbus types to hex strings

This commit is contained in:
coffeepots 2018-08-15 13:13:30 +01:00
parent 88ab097a61
commit 4b03f6d4db
1 changed files with 4 additions and 1 deletions

View File

@ -10,7 +10,7 @@
## This module implements the Ethereum hexadecimal string formats for JSON
## See: https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding
import eth_common/eth_types, stint, byteutils
import eth_common/eth_types, stint, byteutils, nimcrypto
type
HexQuantityStr* = distinct string
@ -142,6 +142,9 @@ proc `%`*(value: EthHashStr): JsonNode =
proc `%`*(value: EthAddress): JsonNode =
result = %("0x" & value.toHex)
proc `%`*(value: Hash256): JsonNode =
result = %("0x" & $value)
proc `%`*(value: UInt256): JsonNode =
result = %("0x" & value.toString)