@polkadot/rpc-core 14.2.2 → 14.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './util/index.js';
6
6
  interface Options {
7
7
  isPedantic?: boolean;
8
8
  provider: ProviderInterface;
9
+ rpcCacheCapacity?: number;
9
10
  userRpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
10
11
  }
11
12
  /**
@@ -41,7 +42,7 @@ export declare class RpcCore {
41
42
  * Default constructor for the core RPC handler
42
43
  * @param {ProviderInterface} provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
43
44
  */
44
- constructor(instanceId: string, registry: Registry, { isPedantic, provider, userRpc }: Options);
45
+ constructor(instanceId: string, registry: Registry, { isPedantic, provider, rpcCacheCapacity, userRpc }: Options);
45
46
  /**
46
47
  * @description Returns the connected status of a provider
47
48
  */
package/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Observable, publishReplay, refCount } from 'rxjs';
2
- import { DEFAULT_CAPACITY, LRUCache } from '@polkadot/rpc-provider';
2
+ import { LRUCache } from '@polkadot/rpc-provider';
3
3
  import { rpcDefinitions } from '@polkadot/types';
4
4
  import { hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aConcat, u8aToU8a } from '@polkadot/util';
5
5
  import { drr, refCountDelay } from './util/index.js';
@@ -14,6 +14,7 @@ const EMPTY_META = {
14
14
  isMap: false
15
15
  }
16
16
  };
17
+ const RPC_CORE_DEFAULT_CAPACITY = 1024 * 10 * 10;
17
18
  /** @internal */
18
19
  function logErrorMessage(method, { noErrorLog, params, type }, error) {
19
20
  if (noErrorLog) {
@@ -65,7 +66,7 @@ export class RpcCore {
65
66
  * Default constructor for the core RPC handler
66
67
  * @param {ProviderInterface} provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
67
68
  */
68
- constructor(instanceId, registry, { isPedantic = true, provider, userRpc = {} }) {
69
+ constructor(instanceId, registry, { isPedantic = true, provider, rpcCacheCapacity, userRpc = {} }) {
69
70
  if (!provider || !isFunction(provider.send)) {
70
71
  throw new Error('Expected Provider to API create');
71
72
  }
@@ -76,7 +77,7 @@ export class RpcCore {
76
77
  const sectionNames = Object.keys(rpcDefinitions);
77
78
  // these are the base keys (i.e. part of jsonrpc)
78
79
  this.sections.push(...sectionNames);
79
- this.__internal__storageCache = new LRUCache(DEFAULT_CAPACITY);
80
+ this.__internal__storageCache = new LRUCache(rpcCacheCapacity || RPC_CORE_DEFAULT_CAPACITY);
80
81
  // decorate all interfaces, defined and user on this instance
81
82
  this.addUserInterfaces(userRpc);
82
83
  }
package/cjs/bundle.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './util/index.js';
6
6
  interface Options {
7
7
  isPedantic?: boolean;
8
8
  provider: ProviderInterface;
9
+ rpcCacheCapacity?: number;
9
10
  userRpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
10
11
  }
11
12
  /**
@@ -41,7 +42,7 @@ export declare class RpcCore {
41
42
  * Default constructor for the core RPC handler
42
43
  * @param {ProviderInterface} provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
43
44
  */
44
- constructor(instanceId: string, registry: Registry, { isPedantic, provider, userRpc }: Options);
45
+ constructor(instanceId: string, registry: Registry, { isPedantic, provider, rpcCacheCapacity, userRpc }: Options);
45
46
  /**
46
47
  * @description Returns the connected status of a provider
47
48
  */
package/cjs/bundle.js CHANGED
@@ -19,6 +19,7 @@ const EMPTY_META = {
19
19
  isMap: false
20
20
  }
21
21
  };
22
+ const RPC_CORE_DEFAULT_CAPACITY = 1024 * 10 * 10;
22
23
  /** @internal */
23
24
  function logErrorMessage(method, { noErrorLog, params, type }, error) {
24
25
  if (noErrorLog) {
@@ -70,7 +71,7 @@ class RpcCore {
70
71
  * Default constructor for the core RPC handler
71
72
  * @param {ProviderInterface} provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
72
73
  */
73
- constructor(instanceId, registry, { isPedantic = true, provider, userRpc = {} }) {
74
+ constructor(instanceId, registry, { isPedantic = true, provider, rpcCacheCapacity, userRpc = {} }) {
74
75
  if (!provider || !(0, util_1.isFunction)(provider.send)) {
75
76
  throw new Error('Expected Provider to API create');
76
77
  }
@@ -81,7 +82,7 @@ class RpcCore {
81
82
  const sectionNames = Object.keys(types_1.rpcDefinitions);
82
83
  // these are the base keys (i.e. part of jsonrpc)
83
84
  this.sections.push(...sectionNames);
84
- this.__internal__storageCache = new rpc_provider_1.LRUCache(rpc_provider_1.DEFAULT_CAPACITY);
85
+ this.__internal__storageCache = new rpc_provider_1.LRUCache(rpcCacheCapacity || RPC_CORE_DEFAULT_CAPACITY);
85
86
  // decorate all interfaces, defined and user on this instance
86
87
  this.addUserInterfaces(userRpc);
87
88
  }
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageInfo = void 0;
4
- exports.packageInfo = { name: '@polkadot/rpc-core', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.2.2' };
4
+ exports.packageInfo = { name: '@polkadot/rpc-core', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.3.1' };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "./cjs/packageDetect.js"
19
19
  ],
20
20
  "type": "module",
21
- "version": "14.2.2",
21
+ "version": "14.3.1",
22
22
  "main": "./cjs/index.js",
23
23
  "module": "./index.js",
24
24
  "types": "./index.d.ts",
@@ -199,10 +199,10 @@
199
199
  }
200
200
  },
201
201
  "dependencies": {
202
- "@polkadot/rpc-augment": "14.2.2",
203
- "@polkadot/rpc-provider": "14.2.2",
204
- "@polkadot/types": "14.2.2",
205
- "@polkadot/util": "^13.2.2",
202
+ "@polkadot/rpc-augment": "14.3.1",
203
+ "@polkadot/rpc-provider": "14.3.1",
204
+ "@polkadot/types": "14.3.1",
205
+ "@polkadot/util": "^13.2.3",
206
206
  "rxjs": "^7.8.1",
207
207
  "tslib": "^2.8.0"
208
208
  }
package/packageInfo.js CHANGED
@@ -1 +1 @@
1
- export const packageInfo = { name: '@polkadot/rpc-core', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.2.2' };
1
+ export const packageInfo = { name: '@polkadot/rpc-core', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.3.1' };