Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for WsProvider, and RpcCore #6031

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/rpc-core/src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ type MemoizedRpcInterfaceMethod = Memoized<RpcInterfaceMethod> & {
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<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
}
Expand Down Expand Up @@ -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)) {
Expand Down
3 changes: 2 additions & 1 deletion packages/rpc-provider/src/ws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>} 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<string, string> = {}, timeout?: number, cacheCapacity?: number) {
const endpoints = Array.isArray(endpoint)
Expand Down
Loading