WalletConnect / kotlin-walletconnect-lib

library to use WalletConnect with Kotlin or Java
MIT License
156 stars 98 forks source link

How to obtain address and personal signature #79

Closed jiaweio closed 2 years ago

jiaweio commented 2 years ago

Hello, I want to know how to establish a connection with metamask through this SDK, obtain the relevant wallet address and conduct personal signature. Is there any relevant document or demo for reference? I accessed the kotlin walletconnect lib Library https://github.com/WalletConnect/kotlin-walletconnect-lib, and found some problems. The library has not been updated for a long time. I hope to get your reply. Thank you

EthanChenccc commented 2 years ago

你可以用https://github.com/WalletConnect/kotlin-walletconnect-lib/tree/handle_non_string_in_ws_message 这个分支,添加了personal sign

jiaweio commented 2 years ago

你可以用https://github.com/WalletConnect/kotlin-walletconnect-lib/tree/handle_non_string_in_ws_message 这个分支,添加了personal sign

@EthanChenccc 你好,我使用了这个分支的相关代码,依然是无效的可以获取钱包地址,但无法进行信息签名(personal_sign)

data class PersonalSingMessage(val id: Long, val address: String, val message: String) : MethodCall(id) (我不知道address 这个参数应该填写什么?)

这是我的相关代码: screen_main_tx_button.setOnClickListener { val from = ExampleApplication.session.approvedAccounts()?.first() ?: return@setOnClickListener val txRequest = System.currentTimeMillis() ExampleApplication.session.performMethodCall( Session.MethodCall.PersonalSingMessage( txRequest, from, "21231233321111" ), ::handleResponse ) val i = Intent(Intent.ACTION_VIEW) i.data = Uri.parse("wc:") startActivity(i) }

Talhaali00 commented 2 years ago

Metamask has not implemented WalletConnect's version 2. For issues related to version 1, please open an issue here https://github.com/WalletConnect/kotlin-walletconnect-lib