TaggedRPCRequest

public struct TaggedRPCRequest<Request> : Encodable where Request : RPCRequest

The structure that wraps each JSON-RPC request made to a Solana node, providing it with necessary information about how the request should be performed and identified in responses.

You can provide this wrapper manually with your request, allowing you to specify information like the version of the JSON-RPC spec and the Integer ID the node will use in communication about this request, or you can allow your RPCSession to do this for you.

Letting RPCSession do the work - most common

let session = RPCSession(...)
let request = RandomInformationRequest(...)

// You will not have knowledge of the JSON-RPC Spec
// or the identifier sent to the node, but
// because of the framework's structure, you usually
// don't need either of these.
let publisher = session.publish(request)

Manually building the tagged request

let session = RPCSession(...)
let request = RandomInformationRequest(...)

// You can keep track of this ID and throw all your requests
// and responses around however you want this way.
let taggedRequest = TaggedRPCRequest(request, id: 123456)
let publisher = session.publish(wrappedRequest)
  • Undocumented

    Declaration

    Swift

    public init(_ request: Request,
                id: UInt?  = nil)
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws