mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-08-10 16:43:12 +00:00
Simplify
This commit is contained in:
parent
2ac173f87c
commit
04beab5b91
@ -54,17 +54,15 @@ func initFromJson*(bytes: var seq[byte], node: JsonNode, _: var string) =
|
|||||||
|
|
||||||
func initFromJson*(address: var EthAddress, node: JsonNode, _: var string) =
|
func initFromJson*(address: var EthAddress, node: JsonNode, _: var string) =
|
||||||
node.expectKind(JString)
|
node.expectKind(JString)
|
||||||
let parsed = EthAddress.parse(node.getStr)
|
if parsed =? EthAddress.parse(node.getStr):
|
||||||
if parsed.isSome:
|
address = parsed
|
||||||
address = parsed.get
|
|
||||||
else:
|
else:
|
||||||
raise newException(ValueError, "invalid ethereum address")
|
raise newException(ValueError, "invalid ethereum address")
|
||||||
|
|
||||||
func initFromJson*(dest: var Destination, node: JsonNode, _: var string) =
|
func initFromJson*(dest: var Destination, node: JsonNode, _: var string) =
|
||||||
node.expectKind(JString)
|
node.expectKind(JString)
|
||||||
let parsed = Destination.parse(node.getStr)
|
if parsed =? Destination.parse(node.getStr):
|
||||||
if parsed.isSome:
|
dest = parsed
|
||||||
dest = parsed.get
|
|
||||||
else:
|
else:
|
||||||
raise newException(ValueError, "invalid nitro destination")
|
raise newException(ValueError, "invalid nitro destination")
|
||||||
|
|
||||||
@ -74,9 +72,8 @@ func initFromJson*(number: var UInt256, node: JsonNode, _: var string) =
|
|||||||
|
|
||||||
func initFromJson*(signature: var Signature, node: JsonNode, _: var string) =
|
func initFromJson*(signature: var Signature, node: JsonNode, _: var string) =
|
||||||
node.expectKind(JString)
|
node.expectKind(JString)
|
||||||
let parsed = Signature.parse(node.getStr)
|
if parsed =? Signature.parse(node.getStr):
|
||||||
if parsed.isSome:
|
signature = parsed
|
||||||
signature = parsed.get
|
|
||||||
else:
|
else:
|
||||||
raise newException(ValueError, "invalid signature")
|
raise newException(ValueError, "invalid signature")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user