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] Solana WalletConnectProvider not emitting accountsChanged events #3183

Open
gcangussu opened this issue Nov 1, 2024 · 1 comment
Open
Labels
bug Something isn't working needs review

Comments

@gcangussu
Copy link

Link to minimal reproducible example

https://github.com/gcangussu/wallet-connect-provider-missing-events?tab=readme-ov-file#accountschanged-bug-repro

Summary

Expected behavior

From a wallet connected with WalletConnect, we can change the current selected Solana account on a dapp.

Technically, when receiving a "WalletConnect" accountsChanged event, the Solana's WalletConnectProvider must emit a "Solana" accountsChanged event (defined by its provider interface) with the first account from the original event as the payload. The difference from the events is that the "WalletConnect" accountsChanged event has an array of strings representing account addresses, and the "Solana" accountsChanged event is just a single PublicKey representing a single account that should be the current selected account.

Here is where the Solana's chain adapter handles it, expecting an accountsChanged with a single PublicKey as parameter.

For an example of this being done correctly by a provider in another context see the implementation on Solana's WalletStandardProvider.

Actual behavior

There is no accountsChanged event being emitted by the Solana's WalletConnectProvider. Consequently, we cannot change the current selected Solana account from the wallet when connected to a dapp by WalletConnect.

Notice that this works fine when

  1. using Solana with "WalletStandard" (e.g. Phantom wallet connection)
  2. or when using Ethereum blockchains/accounts with WalletConnect.

The problem is just with the Solana adapter with the underlying WalletConnect provider. So (1) shows that the Solana chain adapter is handling the accountsChanged event correctly (i.e. the problem is in the provider probably), and (2) that other chains adapters and WalletConnect providers are handling it correctly.

Affected

  • Chains: Solana blockchains (mainnet, testnet, and devnet)
  • Platforms: all relying on package @reown/appkit-adapter-solana (e.g. AppKit) when using WalletConnect for the connection with the wallet

List of related npm package versions

@reown/appkit-adapter-solana <= 1.2.0 (as of written)

@gcangussu gcangussu added bug Something isn't working needs review labels Nov 1, 2024
@zwq652997
Copy link

I also encountered this problem, when can it be solved?

When the user switches wallets, the monitoring is not available

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

2 participants