Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot/rpc-provider

Package Overview
Dependencies
Maintainers
2
Versions
3005
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/rpc-provider - npm Package Compare versions

Comparing version 14.0.1 to 14.1.1

cjs/bundle.d.ts

1

bundle.d.ts
export { HttpProvider } from './http/index.js';
export { DEFAULT_CAPACITY, LRUCache } from './lru.js';
export { packageInfo } from './packageInfo.js';
export { ScProvider } from './substrate-connect/index.js';
export { WsProvider } from './ws/index.js';
export { HttpProvider } from './http/index.js';
export { DEFAULT_CAPACITY, LRUCache } from './lru.js';
export { packageInfo } from './packageInfo.js';
export { ScProvider } from './substrate-connect/index.js';
export { WsProvider } from './ws/index.js';

5

cjs/bundle.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WsProvider = exports.ScProvider = exports.packageInfo = exports.HttpProvider = void 0;
exports.WsProvider = exports.ScProvider = exports.packageInfo = exports.LRUCache = exports.DEFAULT_CAPACITY = exports.HttpProvider = void 0;
var index_js_1 = require("./http/index.js");
Object.defineProperty(exports, "HttpProvider", { enumerable: true, get: function () { return index_js_1.HttpProvider; } });
var lru_js_1 = require("./lru.js");
Object.defineProperty(exports, "DEFAULT_CAPACITY", { enumerable: true, get: function () { return lru_js_1.DEFAULT_CAPACITY; } });
Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function () { return lru_js_1.LRUCache; } });
var packageInfo_js_1 = require("./packageInfo.js");

@@ -7,0 +10,0 @@ Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });

@@ -33,3 +33,4 @@ "use strict";

class HttpProvider {
__internal__callCache = new lru_js_1.LRUCache();
__internal__callCache;
__internal__cacheCapacity;
__internal__coder;

@@ -42,3 +43,3 @@ __internal__endpoint;

*/
constructor(endpoint = defaults_js_1.default.HTTP_URL, headers = {}) {
constructor(endpoint = defaults_js_1.default.HTTP_URL, headers = {}, cacheCapacity) {
if (!/^(https|http):\/\//.test(endpoint)) {

@@ -50,2 +51,4 @@ throw new Error(`Endpoint should start with 'http://' or 'https://', received '${endpoint}'`);

this.__internal__headers = headers;
this.__internal__callCache = new lru_js_1.LRUCache(cacheCapacity === 0 ? 0 : cacheCapacity || lru_js_1.DEFAULT_CAPACITY);
this.__internal__cacheCapacity = cacheCapacity === 0 ? 0 : cacheCapacity || lru_js_1.DEFAULT_CAPACITY;
this.__internal__stats = {

@@ -113,2 +116,5 @@ active: { requests: 0, subscriptions: 0 },

const [, body] = this.__internal__coder.encodeJson(method, params);
if (this.__internal__cacheCapacity === 0) {
return this.__internal__send(body);
}
const cacheKey = isCacheable ? `${method}::${(0, util_1.stringify)(params)}` : '';

@@ -115,0 +121,0 @@ let resultPromise = isCacheable

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LRUCache = exports.DEFAULT_CAPACITY = void 0;
exports.DEFAULT_CAPACITY = 128;
exports.DEFAULT_CAPACITY = 64;
class LRUNode {
key;
__internal__lastAccess;
createdAt;
next;

@@ -11,4 +13,12 @@ prev;

this.key = key;
this.__internal__lastAccess = Date.now();
this.createdAt = this.__internal__lastAccess;
this.next = this.prev = this;
}
refresh() {
this.__internal__lastAccess = Date.now();
}
get lastAccess() {
return this.__internal__lastAccess;
}
}

@@ -22,6 +32,21 @@ class LRUCache {

__internal__tail;
constructor(capacity = exports.DEFAULT_CAPACITY) {
__internal__ttl;
__internal__ttlInterval;
__internal__ttlTimerId = null;
constructor(capacity = exports.DEFAULT_CAPACITY, ttl = 30000, ttlInterval = 15000) {
this.capacity = capacity;
this.__internal__ttl = ttl;
this.__internal__ttlInterval = ttlInterval;
this.__internal__head = this.__internal__tail = new LRUNode('<empty>');
// make sure the interval is not longer than the ttl
if (this.__internal__ttlInterval > this.__internal__ttl) {
this.__internal__ttlInterval = this.__internal__ttl;
}
}
get ttl() {
return this.__internal__ttl;
}
get ttlInterval() {
return this.__internal__ttlInterval;
}
get length() {

@@ -91,7 +116,32 @@ return this.__internal__length;

}
if (this.__internal__ttl > 0 && !this.__internal__ttlTimerId) {
this.__internal__ttlTimerId = setInterval(() => {
this.__internal__ttlClean();
}, this.__internal__ttlInterval);
}
this.__internal__data.set(key, value);
}
__internal__ttlClean() {
// Find last node to keep
const expires = Date.now() - this.__internal__ttl;
// traverse map to find the lastAccessed
while (this.__internal__tail.lastAccess && this.__internal__tail.lastAccess < expires && this.__internal__length > 0) {
if (this.__internal__ttlTimerId && this.__internal__length === 0) {
clearInterval(this.__internal__ttlTimerId);
this.__internal__ttlTimerId = null;
this.__internal__head = this.__internal__tail = new LRUNode('<empty>');
}
else {
this.__internal__refs.delete(this.__internal__tail.key);
this.__internal__data.delete(this.__internal__tail.key);
this.__internal__length -= 1;
this.__internal__tail = this.__internal__tail.prev;
this.__internal__tail.next = this.__internal__head;
}
}
}
__internal__toHead(key) {
const ref = this.__internal__refs.get(key);
if (ref && ref !== this.__internal__head) {
ref.refresh();
ref.prev.next = ref.next;

@@ -104,3 +154,10 @@ ref.next.prev = ref.prev;

}
// eslint-disable-next-line @typescript-eslint/require-await
async clearInterval() {
if (this.__internal__ttlTimerId) {
clearInterval(this.__internal__ttlTimerId);
this.__internal__ttlTimerId = null;
}
}
}
exports.LRUCache = LRUCache;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageInfo = void 0;
exports.packageInfo = { name: '@polkadot/rpc-provider', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.1' };
exports.packageInfo = { name: '@polkadot/rpc-provider', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.1.1' };

@@ -65,2 +65,3 @@ "use strict";

__internal__waitingForId = {};
__internal__cacheCapacity;
__internal__autoConnectMs;

@@ -93,2 +94,3 @@ __internal__endpointIndex;

this.__internal__callCache = new lru_js_1.LRUCache(cacheCapacity || lru_js_1.DEFAULT_CAPACITY);
this.__internal__cacheCapacity = cacheCapacity || lru_js_1.DEFAULT_CAPACITY;
this.__internal__eventemitter = new eventemitter3_1.EventEmitter();

@@ -259,2 +261,5 @@ this.__internal__autoConnectMs = autoConnectMs || 0;

const [id, body] = this.__internal__coder.encodeJson(method, params);
if (this.__internal__cacheCapacity === 0) {
return this.__internal__send(id, body, method, params, subscription);
}
const cacheKey = isCacheable ? `${method}::${(0, util_1.stringify)(params)}` : '';

@@ -261,0 +266,0 @@ let resultPromise = isCacheable

@@ -27,3 +27,3 @@ import type { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted, ProviderStats } from '../types.js';

*/
constructor(endpoint?: string, headers?: Record<string, string>);
constructor(endpoint?: string, headers?: Record<string, string>, cacheCapacity?: number);
/**

@@ -30,0 +30,0 @@ * @summary `true` when this provider supports subscriptions

@@ -5,3 +5,3 @@ import { logger, noop, stringify } from '@polkadot/util';

import defaults from '../defaults.js';
import { LRUCache } from '../lru.js';
import { DEFAULT_CAPACITY, LRUCache } from '../lru.js';
const ERROR_SUBSCRIBE = 'HTTP Provider does not have subscriptions, use WebSockets instead';

@@ -30,3 +30,4 @@ const l = logger('api-http');

export class HttpProvider {
__internal__callCache = new LRUCache();
__internal__callCache;
__internal__cacheCapacity;
__internal__coder;

@@ -39,3 +40,3 @@ __internal__endpoint;

*/
constructor(endpoint = defaults.HTTP_URL, headers = {}) {
constructor(endpoint = defaults.HTTP_URL, headers = {}, cacheCapacity) {
if (!/^(https|http):\/\//.test(endpoint)) {

@@ -47,2 +48,4 @@ throw new Error(`Endpoint should start with 'http://' or 'https://', received '${endpoint}'`);

this.__internal__headers = headers;
this.__internal__callCache = new LRUCache(cacheCapacity === 0 ? 0 : cacheCapacity || DEFAULT_CAPACITY);
this.__internal__cacheCapacity = cacheCapacity === 0 ? 0 : cacheCapacity || DEFAULT_CAPACITY;
this.__internal__stats = {

@@ -110,2 +113,5 @@ active: { requests: 0, subscriptions: 0 },

const [, body] = this.__internal__coder.encodeJson(method, params);
if (this.__internal__cacheCapacity === 0) {
return this.__internal__send(body);
}
const cacheKey = isCacheable ? `${method}::${stringify(params)}` : '';

@@ -112,0 +118,0 @@ let resultPromise = isCacheable

@@ -1,6 +0,8 @@

export declare const DEFAULT_CAPACITY = 128;
export declare const DEFAULT_CAPACITY = 64;
export declare class LRUCache {
#private;
readonly capacity: number;
constructor(capacity?: number);
constructor(capacity?: number, ttl?: number, ttlInterval?: number);
get ttl(): number;
get ttlInterval(): number;
get length(): number;

@@ -13,2 +15,3 @@ get lengthData(): number;

set<T>(key: string, value: T): void;
clearInterval(): Promise<void>;
}

@@ -1,4 +0,6 @@

export const DEFAULT_CAPACITY = 128;
export const DEFAULT_CAPACITY = 64;
class LRUNode {
key;
__internal__lastAccess;
createdAt;
next;

@@ -8,4 +10,12 @@ prev;

this.key = key;
this.__internal__lastAccess = Date.now();
this.createdAt = this.__internal__lastAccess;
this.next = this.prev = this;
}
refresh() {
this.__internal__lastAccess = Date.now();
}
get lastAccess() {
return this.__internal__lastAccess;
}
}

@@ -19,6 +29,21 @@ export class LRUCache {

__internal__tail;
constructor(capacity = DEFAULT_CAPACITY) {
__internal__ttl;
__internal__ttlInterval;
__internal__ttlTimerId = null;
constructor(capacity = DEFAULT_CAPACITY, ttl = 30000, ttlInterval = 15000) {
this.capacity = capacity;
this.__internal__ttl = ttl;
this.__internal__ttlInterval = ttlInterval;
this.__internal__head = this.__internal__tail = new LRUNode('<empty>');
// make sure the interval is not longer than the ttl
if (this.__internal__ttlInterval > this.__internal__ttl) {
this.__internal__ttlInterval = this.__internal__ttl;
}
}
get ttl() {
return this.__internal__ttl;
}
get ttlInterval() {
return this.__internal__ttlInterval;
}
get length() {

@@ -88,7 +113,32 @@ return this.__internal__length;

}
if (this.__internal__ttl > 0 && !this.__internal__ttlTimerId) {
this.__internal__ttlTimerId = setInterval(() => {
this.__internal__ttlClean();
}, this.__internal__ttlInterval);
}
this.__internal__data.set(key, value);
}
__internal__ttlClean() {
// Find last node to keep
const expires = Date.now() - this.__internal__ttl;
// traverse map to find the lastAccessed
while (this.__internal__tail.lastAccess && this.__internal__tail.lastAccess < expires && this.__internal__length > 0) {
if (this.__internal__ttlTimerId && this.__internal__length === 0) {
clearInterval(this.__internal__ttlTimerId);
this.__internal__ttlTimerId = null;
this.__internal__head = this.__internal__tail = new LRUNode('<empty>');
}
else {
this.__internal__refs.delete(this.__internal__tail.key);
this.__internal__data.delete(this.__internal__tail.key);
this.__internal__length -= 1;
this.__internal__tail = this.__internal__tail.prev;
this.__internal__tail.next = this.__internal__head;
}
}
}
__internal__toHead(key) {
const ref = this.__internal__refs.get(key);
if (ref && ref !== this.__internal__head) {
ref.refresh();
ref.prev.next = ref.next;

@@ -101,2 +151,9 @@ ref.next.prev = ref.prev;

}
// eslint-disable-next-line @typescript-eslint/require-await
async clearInterval() {
if (this.__internal__ttlTimerId) {
clearInterval(this.__internal__ttlTimerId);
this.__internal__ttlTimerId = null;
}
}
}

@@ -21,3 +21,3 @@ {

"type": "module",
"version": "14.0.1",
"version": "14.1.1",
"main": "./cjs/index.js",

@@ -30,72 +30,168 @@ "module": "./index.js",

".": {
"types": "./index.d.ts",
"module": "./index.js",
"require": "./cjs/index.js",
"default": "./index.js"
"module": {
"types": "./index.d.ts",
"default": "./index.js"
},
"require": {
"types": "./cjs/index.d.ts",
"default": "./cjs/index.js"
},
"default": {
"types": "./index.d.ts",
"default": "./index.js"
}
},
"./bundle": {
"types": "./bundle.d.ts",
"module": "./bundle.js",
"require": "./cjs/bundle.js",
"default": "./bundle.js"
"module": {
"types": "./bundle.d.ts",
"default": "./bundle.js"
},
"require": {
"types": "./cjs/bundle.d.ts",
"default": "./cjs/bundle.js"
},
"default": {
"types": "./bundle.d.ts",
"default": "./bundle.js"
}
},
"./coder": {
"types": "./coder/index.d.ts",
"module": "./coder/index.js",
"require": "./cjs/coder/index.js",
"default": "./coder/index.js"
"module": {
"types": "./coder/index.d.ts",
"default": "./coder/index.js"
},
"require": {
"types": "./cjs/coder/index.d.ts",
"default": "./cjs/coder/index.js"
},
"default": {
"types": "./coder/index.d.ts",
"default": "./coder/index.js"
}
},
"./coder/error": {
"types": "./coder/error.d.ts",
"module": "./coder/error.js",
"require": "./cjs/coder/error.js",
"default": "./coder/error.js"
"module": {
"types": "./coder/error.d.ts",
"default": "./coder/error.js"
},
"require": {
"types": "./cjs/coder/error.d.ts",
"default": "./cjs/coder/error.js"
},
"default": {
"types": "./coder/error.d.ts",
"default": "./coder/error.js"
}
},
"./defaults": {
"types": "./defaults.d.ts",
"module": "./defaults.js",
"require": "./cjs/defaults.js",
"default": "./defaults.js"
"module": {
"types": "./defaults.d.ts",
"default": "./defaults.js"
},
"require": {
"types": "./cjs/defaults.d.ts",
"default": "./cjs/defaults.js"
},
"default": {
"types": "./defaults.d.ts",
"default": "./defaults.js"
}
},
"./http": {
"types": "./http/index.d.ts",
"module": "./http/index.js",
"require": "./cjs/http/index.js",
"default": "./http/index.js"
"module": {
"types": "./http/index.d.ts",
"default": "./http/index.js"
},
"require": {
"types": "./cjs/http/index.d.ts",
"default": "./cjs/http/index.js"
},
"default": {
"types": "./http/index.d.ts",
"default": "./http/index.js"
}
},
"./http/types": {
"types": "./http/types.d.ts",
"module": "./http/types.js",
"require": "./cjs/http/types.js",
"default": "./http/types.js"
"module": {
"types": "./http/types.d.ts",
"default": "./http/types.js"
},
"require": {
"types": "./cjs/http/types.d.ts",
"default": "./cjs/http/types.js"
},
"default": {
"types": "./http/types.d.ts",
"default": "./http/types.js"
}
},
"./lru": {
"types": "./lru.d.ts",
"module": "./lru.js",
"require": "./cjs/lru.js",
"default": "./lru.js"
"module": {
"types": "./lru.d.ts",
"default": "./lru.js"
},
"require": {
"types": "./cjs/lru.d.ts",
"default": "./cjs/lru.js"
},
"default": {
"types": "./lru.d.ts",
"default": "./lru.js"
}
},
"./mock": {
"types": "./mock/index.d.ts",
"module": "./mock/index.js",
"require": "./cjs/mock/index.js",
"default": "./mock/index.js"
"module": {
"types": "./mock/index.d.ts",
"default": "./mock/index.js"
},
"require": {
"types": "./cjs/mock/index.d.ts",
"default": "./cjs/mock/index.js"
},
"default": {
"types": "./mock/index.d.ts",
"default": "./mock/index.js"
}
},
"./mock/mockHttp": {
"types": "./mock/mockHttp.d.ts",
"module": "./mock/mockHttp.js",
"require": "./cjs/mock/mockHttp.js",
"default": "./mock/mockHttp.js"
"module": {
"types": "./mock/mockHttp.d.ts",
"default": "./mock/mockHttp.js"
},
"require": {
"types": "./cjs/mock/mockHttp.d.ts",
"default": "./cjs/mock/mockHttp.js"
},
"default": {
"types": "./mock/mockHttp.d.ts",
"default": "./mock/mockHttp.js"
}
},
"./mock/mockWs": {
"types": "./mock/mockWs.d.ts",
"module": "./mock/mockWs.js",
"require": "./cjs/mock/mockWs.js",
"default": "./mock/mockWs.js"
"module": {
"types": "./mock/mockWs.d.ts",
"default": "./mock/mockWs.js"
},
"require": {
"types": "./cjs/mock/mockWs.d.ts",
"default": "./cjs/mock/mockWs.js"
},
"default": {
"types": "./mock/mockWs.d.ts",
"default": "./mock/mockWs.js"
}
},
"./mock/types": {
"types": "./mock/types.d.ts",
"module": "./mock/types.js",
"require": "./cjs/mock/types.js",
"default": "./mock/types.js"
"module": {
"types": "./mock/types.d.ts",
"default": "./mock/types.js"
},
"require": {
"types": "./cjs/mock/types.d.ts",
"default": "./cjs/mock/types.js"
},
"default": {
"types": "./mock/types.d.ts",
"default": "./mock/types.js"
}
},

@@ -107,69 +203,141 @@ "./package.json": {

"./packageDetect": {
"types": "./packageDetect.d.ts",
"module": "./packageDetect.js",
"require": "./cjs/packageDetect.js",
"default": "./packageDetect.js"
"module": {
"types": "./packageDetect.d.ts",
"default": "./packageDetect.js"
},
"require": {
"types": "./cjs/packageDetect.d.ts",
"default": "./cjs/packageDetect.js"
},
"default": {
"types": "./packageDetect.d.ts",
"default": "./packageDetect.js"
}
},
"./packageInfo.js": {
"types": "./packageInfo.d.ts",
"module": "./packageInfo.js",
"require": "./cjs/packageInfo.js",
"default": "./packageInfo.js"
"module": {
"types": "./packageInfo.d.ts",
"default": "./packageInfo.js"
},
"require": {
"types": "./cjs/packageInfo.d.ts",
"default": "./cjs/packageInfo.js"
},
"default": {
"types": "./packageInfo.d.ts",
"default": "./packageInfo.js"
}
},
"./packageInfo": {
"types": "./packageInfo.d.ts",
"module": "./packageInfo.js",
"require": "./cjs/packageInfo.js",
"default": "./packageInfo.js"
"module": {
"types": "./packageInfo.d.ts",
"default": "./packageInfo.js"
},
"require": {
"types": "./cjs/packageInfo.d.ts",
"default": "./cjs/packageInfo.js"
},
"default": {
"types": "./packageInfo.d.ts",
"default": "./packageInfo.js"
}
},
"./substrate-connect": {
"types": "./substrate-connect/index.d.ts",
"module": "./substrate-connect/index.js",
"require": "./cjs/substrate-connect/index.js",
"default": "./substrate-connect/index.js"
"module": {
"types": "./substrate-connect/index.d.ts",
"default": "./substrate-connect/index.js"
},
"require": {
"types": "./cjs/substrate-connect/index.d.ts",
"default": "./cjs/substrate-connect/index.js"
},
"default": {
"types": "./substrate-connect/index.d.ts",
"default": "./substrate-connect/index.js"
}
},
"./substrate-connect/Health": {
"types": "./substrate-connect/Health.d.ts",
"module": "./substrate-connect/Health.js",
"require": "./cjs/substrate-connect/Health.js",
"default": "./substrate-connect/Health.js"
"module": {
"types": "./substrate-connect/Health.d.ts",
"default": "./substrate-connect/Health.js"
},
"require": {
"types": "./cjs/substrate-connect/Health.d.ts",
"default": "./cjs/substrate-connect/Health.js"
},
"default": {
"types": "./substrate-connect/Health.d.ts",
"default": "./substrate-connect/Health.js"
}
},
"./substrate-connect/types": {
"types": "./substrate-connect/types.d.ts",
"module": "./substrate-connect/types.js",
"require": "./cjs/substrate-connect/types.js",
"default": "./substrate-connect/types.js"
"module": {
"types": "./substrate-connect/types.d.ts",
"default": "./substrate-connect/types.js"
},
"require": {
"types": "./cjs/substrate-connect/types.d.ts",
"default": "./cjs/substrate-connect/types.js"
},
"default": {
"types": "./substrate-connect/types.d.ts",
"default": "./substrate-connect/types.js"
}
},
"./types": {
"types": "./types.d.ts",
"module": "./types.js",
"require": "./cjs/types.js",
"default": "./types.js"
"module": {
"types": "./types.d.ts",
"default": "./types.js"
},
"require": {
"types": "./cjs/types.d.ts",
"default": "./cjs/types.js"
},
"default": {
"types": "./types.d.ts",
"default": "./types.js"
}
},
"./ws": {
"types": "./ws/index.d.ts",
"module": "./ws/index.js",
"require": "./cjs/ws/index.js",
"default": "./ws/index.js"
"module": {
"types": "./ws/index.d.ts",
"default": "./ws/index.js"
},
"require": {
"types": "./cjs/ws/index.d.ts",
"default": "./cjs/ws/index.js"
},
"default": {
"types": "./ws/index.d.ts",
"default": "./ws/index.js"
}
},
"./ws/errors": {
"types": "./ws/errors.d.ts",
"module": "./ws/errors.js",
"require": "./cjs/ws/errors.js",
"default": "./ws/errors.js"
"module": {
"types": "./ws/errors.d.ts",
"default": "./ws/errors.js"
},
"require": {
"types": "./cjs/ws/errors.d.ts",
"default": "./cjs/ws/errors.js"
},
"default": {
"types": "./ws/errors.d.ts",
"default": "./ws/errors.js"
}
}
},
"dependencies": {
"@polkadot/keyring": "^13.1.1",
"@polkadot/types": "14.0.1",
"@polkadot/types-support": "14.0.1",
"@polkadot/util": "^13.1.1",
"@polkadot/util-crypto": "^13.1.1",
"@polkadot/x-fetch": "^13.1.1",
"@polkadot/x-global": "^13.1.1",
"@polkadot/x-ws": "^13.1.1",
"@polkadot/keyring": "^13.2.1",
"@polkadot/types": "14.1.1",
"@polkadot/types-support": "14.1.1",
"@polkadot/util": "^13.2.1",
"@polkadot/util-crypto": "^13.2.1",
"@polkadot/x-fetch": "^13.2.1",
"@polkadot/x-global": "^13.2.1",
"@polkadot/x-ws": "^13.2.1",
"eventemitter3": "^5.0.1",
"mock-socket": "^9.3.1",
"nock": "^13.5.4",
"tslib": "^2.7.0"
"nock": "^13.5.5",
"tslib": "^2.8.0"
},

@@ -176,0 +344,0 @@ "optionalDependencies": {

@@ -1,1 +0,1 @@

export const packageInfo = { name: '@polkadot/rpc-provider', 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.0.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', 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.1.1' };

@@ -61,2 +61,3 @@ import { EventEmitter } from 'eventemitter3';

__internal__waitingForId = {};
__internal__cacheCapacity;
__internal__autoConnectMs;

@@ -89,2 +90,3 @@ __internal__endpointIndex;

this.__internal__callCache = new LRUCache(cacheCapacity || DEFAULT_CAPACITY);
this.__internal__cacheCapacity = cacheCapacity || DEFAULT_CAPACITY;
this.__internal__eventemitter = new EventEmitter();

@@ -255,2 +257,5 @@ this.__internal__autoConnectMs = autoConnectMs || 0;

const [id, body] = this.__internal__coder.encodeJson(method, params);
if (this.__internal__cacheCapacity === 0) {
return this.__internal__send(id, body, method, params, subscription);
}
const cacheKey = isCacheable ? `${method}::${stringify(params)}` : '';

@@ -257,0 +262,0 @@ let resultPromise = isCacheable

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc