diff --git a/beacon_chain/beacon_node_common.nim b/beacon_chain/beacon_node_common.nim index 34d110355..bc8ce300f 100644 --- a/beacon_chain/beacon_node_common.nim +++ b/beacon_chain/beacon_node_common.nim @@ -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, diff --git a/beacon_chain/rpc/nimbus_rest_api.nim b/beacon_chain/rpc/nimbus_rest_api.nim index e2accf164..a3e0d27da 100644 --- a/beacon_chain/rpc/nimbus_rest_api.nim +++ b/beacon_chain/rpc/nimbus_rest_api.nim @@ -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():