mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-11 21:04:11 +00:00
Updated hexstrings to translate common Nimbus types to hex strings
This commit is contained in:
parent
88ab097a61
commit
4b03f6d4db
@ -10,7 +10,7 @@
|
|||||||
## This module implements the Ethereum hexadecimal string formats for JSON
|
## This module implements the Ethereum hexadecimal string formats for JSON
|
||||||
## See: https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding
|
## 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
|
type
|
||||||
HexQuantityStr* = distinct string
|
HexQuantityStr* = distinct string
|
||||||
@ -142,6 +142,9 @@ proc `%`*(value: EthHashStr): JsonNode =
|
|||||||
proc `%`*(value: EthAddress): JsonNode =
|
proc `%`*(value: EthAddress): JsonNode =
|
||||||
result = %("0x" & value.toHex)
|
result = %("0x" & value.toHex)
|
||||||
|
|
||||||
|
proc `%`*(value: Hash256): JsonNode =
|
||||||
|
result = %("0x" & $value)
|
||||||
|
|
||||||
proc `%`*(value: UInt256): JsonNode =
|
proc `%`*(value: UInt256): JsonNode =
|
||||||
result = %("0x" & value.toString)
|
result = %("0x" & value.toString)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user