Type aliases
RpcPlan
RpcPlan<
TResponse
> =object
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
payload
from 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
TResponse
specified by the PendingRpcRequest<TResponse> returned from that function.
Type Parameters
Type Parameter |
---|
TResponse |
Properties
execute()
execute: (
config
) =>Promise
<RpcResponse
<TResponse
>>
Parameters
Parameter | Type |
---|---|
config | Readonly <{ signal? : AbortSignal ; transport : RpcTransport ; }> |
Returns
Promise
<RpcResponse
<TResponse
>>