WalletConnectSwiftV2 icon indicating copy to clipboard operation
WalletConnectSwiftV2 copied to clipboard

Difference between Swift and JS implementations of Sign.instance.update

Open simonmcl opened this issue 1 year ago • 0 comments

Describe the bug I'm working on a swift version of a wallet that also has a web version. A tester noticed a difference in behaviour when updating sessions (e.g. changing address). On Swift if the dApp is closed (closed the tab/browser window) updating a session update has no effect to the local storage, the dApp must be opened to acknowledge the response before anything happens locally. The next time the dApp is opened, all the updates come through. On web this is not the case, the local session object is updated immediately whether the remote dApp is open or not

In the Swift app, this gives the appearance that the app is broken, as no error is returned/presented. The update just appears to have no effect

Swift:

Task {
    do {
        try await Sign.instance.update(topic: existingSession.topic, namespaces: newNamespaces)
	self.viewModel.refresh(animate: true)
    } catch {
	self.windowError(withTitle: "error".localized(), description: error.localizedDescription)
    }
}

Web:

await this.client.update({ topic, namespaces });
this.refresh();

SDK Version

  • Client: Swift, JS/TS
  • Version: Swift 1.10.0-1.18.4, web sign client 2.7.0

To Reproduce Steps to reproduce the behavior:

  1. Go to a dApp on a browser
  2. Connect to it with a web wallet
  3. Close the dApp window
  4. Change the wallet address for the session, it will update
  5. Repeat process with a mobile app, it will not update until dApp is opened again

Expected behavior SDKs should match, both should be able to update without the dApp open

simonmcl avatar Apr 15 '24 13:04 simonmcl