From c8ec3df105cf0237b4005ef269e7abfd78303f88 Mon Sep 17 00:00:00 2001 From: Bassam Riman Date: Thu, 13 Jul 2023 10:29:24 -0400 Subject: [PATCH] chore: clean imports warnings --- .../iohk/atala/event/notification/Event.scala | 1 - .../JdbcPresentationRepository.scala | 16 +++++++-------- .../notification/JsonEventEncoders.scala | 9 ++------- .../agent/server/DidCommHttpServer.scala | 16 ++++++--------- .../io/iohk/atala/agent/server/Main.scala | 20 +++---------------- .../http/IssueCredentialRecord.scala | 1 - ...dDIDServiceWithEventNotificationImpl.scala | 2 +- 7 files changed, 20 insertions(+), 45 deletions(-) diff --git a/event-notification/src/main/scala/io/iohk/atala/event/notification/Event.scala b/event-notification/src/main/scala/io/iohk/atala/event/notification/Event.scala index 2ed89e8999..17ee4fd480 100644 --- a/event-notification/src/main/scala/io/iohk/atala/event/notification/Event.scala +++ b/event-notification/src/main/scala/io/iohk/atala/event/notification/Event.scala @@ -1,7 +1,6 @@ package io.iohk.atala.event.notification import java.time.Instant import java.util.UUID -import zio.IO case class Event[A](`type`: String, id: UUID, ts: Instant, data: A) diff --git a/pollux/lib/sql-doobie/src/main/scala/io/iohk/atala/pollux/sql/repository/JdbcPresentationRepository.scala b/pollux/lib/sql-doobie/src/main/scala/io/iohk/atala/pollux/sql/repository/JdbcPresentationRepository.scala index f3f9aa880b..91bf476a40 100644 --- a/pollux/lib/sql-doobie/src/main/scala/io/iohk/atala/pollux/sql/repository/JdbcPresentationRepository.scala +++ b/pollux/lib/sql-doobie/src/main/scala/io/iohk/atala/pollux/sql/repository/JdbcPresentationRepository.scala @@ -3,14 +3,14 @@ package io.iohk.atala.pollux.sql.repository import cats.data.NonEmptyList import doobie.* import doobie.implicits.* -import doobie.postgres._ -import doobie.postgres.implicits._ -import io.circe._ -import io.circe.parser._ -import io.circe.syntax._ -import io.iohk.atala.mercury.protocol.presentproof._ -import io.iohk.atala.pollux.core.model.PresentationRecord.ProtocolState +import doobie.postgres.* +import doobie.postgres.implicits.* +import io.circe.* +import io.circe.parser.* +import io.circe.syntax.* +import io.iohk.atala.mercury.protocol.presentproof.* import io.iohk.atala.pollux.core.model.* +import io.iohk.atala.pollux.core.model.PresentationRecord.ProtocolState import io.iohk.atala.pollux.core.repository.PresentationRepository import io.iohk.atala.prism.crypto.MerkleInclusionProof import io.iohk.atala.shared.utils.BytesOps @@ -59,7 +59,7 @@ class JdbcPresentationRepository( // Uncomment to have Doobie LogHandler in scope and automatically output SQL statements in logs // given logHandler: LogHandler = LogHandler.jdkLogHandler - import PresentationRecord._ + import PresentationRecord.* given didCommIDGet: Get[DidCommID] = Get[String].map(DidCommID(_)) given didCommIDPut: Put[DidCommID] = Put[String].contramap(_.value) diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/notification/JsonEventEncoders.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/notification/JsonEventEncoders.scala index 01f962f480..4348e6b4be 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/notification/JsonEventEncoders.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/notification/JsonEventEncoders.scala @@ -4,15 +4,10 @@ import io.iohk.atala.agent.walletapi.model.ManagedDIDDetail import io.iohk.atala.castor.controller.http.ManagedDID import io.iohk.atala.castor.controller.http.ManagedDID.* import io.iohk.atala.connect.controller.http.Connection -import io.iohk.atala.connect.controller.http.Connection.* import io.iohk.atala.connect.core.model.ConnectionRecord -import io.iohk.atala.event.notification.{Event, EventNotificationServiceError} +import io.iohk.atala.event.notification.Event import io.iohk.atala.issue.controller.http.IssueCredentialRecord -import io.iohk.atala.issue.controller.http.IssueCredentialRecord.* -import io.iohk.atala.pollux.core.model.{ - IssueCredentialRecord as PolluxIssueCredentialRecord, - PresentationRecord as PolluxPresentationRecord -} +import io.iohk.atala.pollux.core.model.{IssueCredentialRecord as PolluxIssueCredentialRecord, PresentationRecord as PolluxPresentationRecord} import io.iohk.atala.presentproof.controller.http.PresentationStatus import zio.* import zio.json.* diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/DidCommHttpServer.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/DidCommHttpServer.scala index 6506cc5a8c..030a203ab2 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/DidCommHttpServer.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/DidCommHttpServer.scala @@ -1,7 +1,7 @@ package io.iohk.atala.agent.server -import io.circe.DecodingFailure -import io.circe.ParsingFailure +import io.circe.* +import io.circe.parser.* import io.iohk.atala.agent.walletapi.model.error.DIDSecretStorageError import io.iohk.atala.agent.walletapi.service.ManagedDIDService import io.iohk.atala.connect.core.model.error.ConnectionServiceError @@ -14,17 +14,14 @@ import io.iohk.atala.mercury.protocol.connection.{ConnectionRequest, ConnectionR import io.iohk.atala.mercury.protocol.issuecredential.* import io.iohk.atala.mercury.protocol.presentproof.* import io.iohk.atala.mercury.protocol.trustping.TrustPing -import io.iohk.atala.pollux.core.model.error.CredentialServiceError -import io.iohk.atala.pollux.core.model.error.PresentationError -import io.iohk.atala.pollux.core.service.CredentialService -import io.iohk.atala.pollux.core.service.PresentationService +import io.iohk.atala.pollux.core.model.error.{CredentialServiceError, PresentationError} +import io.iohk.atala.pollux.core.service.{CredentialService, PresentationService} import io.iohk.atala.resolvers.DIDResolver -import java.io.IOException import zio.* import zio.http.* import zio.http.model.* -import io.circe.* -import io.circe.parser.* + +import java.io.IOException object DidCommHttpServer { def run(didCommServicePort: Int) = { @@ -85,7 +82,6 @@ object DidCommHttpServer { jsonString: String ): ZIO[DidOps & ManagedDIDService, ParseResponse | DIDSecretStorageError, Message] = { // Needed for implicit conversion from didcommx UnpackResuilt to mercury UnpackMessage - import io.iohk.atala.mercury.model.given for { recipientDid <- extractFirstRecipientDid(jsonString).mapError(err => ParseResponse(err)) _ <- ZIO.logInfo(s"Extracted recipient Did => $recipientDid") diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Main.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Main.scala index 56c4e0cd14..37090bc5ec 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Main.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Main.scala @@ -3,11 +3,7 @@ package io.iohk.atala.agent.server import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton import io.iohk.atala.agent.server.http.ZioHttpClient import io.iohk.atala.agent.server.sql.Migrations as AgentMigrations -import io.iohk.atala.agent.walletapi.service.{ - ManagedDIDService, - ManagedDIDServiceImpl, - ManagedDIDServiceWithEventNotificationImpl -} +import io.iohk.atala.agent.walletapi.service.{ManagedDIDService, ManagedDIDServiceWithEventNotificationImpl} import io.iohk.atala.agent.walletapi.sql.JdbcDIDNonSecretStorage import io.iohk.atala.castor.controller.{DIDControllerImpl, DIDRegistrarControllerImpl} import io.iohk.atala.castor.core.service.DIDServiceImpl @@ -19,18 +15,8 @@ import io.iohk.atala.event.notification.EventNotificationServiceImpl import io.iohk.atala.issue.controller.IssueControllerImpl import io.iohk.atala.mercury.* import io.iohk.atala.pollux.core.service.* -import io.iohk.atala.pollux.credentialschema.controller.{ - CredentialSchemaController, - CredentialSchemaControllerImpl, - VerificationPolicyControllerImpl -} -import io.iohk.atala.pollux.sql.repository.{ - JdbcCredentialRepository, - JdbcCredentialSchemaRepository, - JdbcPresentationRepository, - JdbcVerificationPolicyRepository, - Migrations as PolluxMigrations -} +import io.iohk.atala.pollux.credentialschema.controller.{CredentialSchemaController, CredentialSchemaControllerImpl, VerificationPolicyControllerImpl} +import io.iohk.atala.pollux.sql.repository.{JdbcCredentialRepository, JdbcCredentialSchemaRepository, JdbcPresentationRepository, JdbcVerificationPolicyRepository, Migrations as PolluxMigrations} import io.iohk.atala.presentproof.controller.PresentProofControllerImpl import io.iohk.atala.resolvers.DIDResolver import io.iohk.atala.system.controller.SystemControllerImpl diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/http/IssueCredentialRecord.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/http/IssueCredentialRecord.scala index 94aef744e8..13cb6c3549 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/http/IssueCredentialRecord.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/issue/controller/http/IssueCredentialRecord.scala @@ -12,7 +12,6 @@ import zio.json.ast.Json import java.nio.charset.StandardCharsets import java.time.{OffsetDateTime, ZoneOffset} -import java.util.UUID /** A class to represent an an outgoing response for a created credential offer. * diff --git a/prism-agent/service/wallet-api/src/main/scala/io/iohk/atala/agent/walletapi/service/ManagedDIDServiceWithEventNotificationImpl.scala b/prism-agent/service/wallet-api/src/main/scala/io/iohk/atala/agent/walletapi/service/ManagedDIDServiceWithEventNotificationImpl.scala index 61409adace..3494dd603a 100644 --- a/prism-agent/service/wallet-api/src/main/scala/io/iohk/atala/agent/walletapi/service/ManagedDIDServiceWithEventNotificationImpl.scala +++ b/prism-agent/service/wallet-api/src/main/scala/io/iohk/atala/agent/walletapi/service/ManagedDIDServiceWithEventNotificationImpl.scala @@ -1,7 +1,7 @@ package io.iohk.atala.agent.walletapi.service import io.iohk.atala.agent.walletapi.crypto.Apollo -import io.iohk.atala.agent.walletapi.model.{ManagedDIDState, ManagedDIDDetail} +import io.iohk.atala.agent.walletapi.model.ManagedDIDDetail import io.iohk.atala.agent.walletapi.model.error.CommonWalletStorageError import io.iohk.atala.agent.walletapi.storage.{DIDNonSecretStorage, DIDSecretStorage} import io.iohk.atala.agent.walletapi.util.SeedResolver