class PrivGetPrivateTransaction implements JsonRpcMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    LOG.trace("Executing {}", RpcMethod.PRIV_GET_PRIVATE_TRANSACTION.getMethodName());

    final Hash hash = requestContext.getRequiredParameter(0, Hash.class);
    final String enclaveKey = enclavePublicKeyProvider.getEnclaveKey(requestContext.getUser());

    final Optional<PrivateTransaction> maybePrivateTx;
    try {
      maybePrivateTx =
          privacyController
              .findPrivateTransactionByPmtHash(hash, enclaveKey)
              .map(PrivateTransaction.class::cast);
    } catch (EnclaveClientException e) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(),
          JsonRpcEnclaveErrorConverter.convertEnclaveInvalidReason(e.getMessage()));
    }

    return maybePrivateTx
        .map(this::mapTransactionResult)
        .map(result -> new JsonRpcSuccessResponse(requestContext.getRequest().getId(), result))
        .orElse(new JsonRpcSuccessResponse(requestContext.getRequest().getId(), null));
  }

  public  PrivGetPrivateTransaction(
      final PrivacyController privacyController,
      final EnclavePublicKeyProvider enclavePublicKeyProvider);

}