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: connected and isConnected() always return true #799

Open
toteto opened this issue Jan 13, 2023 · 7 comments
Open

Bug: connected and isConnected() always return true #799

toteto opened this issue Jan 13, 2023 · 7 comments
Labels
state: investigation Pending investigation type: bug Something isn't working

Comments

@toteto
Copy link

toteto commented Jan 13, 2023

Describe the bug

The CoinbaseWalletProvider is always reporing as conected regardless whethers it is actually conntected to a DApp or not

Steps

  1. Initialize the CoinbaseWalletSDK
  2. Make CoinbaseWalletProvider with coinbaseWalletSdk.makeWeb3Provider(...)`
  3. Try to get the connected state with either connected or isConnected
  4. Both return true always.

Expected behavior

The SDK return false when there is no connection established between the DApp and the wallet application

Version

No response

Additional info

public get connected(): boolean {
return true;
}
public isConnected(): boolean {
return true;
}

Desktop

No response

Smartphone

No response

@toteto toteto added the type: bug Something isn't working label Jan 13, 2023
@bangtoven bangtoven added the state: investigation Pending investigation label Jan 13, 2023
@bangtoven
Copy link
Contributor

thanks for reporting this @toteto .
@cb-jake @jeongmincho , i am not sure whether these props are in js provider standard. can we just remove them?

@cb-jake
Copy link
Contributor

cb-jake commented Jan 13, 2023

EIP-1193#connectivity

The Provider is said to be “connected” when it can service RPC requests to at least one chain.
The Provider is said to be “disconnected” when it cannot service RPC requests to any chain at all.

One thing we should rely on is provider errors to state when the chain or provider is disconnected. We could leverage walletlink sessions to validate the connection. This might require moving the check into the relays.

Status code Name Description
4900 Disconnected The Provider is disconnected from all chains.
4901 Chain Disconnected The Provider is not connected to the requested chain.

@toteto
Copy link
Author

toteto commented Jan 16, 2023

@cb-jake thanks for your answer. Just to be clear, even though the EIP-1193 is big vague about how it defines connectivity, the expected behavior for is/connected field/method would be to return true if it is fully connected to a wallet with account?

@cb-jake
Copy link
Contributor

cb-jake commented Jan 17, 2023

@toteto Yes, I believe we should populate the value based on whether the wallet is connected or not.

@sam41306061
Copy link

@toteto is this issue still open?

@toteto
Copy link
Author

toteto commented Oct 25, 2023

Haven't checked yet, still using 3.6.3, haven't updated to latest to check.

@spencerstock
Copy link
Contributor

spencerstock commented Dec 6, 2023

Just chiming in here: The isConnected flag would presumably indicate you're connected to the the walletlink server - which indicates you are ready to publish messages. Those messages are then queued for the user who may join the session at a later time.

Is there a use-case for needing to know whether or not the user is receiving the messages live vs submitting to their queue?

With the current implementation the SDK does receive a message when the user connects - and that could be used to indicate a live connection. However - if the user connects to the session first and then the dapp connects, the SDK does not receive a message indicating the user is already present. Or if the user disconnects from the session we aren't aware of that in the SDK. I'm not sure if there's a message type we could potentially use to detect a user is connected.

@vishnumad vishnumad removed their assignment Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: investigation Pending investigation type: bug Something isn't working
Development

No branches or pull requests

6 participants