RpcPlan
This type allows an RpcApi to describe how a particular request should be issued to the JSON RPC server.
Given a function that was called on a Rpc, this object exposes an execute function that
dictates which request will be sent, how the underlying transport will be used, and how the
responses will be transformed.
This function accepts a RpcTransport and an AbortSignal and asynchronously returns a
RpcResponse. This gives us the opportunity to:
- define the
payloadfrom the requested method name and parameters before passing it to the transport. - call the underlying transport zero, one or multiple times depending on the use-case (e.g. caching or aggregating multiple responses).
- transform the response from the JSON RPC server, in case it does not match the
TResponsespecified by the PendingRpcRequest<TResponse> returned from that function.
Type Parameters
| Type Parameter |
|---|
TResponse |
Properties
execute()
Parameters
| Parameter | Type |
|---|---|
config | Readonly<{ signal?: AbortSignal; transport: RpcTransport; }> |
Returns
Promise<RpcResponse<TResponse>>