WalletConnectSwift icon indicating copy to clipboard operation
WalletConnectSwift copied to clipboard

Connecting to MetaMask rarely works

Open BrettRosen opened this issue 4 years ago • 13 comments

Using bridgeURL - https://safe-walletconnect.gnosis.io and metamask deep link https://metamask.app.link/wc?uri=wc yet MetaMask mobile rarely opens the prompt to allow permission to connect. It seems to be flaky and works less than it doesn't. Whats going on

BrettRosen avatar Oct 19 '21 06:10 BrettRosen

Same here. I don't know why the example ios app doesn't work whereas android example apps work fine. I think we must request the developer to publish an updated code so that our issues are resolved instead of transferring to other apps code or redirecting to other threads. I am stuck at same from last week and the response everytime is to look : https://github.com/gnosis/safe-ios/blob/40a50dc8e6b3c007c8b3279cab0c202bef06d4a1/Multisig/UI/WalletConnect/WalletConnectServerController.swift

ghost avatar Oct 19 '21 09:10 ghost

Same here. I don't know why the example ios app doesn't work whereas android example apps work fine. I think we must request the developer to publish an updated code so that our issues are resolved instead of transferring to other apps code or redirecting to other threads. I am stuck at same from last week and the response everytime is to look : https://github.com/gnosis/safe-ios/blob/40a50dc8e6b3c007c8b3279cab0c202bef06d4a1/Multisig/UI/WalletConnect/WalletConnectServerController.swift

This might actually be a bug with metamask as I noticed it stopped letting me view WalletConnect sessions within the app settings without crashing out. Resintalling and trying to connect has seemed to fix it for now? Fwiw walletconnect + rainbow works just fine

BrettRosen avatar Oct 19 '21 13:10 BrettRosen

Can you share the code screenshot or something?

ghost avatar Oct 19 '21 13:10 ghost

Same here. I don't know why the example ios app doesn't work whereas android example apps work fine. I think we must request the developer to publish an updated code so that our issues are resolved instead of transferring to other apps code or redirecting to other threads. I am stuck at same from last week and the response everytime is to look : https://github.com/gnosis/safe-ios/blob/40a50dc8e6b3c007c8b3279cab0c202bef06d4a1/Multisig/UI/WalletConnect/WalletConnectServerController.swift

This might actually be a bug with metamask as I noticed it stopped letting me view WalletConnect sessions within the app settings without crashing out. Resintalling and trying to connect has seemed to fix it for now? Fwiw walletconnect + rainbow works just fine

I do think it is some MetaMask issue. Trust wallet also works very well

kohlivarun5 avatar Oct 19 '21 14:10 kohlivarun5

Hey do you have news about that?

ljs19923 avatar Dec 01 '21 14:12 ljs19923

Cannot connect with MetaMask either. WIth metamask deep link https://metamask.app.link/ and bridge url https://c.bridge.walletconnect.org/, I can rarely see a prompt from metamask app.

peywen avatar Dec 05 '21 09:12 peywen

any solutions here?

dustfire avatar Dec 21 '21 18:12 dustfire

I know why the authentication popup in metamask isn't show. Because of deeplink format. in the example. they're using wcUrl.absoluteString let's take a look:

    public var absoluteString: String {
        let bridge = bridgeURL.absoluteString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? ""
        return "wc:\(topic)@\(version)?bridge=\(bridge)&key=\(key)"
    }

this function just encodes bridgeURL and I compared absoluteString to deeplink in WalletConnect popup in browser that encoded whole data so I have to add some encoding actions. Specifically, I encode 2 characters "=" and "&"

        let connectionUrl = walletConnect.connect()
        let _encodeURL = connectionUrl.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? ""
        let _end2 = _encodeURL.replacingOccurrences(of: "=", with: "%3D").replacingOccurrences(of: "&", with: "%26")

         let metamaskLink = "https://metamask.app.link/wc?uri="
         let deepLinkUrl = "\(metamaskLink)\(_end2)"
       ....

Now, I can see an authentication popup in metamask all the time

hungMta avatar Jan 07 '22 11:01 hungMta

absoluteString

Thanks @hungMta, your change does indeed work and I am able to now connect to MetaMask consistently. For reference, this is a code change on my side: https://github.com/kohlivarun5/nfty/pull/246/files#diff-fe7bd9e77510ff56365962e715a1a4d1c2d9183048a39c050b309387d9da648fR92

kohlivarun5 avatar Jan 09 '22 22:01 kohlivarun5

@mazenkourouche maybe the problem is your bridge server. You can try https://safe-walletconnect.gnosis.io/. It's worked for me

hungMta avatar Jan 10 '22 02:01 hungMta

I can't seem to get the sample to work at all. I have been trying for a while. It bounces to Metamask but I am not getting asked to connect..

scottandrew avatar Feb 01 '22 21:02 scottandrew

it's like the connection was broke since the last metamaks app update. can you any confirm that ?

nenadvulic avatar Apr 01 '22 11:04 nenadvulic

absoluteString

Thanks @hungMta, your change does indeed work and I am able to now connect to MetaMask consistently. For reference, this is a code change on my side: https://github.com/kohlivarun5/nfty/pull/246/files#diff-fe7bd9e77510ff56365962e715a1a4d1c2d9183048a39c050b309387d9da648fR92

Looks like you have a pretty good setup for your wallets. I'm going to follow your example.

maurovz avatar May 12 '22 16:05 maurovz