Add a POST /api/nimbus/v1/graffiti API
This commit is contained in:
parent
cc3851ec02
commit
5266db3485
|
@ -11,7 +11,7 @@ import
|
|||
std/osproc,
|
||||
|
||||
# Nimble packages
|
||||
chronos, json_rpc/servers/httpserver, presto
|
||||
chronos, json_rpc/servers/httpserver, presto,
|
||||
|
||||
# Local modules
|
||||
./conf, ./beacon_clock, ./beacon_chain_db,
|
||||
|
|
|
@ -139,6 +139,19 @@ proc installNimbusApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
|||
))
|
||||
return RestApiResponse.jsonResponse((peers: res))
|
||||
|
||||
router.api(MethodPost, "/api/nimbus/v1/graffiti") do (
|
||||
graffiti: Option[string]) -> RestApiResponse:
|
||||
if graffiti.isSome and graffiti.get.isOk:
|
||||
try:
|
||||
node.graffitiBytes = GraffitiBytes.init(graffiti.get.get)
|
||||
return RestApiResponse.jsonResponse((result: true))
|
||||
except CatchableError as err:
|
||||
return RestApiResponse.jsonError(
|
||||
Http400, "Invalid graffiti string", err.msg)
|
||||
else:
|
||||
return RestApiResponse.jsonError(
|
||||
Http400, "You must specify a valid graffiti string")
|
||||
|
||||
router.api(MethodPost, "/api/nimbus/v1/chronicles/settings") do (
|
||||
log_level: Option[string]) -> RestApiResponse:
|
||||
if log_level.isSome():
|
||||
|
|
Loading…
Reference in New Issue