Fetch & cache consensus parameters when Provider
is initialized
#1176
Labels
feat
Issue is a feature
Provider
is initialized
#1176
This API change/feature attempts to solve #1050
Similar to the Rust SDK's
Provider::connect
:In the TS SDK, we could have:
Motivation behind this API change
Making the initialization of the provider asynchronous will let us internally fetch consensus parameters from the chain and cache them on our provider object for later use.
This means that all of our internal logic related to contract calls can stay synchronous as it is with minimal modifications, and just consume these cached consensus parameters from the provider object whenever needed.
Please correct me if I am wrong - but I think the consensus parameters of the chain should not change often. Still, if the user wants to invalidate the cache and wants the provider to use the latest consensus parameters, we can expose a method called
invalidateConsensusParamsCache
from theProvider
class that lets them do that explicitly.The text was updated successfully, but these errors were encountered: