v0.2.2-pre.002-fix.002

This commit is contained in:
2026-08-18 07:20:44 +02:00
parent f625ee5979
commit bec1f2ec08
3 changed files with 150 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-onchain-transport-lib/src/rpc_common.rs
// version: 2
// version: 3
/// Commitment level accepted by typed Solana HTTP RPC adapters.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
@@ -118,10 +118,9 @@ impl SolanaRpcContext {
};
}
/// Decodes one RPC context from a parsed JSON value for staged DTO tests.
#[cfg(test)]
/// Decodes one RPC context from a parsed JSON value for typed RPC adapters.
pub(crate) fn decode_wire(method: &str, value: serde_json::Value) -> ksp_core_lib::Result<Self> {
let decoded = crate::decode_wire_json::<WireRpcContext>(method, value);
let decoded = decode_wire_json::<WireRpcContext>(method, value);
let context = match decoded {
std::result::Result::Ok(context) => context,
std::result::Result::Err(error) => return std::result::Result::Err(error),
@@ -159,7 +158,6 @@ impl<T> SolanaRpcResponse<T> {
}
/// Decodes one private serde wire type and maps shape failures to the shared Transport error domain.
#[cfg(test)]
pub(crate) fn decode_wire_json<T: serde::de::DeserializeOwned>(method: &str, value: serde_json::Value) -> ksp_core_lib::Result<T> {
let decoded = serde_json::from_value::<T>(value);
return match decoded {
@@ -186,7 +184,6 @@ pub(crate) fn parse_wire_pubkey(method: &str, field: &str, value: &str) -> ksp_c
};
}
#[cfg(test)]
#[derive(serde::Deserialize)]
struct WireRpcContext {
slot: u64,