pub trait NodeClient: Send + Sync {
// Required methods
fn send_midnight_transaction<'life0, 'async_trait>(
&'life0 self,
tx: SerializedTransaction,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, Result<SubmissionEvent, NodeClientError>>, NodeClientError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_genesis<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Genesis, NodeClientError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn genesis_hash_hex(&self) -> Option<String> { ... }
fn send_and_wait_for<'life0, 'async_trait>(
&'life0 self,
tx: SerializedTransaction,
stage: SubmissionStage,
) -> Pin<Box<dyn Future<Output = Result<SubmissionEvent, NodeClientError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Client for the Midnight node’s submission RPC.
Concrete impls live alongside this trait. The default is the
subxt-backed PolkadotNodeClient (added behind a feature flag so the
pure-logic layer remains Substrate-free and testable without a full
toolchain).
Required Methods§
Sourcefn send_midnight_transaction<'life0, 'async_trait>(
&'life0 self,
tx: SerializedTransaction,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, Result<SubmissionEvent, NodeClientError>>, NodeClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_midnight_transaction<'life0, 'async_trait>(
&'life0 self,
tx: SerializedTransaction,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, Result<SubmissionEvent, NodeClientError>>, NodeClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Submit a Midnight transaction and stream every subsequent status
event until the stream terminates with SubmissionEvent::Finalized,
a terminal error, or the caller drops the stream.
The implementation is responsible for:
- Connecting to the node (if not already connected).
- Wrapping
txin an unsigned Substrate extrinsic (midnight.send_mn_transaction(tx)). - Subscribing to
author_submitAndWatchExtrinsic. - Translating each returned status into a
SubmissionEventor a terminatingNodeClientError— usecrate::status::SubmissionOutcome::from_statusfor the pure mapping.
Sourcefn get_genesis<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Genesis, NodeClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_genesis<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Genesis, NodeClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch the genesis block and extract its embedded Midnight transactions.
Corresponds to TS getGenesis() — used for initial-state bootstrap.
Provided Methods§
Sourcefn genesis_hash_hex(&self) -> Option<String>
fn genesis_hash_hex(&self) -> Option<String>
The chain’s genesis block hash, 0x-prefixed hex. Identifies
the chain instance: two runs of a local-dev chain have
different genesis hashes even though both call themselves
localdev. Snapshot stores use this to refuse resuming state
captured against a chain that no longer exists. None when
the client can’t know it (offline test doubles).
Sourcefn send_and_wait_for<'life0, 'async_trait>(
&'life0 self,
tx: SerializedTransaction,
stage: SubmissionStage,
) -> Pin<Box<dyn Future<Output = Result<SubmissionEvent, NodeClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_and_wait_for<'life0, 'async_trait>(
&'life0 self,
tx: SerializedTransaction,
stage: SubmissionStage,
) -> Pin<Box<dyn Future<Output = Result<SubmissionEvent, NodeClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Submit a transaction and return the first event matching stage, or
propagate the first error the stream reports.
Default impl drives the stream; concrete clients rarely need to
override. Mirrors TS sendMidnightTransactionAndWait.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".