@polkadot/rpc-core 16.0.1 → 16.1.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
@@ -10,6 +10,7 @@ interface Options {
10
10
  * Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10)
11
11
  */
12
12
  rpcCacheCapacity?: number;
13
+ ttl?: number | null;
13
14
  userRpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
14
15
  }
15
16
  /**
@@ -47,7 +48,7 @@ export declare class RpcCore {
47
48
  * @param {ProviderInterface} options.provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
48
49
  * @param {number} [options.rpcCacheCapacity] Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10)
49
50
  */
50
- constructor(instanceId: string, registry: Registry, { isPedantic, provider, rpcCacheCapacity, userRpc }: Options);
51
+ constructor(instanceId: string, registry: Registry, { isPedantic, provider, rpcCacheCapacity, ttl, userRpc }: Options);
51
52
  /**
52
53
  * @description Returns the connected status of a provider
53
54
  */
package/bundle.js CHANGED
@@ -68,7 +68,7 @@ export class RpcCore {
68
68
  * @param {ProviderInterface} options.provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
69
69
  * @param {number} [options.rpcCacheCapacity] Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10)
70
70
  */
71
- constructor(instanceId, registry, { isPedantic = true, provider, rpcCacheCapacity, userRpc = {} }) {
71
+ constructor(instanceId, registry, { isPedantic = true, provider, rpcCacheCapacity, ttl, userRpc = {} }) {
72
72
  if (!provider || !isFunction(provider.send)) {
73
73
  throw new Error('Expected Provider to API create');
74
74
  }
@@ -79,7 +79,7 @@ export class RpcCore {
79
79
  const sectionNames = Object.keys(rpcDefinitions);
80
80
  // these are the base keys (i.e. part of jsonrpc)
81
81
  this.sections.push(...sectionNames);
82
- this.__internal__storageCache = new LRUCache(rpcCacheCapacity || RPC_CORE_DEFAULT_CAPACITY);
82
+ this.__internal__storageCache = new LRUCache(rpcCacheCapacity || RPC_CORE_DEFAULT_CAPACITY, ttl);
83
83
  // decorate all interfaces, defined and user on this instance
84
84
  this.addUserInterfaces(userRpc);
85
85
  }
package/cjs/bundle.d.ts CHANGED
@@ -10,6 +10,7 @@ interface Options {
10
10
  * Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10)
11
11
  */
12
12
  rpcCacheCapacity?: number;
13
+ ttl?: number | null;
13
14
  userRpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
14
15
  }
15
16
  /**
@@ -47,7 +48,7 @@ export declare class RpcCore {
47
48
  * @param {ProviderInterface} options.provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
48
49
  * @param {number} [options.rpcCacheCapacity] Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10)
49
50
  */
50
- constructor(instanceId: string, registry: Registry, { isPedantic, provider, rpcCacheCapacity, userRpc }: Options);
51
+ constructor(instanceId: string, registry: Registry, { isPedantic, provider, rpcCacheCapacity, ttl, userRpc }: Options);
51
52
  /**
52
53
  * @description Returns the connected status of a provider
53
54
  */
package/cjs/bundle.js CHANGED
@@ -73,7 +73,7 @@ class RpcCore {
73
73
  * @param {ProviderInterface} options.provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
74
74
  * @param {number} [options.rpcCacheCapacity] Custom size of the rpc LRUCache capacity. Defaults to `RPC_CORE_DEFAULT_CAPACITY` (1024 * 10 * 10)
75
75
  */
76
- constructor(instanceId, registry, { isPedantic = true, provider, rpcCacheCapacity, userRpc = {} }) {
76
+ constructor(instanceId, registry, { isPedantic = true, provider, rpcCacheCapacity, ttl, userRpc = {} }) {
77
77
  if (!provider || !(0, util_1.isFunction)(provider.send)) {
78
78
  throw new Error('Expected Provider to API create');
79
79
  }
@@ -84,7 +84,7 @@ class RpcCore {
84
84
  const sectionNames = Object.keys(types_1.rpcDefinitions);
85
85
  // these are the base keys (i.e. part of jsonrpc)
86
86
  this.sections.push(...sectionNames);
87
- this.__internal__storageCache = new rpc_provider_1.LRUCache(rpcCacheCapacity || RPC_CORE_DEFAULT_CAPACITY);
87
+ this.__internal__storageCache = new rpc_provider_1.LRUCache(rpcCacheCapacity || RPC_CORE_DEFAULT_CAPACITY, ttl);
88
88
  // decorate all interfaces, defined and user on this instance
89
89
  this.addUserInterfaces(userRpc);
90
90
  }
@@ -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: '16.0.1' };
4
+ exports.packageInfo = { name: '@polkadot/rpc-core', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '16.1.1' };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "./cjs/packageDetect.js"
19
19
  ],
20
20
  "type": "module",
21
- "version": "16.0.1",
21
+ "version": "16.1.1",
22
22
  "main": "./cjs/index.js",
23
23
  "module": "./index.js",
24
24
  "types": "./index.d.ts",
@@ -199,9 +199,9 @@
199
199
  }
200
200
  },
201
201
  "dependencies": {
202
- "@polkadot/rpc-augment": "16.0.1",
203
- "@polkadot/rpc-provider": "16.0.1",
204
- "@polkadot/types": "16.0.1",
202
+ "@polkadot/rpc-augment": "16.1.1",
203
+ "@polkadot/rpc-provider": "16.1.1",
204
+ "@polkadot/types": "16.1.1",
205
205
  "@polkadot/util": "^13.5.1",
206
206
  "rxjs": "^7.8.1",
207
207
  "tslib": "^2.8.1"
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: '16.0.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: '16.1.1' };