Skip to content

Commit c71bd49

Browse files
authored
Update docs for WsProvider, and RpcCore (#6031)
* Update WS inline docs * Update docs around RPCCORE
1 parent 4e71139 commit c71bd49

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/rpc-core/src/bundle.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ type MemoizedRpcInterfaceMethod = Memoized<RpcInterfaceMethod> & {
3333
interface Options {
3434
isPedantic?: boolean;
3535
provider: ProviderInterface;
36+
/**
37+
* Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10)
38+
*/
3639
rpcCacheCapacity?: number;
3740
userRpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
3841
}
@@ -110,7 +113,9 @@ export class RpcCore {
110113
/**
111114
* @constructor
112115
* Default constructor for the core RPC handler
113-
* @param {ProviderInterface} provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
116+
* @param {Registry} registry Type Registry
117+
* @param {ProviderInterface} options.provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
118+
* @param {number} [options.rpcCacheCapacity] Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10)
114119
*/
115120
constructor (instanceId: string, registry: Registry, { isPedantic = true, provider, rpcCacheCapacity, userRpc = {} }: Options) {
116121
if (!provider || !isFunction(provider.send)) {

packages/rpc-provider/src/ws/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ export class WsProvider implements ProviderInterface {
104104
#timeout: number;
105105

106106
/**
107-
* @param {string | string[]} endpoint The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944`, may provide an array of endpoint strings.
107+
* @param {string | string[]} endpoint The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944`, may provide an array of endpoint strings.
108108
* @param {number | false} autoConnectMs Whether to connect automatically or not (default). Provided value is used as a delay between retries.
109109
* @param {Record<string, string>} headers The headers provided to the underlying WebSocket
110110
* @param {number} [timeout] Custom timeout value used per request . Defaults to `DEFAULT_TIMEOUT_MS`
111+
* @param {number} [cacheCapacity] Custom size of the WsProvider LRUCache. Defaults to `DEFAULT_CAPACITY` (1024)
111112
*/
112113
constructor (endpoint: string | string[] = defaults.WS_URL, autoConnectMs: number | false = RETRY_DELAY, headers: Record<string, string> = {}, timeout?: number, cacheCapacity?: number) {
113114
const endpoints = Array.isArray(endpoint)

0 commit comments

Comments
 (0)