nim-ethers/ethers/providers/rpccalls/conversions.nim

12 lines
313 B
Nim
Raw Normal View History

2022-01-18 11:42:58 +00:00
import std/json
import ../../basics
func `%`*(address: Address): JsonNode =
%($address)
func fromJson*(json: JsonNode, argname: string, result: var Address) =
if address =? Address.init(json.getStr()):
result = address
else:
raise newException(ValueError, "\"" & argname & "\"is not an Address")