pub async fn build_at<'a>(self, hash: Option<T::Hash>) -> Result<Client<T>, Error> {
        let client = if let Some(client) = self.client {
            client
        } else {
            let url = self.url.as_deref().unwrap_or("ws://127.0.0.1:9944");
            if url.starts_with("ws://") || url.starts_with("wss://") {
                let client = WsClientBuilder::default()
                    .max_notifs_per_subscription(4096)
                    .build(url)
                    .await?;
                RpcClient::WebSocket(Arc::new(client))
            } else {
                let client = HttpClientBuilder::default().build(&url)?;
                RpcClient::Http(Arc::new(client))
            }
        };
        let mut rpc = Rpc::new(client);
        if self.accept_weak_inclusion {
            rpc.accept_weak_inclusion();
        }
        let (metadata, genesis_hash, runtime_version, properties) = future::join4(
            rpc.metadata_at(hash),
            rpc.genesis_hash(),
            rpc.runtime_version(None),
            rpc.system_properties(),
        )
        .await;
        let metadata = metadata?;

        if let Err(missing) = self.event_type_registry.check_missing_type_sizes(&metadata)
        {
            if self.skip_type_sizes_check {
                log::warn!(
                    "The following types do not have registered type segmenters: {:?} \
                    If any events containing these types are received, this can cause a \
                    `TypeSizeUnavailable` error and prevent decoding the actual event \
                    being listened for.\
                    \
                    Use `ClientBuilder::register_type_size` to register missing type sizes.",
                    missing
                );
            } else {
                return Err(Error::MissingTypeSizes(missing.into_iter().collect()))
            }
        }

        let events_decoder =
            EventsDecoder::new(metadata.clone(), self.event_type_registry);

        Ok(Client {
            rpc,
            genesis_hash: genesis_hash?,
            metadata,
            events_decoder,
            properties: properties.unwrap_or_else(|_| Default::default()),
            runtime_version: runtime_version?,
            _marker: PhantomData,
            page_size: self.page_size.unwrap_or(10),
        })
    }
/// Creates a new Client with the metadata at some specific block.
Creates a new Client with the metadata at some specific block.
Creates a new Client with the metadata at some specific block .
pub async fn build_at<'a>(self, hash: Option<T::Hash>) -> Result<Client<T>, Error> {
        let client = if let Some(client) = self.client {
            client
        } else {
            let url = self.url.as_deref().unwrap_or("ws://127.0.0.1:9944");
            if url.starts_with("ws://") || url.starts_with("wss://") {
                let client = WsClientBuilder::default()
                    .max_notifs_per_subscription(4096)
                    .build(url)
                    .await?;
                RpcClient::WebSocket(Arc::new(client))
            } else {
                let client = HttpClientBuilder::default().build(&url)?;
                RpcClient::Http(Arc::new(client))
            }
        };
        let mut rpc = Rpc::new(client);
        if self.accept_weak_inclusion {
            rpc.accept_weak_inclusion();
        }
        let (metadata, genesis_hash, runtime_version, properties) = future::join4(
            rpc.metadata_at(hash),
            rpc.genesis_hash(),
            rpc.runtime_version(None),
            rpc.system_properties(),
        )
        .await;
        let metadata = metadata?;
        if let Err(missing) = self.event_type_registry.check_missing_type_sizes(&metadata)
        {
            if self.skip_type_sizes_check {
                log::warn!(
                    "The following types do not have registered type segmenters: {:?} \
                    If any events containing these types are received, this can cause a \
                    `TypeSizeUnavailable` error and prevent decoding the actual event \
                    being listened for.\
                    \
                    Use `ClientBuilder::register_type_size` to register missing type sizes.",
                    missing
                );
            } else {
                return Err(Error::MissingTypeSizes(missing.into_iter().collect()))
            }
        }
        let events_decoder =
            EventsDecoder::new(metadata.clone(), self.event_type_registry);
        Ok(Client {
            rpc,
            genesis_hash: genesis_hash?,
            metadata,
            events_decoder,
            properties: properties.unwrap_or_else(|_| Default::default()),
            runtime_version: runtime_version?,
            _marker: PhantomData,
            page_size: self.page_size.unwrap_or(10),
        })
    }
pub async fn build_at < ' a > ( self , hash : Option < T :: Hash > ) -> Result < Client < T > , Error > { let client = if let Some ( client ) = self . client { client } else { let url = self . url . as_deref ( ) . unwrap_or ( " " ) ; if url . starts_with ( " " ) || url . starts_with ( " " ) { let client = WsClientBuilder :: default ( ) . max_notifs_per_subscription ( 4096 ) . build ( url ) . await ? ; RpcClient :: WebSocket ( Arc :: new ( client ) ) } else { let client = HttpClientBuilder :: default ( ) . build ( & url ) ? ; RpcClient :: Http ( Arc :: new ( client ) ) } } ; let mut rpc = Rpc :: new ( client ) ; if self . accept_weak_inclusion { rpc . accept_weak_inclusion ( ) ; } let ( metadata , genesis_hash , runtime_version , properties ) = future :: join4 ( rpc . metadata_at ( hash ) , rpc . genesis_hash ( ) , rpc . runtime_version ( None ) , rpc . system_properties ( ) , ) . await ; let metadata = metadata ? ; if let Err ( missing ) = self . event_type_registry . check_missing_type_sizes ( & metadata ) { if self . skip_type_sizes_check { log :: warn ! ( " \
 \
 \
 \
 \
 " missing ) ; } else { return Err ( Error :: MissingTypeSizes ( missing . into_iter ( ) . collect ( ) ) ) } } let events_decoder = EventsDecoder :: new ( metadata . clone ( ) , self . event_type_registry ) ; Ok ( Client { rpc , genesis_hash : genesis_hash ? , metadata , events_decoder , properties : properties . unwrap_or_else ( | _ | Default :: default ( ) ) , runtime_version : runtime_version ? , _marker : PhantomData , page_size : self . page_size . unwrap_or ( 10 ) , } ) }
Creates a new Client with the metadata at some specific block.
Creates a new Client with the metadata at some specific block .
self
hash
Option<T::Hash>
self
hash
Option<T::Hash>