diff --git a/product/appkit/ReadMe.md b/product/appkit/ReadMe.md index c9ea7ad82..c5dc98fdc 100644 --- a/product/appkit/ReadMe.md +++ b/product/appkit/ReadMe.md @@ -2,12 +2,6 @@ # Installation -:::caution -**The AppKit SDK is currently in Alpha and is not production-ready**. - -It's public API and associated documentation may still see significant and breaking changes. -::: - Kotlin implementation of AppKit for Android applications. Android Core ![Maven Central](https://img.shields.io/maven-central/v/com.walletconnect/android-core) diff --git a/product/appkit/src/main/kotlin/com/reown/appkit/client/AppKit.kt b/product/appkit/src/main/kotlin/com/reown/appkit/client/AppKit.kt index 5a828cfd5..6b765d0f3 100644 --- a/product/appkit/src/main/kotlin/com/reown/appkit/client/AppKit.kt +++ b/product/appkit/src/main/kotlin/com/reown/appkit/client/AppKit.kt @@ -174,21 +174,6 @@ object AppKit { }.launchIn(scope) } - @Deprecated( - message = "Replaced with the same name method but onSuccess callback returns a Pairing URL", - replaceWith = ReplaceWith(expression = "fun connect(connect: Modal.Params.Connect, onSuccess: (String) -> Unit, onError: (Modal.Model.Error) -> Unit)") - ) - internal fun connect( - connect: Modal.Params.Connect, - onSuccess: () -> Unit, - onError: (Modal.Model.Error) -> Unit - ) { - SignClient.connect( - connect.toSign(), - onSuccess - ) { onError(it.toModal()) } - } - fun connect( connect: Modal.Params.Connect, onSuccess: (String) -> Unit, @@ -219,23 +204,6 @@ object AppKit { } } - @Deprecated( - message = "Modal.Params.Request is deprecated", - replaceWith = ReplaceWith("com.reown.appkit.client.models.Request") - ) - fun request( - request: Modal.Params.Request, - onSuccess: (Modal.Model.SentRequest) -> Unit = {}, - onError: (Modal.Model.Error) -> Unit, - ) { - checkEngineInitialization() - appKitEngine.request( - request = Request(request.method, request.params, request.expiry), - onSuccess = { onSuccess(it.sentRequestToModal()) }, - onError = { onError(it.toModalError()) } - ) - } - fun request( request: Request, onSuccess: (SentRequestResult) -> Unit = {}, @@ -261,26 +229,6 @@ object AppKit { fun ping(sessionPing: Modal.Listeners.SessionPing? = null) = appKitEngine.ping(sessionPing) - @Deprecated( - message = "This has become deprecate in favor of the parameterless disconnect function", - level = DeprecationLevel.WARNING - ) - fun disconnect( - onSuccess: (Modal.Params.Disconnect) -> Unit = {}, - onError: (Modal.Model.Error) -> Unit, - ) { - checkEngineInitialization() - val topic = when (val session = appKitEngine.getActiveSession()) { - is WalletConnect -> session.topic - else -> String.Empty - } - - appKitEngine.disconnect( - onSuccess = { onSuccess(Modal.Params.Disconnect(topic)) }, - onError = { onError(it.toModalError()) } - ) - } - fun disconnect( onSuccess: () -> Unit, onError: (Throwable) -> Unit, @@ -294,7 +242,6 @@ object AppKit { * It is advised that this function be called from background operation */ fun getSelectedChain() = selectedChain -// fun getSelectedChain() = getSelectedChainUseCase()?.toChain() /** * Caution: This function is blocking and runs on the current thread. diff --git a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt index bfdfc8d4e..d881f99b8 100644 --- a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt +++ b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt @@ -302,19 +302,6 @@ object WalletKit { return SignClient.getActiveSessionByTopic(topic)?.toWallet() } - /** - * Caution: This function is blocking and runs on the current thread. - * It is advised that this function be called from background operation - */ - - @Deprecated( - "The return type of getPendingRequests methods has been replaced with SessionRequest list", - replaceWith = ReplaceWith("getPendingSessionRequests(topic: String): List") - ) - @Throws(IllegalStateException::class) - fun getPendingSessionRequests(topic: String): List { - return SignClient.getPendingRequests(topic).mapToPendingRequests() - } /** * Caution: This function is blocking and runs on the current thread. diff --git a/protocol/sign/src/main/kotlin/com/reown/sign/client/SignInterface.kt b/protocol/sign/src/main/kotlin/com/reown/sign/client/SignInterface.kt index 9b80fb524..2e61406bb 100644 --- a/protocol/sign/src/main/kotlin/com/reown/sign/client/SignInterface.kt +++ b/protocol/sign/src/main/kotlin/com/reown/sign/client/SignInterface.kt @@ -54,16 +54,6 @@ interface SignInterface { fun initialize(init: Sign.Params.Init, onSuccess: () -> Unit = {}, onError: (Sign.Model.Error) -> Unit) fun setWalletDelegate(delegate: WalletDelegate) fun setDappDelegate(delegate: DappDelegate) - - @Deprecated( - message = "Replaced with the same name method but onSuccess callback returns a Pairing URL", - replaceWith = ReplaceWith(expression = "fun connect(connect: Sign.Params.Connect, onSuccess: (String) -> Unit, onError: (Sign.Model.Error) -> Unit)") - ) - fun connect( - connect: Sign.Params.Connect, onSuccess: () -> Unit, - onError: (Sign.Model.Error) -> Unit, - ) - fun connect( connect: Sign.Params.Connect, onSuccess: (String) -> Unit, onError: (Sign.Model.Error) -> Unit, @@ -71,29 +61,12 @@ interface SignInterface { fun authenticate(authenticate: Sign.Params.Authenticate, walletAppLink: String? = null, onSuccess: (String) -> Unit, onError: (Sign.Model.Error) -> Unit) fun dispatchEnvelope(urlWithEnvelope: String, onError: (Sign.Model.Error) -> Unit) - - @Deprecated( - message = "Creating a pairing will be moved to CoreClient to make pairing SDK agnostic", - replaceWith = ReplaceWith(expression = "CoreClient.Pairing.pair()", imports = ["com.reown.android.CoreClient"]) - ) - fun pair(pair: Sign.Params.Pair, onSuccess: (Sign.Params.Pair) -> Unit = {}, onError: (Sign.Model.Error) -> Unit) fun approveSession(approve: Sign.Params.Approve, onSuccess: (Sign.Params.Approve) -> Unit = {}, onError: (Sign.Model.Error) -> Unit) fun rejectSession(reject: Sign.Params.Reject, onSuccess: (Sign.Params.Reject) -> Unit = {}, onError: (Sign.Model.Error) -> Unit) fun approveAuthenticate(approve: Sign.Params.ApproveAuthenticate, onSuccess: (Sign.Params.ApproveAuthenticate) -> Unit, onError: (Sign.Model.Error) -> Unit) fun rejectAuthenticate(reject: Sign.Params.RejectAuthenticate, onSuccess: (Sign.Params.RejectAuthenticate) -> Unit, onError: (Sign.Model.Error) -> Unit) fun formatAuthMessage(formatMessage: Sign.Params.FormatMessage): String - @Deprecated( - message = "The onSuccess callback has been replaced with a new callback that returns Sign.Model.SentRequest", - replaceWith = ReplaceWith(expression = "this.request(request, onSuccessWithSentRequest, onError)", imports = ["com.reown.sign.client"]) - ) - fun request( - request: Sign.Params.Request, - onSuccess: (Sign.Params.Request) -> Unit = {}, - onSuccessWithSentRequest: (Sign.Model.SentRequest) -> Unit = { it: Sign.Model.SentRequest -> Unit }, - onError: (Sign.Model.Error) -> Unit, - ) - fun request(request: Sign.Params.Request, onSuccess: (Sign.Model.SentRequest) -> Unit = {}, onError: (Sign.Model.Error) -> Unit) fun respond(response: Sign.Params.Response, onSuccess: (Sign.Params.Response) -> Unit = {}, onError: (Sign.Model.Error) -> Unit) fun update(update: Sign.Params.Update, onSuccess: (Sign.Params.Update) -> Unit = {}, onError: (Sign.Model.Error) -> Unit) @@ -115,46 +88,6 @@ interface SignInterface { */ fun getActiveSessionByTopic(topic: String): Sign.Model.Session? - /** - * Caution: This function is blocking and runs on the current thread. - * It is advised that this function be called from background operation - */ - @Deprecated( - message = "Getting a list of settled sessions is replaced with getListOfActiveSessions()", - replaceWith = ReplaceWith(expression = "SignClient.getListOfActiveSessions()") - ) - fun getListOfSettledSessions(): List - - /** - * Caution: This function is blocking and runs on the current thread. - * It is advised that this function be called from background operation - */ - @Deprecated( - message = "Getting a list of settled sessions by topic is replaced with getSettledSessionByTopic()", - replaceWith = ReplaceWith(expression = "SignClient.getSettledSessionByTopic()") - ) - fun getSettledSessionByTopic(topic: String): Sign.Model.Session? - - /** - * Caution: This function is blocking and runs on the current thread. - * It is advised that this function be called from background operation - */ - @Deprecated( - message = "Getting a list of Pairings will be moved to CoreClient to make pairing SDK agnostic", - replaceWith = ReplaceWith(expression = "CoreClient.Pairing.getPairings()") - ) - fun getListOfSettledPairings(): List - - /** - * Caution: This function is blocking and runs on the current thread. - * It is advised that this function be called from background operation - */ - @Deprecated( - "The return type of getPendingRequests methods has been replaced with SessionRequest list", - replaceWith = ReplaceWith("getPendingSessionRequests(topic: String): List") - ) - fun getPendingRequests(topic: String): List - /** * Caution: This function is blocking and runs on the current thread. * It is advised that this function be called from background operation diff --git a/protocol/sign/src/main/kotlin/com/reown/sign/client/SignProtocol.kt b/protocol/sign/src/main/kotlin/com/reown/sign/client/SignProtocol.kt index 2a5db588f..516ec2a39 100644 --- a/protocol/sign/src/main/kotlin/com/reown/sign/client/SignProtocol.kt +++ b/protocol/sign/src/main/kotlin/com/reown/sign/client/SignProtocol.kt @@ -172,27 +172,6 @@ class SignProtocol(private val koinApp: KoinApplication = wcKoinApp) : SignInter return runBlocking { signEngine.formatMessage(formatMessage.payloadParams.toEngine(), formatMessage.iss) } } - @Throws(IllegalStateException::class) - override fun pair( - pair: Sign.Params.Pair, - onSuccess: (Sign.Params.Pair) -> Unit, - onError: (Sign.Model.Error) -> Unit, - ) { - checkEngineInitialization() - - scope.launch { - try { - signEngine.pair( - uri = pair.uri, - onSuccess = { onSuccess(pair) }, - onFailure = { throwable -> onError(Sign.Model.Error(throwable)) } - ) - } catch (error: Exception) { - onError(Sign.Model.Error(error)) - } - } - } - @Throws(IllegalStateException::class) override fun approveSession(approve: Sign.Params.Approve, onSuccess: (Sign.Params.Approve) -> Unit, onError: (Sign.Model.Error) -> Unit) { checkEngineInitialization() @@ -424,23 +403,6 @@ class SignProtocol(private val koinApp: KoinApplication = wcKoinApp) : SignInter } } - @Throws(IllegalStateException::class) - override fun getListOfSettledSessions(): List { - checkEngineInitialization() - return runBlocking { - signEngine.getListOfSettledSessions().map(EngineDO.Session::toClientActiveSession) - } - } - - @Throws(IllegalStateException::class) - override fun getSettledSessionByTopic(topic: String): Sign.Model.Session? { - checkEngineInitialization() - return runBlocking { - signEngine.getListOfSettledSessions().map(EngineDO.Session::toClientActiveSession) - .find { session -> session.topic == topic } - } - } - @Throws(IllegalStateException::class) override fun getPendingSessionRequests(topic: String): List { checkEngineInitialization() @@ -471,79 +433,6 @@ class SignProtocol(private val koinApp: KoinApplication = wcKoinApp) : SignInter return runBlocking { signEngine.getListOfVerifyContexts().map { verifyContext -> verifyContext.toCore() } } } - @Deprecated( - message = "Replaced with the same name method but onSuccess callback returns a Pairing URL", - replaceWith = ReplaceWith(expression = "fun connect(connect: Sign.Params.Connect, onSuccess: (String) -> Unit, onError: (Sign.Model.Error) -> Unit)") - ) - @Throws(IllegalStateException::class) - override fun connect( - connect: Sign.Params.Connect, - onSuccess: () -> Unit, - onError: (Sign.Model.Error) -> Unit, - ) { - checkEngineInitialization() - scope.launch { - try { - signEngine.proposeSession( - connect.namespaces?.toMapOfEngineNamespacesRequired(), - connect.optionalNamespaces?.toMapOfEngineNamespacesOptional(), - connect.properties, - connect.pairing.toPairing(), - onSuccess = { onSuccess() }, - onFailure = { error -> onError(Sign.Model.Error(error)) } - ) - } catch (error: Exception) { - onError(Sign.Model.Error(error)) - } - } - } - - @Deprecated( - "The onSuccess callback has been replaced with a new callback that returns Sign.Model.SentRequest", - replaceWith = ReplaceWith("this.request(request, onSuccessWithSentRequest, onError)", "com.reown.sign.client") - ) - @Throws(IllegalStateException::class) - override fun request( - request: Sign.Params.Request, - onSuccess: (Sign.Params.Request) -> Unit, - onSuccessWithSentRequest: (Sign.Model.SentRequest) -> Unit, - onError: (Sign.Model.Error) -> Unit, - ) { - checkEngineInitialization() - - scope.launch { - try { - signEngine.sessionRequest( - request = request.toEngineDORequest(), - onSuccess = { onSuccess(request) }, - onFailure = { error -> onError(Sign.Model.Error(error)) } - ) - } catch (error: Exception) { - onError(Sign.Model.Error(error)) - } - } - } - - @Deprecated( - "Getting a list of Pairings will be moved to CoreClient to make pairing SDK agnostic", - replaceWith = ReplaceWith("CoreClient.Pairing.getPairings()", "com.reown.android.CoreClient") - ) - @Throws(IllegalStateException::class) - override fun getListOfSettledPairings(): List { - checkEngineInitialization() - return runBlocking { signEngine.getListOfSettledPairings().map(EngineDO.PairingSettle::toClientSettledPairing) } - } - - @Deprecated( - "The return type of getPendingRequests methods has been replaced with SessionRequest list", - replaceWith = ReplaceWith("getPendingSessionRequests(topic: String): List") - ) - @Throws(IllegalStateException::class) - override fun getPendingRequests(topic: String): List { - checkEngineInitialization() - return runBlocking { signEngine.getPendingRequests(Topic(topic)).mapToPendingRequests() } - } - // TODO: Uncomment once reinit scope logic is added // fun shutdown() { // scope.cancel()