-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Labels
F7-enhancementEnhances an already existing functionalityEnhances an already existing functionalityQ0-trivial
Description
E.g. add new function to create a JsonrpseeClient wrapper but with a user defined client here:
substrate-api-client/src/rpc/jsonrpsee_client/mod.rs
Lines 35 to 50 in 3098812
| impl JsonrpseeClient { | |
| pub async fn with_default_url() -> Result<Self> { | |
| Self::new("ws://127.0.0.1:9944").await | |
| } | |
| pub async fn new(url: &str) -> Result<Self> { | |
| let uri: Uri = url.parse().map_err(|e| Error::Client(Box::new(e)))?; | |
| let (tx, rx) = WsTransportClientBuilder::default() | |
| .build(uri) | |
| .await | |
| .map_err(|e| Error::Client(Box::new(e)))?; | |
| let client = ClientBuilder::default() | |
| .max_notifs_per_subscription(4096) | |
| .build_with_tokio(tx, rx); | |
| Ok(Self { inner: Arc::new(client) }) | |
| } |
Example:
pub async fn with_client(client: Arc<Client>) -> Self {
Self { inner: client }
}I'd also propose to make the inner client public - then the user may change settings any time.
Metadata
Metadata
Assignees
Labels
F7-enhancementEnhances an already existing functionalityEnhances an already existing functionalityQ0-trivial