diff --git a/packages/rpc-core/src/bundle.ts b/packages/rpc-core/src/bundle.ts index ff81658a70d..ad35a11e03f 100644 --- a/packages/rpc-core/src/bundle.ts +++ b/packages/rpc-core/src/bundle.ts @@ -33,6 +33,9 @@ type MemoizedRpcInterfaceMethod = Memoized & { interface Options { isPedantic?: boolean; provider: ProviderInterface; + /** + * Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10) + */ rpcCacheCapacity?: number; userRpc?: Record>; } @@ -110,7 +113,9 @@ export class RpcCore { /** * @constructor * Default constructor for the core RPC handler - * @param {ProviderInterface} provider An API provider using any of the supported providers (HTTP, SC or WebSocket) + * @param {Registry} registry Type Registry + * @param {ProviderInterface} options.provider An API provider using any of the supported providers (HTTP, SC or WebSocket) + * @param {number} [options.rpcCacheCapacity] Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10) */ constructor (instanceId: string, registry: Registry, { isPedantic = true, provider, rpcCacheCapacity, userRpc = {} }: Options) { if (!provider || !isFunction(provider.send)) { diff --git a/packages/rpc-provider/src/ws/index.ts b/packages/rpc-provider/src/ws/index.ts index c75c63598c9..7f59b0b9122 100644 --- a/packages/rpc-provider/src/ws/index.ts +++ b/packages/rpc-provider/src/ws/index.ts @@ -104,10 +104,11 @@ export class WsProvider implements ProviderInterface { #timeout: number; /** - * @param {string | string[]} endpoint The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944`, may provide an array of endpoint strings. + * @param {string | string[]} endpoint The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944`, may provide an array of endpoint strings. * @param {number | false} autoConnectMs Whether to connect automatically or not (default). Provided value is used as a delay between retries. * @param {Record} headers The headers provided to the underlying WebSocket * @param {number} [timeout] Custom timeout value used per request . Defaults to `DEFAULT_TIMEOUT_MS` + * @param {number} [cacheCapacity] Custom size of the WsProvider LRUCache. Defaults to `DEFAULT_CAPACITY` (1024) */ constructor (endpoint: string | string[] = defaults.WS_URL, autoConnectMs: number | false = RETRY_DELAY, headers: Record = {}, timeout?: number, cacheCapacity?: number) { const endpoints = Array.isArray(endpoint)