update coordinator and add end to end tests

This commit is contained in:
Timur Gordon
2025-11-19 10:34:28 +01:00
parent 7675dc2150
commit 8c33c73b3c
8 changed files with 830 additions and 10 deletions

View File

@@ -290,13 +290,19 @@ impl CoordinatorClient {
async fn call<T: serde::de::DeserializeOwned>(&self, method: &str, params: Value) -> Result<T> {
use jsonrpsee::core::client::ClientT;
use jsonrpsee::core::params::ArrayParams;
use jsonrpsee::core::params::ObjectParams;
let mut array_params = ArrayParams::new();
array_params.insert(params).map_err(|e| CoordinatorError::Rpc(e.to_string()))?;
// Coordinator expects params as named parameters (object), not positional (array)
// Convert the Value object to ObjectParams
let mut object_params = ObjectParams::new();
if let Value::Object(map) = params {
for (key, value) in map {
object_params.insert(&key, value).map_err(|e| CoordinatorError::Rpc(e.to_string()))?;
}
}
self.client
.request(method, array_params)
let result: T = self.client
.request(method, object_params)
.await
.map_err(|e| {
let err_str = e.to_string();
@@ -311,7 +317,9 @@ impl CoordinatorClient {
} else {
CoordinatorError::Rpc(err_str)
}
})
})?;
Ok(result)
}
}