@polkadot/rpc-core 6.6.2-10 → 6.6.2-14

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.cjs CHANGED
@@ -19,9 +19,9 @@ Object.defineProperty(exports, "packageInfo", {
19
19
 
20
20
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
21
 
22
- var _classPrivateFieldLooseBase2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseBase"));
22
+ var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
23
23
 
24
- var _classPrivateFieldLooseKey2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseKey"));
24
+ var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
25
25
 
26
26
  var _rxjs = require("rxjs");
27
27
 
@@ -45,9 +45,9 @@ Object.keys(_index).forEach(function (key) {
45
45
 
46
46
  var _packageInfo = require("./packageInfo.cjs");
47
47
 
48
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
48
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
49
49
 
50
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
50
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
51
51
 
52
52
  const l = (0, _util.logger)('rpc-core');
53
53
  const EMPTY_META = {
@@ -113,13 +113,13 @@ function isTreatAsHex(key) {
113
113
  */
114
114
 
115
115
 
116
- var _instanceId = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("instanceId");
116
+ var _instanceId = /*#__PURE__*/new WeakMap();
117
117
 
118
- var _registryDefault = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("registryDefault");
118
+ var _registryDefault = /*#__PURE__*/new WeakMap();
119
119
 
120
- var _getBlockRegistry = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("getBlockRegistry");
120
+ var _getBlockRegistry = /*#__PURE__*/new WeakMap();
121
121
 
122
- var _storageCache = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("storageCache");
122
+ var _storageCache = /*#__PURE__*/new WeakMap();
123
123
 
124
124
  class RpcCore {
125
125
  /**
@@ -129,29 +129,34 @@ class RpcCore {
129
129
  */
130
130
  constructor(instanceId, registry, provider) {
131
131
  let userRpc = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
132
- Object.defineProperty(this, _instanceId, {
132
+
133
+ _classPrivateFieldInitSpec(this, _instanceId, {
133
134
  writable: true,
134
135
  value: void 0
135
136
  });
136
- Object.defineProperty(this, _registryDefault, {
137
+
138
+ _classPrivateFieldInitSpec(this, _registryDefault, {
137
139
  writable: true,
138
140
  value: void 0
139
141
  });
140
- Object.defineProperty(this, _getBlockRegistry, {
142
+
143
+ _classPrivateFieldInitSpec(this, _getBlockRegistry, {
141
144
  writable: true,
142
145
  value: void 0
143
146
  });
144
- Object.defineProperty(this, _storageCache, {
147
+
148
+ _classPrivateFieldInitSpec(this, _storageCache, {
145
149
  writable: true,
146
150
  value: new Map()
147
151
  });
148
- this.mapping = new Map();
149
- this.provider = void 0;
150
- this.sections = [];
152
+
153
+ (0, _defineProperty2.default)(this, "mapping", new Map());
154
+ (0, _defineProperty2.default)(this, "provider", void 0);
155
+ (0, _defineProperty2.default)(this, "sections", []);
151
156
  // eslint-disable-next-line @typescript-eslint/unbound-method
152
157
  (0, _util.assert)(provider && (0, _util.isFunction)(provider.send), 'Expected Provider to API create');
153
- (0, _classPrivateFieldLooseBase2.default)(this, _instanceId)[_instanceId] = instanceId;
154
- (0, _classPrivateFieldLooseBase2.default)(this, _registryDefault)[_registryDefault] = registry;
158
+ (0, _classPrivateFieldSet2.default)(this, _instanceId, instanceId);
159
+ (0, _classPrivateFieldSet2.default)(this, _registryDefault, registry);
155
160
  this.provider = provider;
156
161
  const sectionNames = Object.keys(_types.rpcDefinitions); // these are the base keys (i.e. part of jsonrpc)
157
162
 
@@ -189,54 +194,50 @@ class RpcCore {
189
194
 
190
195
 
191
196
  setRegistrySwap(registrySwap) {
192
- (0, _classPrivateFieldLooseBase2.default)(this, _getBlockRegistry)[_getBlockRegistry] = (0, _util.memoize)(registrySwap, {
193
- getInstanceId: () => (0, _classPrivateFieldLooseBase2.default)(this, _instanceId)[_instanceId]
194
- });
197
+ (0, _classPrivateFieldSet2.default)(this, _getBlockRegistry, (0, _util.memoize)(registrySwap, {
198
+ getInstanceId: () => (0, _classPrivateFieldGet2.default)(this, _instanceId)
199
+ }));
195
200
  }
196
201
 
197
202
  addUserInterfaces(userRpc) {
198
203
  // add any extra user-defined sections
199
- this.sections.push(...Object.keys(userRpc).filter(key => !this.sections.includes(key))); // decorate the sections with base and user methods
204
+ this.sections.push(...Object.keys(userRpc).filter(k => !this.sections.includes(k)));
200
205
 
201
- this.sections.forEach(sectionName => {
202
- var _ref3, _ref4;
206
+ for (let s = 0; s < this.sections.length; s++) {
207
+ const section = this.sections[s];
208
+ const defs = (0, _util.objectSpread)({}, _types.rpcDefinitions[section], userRpc[section]);
209
+ const methods = Object.keys(defs);
203
210
 
204
- (_ref3 = this)[_ref4 = sectionName] || (_ref3[_ref4] = {});
205
- const section = this[sectionName];
206
- Object.entries(_objectSpread(_objectSpread({}, this._createInterface(sectionName, _types.rpcDefinitions[sectionName] || {})), this._createInterface(sectionName, userRpc[sectionName] || {}))).forEach(_ref5 => {
207
- let [key, value] = _ref5;
208
- section[key] || (section[key] = value);
209
- });
210
- });
211
+ for (let m = 0; m < methods.length; m++) {
212
+ const method = methods[m];
213
+ const def = defs[method];
214
+
215
+ if (!this.mapping.has(def.endpoint || `${section}_${method}`)) {
216
+ if (!this[section]) {
217
+ this[section] = {};
218
+ }
219
+
220
+ (0, _util.lazyMethod)(this[section], method, () => this._createInterface(section, method, def));
221
+ }
222
+ }
223
+ }
211
224
  }
212
225
 
213
- _createInterface(section, methods) {
214
- return Object.entries(methods).filter(_ref6 => {
215
- let [method, {
216
- endpoint
217
- }] = _ref6;
218
- return !this.mapping.has(endpoint || `${section}_${method}`);
219
- }).reduce((exposed, _ref7) => {
220
- let [method, {
221
- endpoint
222
- }] = _ref7;
223
- const def = methods[method];
224
- const isSubscription = !!def.pubsub;
225
- const jsonrpc = endpoint || `${section}_${method}`;
226
- this.mapping.set(jsonrpc, _objectSpread(_objectSpread({}, def), {}, {
227
- isSubscription,
228
- jsonrpc,
229
- method,
230
- section
231
- }));
232
- exposed[method] = isSubscription ? this._createMethodSubscribe(section, method, def) : this._createMethodSend(section, method, def);
233
- return exposed;
234
- }, {});
226
+ _createInterface(section, method, def) {
227
+ const isSubscription = !!def.pubsub;
228
+ const jsonrpc = def.endpoint || `${section}_${method}`;
229
+ this.mapping.set(jsonrpc, { ...def,
230
+ isSubscription,
231
+ jsonrpc,
232
+ method,
233
+ section
234
+ });
235
+ return isSubscription ? this._createMethodSubscribe(section, method, def) : this._createMethodSend(section, method, def);
235
236
  }
236
237
 
237
238
  _memomize(creator, def) {
238
239
  const memoOpts = {
239
- getInstanceId: () => (0, _classPrivateFieldLooseBase2.default)(this, _instanceId)[_instanceId]
240
+ getInstanceId: () => (0, _classPrivateFieldGet2.default)(this, _instanceId)
240
241
  };
241
242
  const memoized = (0, _util.memoize)(creator(true), memoOpts);
242
243
  memoized.raw = (0, _util.memoize)(creator(false), memoOpts);
@@ -250,10 +251,10 @@ class RpcCore {
250
251
 
251
252
  _createMethodSend(section, method, def) {
252
253
  const rpcName = def.endpoint || `${section}_${method}`;
253
- const hashIndex = def.params.findIndex(_ref8 => {
254
+ const hashIndex = def.params.findIndex(_ref3 => {
254
255
  let {
255
256
  isHistoric
256
- } = _ref8;
257
+ } = _ref3;
257
258
  return isHistoric;
258
259
  });
259
260
  let memoized = null; // execute the RPC call, doing a registry swap for historic as applicable
@@ -262,8 +263,8 @@ class RpcCore {
262
263
  const blockHash = hashIndex === -1 ? null : values[hashIndex];
263
264
  const {
264
265
  registry
265
- } = isScale && blockHash && (0, _classPrivateFieldLooseBase2.default)(this, _getBlockRegistry)[_getBlockRegistry] ? await (0, _classPrivateFieldLooseBase2.default)(this, _getBlockRegistry)[_getBlockRegistry]((0, _util.u8aToU8a)(blockHash)) : {
266
- registry: (0, _classPrivateFieldLooseBase2.default)(this, _registryDefault)[_registryDefault]
266
+ } = isScale && blockHash && (0, _classPrivateFieldGet2.default)(this, _getBlockRegistry) ? await (0, _classPrivateFieldGet2.default)(this, _getBlockRegistry).call(this, (0, _util.u8aToU8a)(blockHash)) : {
267
+ registry: (0, _classPrivateFieldGet2.default)(this, _registryDefault)
267
268
  };
268
269
 
269
270
  const params = this._formatInputs(registry, null, def, values);
@@ -303,13 +304,13 @@ class RpcCore {
303
304
  } // create a subscriptor, it subscribes once and resolves with the id as subscribe
304
305
 
305
306
 
306
- _createSubscriber(_ref9, errorHandler) {
307
+ _createSubscriber(_ref4, errorHandler) {
307
308
  let {
308
309
  paramsJson,
309
310
  subName,
310
311
  subType,
311
312
  update
312
- } = _ref9;
313
+ } = _ref4;
313
314
  return new Promise((resolve, reject) => {
314
315
  this.provider.subscribe(subType, subName, paramsJson, update).then(resolve).catch(error => {
315
316
  errorHandler(error);
@@ -335,8 +336,7 @@ class RpcCore {
335
336
  return new _rxjs.Observable(observer => {
336
337
  // Have at least an empty promise, as used in the unsubscribe
337
338
  let subscriptionPromise = Promise.resolve(null);
338
-
339
- const registry = (0, _classPrivateFieldLooseBase2.default)(_this, _registryDefault)[_registryDefault];
339
+ const registry = (0, _classPrivateFieldGet2.default)(_this, _registryDefault);
340
340
 
341
341
  const errorHandler = error => {
342
342
  logErrorMessage(method, def, error);
@@ -388,10 +388,10 @@ class RpcCore {
388
388
  }
389
389
 
390
390
  _formatInputs(registry, blockHash, def, inputs) {
391
- const reqArgCount = def.params.filter(_ref10 => {
391
+ const reqArgCount = def.params.filter(_ref5 => {
392
392
  let {
393
393
  isOptional
394
- } = _ref10;
394
+ } = _ref5;
395
395
  return !isOptional;
396
396
  }).length;
397
397
  const optText = reqArgCount === def.params.length ? '' : ` (${def.params.length - reqArgCount} optional)`;
@@ -409,11 +409,11 @@ class RpcCore {
409
409
  const keys = params[0];
410
410
  return keys ? this._formatStorageSet(registry, result.block, keys, result.changes) : registry.createType('StorageChangeSet', result);
411
411
  } else if (rpc.type === 'Vec<StorageChangeSet>') {
412
- const mapped = result.map(_ref11 => {
412
+ const mapped = result.map(_ref6 => {
413
413
  let {
414
414
  block,
415
415
  changes
416
- } = _ref11;
416
+ } = _ref6;
417
417
  return [registry.createType('Hash', block), this._formatStorageSet(registry, block, params[0], changes)];
418
418
  }); // we only query at a specific block, not a range - flatten
419
419
 
@@ -448,22 +448,21 @@ class RpcCore {
448
448
 
449
449
  _formatStorageSetEntry(registry, blockHash, key, changes, witCache, entryIndex) {
450
450
  const hexKey = key.toHex();
451
- const found = changes.find(_ref12 => {
452
- let [key] = _ref12;
451
+ const found = changes.find(_ref7 => {
452
+ let [key] = _ref7;
453
453
  return key === hexKey;
454
454
  }); // if we don't find the value, this is our fallback
455
455
  // - in the case of an array of values, fill the hole from the cache
456
456
  // - if a single result value, don't fill - it is not an update hole
457
457
  // - fallback to an empty option in all cases
458
458
 
459
- const value = (0, _util.isUndefined)(found) ? witCache && (0, _classPrivateFieldLooseBase2.default)(this, _storageCache)[_storageCache].get(hexKey) || null : found[1];
459
+ const value = (0, _util.isUndefined)(found) ? witCache && (0, _classPrivateFieldGet2.default)(this, _storageCache).get(hexKey) || null : found[1];
460
460
  const isEmpty = (0, _util.isNull)(value);
461
461
  const input = isEmpty || isTreatAsHex(key) ? value : (0, _util.u8aToU8a)(value); // store the retrieved result - the only issue with this cache is that there is no
462
462
  // clearing of it, so very long running processes (not just a couple of hours, longer)
463
463
  // will increase memory beyond what is allowed.
464
464
 
465
- (0, _classPrivateFieldLooseBase2.default)(this, _storageCache)[_storageCache].set(hexKey, value);
466
-
465
+ (0, _classPrivateFieldGet2.default)(this, _storageCache).set(hexKey, value);
467
466
  return this._newType(registry, blockHash, key, input, isEmpty, entryIndex);
468
467
  }
469
468
 
package/bundle.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { ProviderInterface } from '@polkadot/rpc-provider/types';
2
2
  import type { DefinitionRpc, DefinitionRpcExt, DefinitionRpcSub, Registry } from '@polkadot/types/types';
3
- import type { RpcInterface } from './types';
4
3
  export { packageInfo } from './packageInfo';
5
4
  export * from './util';
6
5
  /**
@@ -55,7 +54,7 @@ export declare class RpcCore {
55
54
  setRegistrySwap(registrySwap: (blockHash: Uint8Array) => Promise<{
56
55
  registry: Registry;
57
56
  }>): void;
58
- addUserInterfaces<Section extends keyof RpcInterface>(userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void;
57
+ addUserInterfaces(userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void;
59
58
  private _createInterface;
60
59
  private _memomize;
61
60
  private _formatResult;
package/bundle.js CHANGED
@@ -1,16 +1,8 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
3
- import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
4
-
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6
-
7
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
-
9
1
  // Copyright 2017-2021 @polkadot/rpc-core authors & contributors
10
2
  // SPDX-License-Identifier: Apache-2.0
11
3
  import { Observable, publishReplay, refCount } from 'rxjs';
12
4
  import { rpcDefinitions } from '@polkadot/types';
13
- import { assert, hexToU8a, isFunction, isNull, isUndefined, logger, memoize, u8aToU8a } from '@polkadot/util';
5
+ import { assert, hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aToU8a } from '@polkadot/util';
14
6
  import { drr, refCountDelay } from "./util/index.js";
15
7
  export { packageInfo } from "./packageInfo.js";
16
8
  export * from "./util/index.js";
@@ -74,44 +66,24 @@ function isTreatAsHex(key) {
74
66
  */
75
67
 
76
68
 
77
- var _instanceId = /*#__PURE__*/_classPrivateFieldLooseKey("instanceId");
78
-
79
- var _registryDefault = /*#__PURE__*/_classPrivateFieldLooseKey("registryDefault");
80
-
81
- var _getBlockRegistry = /*#__PURE__*/_classPrivateFieldLooseKey("getBlockRegistry");
82
-
83
- var _storageCache = /*#__PURE__*/_classPrivateFieldLooseKey("storageCache");
84
-
85
69
  export class RpcCore {
70
+ #instanceId;
71
+ #registryDefault;
72
+ #getBlockRegistry;
73
+ #storageCache = new Map();
74
+ mapping = new Map();
75
+ sections = [];
86
76
  /**
87
77
  * @constructor
88
78
  * Default constructor for the Api Object
89
79
  * @param {ProviderInterface} provider An API provider using HTTP or WebSocket
90
80
  */
81
+
91
82
  constructor(instanceId, registry, provider, userRpc = {}) {
92
- Object.defineProperty(this, _instanceId, {
93
- writable: true,
94
- value: void 0
95
- });
96
- Object.defineProperty(this, _registryDefault, {
97
- writable: true,
98
- value: void 0
99
- });
100
- Object.defineProperty(this, _getBlockRegistry, {
101
- writable: true,
102
- value: void 0
103
- });
104
- Object.defineProperty(this, _storageCache, {
105
- writable: true,
106
- value: new Map()
107
- });
108
- this.mapping = new Map();
109
- this.provider = void 0;
110
- this.sections = [];
111
83
  // eslint-disable-next-line @typescript-eslint/unbound-method
112
84
  assert(provider && isFunction(provider.send), 'Expected Provider to API create');
113
- _classPrivateFieldLooseBase(this, _instanceId)[_instanceId] = instanceId;
114
- _classPrivateFieldLooseBase(this, _registryDefault)[_registryDefault] = registry;
85
+ this.#instanceId = instanceId;
86
+ this.#registryDefault = registry;
115
87
  this.provider = provider;
116
88
  const sectionNames = Object.keys(rpcDefinitions); // these are the base keys (i.e. part of jsonrpc)
117
89
 
@@ -149,49 +121,50 @@ export class RpcCore {
149
121
 
150
122
 
151
123
  setRegistrySwap(registrySwap) {
152
- _classPrivateFieldLooseBase(this, _getBlockRegistry)[_getBlockRegistry] = memoize(registrySwap, {
153
- getInstanceId: () => _classPrivateFieldLooseBase(this, _instanceId)[_instanceId]
124
+ this.#getBlockRegistry = memoize(registrySwap, {
125
+ getInstanceId: () => this.#instanceId
154
126
  });
155
127
  }
156
128
 
157
129
  addUserInterfaces(userRpc) {
158
130
  // add any extra user-defined sections
159
- this.sections.push(...Object.keys(userRpc).filter(key => !this.sections.includes(key))); // decorate the sections with base and user methods
131
+ this.sections.push(...Object.keys(userRpc).filter(k => !this.sections.includes(k)));
160
132
 
161
- this.sections.forEach(sectionName => {
162
- var _ref, _ref2;
133
+ for (let s = 0; s < this.sections.length; s++) {
134
+ const section = this.sections[s];
135
+ const defs = objectSpread({}, rpcDefinitions[section], userRpc[section]);
136
+ const methods = Object.keys(defs);
163
137
 
164
- (_ref = this)[_ref2 = sectionName] || (_ref[_ref2] = {});
165
- const section = this[sectionName];
166
- Object.entries(_objectSpread(_objectSpread({}, this._createInterface(sectionName, rpcDefinitions[sectionName] || {})), this._createInterface(sectionName, userRpc[sectionName] || {}))).forEach(([key, value]) => {
167
- section[key] || (section[key] = value);
168
- });
169
- });
138
+ for (let m = 0; m < methods.length; m++) {
139
+ const method = methods[m];
140
+ const def = defs[method];
141
+
142
+ if (!this.mapping.has(def.endpoint || `${section}_${method}`)) {
143
+ if (!this[section]) {
144
+ this[section] = {};
145
+ }
146
+
147
+ lazyMethod(this[section], method, () => this._createInterface(section, method, def));
148
+ }
149
+ }
150
+ }
170
151
  }
171
152
 
172
- _createInterface(section, methods) {
173
- return Object.entries(methods).filter(([method, {
174
- endpoint
175
- }]) => !this.mapping.has(endpoint || `${section}_${method}`)).reduce((exposed, [method, {
176
- endpoint
177
- }]) => {
178
- const def = methods[method];
179
- const isSubscription = !!def.pubsub;
180
- const jsonrpc = endpoint || `${section}_${method}`;
181
- this.mapping.set(jsonrpc, _objectSpread(_objectSpread({}, def), {}, {
182
- isSubscription,
183
- jsonrpc,
184
- method,
185
- section
186
- }));
187
- exposed[method] = isSubscription ? this._createMethodSubscribe(section, method, def) : this._createMethodSend(section, method, def);
188
- return exposed;
189
- }, {});
153
+ _createInterface(section, method, def) {
154
+ const isSubscription = !!def.pubsub;
155
+ const jsonrpc = def.endpoint || `${section}_${method}`;
156
+ this.mapping.set(jsonrpc, { ...def,
157
+ isSubscription,
158
+ jsonrpc,
159
+ method,
160
+ section
161
+ });
162
+ return isSubscription ? this._createMethodSubscribe(section, method, def) : this._createMethodSend(section, method, def);
190
163
  }
191
164
 
192
165
  _memomize(creator, def) {
193
166
  const memoOpts = {
194
- getInstanceId: () => _classPrivateFieldLooseBase(this, _instanceId)[_instanceId]
167
+ getInstanceId: () => this.#instanceId
195
168
  };
196
169
  const memoized = memoize(creator(true), memoOpts);
197
170
  memoized.raw = memoize(creator(false), memoOpts);
@@ -214,8 +187,8 @@ export class RpcCore {
214
187
  const blockHash = hashIndex === -1 ? null : values[hashIndex];
215
188
  const {
216
189
  registry
217
- } = isScale && blockHash && _classPrivateFieldLooseBase(this, _getBlockRegistry)[_getBlockRegistry] ? await _classPrivateFieldLooseBase(this, _getBlockRegistry)[_getBlockRegistry](u8aToU8a(blockHash)) : {
218
- registry: _classPrivateFieldLooseBase(this, _registryDefault)[_registryDefault]
190
+ } = isScale && blockHash && this.#getBlockRegistry ? await this.#getBlockRegistry(u8aToU8a(blockHash)) : {
191
+ registry: this.#registryDefault
219
192
  };
220
193
 
221
194
  const params = this._formatInputs(registry, null, def, values);
@@ -276,8 +249,7 @@ export class RpcCore {
276
249
  return new Observable(observer => {
277
250
  // Have at least an empty promise, as used in the unsubscribe
278
251
  let subscriptionPromise = Promise.resolve(null);
279
-
280
- const registry = _classPrivateFieldLooseBase(this, _registryDefault)[_registryDefault];
252
+ const registry = this.#registryDefault;
281
253
 
282
254
  const errorHandler = error => {
283
255
  logErrorMessage(method, def, error);
@@ -388,14 +360,13 @@ export class RpcCore {
388
360
  // - if a single result value, don't fill - it is not an update hole
389
361
  // - fallback to an empty option in all cases
390
362
 
391
- const value = isUndefined(found) ? witCache && _classPrivateFieldLooseBase(this, _storageCache)[_storageCache].get(hexKey) || null : found[1];
363
+ const value = isUndefined(found) ? witCache && this.#storageCache.get(hexKey) || null : found[1];
392
364
  const isEmpty = isNull(value);
393
365
  const input = isEmpty || isTreatAsHex(key) ? value : u8aToU8a(value); // store the retrieved result - the only issue with this cache is that there is no
394
366
  // clearing of it, so very long running processes (not just a couple of hours, longer)
395
367
  // will increase memory beyond what is allowed.
396
368
 
397
- _classPrivateFieldLooseBase(this, _storageCache)[_storageCache].set(hexKey, value);
398
-
369
+ this.#storageCache.set(hexKey, value);
399
370
  return this._newType(registry, blockHash, key, input, isEmpty, entryIndex);
400
371
  }
401
372
 
package/package.json CHANGED
@@ -20,17 +20,17 @@
20
20
  "./detectPackage.cjs"
21
21
  ],
22
22
  "type": "module",
23
- "version": "6.6.2-10",
23
+ "version": "6.6.2-14",
24
24
  "main": "index.js",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.16.0",
27
- "@polkadot/rpc-provider": "6.6.2-10",
28
- "@polkadot/types": "6.6.2-10",
29
- "@polkadot/util": "^7.7.1",
27
+ "@polkadot/rpc-provider": "6.6.2-14",
28
+ "@polkadot/types": "6.6.2-14",
29
+ "@polkadot/util": "^7.7.2-5",
30
30
  "rxjs": "^7.4.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@polkadot/keyring": "^7.7.1"
33
+ "@polkadot/keyring": "^7.7.2-5"
34
34
  },
35
35
  "exports": {
36
36
  ".": {
package/packageInfo.cjs CHANGED
@@ -9,6 +9,6 @@ exports.packageInfo = void 0;
9
9
  // Auto-generated by @polkadot/dev, do not edit
10
10
  const packageInfo = {
11
11
  name: '@polkadot/rpc-core',
12
- version: '6.6.2-10'
12
+ version: '6.6.2-14'
13
13
  };
14
14
  exports.packageInfo = packageInfo;
package/packageInfo.js CHANGED
@@ -3,5 +3,5 @@
3
3
  // Auto-generated by @polkadot/dev, do not edit
4
4
  export const packageInfo = {
5
5
  name: '@polkadot/rpc-core',
6
- version: '6.6.2-10'
6
+ version: '6.6.2-14'
7
7
  };
@@ -1,7 +1,8 @@
1
1
  import type { Observable } from 'rxjs';
2
- import type { AnyFunction } from '@polkadot/types/types';
2
+ import type { AnyFunction, DefinitionRpc } from '@polkadot/types/types';
3
3
  export interface RpcInterface {
4
4
  }
5
5
  export declare type AugmentedRpc<F extends AnyFunction> = F & {
6
6
  raw: <T>(...params: Parameters<F>) => Observable<T>;
7
+ meta: DefinitionRpc;
7
8
  };