This documentation provides a detailed guide on integrating and utilizing the ParticleConnect SDK in your Android application, focusing on Wallet Connect functionality. ParticleConnect simplifies the connection of decentralized wallets to your DApp through the Wallet Connect protocol.
Configuration
To integrate ParticleConnect into your project for Wallet Connect, follow these steps:
Initialize ParticleConnect in your application with Wallet Connect support:
val dAppMetadata =DAppMetadata(="", name ="Particle Connect", icon ="https://connect.particle.network/icons/512.png", url ="https://particle.network", description = "Particle Connect is a decentralized wallet connection protocol that makes it easy for users to connect their wallets to your DApp.",
)ParticleConnect.init(this.application, Env.PRODUCTION, Ethereum, dAppMetadata) {listOf(MetaMaskConnectAdapter(),RainbowConnectAdapter(),TrustConnectAdapter(),WalletConnectAdapter(),ImTokenConnectAdapter(),BitKeepConnectAdapter() )}
Login
Use the following code snippet to perform login with Wallet Connect:
val walletName = MobileWCWalletName.val metaMaskConnectAdapter = ParticleConnect.getAdapters().first { it.name == walletName.name }val config =null// ParticleConnectConfig only used for ParticleConnectAdapter, other adapter can be nullmetaMaskConnectAdapter.connect(config, object : ConnectCallback {overridefunonConnected(account: Account) {//connected wallet's address, it is 0x addressval address = account.publicAddress }overridefunonError(error: ConnectError) {//process error }})
Conclusion
This concludes the Wallet Connect integration guide for ParticleConnect in your Android application. Utilize this functionality to seamlessly connect decentralized wallets to your DApp.