Connects to a chain.
After you've called this function, the client will verify whether the chain specification is
valid. Once this is done, the Promise
returned by this function will yield a
Chain that can be used to interact with that chain. Only after the Promise
has
yielded will the client actually start establishing networking connections to the chain.
The Promise
throws an exception if the chain specification isn't valid, or if the chain
specification concerns a parachain but no corresponding relay chain can be found.
Smoldot will automatically de-duplicate chains if multiple identical chains are added, in
order to save resources. In other words, it is not a problem to call addChain
multiple
times with the same chain specifications and obtain multiple Chain objects.
When the same client is used for multiple different purposes, you are in fact strongly
encouraged to trust smoldot and not attempt to de-duplicate chains yourself, as determining
whether two chains are identical is complicated and might have security implications.
Smoldot tries to distribute CPU resources equally between all active Chain objects of the same client.
Configuration of the chain to add.
AddChainError If the chain can't be added.
AlreadyDestroyedError If the client has been terminated earlier.
CrashError If the background client has crashed.
Terminates the client.
This implicitly calls Chain.remove on all the chains associated with this client, then shuts down the client itself.
Afterwards, trying to use the client or any of its chains again will lead to an exception being thrown.
AlreadyDestroyedError If the client has already been terminated earlier.
CrashError If the background client has crashed.
Client with zero or more active connections to blockchains.