Users can now use their own chain_spec.json
files to connect via the Smoldot lightclient integration that subxt can use under the unstable-lightclient
feature flag.
Also at the start of the web app, chain spec presets are fetched from This Repo via the github API. Currently this amounts to 4 chain specs. They are loaded in about 100ms, so it is not that bad. Users can select these presets instead of supplying their own chain specs:
Also the app state has been cleaned up a little. Creating a client now involves two data structures, a ClientCreationConfig
and ClientCreationData
.
At any point of the app lifecycle, a ClientCreationConfig
can be derived from the query params. This is also done at app start. Any ClientCreationConfig
can be used to generate ClientCreationData
, which then is passed to the Rust Code in WASM to initiate the connection.
However the opposite way (ClientCreationData
-> ClientCreationConfig
) is not always possible. That is because a ClientCreationConfig
should be 100% representable in terms of query params. Which is e.g. not possible if a user uploads a file.
There is now the option to share URLs that use light client presets. For this a url needs to contain ?lightclient=Polkadot
. This creates a ClientCreationConfig
at app starts that is checked against any chain specs obtained from the aforementioned substrate connect repo.
Currently connecting with a light client is super slow. Ofter 30+ seconds. I think it is due to some state synching smoldot is doing. Also Smoldot makes a lot of P2P requests to random IP addresses that sometimes fail (sometimes a lot), which currently clutters the Javascript Console with error messages.