this works but i dont like it

This commit is contained in:
Bryan Stitt 2022-05-12 03:54:42 +00:00
parent 3427f5eab9
commit 10cd52f19a
2 changed files with 7 additions and 1 deletions

@ -131,6 +131,7 @@ impl Web3Connections {
params: Option<Box<RawValue>>, params: Option<Box<RawValue>>,
response_sender: flume::Sender<anyhow::Result<Box<RawValue>>>, response_sender: flume::Sender<anyhow::Result<Box<RawValue>>>,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
// TODO: if only 1 active_request_handles, do self.try_send_request
let mut unordered_futures = FuturesUnordered::new(); let mut unordered_futures = FuturesUnordered::new();
for connection in active_request_handles { for connection in active_request_handles {

@ -9,6 +9,7 @@ pub struct JsonRpcRequest {
// pub jsonrpc: Box<RawValue>, // pub jsonrpc: Box<RawValue>,
pub id: Box<RawValue>, pub id: Box<RawValue>,
pub method: String, pub method: String,
// TODO: should we have the default of [] here instead?
pub params: Option<Box<RawValue>>, pub params: Option<Box<RawValue>>,
} }
@ -109,7 +110,11 @@ impl<'de> Deserialize<'de> for JsonRpcRequestEnum {
let id = id.ok_or_else(|| de::Error::missing_field("id"))?; let id = id.ok_or_else(|| de::Error::missing_field("id"))?;
let method = method.ok_or_else(|| de::Error::missing_field("method"))?; let method = method.ok_or_else(|| de::Error::missing_field("method"))?;
let params = params.ok_or_else(|| de::Error::missing_field("params"))?;
let params: Option<Box<RawValue>> = match params {
None => Some(RawValue::from_string("[]".to_string()).unwrap()),
Some(x) => Some(x),
};
let single = JsonRpcRequest { id, method, params }; let single = JsonRpcRequest { id, method, params };