Wallet Connect 2 Auth - no response`

I’m creating a native iOS dApp that uses MetaMask and Rainbow for Auth and signing transactions using Wallet Connect 2, but I’m running into some difficulty. All the following code works with Rainbow.

I setup as follows. The DefaultSocketFactory and DefaultCryptoProvider are from the demo app

        Networking.configure(projectId: Self.ProjectId, socketFactory: DefaultSocketFactory())
        Auth.configure(crypto: DefaultCryptoProvider())

        let metadata = AppMetadata(name: "Source",
                                   description: "A mobile application acting as a Dapp to connect to a crypto wallet using the WalletConnect SDK",
                                   url: Self.ClientUrl.absoluteString,
                                   icons: ["https://i.ebayimg.com/images/g/5qgAAOSwoBtW3zvq/s-l400.jpg"])

        Pair.configure(metadata: metadata)

        Task {
            try await Sign.instance.cleanup()
        }

Then I auth using this code

    func authenticate(usingWallet wallet: WalletConnectType) {
        Task(priority: .userInitiated) {
            guard let uri else {
                Task { @MainActor in
                    self.authenticatedState = .notAuthenticated
                }
                return
            }

            do {
                try await Auth.instance.request(.stub(), topic: uri.topic)
            } catch {
                Task { @MainActor in
                    self.authenticatedState = .notAuthenticated
                }
            }

            Task { @MainActor in
                let url = URL(string: "https://\(wallet.universalLinkHost)/wc?uri=\(uri.deeplinkUri)")
                UIApplication.shared.open(url!)
            }
        }
    }

private extension RequestParams {
    static func stub(
        domain: String = "service.invalid",
        chainId: String = "eip155:1",
        nonce: String = "32891756",
        aud: String = "https://service.invalid/login",
        nbf: String? = nil,
        exp: String? = nil,
        statement: String? = "I accept the ServiceOrg Terms of Service: https://service.invalid/tos",
        requestId: String? = nil,
        resources: [String]? = ["ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/", "https://example.com/my-web2-claim.json"]
    ) -> RequestParams {
        return RequestParams(
            domain: domain,
            chainId: chainId,
            nonce: nonce,
            aud: aud,
            nbf: nbf,
            exp: exp,
            statement: statement,
            requestId: requestId,
            resources: resources
        )
    }
}

MetaMask opens, but it does not react. Testing with Rainbow, it opens and shows the authentication popup.

Can you help diagnose what I’m doing wrong?

Is there any movement on fixing this? We’re launching soon and WalletConnect support is essential to our applications.

Hey @ndmccormack, would you be able to create an issue on GitHub here:

1 Like

@nakedwinnie sure will do

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.