v0.2.8-pre.008

This commit is contained in:
2026-08-23 17:19:44 +02:00
parent 7eb6dec809
commit 7c12ec886b
8 changed files with 672 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-onchain-transport-lib/src/ws_helius_transactions.rs
// version: 4
// version: 5
const MAX_HELIUS_TRANSACTION_FILTER_ACCOUNTS: usize = 50_000;
@@ -348,7 +348,7 @@ fn helius_transaction_subscribe_params(request: &crate::HeliusTransactionSubscri
///
/// The nested transaction payload is deliberately retained as JSON because its exact Solana wire representation depends on the requested encoding and detail
/// mode. KSP types the stable provider envelope while preserving the full nested payload without Program-specific decoding.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, PartialEq)]
pub struct HeliusFullTransactionNotification {
transaction: serde_json::Value,
signature: std::string::String,
@@ -382,8 +382,20 @@ impl HeliusFullTransactionNotification {
}
}
impl std::fmt::Debug for HeliusFullTransactionNotification {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
return formatter
.debug_struct("HeliusFullTransactionNotification")
.field("transaction", &"<omitted>")
.field("signature", &"<omitted>")
.field("slot", &self.slot)
.field("transaction_index", &self.transaction_index)
.finish();
}
}
/// Signatures-mode notification delivered by Helius `transactionSubscribe`.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, PartialEq)]
pub struct HeliusTransactionSignatureNotification {
signature: std::string::String,
slot: u64,
@@ -438,11 +450,36 @@ impl HeliusTransactionSignatureNotification {
}
}
impl std::fmt::Debug for HeliusTransactionSignatureNotification {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
return formatter
.debug_struct("HeliusTransactionSignatureNotification")
.field("signature", &"<omitted>")
.field("slot", &self.slot)
.field("transaction_index", &self.transaction_index)
.field("err", &wire_field_debug_state(&self.err))
.field("memo", &wire_field_debug_state(&self.memo))
.field("block_time", &wire_field_debug_state(&self.block_time))
.field("confirmation_status", &wire_field_debug_state(&self.confirmation_status))
.finish();
}
}
fn wire_field_debug_state<T>(field: &crate::SolanaWireField<T>) -> &'static str {
if field.is_omitted() {
return "omitted";
}
if field.is_null() {
return "null";
}
return "value";
}
/// Typed Helius `transactionNotification` payload union.
///
/// `Full` also covers the provider `accounts` detail mode because both contain the nested `transaction` member. `Signature` covers the lightweight
/// signatures mode. `Unknown` preserves `none` mode and forward-compatible provider shapes instead of failing the logical subscription.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, PartialEq)]
#[non_exhaustive]
pub enum HeliusTransactionNotification {
/// Full/accounts notification carrying the nested transaction payload.
@@ -453,6 +490,16 @@ pub enum HeliusTransactionNotification {
Unknown(serde_json::Value),
}
impl std::fmt::Debug for HeliusTransactionNotification {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
return match self {
Self::Full(notification) => formatter.debug_tuple("Full").field(notification).finish(),
Self::Signature(notification) => formatter.debug_tuple("Signature").field(notification).finish(),
Self::Unknown(_) => formatter.debug_tuple("Unknown").field(&"<omitted>").finish(),
};
}
}
impl crate::HeliusLaserStreamWsSession {
/// Opens one Helius `transactionSubscribe` logical subscription through the shared physical actor.
///

View File

@@ -1,11 +1,20 @@
// file: crates/ksp-onchain-transport-lib/src/ws_protocol_session.rs
// version: 4
// version: 5
/// Typed facade for one standard Solana WebSocket physical session.
///
/// The facade delegates to the same [`crate::WsSession`] actor used by the compatibility API. It owns no socket, registry, reconnect loop or queue of its
/// own and therefore does not duplicate the physical WebSocket runtime. Subscription wrappers are implemented beside their wire owners in the
/// `ws_accounts`, `ws_blocks`, `ws_cluster` and `ws_transactions` modules.
///
/// ```compile_fail
/// async fn unsupported_helius_transaction(
/// session: &ksp_onchain_transport_lib::SolanaStandardWsSession,
/// request: &ksp_onchain_transport_lib::HeliusTransactionSubscribeRequest,
/// ) {
/// let _ = session.transaction_subscribe(request).await;
/// }
/// ```
#[derive(Clone)]
pub struct SolanaStandardWsSession {
inner: crate::WsSession,