WalletConnectSwift icon indicating copy to clipboard operation
WalletConnectSwift copied to clipboard

Trying to disconnect from active session does nothing

Open poPaTheGuru opened this issue 2 years ago • 2 comments

Hello!

I have connected to Metamask using Wallet Connect successfully, but I can't achieve to end that session.

The function that I create it for disconnecting from session is at it follows:

func disconnect() {
        if let oldSessionObject = UserDefaults.standard.object(forKey: sessionKey) as? Data,
           let session = try? JSONDecoder().decode(Session.self, from: oldSessionObject) {
            client = Client(delegate: self, dAppInfo: session.dAppInfo)
            
            try? client?.disconnect(from: session)
        }
    }

And my delegate is at it follows:

func client(_ client: Client, didDisconnect session: Session) {
        UserDefaults.standard.removeObject(forKey: sessionKey)
        delegate.didDisconnect()
    } 

In the end, nothing happens, no log, the session in Metamask is still active. I have the latest version of this package installed in my Swift project.

Is there another way to disconnect from an active session?

-----------------------------------------------------

After some time in debugger, the client.disconnect(from: session) throws me the next error: WalletConnectSwift.WalletConnect.WalletConnectError.tryingToDisconnectInactiveSession which is weird because the session is the correct one and is active in Metamask.

poPaTheGuru avatar May 16 '22 06:05 poPaTheGuru

Hello @Donovan043. At the moment, it still throws me the same error. I'm still doing some research, maybe I'm doing something wrong

poPaTheGuru avatar May 17 '22 05:05 poPaTheGuru

@Donovan043 i'll try reaching to them. Will be back when i'll have news. Thank you for support!

poPaTheGuru avatar May 17 '22 13:05 poPaTheGuru