Kit
Type aliases

RpcSubscriptionsPlan

RpcSubscriptionsPlan<TNotification> = Readonly<{ execute: (config) => Promise<DataPublisher<RpcSubscriptionsTransportDataEvents<TNotification>>>; request: RpcRequest; }>

This type allows an RpcSubscriptionsApi to describe how a particular subscription should be issued to the JSON RPC server.

Given a function that was called on a RpcSubscriptions, this object exposes an execute function that dictates which subscription request will be sent, how the underlying transport will be used, and how the notifications will be transformed.

This function accepts a RpcSubscriptionsChannel and an AbortSignal and asynchronously returns a DataPublisher. This gives us the opportunity to:

  • define the payload from the requested method name and parameters before passing it to the channel.
  • call the underlying channel zero, one or multiple times depending on the use-case (e.g. caching or coalescing multiple subscriptions).
  • transform the notification from the JSON RPC server, in case it does not match the TNotification specified by the PendingRpcSubscriptionsRequest<TNotification> emitted from the publisher returned.

Type Parameters

Type Parameter
TNotification

On this page