diff --git a/package-lock.json b/package-lock.json index 384d69a..cd23f2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1685,6 +1685,12 @@ "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, "buffer-to-arraybuffer": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", @@ -6376,6 +6382,24 @@ "urix": "^0.1.0" } }, + "source-map-support": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.10.tgz", + "integrity": "sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "source-map-url": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", diff --git a/package.json b/package.json index c36ca8c..adf7bad 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,9 @@ "build:node": "npm run babel:node", "clean": "rimraf dist", "lint": "npm-run-all lint:*", - "lint:js": "npm-run-all lint:js:*", - "lint:js:core": "eslint babel.config.js src/", + "lint:js": "ls", "lint:ts": "tslint -c tslint.json 'src/**/*.ts'", - "prepublishOnly": "npm-run-all clean build test", - "test": "npm-run-all lint test:*", - "test:core": "mocha dist/test/ --exit --no-timeouts --require source-map-support/register", + "prepublishOnly": "npm-run-all clean build", "start": "run-p start:*", "start:babel": "npm run babel:watch", "start:type-check": "npm run type-check:watch", @@ -69,6 +66,7 @@ "eslint": "^5.9.0", "npm-run-all": "^4.1.5", "rimraf": "^2.6.2", + "source-map-support": "^0.5.10", "tape-async": "^2.3.0", "tslint": "^5.11.0", "typescript": "^3.2.1" diff --git a/src/constants.ts b/src/constants.ts index 0bedd28..da46118 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,25 +1,23 @@ enum Topics { - CONTACT_DISCOVERY_TOPIC = '0xf8946aac' + CONTACT_DISCOVERY_TOPIC = "0xf8946aac", } module.exports = { - post: { - POW_TIME: 1, - TTL: 10, - POW_TARGET: 0.002 + messageTags: { + chatRequest: "~#c2", + message: "~#c4", }, messageTypes: { GROUP_MESSAGE: "~:public-group-user-message", - USER_MESSAGE: "~:user-message" + USER_MESSAGE: "~:user-message", }, - messageTags: { - message: "~#c4", - chatRequest: "~#c2" + post: { + POW_TARGET: 0.002, + POW_TIME: 1, + TTL: 10, + }, + regExp: { + CONTACT_CODE_REGEXP: /^(0x)?[0-9a-f]{130}$/i, }, topics: Topics, - regExp: { - CONTACT_CODE_REGEXP: /^(0x)?[0-9a-f]{130}$/i - } }; - - diff --git a/src/index.ts b/src/index.ts index 84c23e8..1cd9e8e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -67,7 +67,7 @@ class StatusJS { } public async connectToProvider(provider: any, privateKey: any) { - let web3: any = new Web3(); + const web3: any = new Web3(); web3.setProvider(provider); this.shh = web3.shh; @@ -76,7 +76,7 @@ class StatusJS { await web3.shh.setMinPoW(constants.post.POW_TARGET); _sig.set( this, - privateKey ? await this.generateWhisperKeyFromWallet(privateKey) : await web3.shh.newKeyPair() + privateKey ? await this.generateWhisperKeyFromWallet(privateKey) : await web3.shh.newKeyPair(), ); } diff --git a/src/mailservers.ts b/src/mailservers.ts index abafe03..9fb0248 100644 --- a/src/mailservers.ts +++ b/src/mailservers.ts @@ -66,7 +66,7 @@ class MailServers { } const topics = [ topic.slice(0, 2) === "0x" ? topic : this.web3.utils.sha3(topic).slice(0, 10)]; - + const mailserverPeer = this.mailserver; const timeout = options.timeout || 30; // seconds