Commit 21a584b
authored
Pass isInitializingStreamProvider to metamask_getProviderState (#422)
In order to initialize the state of the StreamProvider,
`metamask_getProviderState` must be called. In the extension, the
current implementation of this RPC method retrieves the network version
of the currently selected network via `net_version` and returns it along
with other information. This creates a problem, however. Because the
StreamProvider must be initialized in order to load the UI, if the
network is slow or unresponsive, then users will see an infinite spinner
until the request is resolved.
To fix this, we inform the RPC method that the StreamProvider is being
initialized. The idea is that for this special case, the extension will
opt not to make a request for the network version, returning "loading".
For requests for `metamask_getProviderState` outside of StreamProvider
this will not be the case and the network version will be retrieved as
usual.
This means that StreamProvider will not have a network version
initially. However, while they do expect `metamask_getProviderState` to
return a `networkVersion` property, neither BaseProvider nor
StreamProvider seem to do anything with it (unlike
MetaMaskInpageProvider, which tracks it and allows dapps to read it).1 parent 5b3055f commit 21a584b
2 files changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| |||
0 commit comments