- // TODO implement register, verify, link
- if (c != null && command instanceof JsonRpcMultiCommand<?> jsonRpcCommand) {
- return runCommand(objectMapper, params, new MultiCommandRunnerImpl<>(c, jsonRpcCommand));
+ if (c != null) {
+ if (command instanceof JsonRpcMultiCommand<?> jsonRpcCommand) {
+ return runCommand(objectMapper, params, new MultiCommandRunnerImpl<>(c, jsonRpcCommand));
+ }
+ if (command instanceof JsonRpcRegistrationCommand<?> jsonRpcCommand) {
+ try (var manager = getRegistrationManagerFromParams(params)) {
+ if (manager != null) {
+ return runCommand(objectMapper,
+ params,
+ new RegistrationCommandRunnerImpl<>(manager, c, jsonRpcCommand));
+ } else {
+ throw new JsonRpcException(new JsonRpcResponse.Error(JsonRpcResponse.Error.INVALID_PARAMS,
+ "Method requires valid account parameter",
+ null));
+ }
+ } catch (IOException e) {
+ logger.warn("Failed to close registration manager", e);
+ }
+ }