NodeRpcClientImpl
class NodeRpcClientImpl(httpClient: HttpClient, nodeUrl: String = "http://localhost:9944", developmentMode: Boolean = true) : NodeRpcClient
Ktor-based implementation of NodeRpcClient for Midnight node JSON-RPC API.
Connection:
HTTP endpoint: POST to
{nodeUrl}(e.g., http://localhost:9944)JSON-RPC 2.0 protocol
Timeout: 30 seconds (configurable)
Security:
Development mode: Allows HTTP to localhost (testing only)
Production mode: Requires HTTPS (not yet implemented)
Parameters
httpClient
HTTP client for making requests (injectable for testing)
nodeUrl
Node RPC endpoint URL (e.g., "http://localhost:9944")
developmentMode
If true, allows HTTP to localhost (INSECURE - testing only)
Functions
Link copied to clipboard
Get the hash of the latest finalized block.
Link copied to clipboard
open suspend override fun submitAndWaitForFinalization(serializedTxHex: String, timeoutMs: Long, onStage: suspend (NodeRpcClient.SubmissionStage) -> Unit?): TransactionFinalizationResult
Submit transaction and wait for finalization using WebSocket subscription.
Link copied to clipboard
Submit a serialized transaction to the Midnight node (fire-and-forget).