import { type Client } from "https://deno.land/x/smoldot2@light-js-deno-v2.0.26/public-types.d.ts";
Client with zero or more active connections to blockchains.
Methods
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.