Skip to content

Commit

Permalink
Merge pull request #1495 from WalletConnect/deprecate
Browse files Browse the repository at this point in the history
Deprecate
  • Loading branch information
jakubuid authored Sep 21, 2024
2 parents 743ff1e + 8395e0c commit e373c53
Show file tree
Hide file tree
Showing 52 changed files with 391 additions and 42 deletions.
9 changes: 5 additions & 4 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
![WalletConnect V2](/docs/walletconnect-banner.svg)

# **WalletConnect - Kotlin**

The communications protocol for web3, WalletConnect brings the ecosystem together by enabling hundreds of wallets and apps to securely connect and interact. This repository contains Kotlin implementation of
WalletConnect v2 protocols for Android applications.
# **Deprecated - WalletConnect - Kotlin**
WalletConnect Inc is now Reown. As part of this transition, we are deprecating a number of repositories/packages across our supported platforms, and transitioning to their equivalents published under the Reown organization.

This repository is now considered deprecated and will reach End-of-Life on February 17th 2025. For more details, including migration guides please see: https://docs.reown.com/advanced/walletconnect-deprecations

---
####

## BOM Instructions:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.walletconnect.android

@Deprecated("com.walletconnect.android.CoreClient has been deprecated. Please use com.reown.android.CoreClient instead from - https://github.com/reown-com/reown-kotlin")
object CoreClient : CoreInterface by CoreProtocol.instance {

@Deprecated("com.walletconnect.android.CoreDelegate has been deprecated. Please use com.reown.android.CoreDelegate instead from - https://github.com/reown-com/reown-kotlin")
interface CoreDelegate : CoreInterface.Delegate

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.walletconnect.android.relay.NetworkClientTimeout
import com.walletconnect.android.relay.RelayConnectionInterface
import com.walletconnect.android.verify.client.VerifyInterface

@Deprecated("com.walletconnect.android.CoreInterface has been deprecated. Please use com.reown.android.CoreInterface instead from - https://github.com/reown-com/reown-kotlin")
interface CoreInterface {
val Pairing: PairingInterface
val PairingController: PairingControllerInterface
Expand All @@ -20,10 +21,13 @@ interface CoreInterface {
val Verify: VerifyInterface
val Explorer: ExplorerInterface

@Deprecated("com.walletconnect.android.CoreInterface has been deprecated. Please use com.reown.android.CoreInterface instead from - https://github.com/reown-com/reown-kotlin")
interface Delegate : PairingInterface.Delegate

@Deprecated("com.walletconnect.android.CoreInterface has been deprecated. Please use com.reown.android.CoreInterface instead from - https://github.com/reown-com/reown-kotlin")
fun setDelegate(delegate: Delegate)

@Deprecated("com.walletconnect.android.CoreClient has been deprecated. Please use com.reown.android.CoreClient instead from - https://github.com/reown-com/reown-kotlin")
fun initialize(
metaData: Core.Model.AppMetaData,
relayServerUrl: String,
Expand All @@ -36,6 +40,7 @@ interface CoreInterface {
onError: (Core.Model.Error) -> Unit,
)

@Deprecated("com.walletconnect.android.CoreClient has been deprecated. Please use com.reown.android.CoreClient instead from - https://github.com/reown-com/reown-kotlin")
fun initialize(
application: Application,
projectId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter
plantTimber()
}

@Deprecated("com.walletconnect.android.CoreClient has been deprecated. Please use com.reown.android.CoreClient instead from - https://github.com/reown-com/reown-kotlin")
override fun setDelegate(delegate: CoreInterface.Delegate) {
Pairing.setDelegate(delegate)
}
Expand All @@ -65,6 +66,7 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter
val instance = CoreProtocol()
}

@Deprecated("com.walletconnect.android.CoreClient has been deprecated. Please use com.reown.android.CoreClient instead from - https://github.com/reown-com/reown-kotlin")
override fun initialize(
metaData: Core.Model.AppMetaData,
relayServerUrl: String,
Expand Down Expand Up @@ -96,6 +98,7 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter
}
}

@Deprecated("com.walletconnect.android.CoreClient has been deprecated. Please use com.reown.android.CoreClient instead from - https://github.com/reown-com/reown-kotlin")
override fun initialize(
application: Application,
projectId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import kotlinx.coroutines.supervisorScope
import org.koin.core.KoinApplication
import org.koin.core.qualifier.named

@Deprecated("com.walletconnect.android.relay.RelayClient has been deprecated. Please use com.reown.android.relay.RelayClient instead from - https://github.com/reown-com/reown-kotlin")
class RelayClient(private val koinApp: KoinApplication = wcKoinApp) : BaseRelayClient(), RelayConnectionInterface {
private val manualConnection: ManualConnectionLifecycle by lazy { koinApp.koin.get(named(AndroidCommonDITags.MANUAL_CONNECTION_LIFECYCLE)) }
private val networkState: ConnectivityState by lazy { koinApp.koin.get(named(AndroidCommonDITags.CONNECTIVITY_STATE)) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.walletconnect.android.Core
import com.walletconnect.foundation.network.RelayInterface
import kotlinx.coroutines.flow.StateFlow

@Deprecated("com.walletconnect.android.relay.RelayConnectionInterface has been deprecated. Please use com.reown.android.relay.RelayConnectionInterface instead from - https://github.com/reown-com/reown-kotlin")
interface RelayConnectionInterface : RelayInterface {
val wssConnectionState: StateFlow<WSSConnectionState>
val isNetworkAvailable: StateFlow<Boolean?>
Expand Down
6 changes: 0 additions & 6 deletions product/walletconnectmodal/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

# Installation

:::caution
**The WalletConnectModal 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 WalletConnectModal for Android applications.

Android Core ![Maven Central](https://img.shields.io/maven-central/v/com.walletconnect/android-core)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.walletconnect.android.CoreInterface
import com.walletconnect.android.cacao.SignatureInterface
import com.walletconnect.android.internal.common.signing.cacao.Issuer

@Deprecated("com.walletconnect.web3.modal.client.Wallet has been deprecated. Please use com.reown.appkit.client.Modal instead from - https://github.com/reown-com/reown-kotlin")
object Modal {

sealed interface Listeners {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.jetbrains.annotations.ApiStatus.Experimental
import org.koin.core.qualifier.named
import org.koin.dsl.module

@Deprecated("This package is now considered deprecated and will reach End-of-Life on February 17th 2025. For more details, including migration guides please see: docs.reown.com")
object Web3Modal {

internal var chains: List<Modal.Model.Chain> = listOf()
Expand All @@ -38,6 +39,7 @@ object Web3Modal {

private lateinit var web3ModalEngine: Web3ModalEngine

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.ModalDelegate"))
interface ModalDelegate {
fun onSessionApproved(approvedSession: Modal.Model.ApprovedSession)
fun onSessionRejected(rejectedSession: Modal.Model.RejectedSession)
Expand All @@ -64,13 +66,15 @@ object Web3Modal {
fun onError(error: Modal.Model.Error)
}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.ComponentDelegate"))
interface ComponentDelegate {
fun onModalExpanded()

fun onModalHidden()

}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.initialize(init, onSuccess, onError)"))
fun initialize(
init: Modal.Params.Init,
onSuccess: () -> Unit = {},
Expand All @@ -91,12 +95,14 @@ object Web3Modal {
)
}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.register(activity)"))
@Experimental
fun register(activity: ComponentActivity) {
checkEngineInitialization()
web3ModalEngine.registerCoinbaseLauncher(activity)
}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.unregister()"))
@Experimental
fun unregister() {
checkEngineInitialization()
Expand Down Expand Up @@ -135,18 +141,22 @@ object Web3Modal {
}
}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.setChains(chains)"))
fun setChains(chains: List<Modal.Model.Chain>) {
this.chains = chains
}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.setAuthRequestParams(authParams)"))
fun setAuthRequestParams(authParams: Modal.Model.AuthPayloadParams) {
authPayloadParams = authParams
}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.setSessionProperties(properties)"))
fun setSessionProperties(properties: Map<String, String>) {
sessionProperties = properties
}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.setDelegate(delegate)"))
@Throws(IllegalStateException::class)
fun setDelegate(delegate: ModalDelegate) {
Web3ModalDelegate.connectionState.onEach { connectionState ->
Expand Down Expand Up @@ -189,6 +199,7 @@ object Web3Modal {
) { onError(it.toModal()) }
}

@Deprecated("Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin", replaceWith = ReplaceWith("AppKit.connect(connect, onSuccess, onError)"))
fun connect(
connect: Modal.Params.Connect,
onSuccess: (String) -> Unit,
Expand All @@ -201,6 +212,10 @@ object Web3Modal {
)
}

@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.authenticate(authenticate, walletAppLink, onSuccess, onError)")
)
fun authenticate(
authenticate: Modal.Params.Authenticate,
walletAppLink: String? = null,
Expand All @@ -213,15 +228,19 @@ object Web3Modal {
onError = { onError(it.toModal()) })
}

@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.handleDeepLink(url, onError)")
)
fun handleDeepLink(url: String, onError: (Modal.Model.Error) -> Unit) {
SignClient.dispatchEnvelope(url) {
onError(it.toModal())
}
}

@Deprecated(
message = "Modal.Params.Request is deprecated",
replaceWith = ReplaceWith("com.walletconnect.web3.modal.client.models.Request")
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.request(request, onSuccess, onError)")
)
fun request(
request: Modal.Params.Request,
Expand All @@ -236,6 +255,10 @@ object Web3Modal {
)
}

@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.request(request, onSuccess, onError)")
)
fun request(
request: Request,
onSuccess: (SentRequestResult) -> Unit = {},
Expand All @@ -250,6 +273,10 @@ object Web3Modal {
is SentRequestResult.WalletConnect -> Modal.Model.SentRequest(requestId, sessionTopic, method, params, chainId)
}

@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.request(request, onSuccess, onError)")
)
fun request(
request: Request,
onSuccess: () -> Unit,
Expand All @@ -259,11 +286,15 @@ object Web3Modal {
web3ModalEngine.request(request, { onSuccess() }, onError)
}

@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.ping(sessionPing)")
)
fun ping(sessionPing: Modal.Listeners.SessionPing? = null) = web3ModalEngine.ping(sessionPing)

@Deprecated(
message = "This has become deprecate in favor of the parameterless disconnect function",
level = DeprecationLevel.WARNING
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.disconnect(onSuccess, onError)")
)
fun disconnect(
onSuccess: (Modal.Params.Disconnect) -> Unit = {},
Expand All @@ -281,6 +312,10 @@ object Web3Modal {
)
}

@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.disconnect(onSuccess, onError)")
)
fun disconnect(
onSuccess: () -> Unit,
onError: (Throwable) -> Unit,
Expand All @@ -293,6 +328,10 @@ object Web3Modal {
* Caution: This function is blocking and runs on the current thread.
* It is advised that this function be called from background operation
*/
@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.getSelectedChain()")
)
fun getSelectedChain() = selectedChain
// fun getSelectedChain() = getSelectedChainUseCase()?.toChain()

Expand All @@ -301,9 +340,8 @@ object Web3Modal {
* It is advised that this function be called from background operation
*/
@Deprecated(
message = "Getting active session is replaced with getAccount()",
replaceWith = ReplaceWith("com.walletconnect.web3.modal.client.Web3Modal.getAccount()"),
level = DeprecationLevel.WARNING
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.getAccount()")
)
internal fun getActiveSessionByTopic(topic: String) = SignClient.getActiveSessionByTopic(topic)?.toModal()

Expand All @@ -312,9 +350,8 @@ object Web3Modal {
* It is advised that this function be called from background operation
*/
@Deprecated(
message = "Getting active session is replaced with getAccount()",
replaceWith = ReplaceWith("com.walletconnect.web3.modal.client.Web3Modal.getAccount()"),
level = DeprecationLevel.WARNING
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.getAccount()")
)
fun getActiveSession(): Modal.Model.Session? {
checkEngineInitialization()
Expand All @@ -325,6 +362,10 @@ object Web3Modal {
* Caution: This function is blocking and runs on the current thread.
* It is advised that this function be called from background operation
*/
@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.getAccount()")
)
fun getAccount(): Account? {
checkEngineInitialization()
return web3ModalEngine.getAccount()
Expand All @@ -334,6 +375,10 @@ object Web3Modal {
* Caution: This function is blocking and runs on the current thread.
* It is advised that this function be called from background operation
*/
@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.getSession()")
)
fun getSession(): Session? {
checkEngineInitialization()
return web3ModalEngine.getSession()
Expand All @@ -343,6 +388,10 @@ object Web3Modal {
* Caution: This function is blocking and runs on the current thread.
* It is advised that this function be called from background operation
*/
@Deprecated(
"Web3Modal has been deprecated. Please use AppKit instead from - https://github.com/reown-com/reown-kotlin",
replaceWith = ReplaceWith("AppKit.getConnectorType()")
)
fun getConnectorType(): Modal.ConnectorType? {
checkEngineInitialization()
return web3ModalEngine.getConnectorType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.walletconnect.web3.modal.client.models

import com.walletconnect.web3.modal.client.Modal

@Deprecated("com.walletconnect.web3.modal.client.models.Account has been deprecated. Please use com.reown.appkit.client.models.Account instead from - https://github.com/reown-com/reown-kotlin")
data class Account(
val address: String,
val chain: Modal.Model.Chain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ package com.walletconnect.web3.modal.client.models

import com.walletconnect.android.internal.common.exception.WalletConnectException

@Deprecated("com.walletconnect.web3.modal.client.models.Web3ModelClientAlreadyInitializedException has been deprecated. Please use com.reown.appkit.client.models.Web3ModelClientAlreadyInitializedException instead from - https://github.com/reown-com/reown-kotlin")
class Web3ModelClientAlreadyInitializedException : WalletConnectException("Web3Modal already initialized")

@Deprecated("com.walletconnect.web3.modal.client.models.CoinbaseClientAlreadyInitializedException has been deprecated. Please use com.reown.appkit.client.models.CoinbaseClientAlreadyInitializedException instead from - https://github.com/reown-com/reown-kotlin")
class CoinbaseClientAlreadyInitializedException : WalletConnectException("Coinbase already initialized")
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.walletconnect.web3.modal.client.models
import com.walletconnect.android.Core
import com.walletconnect.web3.modal.client.Modal

@Deprecated("com.walletconnect.web3.modal.client.models.Session has been deprecated. Please use com.reown.appkit.client.models.Modal instead from - https://github.com/reown-com/reown-kotlin")
sealed class Session {

data class WalletConnectSession(
val pairingTopic: String,
val topic: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.walletconnect.web3.modal.client.models.request

@Deprecated("com.walletconnect.web3.modal.client.models.request.Request has been deprecated. Please use com.reown.appkit.client.models.request.Request instead from - https://github.com/reown-com/reown-kotlin")
data class Request(
val method: String,
val params: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.walletconnect.web3.modal.client.models.request
import com.walletconnect.sign.client.Sign
import com.walletconnect.web3.modal.engine.coinbase.CoinbaseResult

@Deprecated("com.walletconnect.web3.modal.client.models.request.SentRequestResult has been deprecated. Please use com.reown.appkit.client.models.request.SentRequestResult instead from - https://github.com/reown-com/reown-kotlin")
sealed class SentRequestResult {
abstract val method: String
abstract val params: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.walletconnect.web3.modal.presets
import com.walletconnect.web3.modal.client.Modal
import com.walletconnect.web3.modal.utils.EthUtils

@Deprecated("com.walletconnect.web3.modal.presets.Web3ModalChainsPresets has been deprecated. Please use com.reown.appkit.presets.AppKitChainsPresets instead from - https://github.com/reown-com/reown-kotlin")
object Web3ModalChainsPresets {
val ethToken = Modal.Model.Token(name = "Ether", symbol = "ETH", decimal = 18)

Expand Down
Loading

0 comments on commit e373c53

Please sign in to comment.