@@ -176,34 +176,38 @@ metadata: Mapping[str, Any] = mesc.get_global_metadata(profile='xyz_tool')"#;
176176}
177177
178178fn print_rust_interface ( ) {
179- let interface = r#"use mesc;
180- use mesc::MescError ;
179+ let interface = r#"use mesc::{MescError, Endpoint} ;
180+ use std::collections::HashMap ;
181181
182182type OptionalResult = Result<Option<Endpoint>, MescError>;
183183type MultiResult = Result<Vec<Endpoint>, MescError>;
184- type MetadataResult = Result<HashMap<String, serde_json::Value>, MescError>
184+ type MetadataResult = Result<HashMap<String, serde_json::Value>, MescError>;
185+
186+ // check whether mesc is enabled
187+ let enabled: bool = mesc::is_mesc_enabled();
185188
186189// get the default endpoint
187190let endpoint: OptionalResult = mesc::get_default_endpoint(None);
188191
189192// get the default endpoint of a network
190- let endpoint: OptionalResult = mesc::get_endpoint_by_network(5 , None);
193+ let endpoint: OptionalResult = mesc::get_endpoint_by_network("5" , None);
191194
192195// get the default network for a particular tool
193196let chain_id: OptionalResult = mesc::get_default_endpoint(Some("xyz_tool"));
194197
195198// get the default endpoint of a network for a particular tool
196- let endpoint: OptionalResult = mesc::get_endpoint_by_network(5 , Some("xyz_tool"));
199+ let endpoint: OptionalResult = mesc::get_endpoint_by_network("5" , Some("xyz_tool"));
197200
198201// get an endpoint by name
199202let endpoint: OptionalResult = mesc::get_endpoint_by_name("local_goerli");
200203
201204// parse a user-provided string into a matching endpoint
202205// (first try 1. endpoint name, then 2. chain id, then 3. network name)
206+ let user_str = "local_goerli";
203207let endpoint: OptionalResult = mesc::get_endpoint_by_query(user_str, Some("xyz_tool"));
204208
205209// find all endpoints matching given criteria
206- let query = mesc::MultiEndpointQuery::new().chain_id(5 );
210+ let query = mesc::MultiEndpointQuery::new().chain_id("5").unwrap( );
207211let endpoints: MultiResult = mesc::find_endpoints(query);
208212
209213// get non-endpoint metadata
0 commit comments