Providing settings for client
Before connecting with Substrate network, you need to provide all required settings. Here is a settings class declaration:
All nodes are different, and their configurations are different.
For a regular Kusama node by Parity (kusama-rpc.polkadot.io
), you might provide rpcPath, rpcParams, webSocketPath, webSocketParams, webSocketPort as null. These will be fully ignored.
But for OnFinality nodes, with your own API key with RPC at https://kusama.api.onfinality.io/rpc?apikey=<YOUR_KEY>
and web socket as wss://kusama.api.onfinality.io/ws?apikey=<YOUR_KEY>
you need to provide settings like that:
Speaking of other parameters, runtimeMetadataUpdateTimeoutMs is delay in milliseconds (1 hour by default) which defines how often runtime metadata should be updated. Applicable only after your receive a runtime metadata at least once.
Naming policy is a enum:
It is used in all services to match your outgoing requests. If you're sure that you can provide pallets, constants, storage, and functions names exactly as they're declared in metadata, feel free to apply NONE policy to avoid extra computation.
And the last, but not least is object storage factory, which is an interface:
This is used for storing a runtime metadata. You can provide whatever implementation you want to store metadata on disk, cache, database, and whatnot.
But for convenience we added simple implementation in memory factory, which simply creates Kotlin's MutableStateFlow from coroutines:
Last updated