Skip to content

Expose RpcClient and RestClient interfaces as pub #825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lightning-block-sync/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ enum HttpMessageLength {
}

/// An HTTP response body in binary format.
pub(crate) struct BinaryResponse(pub(crate) Vec<u8>);
pub struct BinaryResponse(pub Vec<u8>);

/// An HTTP response body in JSON format.
pub(crate) struct JsonResponse(pub(crate) serde_json::Value);
pub struct JsonResponse(pub serde_json::Value);

/// Interprets bytes from an HTTP response body as binary data.
impl TryFrom<Vec<u8>> for BinaryResponse {
Expand Down
2 changes: 1 addition & 1 deletion lightning-block-sync/src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl RestClient {
}

/// Requests a resource encoded in `F` format and interpreted as type `T`.
async fn request_resource<F, T>(&mut self, resource_path: &str) -> std::io::Result<T>
pub async fn request_resource<F, T>(&mut self, resource_path: &str) -> std::io::Result<T>
where F: TryFrom<Vec<u8>, Error = std::io::Error> + TryInto<T, Error = std::io::Error> {
let host = format!("{}:{}", self.endpoint.host(), self.endpoint.port());
let uri = format!("{}/{}", self.endpoint.path().trim_end_matches("/"), resource_path);
Expand Down
2 changes: 1 addition & 1 deletion lightning-block-sync/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl RpcClient {
}

/// Calls a method with the response encoded in JSON format and interpreted as type `T`.
async fn call_method<T>(&mut self, method: &str, params: &[serde_json::Value]) -> std::io::Result<T>
pub async fn call_method<T>(&mut self, method: &str, params: &[serde_json::Value]) -> std::io::Result<T>
where JsonResponse: TryFrom<Vec<u8>, Error = std::io::Error> + TryInto<T, Error = std::io::Error> {
let host = format!("{}:{}", self.endpoint.host(), self.endpoint.port());
let uri = self.endpoint.path();
Expand Down