@polkadot/rpc-core 8.6.3-4 → 8.6.3-7
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.js +18 -6
- package/cjs/bundle.js +18 -6
- package/cjs/packageInfo.js +1 -1
- package/package.json +4 -4
- package/packageInfo.js +1 -1
package/bundle.js
CHANGED
|
@@ -378,21 +378,33 @@ export class RpcCore {
|
|
|
378
378
|
}, []);
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
-
_formatStorageSetEntry(registry, blockHash, key, changes,
|
|
381
|
+
_formatStorageSetEntry(registry, blockHash, key, changes, withCache, entryIndex) {
|
|
382
382
|
const hexKey = key.toHex();
|
|
383
|
-
const found = changes.find(([key]) => key === hexKey);
|
|
383
|
+
const found = changes.find(([key]) => key === hexKey);
|
|
384
|
+
const isNotFound = isUndefined(found); // if we don't find the value, this is our fallback
|
|
384
385
|
// - in the case of an array of values, fill the hole from the cache
|
|
385
386
|
// - if a single result value, don't fill - it is not an update hole
|
|
386
387
|
// - fallback to an empty option in all cases
|
|
387
388
|
|
|
388
|
-
|
|
389
|
+
if (isNotFound && withCache) {
|
|
390
|
+
const cached = this.#storageCache.get(hexKey);
|
|
391
|
+
|
|
392
|
+
if (cached) {
|
|
393
|
+
return cached;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const value = isNotFound ? null : found[1];
|
|
389
398
|
const isEmpty = isNull(value);
|
|
390
|
-
const input = isEmpty || isTreatAsHex(key) ? value : u8aToU8a(value);
|
|
399
|
+
const input = isEmpty || isTreatAsHex(key) ? value : u8aToU8a(value);
|
|
400
|
+
|
|
401
|
+
const codec = this._newType(registry, blockHash, key, input, isEmpty, entryIndex); // store the retrieved result - the only issue with this cache is that there is no
|
|
391
402
|
// clearing of it, so very long running processes (not just a couple of hours, longer)
|
|
392
403
|
// will increase memory beyond what is allowed.
|
|
393
404
|
|
|
394
|
-
|
|
395
|
-
|
|
405
|
+
|
|
406
|
+
this.#storageCache.set(hexKey, codec);
|
|
407
|
+
return codec;
|
|
396
408
|
}
|
|
397
409
|
|
|
398
410
|
_newType(registry, blockHash, key, input, isEmpty, entryIndex = -1) {
|
package/cjs/bundle.js
CHANGED
|
@@ -436,24 +436,36 @@ class RpcCore {
|
|
|
436
436
|
}, []);
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
-
_formatStorageSetEntry(registry, blockHash, key, changes,
|
|
439
|
+
_formatStorageSetEntry(registry, blockHash, key, changes, withCache, entryIndex) {
|
|
440
440
|
const hexKey = key.toHex();
|
|
441
441
|
const found = changes.find(_ref7 => {
|
|
442
442
|
let [key] = _ref7;
|
|
443
443
|
return key === hexKey;
|
|
444
|
-
});
|
|
444
|
+
});
|
|
445
|
+
const isNotFound = (0, _util.isUndefined)(found); // if we don't find the value, this is our fallback
|
|
445
446
|
// - in the case of an array of values, fill the hole from the cache
|
|
446
447
|
// - if a single result value, don't fill - it is not an update hole
|
|
447
448
|
// - fallback to an empty option in all cases
|
|
448
449
|
|
|
449
|
-
|
|
450
|
+
if (isNotFound && withCache) {
|
|
451
|
+
const cached = this.#storageCache.get(hexKey);
|
|
452
|
+
|
|
453
|
+
if (cached) {
|
|
454
|
+
return cached;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const value = isNotFound ? null : found[1];
|
|
450
459
|
const isEmpty = (0, _util.isNull)(value);
|
|
451
|
-
const input = isEmpty || isTreatAsHex(key) ? value : (0, _util.u8aToU8a)(value);
|
|
460
|
+
const input = isEmpty || isTreatAsHex(key) ? value : (0, _util.u8aToU8a)(value);
|
|
461
|
+
|
|
462
|
+
const codec = this._newType(registry, blockHash, key, input, isEmpty, entryIndex); // store the retrieved result - the only issue with this cache is that there is no
|
|
452
463
|
// clearing of it, so very long running processes (not just a couple of hours, longer)
|
|
453
464
|
// will increase memory beyond what is allowed.
|
|
454
465
|
|
|
455
|
-
|
|
456
|
-
|
|
466
|
+
|
|
467
|
+
this.#storageCache.set(hexKey, codec);
|
|
468
|
+
return codec;
|
|
457
469
|
}
|
|
458
470
|
|
|
459
471
|
_newType(registry, blockHash, key, input, isEmpty) {
|
package/cjs/packageInfo.js
CHANGED
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./cjs/detectPackage.js"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "8.6.3-
|
|
23
|
+
"version": "8.6.3-7",
|
|
24
24
|
"main": "./cjs/index.js",
|
|
25
25
|
"module": "./index.js",
|
|
26
26
|
"types": "./index.d.ts",
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@babel/runtime": "^7.18.3",
|
|
99
|
-
"@polkadot/rpc-augment": "8.6.3-
|
|
100
|
-
"@polkadot/rpc-provider": "8.6.3-
|
|
101
|
-
"@polkadot/types": "8.6.3-
|
|
99
|
+
"@polkadot/rpc-augment": "8.6.3-7",
|
|
100
|
+
"@polkadot/rpc-provider": "8.6.3-7",
|
|
101
|
+
"@polkadot/types": "8.6.3-7",
|
|
102
102
|
"@polkadot/util": "^9.3.2-1",
|
|
103
103
|
"rxjs": "^7.5.5"
|
|
104
104
|
}
|
package/packageInfo.js
CHANGED
|
@@ -5,5 +5,5 @@ export const packageInfo = {
|
|
|
5
5
|
name: '@polkadot/rpc-core',
|
|
6
6
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
7
7
|
type: 'esm',
|
|
8
|
-
version: '8.6.3-
|
|
8
|
+
version: '8.6.3-7'
|
|
9
9
|
};
|