Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# Auto detect text files and perform LF normalization
* text=auto
# Force LF endings for Rust code and common text files
*.rs text eol=lf
*.toml text eol=lf
*.md text eol=lf
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description = "Soroban Transaction Debugger — From cryptic error to root cause

[workspace.dependencies]
# Stellar / Soroban — Critical Path
stellar-xdr = { version = "=21.2.0", features = ["std", "serde"] }
stellar-xdr = { version = "=21.2.0", features = ["std", "serde", "base64"] }
stellar-strkey = "0.0.9"
soroban-env-host = "=21.2.0"
soroban-spec = "=21.2.0"
Expand Down
22 changes: 10 additions & 12 deletions crates/core/src/network/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ pub fn default_network() -> NetworkConfig {
}

/// Validate that a network configuration is reachable.
///
/// Uses the timeout from [`NetworkConfig::request_timeout_secs`] so a
/// misconfigured or unreachable endpoint does not block the caller
/// indefinitely.
pub async fn validate_network(config: &NetworkConfig) -> bool {
let client = reqwest::Client::new();
client
.post(&config.rpc_url)
.json(&serde_json::json!({
"jsonrpc": "2.0",
"id": 1,
"method": "getHealth",
"params": {}
}))
.send()
let timeout = Duration::from_secs(config.request_timeout_secs);
let transport = JsonRpcTransport::new(&config.rpc_url, 0, timeout);
let req = JsonRpcRequest::new(1, "getHealth", GetHealthParams {});
transport
.call::<_, serde_json::Value>(&req)
.await
.map(|r| r.status().is_success())
.unwrap_or(false)
.is_ok()
}
Loading