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

[bug] createSIWEConfig paramter "signOutOnNetworkChange" still signs out when set to "false" #2222

Closed
tx-nikola opened this issue May 7, 2024 · 2 comments
Labels
bug Something isn't working needs review

Comments

@tx-nikola
Copy link

Link to minimal reproducible example

https://app.txsync.io/

Summary

When setting up SIWE configuration, we're using the createSIWEConfig function from @web3modal/siwe package.
We're passing these options:

createSIWEConfig({
  getNonce,
  createMessage,
  verifyMessage,
  signOut,
  getSession,
  signOutOnNetworkChange: false,
});

where the last option, signOutOnNetworkChange which is set to false, doesn't work as expected. Whenever the user switches networks it asks to sign the message again, otherwise, it calls the signOut function and logs the user out.

I noticed that this file seems to be responsible for calling the signOut function:
packages/scaffold/src/modal/w3m-modal/index.ts

More specifically, this block:

if (isConnected && newCaipAddress && this.caipAddress !== newCaipAddress) {
  await SIWEController.signOut()
  this.onSiweNavigation()
  this.caipAddress = newCaipAddress
}

I didn't see the signOutOnNetworkChange parameter being used anywhere - I'm not sure if I missed something.

List of related npm package versions

  • "@web3modal/siwe": "^4.1.9", (and I tried it on the latest versions as well, still not fixed)
  • "@web3modal/wagmi": "^4.1.9",
  • @web3modal/scaffold - the issue is potentially in this package
@tx-nikola tx-nikola added bug Something isn't working needs review labels May 7, 2024
@mshojaei-txfusion
Copy link

In cases DAPP includes a bridge (or any other multichain functionality) it is annoying for users to sign the message everytime they change the network, maybe better to give the disable option for developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs review
Projects
None yet
Development

No branches or pull requests

3 participants