Trust wallet not connect with walletconnect for version 2

1.7k Views Asked by At

I have an application which connect the metamask wallet app with the wallet connect SDk v1. From the it's verifying the connection and allows user to login in app. Now i want to update the wallet connect SDK with version 2. This version 2 is not available in metamask for now so I tried to connect the wallet connect with trust wallet.

https://github.com/WalletConnect/WalletConnectSwift

I have referred it's document for implementation https://docs.walletconnect.com/2.0/ but it's not working.

I have created uri (deep link) from the code and i was able redirect to the trust wallet but it not showing the verifying screen. It always shows the wallet connect session was disconnected.

Trust wallet shows this error

I have tried below code sample and also checked with sample Dapp from the SDK

`let namespaces: [String: ProposalNamespace] = [
            "eip155": ProposalNamespace(
                chains: [
                    Blockchain("eip155:137")!,
                    Blockchain("eip155:1")!
                ],
                methods: ["personal_sign"], events: ["accountsChanged", "chainChanged"]
            )
        ]

Task {
            let uri = try await Pair.instance.create()
            try await Sign.instance.connect(
                requiredNamespaces: namespaces
                topic: uri.topic
            )
            await showConnectScreen(uri: uri)
        }

func showConnectScreen(uri: WalletConnectURI) async {
let url = URL(string: "https://link.trustwallet.com/wc?uri=\(uri.absoluteString)")!
//or check with wallet connect as well
//            let url = URL(string: "https://walletconnect.com/wc?uri=\(uri.absoluteString)")!
            DispatchQueue.main.async {
                UIApplication.shared.open(url, options: [:]) { [weak self] _ in
                    self?.dismiss(animated: true, completion: nil)
                }
            }
}`

I want trust wallet app to verify my app for connection, send and receive the data from it. `

Sign.instance.sessionDeletePublisher
            .receive(on: DispatchQueue.main)
            .sink {  _ in
                print("showSelectChainScreen")
            }.store(in: &publishers)

        Sign.instance.sessionResponsePublisher
            .receive(on: DispatchQueue.main)
            .sink {  response in
            }.store(in: &publishers)

        Sign.instance.sessionSettlePublisher
            .receive(on: DispatchQueue.main)
            .sink { [unowned self] session in
                print("session: \(session)")
            }.store(in: &publishers)`

I have check the wallet connection on https://pancakeswap.finance. which works from browser. It shows multiple wallet to connect with and verify the connection also

It would be great if I connect with any other wallet app also.I want is should work with from mobile application not from desktop application.

0

There are 0 best solutions below