0

I have following problem. I just can't figure out how to initialize WalletConnect and connect to Metamask on Android. I always get following exception.

java.lang.NoSuchMethodError: No interface method getInitializationErrorsFlow()Lkotlinx/coroutines/flow/Flow; in class Lcom/walletconnect/android/internal/common/model/JsonRpcInteractorInterface;

My code looks as follows:

    val projectId = "15f2b4ae8bb12dsd3d267ce6441d5a9d" // I got the Project ID from https://cloud.walletconnect.com/
    val relayUrl = "relay.walletconnect.com"
    val serverUrl = "wss://$relayUrl?projectId=$projectId"
    val connectionType = ConnectionType.AUTOMATIC

    val appMetaData = Core.Model.AppMetaData( // <-- What data should be entered here?
        name = "Metamask",
        description = "Description",
        url = "Wallet Url", // How can I get the wallet url?
        icons = listOf(""),
        redirect = "kotlin-wallet-wc:/request"
    )
    CoreClient.initialize(relayServerUrl = serverUrl, connectionType = connectionType, application = application, metaData = appMetaData)
    val init = Sign.Params.Init(CoreClient)
    SignClient.initialize(init, onError = { error ->

    })
Lukas
  • 812
  • 1
  • 14
  • 43

4 Answers4

2

Are you calling all initialize methods inside the Application onCreate() method? We have a demo wallet to showcase how it should be done here

Elyniss
  • 31
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 24 '22 at 07:55
0
enter code here

wc:a593bc04-32b5-4e25-aaec-9e2c247e868a@1?bridge=https%3A%2F%2Fv.bridge.walletconnect.org&key=be7212e692f047b39425b0fe88d805582ac29aa76ccb893d5c0cdef8845dc3c3

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 12 '22 at 04:47
0

All the answers are from this tutorial: Connect a iOS or Android DApp to Web3 Wallet. I strongly recommend reading it.

1. "What data should be entered here?":

It's the data about your DApp, it allows the end user to recognize and decide to grant you rights when his wallet asks for it. Here is a simple example:

    private val metaData = Session.PeerMeta(
              name = "nfscene",
              url = "nfscene.com",
              description = "nfscene WalletConnect demo"
       )

2. "How can I get the wallet URL?"

You need to understand that the end-user can choose his wallet. So you can't force the wallet to be used. Knowing what Wallet the user use is not your concern as the transactions are sent through the Wallet Connect bridge. If you only want to allow the use of MetaMask you should directly use the MetaMask API.

Blackarrow
  • 23
  • 4
0

you using 2.0.0? it was fixed in 2.1.0.