Making RPC Requests
-
A session that handles communication with the Solana JSON-RPC API.
See moreDeclaration
Swift
public class RPCSession -
A node on the Solana network, addressable via JSON-RPC calls.
See moreDeclaration
Swift
public struct RPCNode -
The protocol Solana JSON-RPC requests must confrom to.
See moreDeclaration
Swift
public protocol 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
RPCSessionto 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
See morelet 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)Declaration
Swift
public struct TaggedRPCRequest<Request> : Encodable where Request : RPCRequest -
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
See moreRPCSessionobject with your conforming object to create a custom testing or mock system. For normal use,RPCNetworkRequestAdaptorcomes pre-configured, andRPCPassthroughRequestAdaptorcan handle sending flat files from disk.Declaration
Swift
public protocol RPCRequestAdaptor
Making RPC Requests Reference