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

streamr-client-protocol

Package Overview
Dependencies
Maintainers
17
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streamr-client-protocol - npm Package Compare versions

Comparing version 8.5.0-alpha.0 to 8.5.0-alpha.1

dist/src/utils/HashUtil.d.ts

3

dist/src/utils/index.d.ts

@@ -10,2 +10,3 @@ import TimestampUtil from "./TimestampUtil";

import { generateMnemonicFromAddress, parseAddressFromNodeId } from './NodeUtil';
export { TimestampUtil, OrderingUtil, StreamMessageValidator, CachingStreamMessageValidator, SigningUtil, SmartContractRecord, TrackerRegistry, createTrackerRegistry, getTrackerRegistryFromContract, StorageNodeRegistry, createStorageNodeRegistry, getStorageNodeRegistryFromContract, generateMnemonicFromAddress, parseAddressFromNodeId };
import { keyToArrayIndex } from "./HashUtil";
export { TimestampUtil, OrderingUtil, StreamMessageValidator, CachingStreamMessageValidator, SigningUtil, SmartContractRecord, TrackerRegistry, createTrackerRegistry, getTrackerRegistryFromContract, StorageNodeRegistry, createStorageNodeRegistry, getStorageNodeRegistryFromContract, generateMnemonicFromAddress, parseAddressFromNodeId, keyToArrayIndex, };

@@ -16,3 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAddressFromNodeId = exports.generateMnemonicFromAddress = exports.getStorageNodeRegistryFromContract = exports.createStorageNodeRegistry = exports.StorageNodeRegistry = exports.getTrackerRegistryFromContract = exports.createTrackerRegistry = exports.TrackerRegistry = exports.SigningUtil = exports.CachingStreamMessageValidator = exports.StreamMessageValidator = exports.OrderingUtil = exports.TimestampUtil = void 0;
exports.keyToArrayIndex = exports.parseAddressFromNodeId = exports.generateMnemonicFromAddress = exports.getStorageNodeRegistryFromContract = exports.createStorageNodeRegistry = exports.StorageNodeRegistry = exports.getTrackerRegistryFromContract = exports.createTrackerRegistry = exports.TrackerRegistry = exports.SigningUtil = exports.CachingStreamMessageValidator = exports.StreamMessageValidator = exports.OrderingUtil = exports.TimestampUtil = void 0;
const TimestampUtil_1 = __importDefault(require("./TimestampUtil"));

@@ -40,2 +40,4 @@ exports.TimestampUtil = TimestampUtil_1.default;

Object.defineProperty(exports, "parseAddressFromNodeId", { enumerable: true, get: function () { return NodeUtil_1.parseAddressFromNodeId; } });
const HashUtil_1 = require("./HashUtil");
Object.defineProperty(exports, "keyToArrayIndex", { enumerable: true, get: function () { return HashUtil_1.keyToArrayIndex; } });
//# sourceMappingURL=index.js.map

@@ -24,10 +24,5 @@ "use strict";

const ethers_1 = require("ethers");
const HashUtil_1 = require("./HashUtil");
const trackerRegistryConfig = __importStar(require("../../contracts/TrackerRegistry.json"));
const { JsonRpcProvider } = ethers_1.providers;
// source: https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
function hashCode(str) {
const a = str.split('')
.reduce((prevHash, currVal) => (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0, 0);
return Math.abs(a);
}
class TrackerRegistry {

@@ -46,3 +41,4 @@ constructor(records) {

const streamKey = `${streamId}::${partition}`;
return this.records[hashCode(streamKey) % this.records.length];
const index = (0, HashUtil_1.keyToArrayIndex)(this.records.length, streamKey);
return this.records[index];
}

@@ -49,0 +45,0 @@ getAllTrackers() {

{
"name": "streamr-client-protocol",
"version": "8.5.0-alpha.0",
"version": "8.5.0-alpha.1",
"description": "JavaScript classes implementing the Streamr client-to-node protocol",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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