Compare commits

..

No commits in common. "e03937041ba3a44bfbbca8d97140a7167d3afcdb" and "c831bd5c3554b12f3b76c6ec358ef673c5e84ddd" have entirely different histories.

1 changed files with 26 additions and 0 deletions

View File

@ -75,6 +75,32 @@ impl From<wasm_bindgen::JsValue> for JsonRpcError {
}
}
impl From<Result<String, ()>> for ClientError {
fn from(result: Result<String, ()>) -> Self {
match result {
Ok(msg) => ClientError::JsonRpcError(JsonRpcError {
code: 0,
message: msg,
data: None,
}),
Err(_) => ClientError::JsonRpcError(JsonRpcError {
code: 0,
message: "response is not a string".to_string(),
data: None,
}),
}
}
}
impl From<()> for HttpClientError {
fn from(_: ()) -> Self {
HttpClientError::JsonRpcError(JsonRpcError {
code: 0,
message: "".to_string(),
data: None,
})
}
}
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
impl JsonRpcClient for Provider {