Skip to main content

Module client

Module client 

Source
Expand description

Client-side Ark server connector.

This module provides a managed, version-aware gRPC connection between a Bark client and a paired Ark server. Its responsibilities are:

  • Negotiating and enforcing a compatible wire protocol version via a handshake.
  • Establishing a gRPC channel (optionally with TLS) with sensible timeouts and keepalives.
  • Injecting the negotiated protocol version into every RPC call so the server can route/validate requests correctly.
  • Fetching and exposing the server’s runtime configuration (ArkInfo) so the client can adapt its behavior (e.g., network, round cadence, limits).

Overview

  • Version negotiation: The client first calls the server’s handshake RPC, which returns the supported protocol version range. The client checks its own supported range (MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION) and picks the highest mutually supported version.
  • Metadata propagation: After negotiation, all subsequent RPCs carry the selected protocol version in the request metadata using a gRPC interceptor.
  • TLS: If the server URI is HTTPS, a TLS configuration with the configured crate roots is set up; otherwise the connection proceeds in cleartext.
  • Server info: Once connected, the client retrieves ArkInfo to validate that the selected Bitcoin Network matches the wallet and to learn server-side parameters that drive client behavior.

Structs§

ArkInfoHandle
A handle to the Ark info.
ArkServiceInterceptor
A gRPC interceptor that attaches ark-specific headers to each request
ProtocolVersionInterceptorDeprecated
A gRPC interceptor that attaches the negotiated protocol version to each request.
ServerConnection
A managed connection to the Ark server.
ServerConnectionBuilder
ServerInfo

Enums§

ConnectError
CreateEndpointError

Constants§

ACCESS_TOKEN_HEADER
The HTTP header used for private server access tokens
MAX_PROTOCOL_VERSION
The maximum protocol version supported by the client.
MIN_PROTOCOL_VERSION
The minimum protocol version supported by the client.
NO_TRANSPORT_BACKEND_MESSAGE
Error text used when no Ark RPC transport backend was compiled into the binary.