Skip to content
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

feat: Remove bundled Ripple RPC and load from a path in firebolt-devices #620

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
19 changes: 2 additions & 17 deletions core/main/src/state/openrpc_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use ripple_sdk::{
fb_capabilities::FireboltPermission,
fb_openrpc::{
CapabilitySet, FireboltOpenRpc, FireboltOpenRpcMethod, FireboltSemanticVersion,
FireboltVersionManifest, OpenRPCParser,
FireboltVersionManifest,
},
provider::ProviderAttributes,
},
Expand Down Expand Up @@ -78,19 +78,6 @@ pub struct OpenRpcState {
}

impl OpenRpcState {
fn load_additional_rpc(rpc: &mut FireboltOpenRpc, file_contents: &'static str) {
match serde_json::from_str::<OpenRPCParser>(file_contents) {
Ok(addl_rpc) => {
for m in addl_rpc.methods {
rpc.methods.push(m.clone());
}
}
Err(_) => {
error!("Could not read additional RPC file");
}
}
}

fn load_open_rpc(path: &str) -> Option<FireboltOpenRpc> {
match std::fs::read_to_string(path) {
Ok(content) => {
Expand Down Expand Up @@ -134,9 +121,7 @@ impl OpenRpcState {
let version_manifest: FireboltVersionManifest = serde_json::from_str(&open_rpc_path)
.expect("Failed parsing FireboltVersionManifest from open RPC file");
let firebolt_open_rpc: FireboltOpenRpc = version_manifest.clone().into();
let ripple_rpc_file = std::include_str!("./ripple-rpc.json");
let mut ripple_open_rpc: FireboltOpenRpc = FireboltOpenRpc::default();
Self::load_additional_rpc(&mut ripple_open_rpc, ripple_rpc_file);
let ripple_open_rpc: FireboltOpenRpc = FireboltOpenRpc::default();
let openrpc_validator: FireboltOpenRpcValidator = serde_json::from_str(&open_rpc_path)
.expect("Failed parsing FireboltOpenRpcValidator from open RPC file");
let v = OpenRpcState {
Expand Down
Loading