mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-09 02:35:08 +00:00
Add JSON transform for bloom filter
This commit is contained in:
parent
b6a73327c3
commit
1826c0ce92
@ -151,6 +151,11 @@ proc `%`*(value: UInt256): JsonNode =
|
|||||||
proc `%`*(value: openArray[seq]): JsonNode =
|
proc `%`*(value: openArray[seq]): JsonNode =
|
||||||
result = %("0x" & value.toHex)
|
result = %("0x" & value.toHex)
|
||||||
|
|
||||||
|
proc `%`*(value: ref BloomFilter): JsonNode =
|
||||||
|
result = %("0x" & toHex[256](value[]))
|
||||||
|
|
||||||
|
# Marshalling from JSON to Nim types that includes format checking
|
||||||
|
|
||||||
proc fromJson*(n: JsonNode, argName: string, result: var HexQuantityStr) =
|
proc fromJson*(n: JsonNode, argName: string, result: var HexQuantityStr) =
|
||||||
# Note that '0x' is stripped after validation
|
# Note that '0x' is stripped after validation
|
||||||
n.kind.expect(JString, argName)
|
n.kind.expect(JString, argName)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user