@waku/core 0.0.30-d8ed83f.0 → 0.0.30
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/CHANGELOG.md +27 -0
- package/bundle/{base_protocol-DCOj0QWD.js → base_protocol-C6HnrRx8.js} +1 -2
- package/bundle/{browser-zSUobdfj.js → index-DnW8ifxc.js} +616 -5
- package/bundle/index.js +21 -22
- package/bundle/lib/base_protocol.js +2 -3
- package/bundle/lib/message/version_0.js +2 -3
- package/bundle/{version_0-TEIsGmpJ.js → version_0-DQ9xsSLk.js} +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/lib/connection_manager.d.ts +3 -2
- package/dist/lib/connection_manager.js +16 -16
- package/dist/lib/connection_manager.js.map +1 -1
- package/package.json +130 -1
- package/src/lib/connection_manager.ts +28 -28
- package/bundle/index-BcSodzY4.js +0 -614
- package/bundle/lib/predefined_bootstrap_nodes.js +0 -81
- package/dist/lib/predefined_bootstrap_nodes.d.ts +0 -34
- package/dist/lib/predefined_bootstrap_nodes.js +0 -54
- package/dist/lib/predefined_bootstrap_nodes.js.map +0 -1
- package/src/lib/predefined_bootstrap_nodes.ts +0 -68
package/package.json
CHANGED
@@ -1 +1,130 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"name": "@waku/core",
|
3
|
+
"version": "0.0.30",
|
4
|
+
"description": "TypeScript implementation of the Waku v2 protocol",
|
5
|
+
"types": "./dist/index.d.ts",
|
6
|
+
"module": "./dist/index.js",
|
7
|
+
"exports": {
|
8
|
+
".": {
|
9
|
+
"types": "./dist/index.d.ts",
|
10
|
+
"import": "./dist/index.js"
|
11
|
+
},
|
12
|
+
"./lib/message/version_0": {
|
13
|
+
"types": "./dist/lib/message/version_0.d.ts",
|
14
|
+
"import": "./dist/lib/message/version_0.js"
|
15
|
+
},
|
16
|
+
"./lib/base_protocol": {
|
17
|
+
"types": "./dist/lib/base_protocol.d.ts",
|
18
|
+
"import": "./dist/lib/base_protocol.js"
|
19
|
+
}
|
20
|
+
},
|
21
|
+
"typesVersions": {
|
22
|
+
"*": {
|
23
|
+
"lib/*": [
|
24
|
+
"dist/lib/*"
|
25
|
+
],
|
26
|
+
"constants/*": [
|
27
|
+
"dist/constants/*"
|
28
|
+
]
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"type": "module",
|
32
|
+
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/core#readme",
|
33
|
+
"repository": {
|
34
|
+
"type": "git",
|
35
|
+
"url": "https://github.com/waku-org/js-waku.git"
|
36
|
+
},
|
37
|
+
"bugs": {
|
38
|
+
"url": "https://github.com/waku-org/js-waku/issues"
|
39
|
+
},
|
40
|
+
"license": "MIT OR Apache-2.0",
|
41
|
+
"keywords": [
|
42
|
+
"waku",
|
43
|
+
"decentralised",
|
44
|
+
"communication",
|
45
|
+
"web3",
|
46
|
+
"ethereum",
|
47
|
+
"dapps"
|
48
|
+
],
|
49
|
+
"scripts": {
|
50
|
+
"build": "run-s build:**",
|
51
|
+
"build:esm": "tsc",
|
52
|
+
"build:bundle": "rollup --config rollup.config.js",
|
53
|
+
"fix": "run-s fix:*",
|
54
|
+
"fix:lint": "eslint src *.js --fix",
|
55
|
+
"check": "run-s check:*",
|
56
|
+
"check:tsc": "tsc -p tsconfig.dev.json",
|
57
|
+
"check:lint": "eslint src *.js",
|
58
|
+
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
|
59
|
+
"test": "NODE_ENV=test run-s test:*",
|
60
|
+
"test:node": "NODE_ENV=test TS_NODE_PROJECT=./tsconfig.dev.json mocha",
|
61
|
+
"test:browser": "NODE_ENV=test karma start karma.conf.cjs",
|
62
|
+
"watch:build": "tsc -p tsconfig.json -w",
|
63
|
+
"watch:test": "mocha --watch",
|
64
|
+
"prepublish": "npm run build",
|
65
|
+
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
|
66
|
+
},
|
67
|
+
"engines": {
|
68
|
+
"node": ">=18"
|
69
|
+
},
|
70
|
+
"dependencies": {
|
71
|
+
"@libp2p/ping": "^1.0.12",
|
72
|
+
"@waku/enr": "^0.0.24",
|
73
|
+
"@waku/interfaces": "0.0.25",
|
74
|
+
"@waku/proto": "0.0.7",
|
75
|
+
"@waku/utils": "0.0.18",
|
76
|
+
"debug": "^4.3.4",
|
77
|
+
"it-all": "^3.0.4",
|
78
|
+
"it-length-prefixed": "^9.0.4",
|
79
|
+
"it-pipe": "^3.0.1",
|
80
|
+
"p-event": "^6.0.1",
|
81
|
+
"uint8arraylist": "^2.4.3",
|
82
|
+
"uuid": "^9.0.0"
|
83
|
+
},
|
84
|
+
"devDependencies": {
|
85
|
+
"@multiformats/multiaddr": "^12.0.0",
|
86
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
87
|
+
"@rollup/plugin-json": "^6.0.0",
|
88
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
89
|
+
"@types/chai": "^4.3.11",
|
90
|
+
"@types/debug": "^4.1.12",
|
91
|
+
"@types/mocha": "^10.0.6",
|
92
|
+
"@types/uuid": "^9.0.8",
|
93
|
+
"@waku/build-utils": "*",
|
94
|
+
"chai": "^4.3.10",
|
95
|
+
"cspell": "^8.6.1",
|
96
|
+
"fast-check": "^3.15.1",
|
97
|
+
"ignore-loader": "^0.1.2",
|
98
|
+
"isomorphic-fetch": "^3.0.0",
|
99
|
+
"mocha": "^10.3.0",
|
100
|
+
"npm-run-all": "^4.1.5",
|
101
|
+
"process": "^0.11.10",
|
102
|
+
"rollup": "^4.12.0"
|
103
|
+
},
|
104
|
+
"peerDependencies": {
|
105
|
+
"@multiformats/multiaddr": "^12.0.0",
|
106
|
+
"libp2p": "^1.1.2",
|
107
|
+
"@waku/enr": "^0.0.21",
|
108
|
+
"@waku/interfaces": "0.0.22",
|
109
|
+
"@waku/proto": "0.0.6",
|
110
|
+
"@waku/utils": "0.0.15"
|
111
|
+
},
|
112
|
+
"peerDependenciesMeta": {
|
113
|
+
"@multiformats/multiaddr": {
|
114
|
+
"optional": true
|
115
|
+
},
|
116
|
+
"@waku/interfaces": {
|
117
|
+
"optional": true
|
118
|
+
}
|
119
|
+
},
|
120
|
+
"files": [
|
121
|
+
"dist",
|
122
|
+
"bundle",
|
123
|
+
"src/**/*.ts",
|
124
|
+
"!**/*.spec.*",
|
125
|
+
"!**/*.json",
|
126
|
+
"CHANGELOG.md",
|
127
|
+
"LICENSE",
|
128
|
+
"README.md"
|
129
|
+
]
|
130
|
+
}
|
@@ -89,6 +89,34 @@ export class ConnectionManager
|
|
89
89
|
return instance;
|
90
90
|
}
|
91
91
|
|
92
|
+
stop(): void {
|
93
|
+
this.keepAliveManager.stopAll();
|
94
|
+
this.libp2p.removeEventListener(
|
95
|
+
"peer:connect",
|
96
|
+
this.onEventHandlers["peer:connect"]
|
97
|
+
);
|
98
|
+
this.libp2p.removeEventListener(
|
99
|
+
"peer:disconnect",
|
100
|
+
this.onEventHandlers["peer:disconnect"]
|
101
|
+
);
|
102
|
+
this.libp2p.removeEventListener(
|
103
|
+
"peer:discovery",
|
104
|
+
this.onEventHandlers["peer:discovery"]
|
105
|
+
);
|
106
|
+
}
|
107
|
+
|
108
|
+
async dropConnection(peerId: PeerId): Promise<void> {
|
109
|
+
try {
|
110
|
+
this.keepAliveManager.stop(peerId);
|
111
|
+
await this.libp2p.hangUp(peerId);
|
112
|
+
log.info(`Dropped connection with peer ${peerId.toString()}`);
|
113
|
+
} catch (error) {
|
114
|
+
log.error(
|
115
|
+
`Error dropping connection with peer ${peerId.toString()} - ${error}`
|
116
|
+
);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
92
120
|
public async getPeersByDiscovery(): Promise<PeersByDiscoveryResult> {
|
93
121
|
const peersDiscovered = await this.libp2p.peerStore.all();
|
94
122
|
const peersConnected = this.libp2p
|
@@ -200,22 +228,6 @@ export class ConnectionManager
|
|
200
228
|
this.startPeerDisconnectionListener();
|
201
229
|
}
|
202
230
|
|
203
|
-
stop(): void {
|
204
|
-
this.keepAliveManager.stopAll();
|
205
|
-
this.libp2p.removeEventListener(
|
206
|
-
"peer:connect",
|
207
|
-
this.onEventHandlers["peer:connect"]
|
208
|
-
);
|
209
|
-
this.libp2p.removeEventListener(
|
210
|
-
"peer:disconnect",
|
211
|
-
this.onEventHandlers["peer:disconnect"]
|
212
|
-
);
|
213
|
-
this.libp2p.removeEventListener(
|
214
|
-
"peer:discovery",
|
215
|
-
this.onEventHandlers["peer:discovery"]
|
216
|
-
);
|
217
|
-
}
|
218
|
-
|
219
231
|
private async dialPeer(peerId: PeerId): Promise<void> {
|
220
232
|
this.currentActiveParallelDialCount += 1;
|
221
233
|
let dialAttempt = 0;
|
@@ -298,18 +310,6 @@ export class ConnectionManager
|
|
298
310
|
}
|
299
311
|
}
|
300
312
|
|
301
|
-
private async dropConnection(peerId: PeerId): Promise<void> {
|
302
|
-
try {
|
303
|
-
this.keepAliveManager.stop(peerId);
|
304
|
-
await this.libp2p.hangUp(peerId);
|
305
|
-
log.info(`Dropped connection with peer ${peerId.toString()}`);
|
306
|
-
} catch (error) {
|
307
|
-
log.error(
|
308
|
-
`Error dropping connection with peer ${peerId.toString()} - ${error}`
|
309
|
-
);
|
310
|
-
}
|
311
|
-
}
|
312
|
-
|
313
313
|
private processDialQueue(): void {
|
314
314
|
if (
|
315
315
|
this.pendingPeerDialQueue.length > 0 &&
|