Kit
Type aliases

RpcSubscriptionsChannelFromClusterUrl

RpcSubscriptionsChannelFromClusterUrl<TClusterUrl, TOutboundMessage, TInboundMessage> = TClusterUrl extends DevnetUrl ? RpcSubscriptionsChannelDevnet<TOutboundMessage, TInboundMessage> : TClusterUrl extends TestnetUrl ? RpcSubscriptionsChannelTestnet<TOutboundMessage, TInboundMessage> : TClusterUrl extends MainnetUrl ? RpcSubscriptionsChannelMainnet<TOutboundMessage, TInboundMessage> : RpcSubscriptionsChannel<TOutboundMessage, TInboundMessage>

Given a ClusterUrl, this utility type will resolve to as specific a RpcSubscriptionsChannel as possible.

Type Parameters

Type Parameter
TClusterUrl extends ClusterUrl
TOutboundMessage
TInboundMessage

Example

function createCustomSubscriptionsChannel<TClusterUrl extends ClusterUrl>(
    clusterUrl: TClusterUrl,
): RpcSubscriptionsChannelFromClusterUrl<TClusterUrl> {
    /* ... */
}
 
const channel = createCustomSubscriptionsChannel(testnet('ws://api.testnet.solana.com'));
channel satisfies RpcSubscriptionsChannelTestnet; // OK

On this page