misc fixes to get package npm publishable again

This commit is contained in:
Iuri Matias 2019-01-31 17:07:28 +01:00
parent 3718ee8508
commit ba48929a0a
5 changed files with 42 additions and 22 deletions

24
package-lock.json generated
View File

@ -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",

View File

@ -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"

View File

@ -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
}
};

View File

@ -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(),
);
}