WalletConnect v2 "connect" does not work
Describe the bug
We have implemented the WalletConnect v2 Sign.connect flow so that we can then perform a sendTransactions request, however the initial connect request does not work.
- our iOS dApp sets up the Walletconnect v2 connection
- the MetaMask application opens
- MetaMask shows the connect popup
- the popup closes when I tap connect
- the dApp does not reopen
- MetaMask shows a message saying that it has connected to the dApp via WalletConnect
- I reopen the iOS dApp manually but WalletConnect does not get a response in the dApp
Here is the code setting up the WC uri and
let methods: Set<String> = ["eth_sendTransaction"]
var blockchains: Set<Blockchain> = Set([Blockchain("eip155:1")!])
let namespaces: [String: ProposalNamespace] = ["eip155": ProposalNamespace(chains: blockchains, methods: methods, events: [])]
do {
try await Sign.instance.connect(requiredNamespaces: namespaces, topic: uri.topic)
} catch {
signingEvent.send(.failed(reason: .connectionFailed))
try await createUri()
}
Task { @MainActor in
openWallet(wallet: wallet, uri: uri)
}
There is a similar issue with WCv2 Auth, which I understand is not supported. https://github.com/MetaMask/metamask-mobile/issues/6704
Can you tell us if MetaMask supports WCv2 Sign.connect and Sign.request?
Expected behavior Wallet Connect v2 Sign.connect should work
Smartphone (please complete the following information):
- Device: iPhone
- OS: iOS 16
- App Version: 7.3.0
- WalletConnect SDK Version: 1.16.12
to be added after bug submission by internal support / PM Severity
- How critical is the impact of this bug on a user?
- Add stats if available on % of customers impacted
- Is this visible to all users?
- Is this tech debt?
This is a documented issue related to the iOS OS. See this, it explains what your issue is and how to resolve. https://docs.walletconnect.com/2.0/ios/guides/mobile-linking#ios-app-link-constraints
@itsallmememe Thanks for reporting! Feel free to re-open this if the above does not work. Thank you!
This is not appropriate to the bug.
MetaMask opens on but the communication between MetaMask and WalletConnect is not correct.
The flow above works perfectly with Rainbow and Trust, but using MetaMask we do not get any information about the Sign.connect request.
I'll reopen this.
@equalogix @anaamolnar I can't seem to reopen, can you do this for me please?
Hopefully this bug will be fixed. iOS engineers at Metamask seem to be interpreting this as being outside the scope of Wallet Connect V2 support, but they are wrong. The Android version of Metamask is working fine.
@Idkfr @ldkfreetoplay This does work! Can you tell me what sessionProperties you used or, indeed, what they're for?
@ldkfreetoplay - you don't happen to use WalletConnect 2 Auth as well? I can't get that to work with Metamask either.
@anaamolnar @equalogix - See the point above by @ldkfreetoplay
This method does not work with MetaMask
try await Sign.instance.connect(requiredNamespaces: namespaces, topic: uri.topic)
but this does. It's not clear why passing in dummy sessionProperties value fixes the issue
try await Sign.instance.connect(
requiredNamespaces: namespaces,
optionalNamespaces: [:],
sessionProperties: ["key": "value"],
topic: uri.topic
)
Hi @itsallmememe , could you please confirm if one of the solution above worked for you? If not, please share a repo so that we can try your dapp specifically.
This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.
This issue was closed because there has been no follow activity in 7 days. If you feel this was closed in error please provide evidence on the current production app in a new issue or comment in the existing issue to a maintainer. Thank you for your contributions.