reown-com / appkit

The full stack toolkit to build onchain app UX
https://reown.com/appkit
Apache License 2.0
4.88k stars 1.37k forks source link

can't hide the fallback Web3 Wallet #48

Closed dkent600 closed 5 years ago

dkent600 commented 5 years ago

When there is no injected provider, Web3Connect used the "fallback" provider which is called "Web3", type "injected", check "isWeb3".

What is the point of this? In what typical conditions will this fallback succeed? Seems like it should not be displayed unless it has a chance to succeed. For me, it is showing up and failing. It is not even needed because I have Portis and Fortmatic showing (but not WalletConnect, and no extensions are available).

So to get rid of this, I tried supplying disableInjectedProvider and when I do, when the Modal comes up the fallback is not hidden (even though it is "injected"), and there is a console log message, even though I am passing true:

Warning: Failed prop type: The prop `injectedProvider` is marked as required in `Modal`, but its value is `null`.
    in Modal
checkPropTypes.js:20

How can I cause this fallback to not be shown? Thanks.

crisgarner commented 5 years ago

The idea of the fallback is for injected providers that haven't been added to the library or that don't support the normal specification. Opera is an example of it.

The problem that you have is that you don't want the injected provider to appear and when you supply disableInjectedProvider it is shown?

dkent600 commented 5 years ago

The problem that you have is that you don't want the injected provider to appear and when you supply disableInjectedProvider it is shown?

I would prefer that the fallback button not appear if it is only going to fail if the user selects it. If that is not possible, then I'd like to be able to hide it by setting disableInjectedProvider, say, when I can't find window.web3 or window.ethereum (anticipating on my own that it is going to fail).

crisgarner commented 5 years ago

There was a bug that didn't hide the injected provider using disableInjectedProvider

dkent600 commented 5 years ago

Cool, but best would still be if the Web3 button were not be displayed if there is no injected extension to work with. In that case it is worse than worthless, as it crashes.

What is the dApp expected to do in this situation? I'm not sure that expecting the dApp to know whether to disable extensions (even if that works now) is a friendly UX. (disableInjectedProvider: !((window as any).web3 || (window as any).ethereum)) Would be better IMHO that Web3Connect be smarter on its own about when to show the fallback.

crisgarner commented 5 years ago

I'll open it again and check it out since what you describe should be the default functionality and shouldn't crash.

crisgarner commented 5 years ago

The problem is: "If you have no web3 injected provider it crashes"? right? @dkent600

dkent600 commented 5 years ago

@crisgarner

If you have no web3 injected provider it crashes

Yes, last i checked.

crisgarner commented 5 years ago

Screenshot from 2019-08-02 11-59-22 I think, this was fixed on the 1.0.0 release

dkent600 commented 5 years ago

@crisgarner So now I'm curious, when is the fallback provider supposed to be displayed? I'm having trouble now making it appear. Thanks.

dkent600 commented 5 years ago

Oh, with Opera, I see it, thanks