RPCRequestAdaptor

public protocol RPCRequestAdaptor

A protocol that represents the bridging logic betweeen a source of knowledge and a session that handles Solana JSON-RPC requests.

Conform to this protocol and set up an RPCSession object with your conforming object to create a custom testing or mock system. For normal use, RPCNetworkRequestAdaptor comes pre-configured, and RPCPassthroughRequestAdaptor can handle sending flat files from disk.

  • publisher(for:) Default implementation

    Creates an automatically-connecting Combine publisher that responds to a given request. Since the request has not already been wrapped with TaggedRPCRequest, this will create an identifier and its tags internally.

    Default Implementation

    Undocumented

    Declaration

    Swift

    func publisher<Request: RPCRequest>(
        for unwrappedRequest: Request
    ) -> AnyPublisher<TaggedRPCResponse<
        Request.Response,
        SolanaNodeError>, Error>
  • Creates an automatically-connecting Combine publisher that responds to a given request.

    Declaration

    Swift

    func publisher<Request: RPCRequest>(
        for request: TaggedRPCRequest<Request>
    ) -> AnyPublisher<TaggedRPCResponse<
        Request.Response,
        SolanaNodeError>, Error>
  • webSocketPublisher(for:) Default implementation

    Creates an automatically-connecting Combine publisher that emits signals from a web socket task created for a given request. Since the request has not already been wrapped with TaggedRPCRequest, this will create an identifier and its tags internally.

    Default Implementation

    Undocumented

    Declaration

    Swift

    func webSocketPublisher<Request: WebSocketRequest>(for untaggedRequest: Request)
    -> AnyPublisher<URLSessionWebSocketTask.Message, WebSocketError>
  • Creates an automatically-connecting Combine publisher that emits signals from a web socket task created for a given request.

    Declaration

    Swift

    func webSocketPublisher<Request: WebSocketRequest>(for taggedRequest: TaggedRPCRequest<Request>)
    -> AnyPublisher<URLSessionWebSocketTask.Message, WebSocketError>