Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to disconnect from active session does nothing #113

Open
poPaTheGuru opened this issue May 16, 2022 · 2 comments
Open

Trying to disconnect from active session does nothing #113

poPaTheGuru opened this issue May 16, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@poPaTheGuru
Copy link

poPaTheGuru commented May 16, 2022

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
Copy link
Author

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
Copy link
Author

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

@DmitryBespalov DmitryBespalov added the bug Something isn't working label Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants