WalletConnect / kotlin-walletconnect-lib

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

The chainId in the returned data is empty #30

Open VliceZ opened 3 years ago

VliceZ commented 3 years ago

How can i get it right?

montaigne2100 commented 3 years ago

@VliceZ Hi, did you manage to make it work?

VliceZ commented 3 years ago

@miohtama i have no idea,just shows a dialog for users to choose,like ETH、BSC。

ligi commented 3 years ago

What exactly is the problem with this lib? The lib should show no dialog.

VliceZ commented 3 years ago

What I mean is that I don’t know the chainId returned, so I let the user choose which chain the specific wallet is.

montaigne2100 commented 3 years ago

@VliceZ @ligi The sample app is not working and when I fix it and click to connect button, it navigates me to the wallet app I chose and returns me this strings: isthis It just oppens the app not asks for permission. How can I fix it?

VliceZ commented 3 years ago

@miohtama The bridge parameter in in simple app is not working, try to change it to "https://bridge.walletconnect.org" ,the complete code like this in Application : fun resetSession() { nullOnThrow { session }?.clearCallbacks() val icons: ArrayList = arrayListOf() icons.add("https://images/xx.png") val key = ByteArray(32).also { Random().nextBytes(it) }.toNoPrefixHexString() config = Session.Config(UUID.randomUUID().toString(), "https://bridge.walletconnect.org", key) session = WCSession(config, MoshiPayloadAdapter(moshi), storage, OkHttpTransport.Builder(client, moshi), Session.PeerMeta(name = "Dfox",icons = icons) ) session?.offer() }

montaigne2100 commented 3 years ago

@VliceZ Hi, thank you so much for posting this code snippet :) I am now able to send permission request but it crashes when user accepts connection. Error: E/AndroidRuntime: FATAL EXCEPTION: OkHttp https://bridge.walletconnect.org/... Process: com.application.kotlinwalletconnectdeneme, PID: 20277 java.lang.IllegalStateException: Module with the Main dispatcher had failed to initialize

Can you take a look at this please? Thank you so much :)

VliceZ commented 3 years ago

@montaigne2100 I think the error is from this line "icons.add("https://images/xx.png")",the icons url just a example , you need add a real icon Url.

montaigne2100 commented 3 years ago

@VliceZ Yeah I did that but problem was about coroutines library's version. I upgraded it and its fixed. Thank you so so much :) You saved my days

ligi commented 3 years ago

So the problem is solved by using a valid icon URL? Maybe we should throw an exception as the library then

kashifahmad662 commented 3 years ago

@miohtama The bridge parameter in in simple app is not working, try to change it to "https://bridge.walletconnect.org" ,the complete code like this in Application : fun resetSession() { nullOnThrow { session }?.clearCallbacks() val icons: ArrayList = arrayListOf() icons.add("https://images/xx.png") val key = ByteArray(32).also { Random().nextBytes(it) }.toNoPrefixHexString() config = Session.Config(UUID.randomUUID().toString(), "https://bridge.walletconnect.org", key) session = WCSession(config, MoshiPayloadAdapter(moshi), storage, OkHttpTransport.Builder(client, moshi), Session.PeerMeta(name = "Dfox",icons = icons) ) session?.offer() }

Im having error after doing this java.net.connection failed to connect bridge.walletconnect.org

I don’t know why is it coming before some time my code was working fine and now this exception throws every time i send request to metamask or trustwallet.

Can u help me out with this problem i have already raised a issue u can see my issue in issue tab with all the codes

dophunhan commented 2 years ago

How to get chaninId @ligi @VliceZ @kashifahmad662 @montaigne2100 I need to get the channel ID to check if the network matches or not