mirror of https://github.com/waku-org/js-waku.git
parent
f02581f110
commit
8291f4d010
|
@ -11822,6 +11822,15 @@
|
||||||
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
|
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/async-mutex": {
|
||||||
|
"version": "0.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz",
|
||||||
|
"integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/asynckit": {
|
"node_modules/asynckit": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
@ -39397,7 +39406,7 @@
|
||||||
"license": "MIT OR Apache-2.0",
|
"license": "MIT OR Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chainsafe/libp2p-noise": "^15.1.0",
|
"@chainsafe/libp2p-noise": "^15.1.0",
|
||||||
"@libp2p/bootstrap": "^10.1.2",
|
"@libp2p/bootstrap": "^10",
|
||||||
"@libp2p/identify": "^2.1.2",
|
"@libp2p/identify": "^2.1.2",
|
||||||
"@libp2p/mplex": "^10.1.2",
|
"@libp2p/mplex": "^10.1.2",
|
||||||
"@libp2p/ping": "^1.1.2",
|
"@libp2p/ping": "^1.1.2",
|
||||||
|
@ -39409,6 +39418,7 @@
|
||||||
"@waku/message-hash": "0.1.16",
|
"@waku/message-hash": "0.1.16",
|
||||||
"@waku/proto": "^0.0.8",
|
"@waku/proto": "^0.0.8",
|
||||||
"@waku/utils": "0.0.20",
|
"@waku/utils": "0.0.20",
|
||||||
|
"async-mutex": "^0.5.0",
|
||||||
"libp2p": "^1.8.1"
|
"libp2p": "^1.8.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class BaseProtocol implements IBaseProtocolCore {
|
||||||
|
|
||||||
protected constructor(
|
protected constructor(
|
||||||
public multicodec: string,
|
public multicodec: string,
|
||||||
private components: Libp2pComponents,
|
protected components: Libp2pComponents,
|
||||||
private log: Logger,
|
private log: Logger,
|
||||||
public readonly pubsubTopics: PubsubTopic[]
|
public readonly pubsubTopics: PubsubTopic[]
|
||||||
) {
|
) {
|
||||||
|
@ -52,9 +52,9 @@ export class BaseProtocol implements IBaseProtocolCore {
|
||||||
* the class protocol. Waku may or may not be currently connected to these
|
* the class protocol. Waku may or may not be currently connected to these
|
||||||
* peers.
|
* peers.
|
||||||
*/
|
*/
|
||||||
// public async allPeers(): Promise<Peer[]> {
|
public async allPeers(): Promise<Peer[]> {
|
||||||
// return getPeersForProtocol(this.peerStore, [this.multicodec]);
|
return getPeersForProtocol(this.components.peerStore, [this.multicodec]);
|
||||||
// }
|
}
|
||||||
|
|
||||||
public async connectedPeers(withOpenStreams = false): Promise<Peer[]> {
|
public async connectedPeers(withOpenStreams = false): Promise<Peer[]> {
|
||||||
const peers = await this.allPeers();
|
const peers = await this.allPeers();
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Metadata extends BaseProtocol implements IMetadata {
|
||||||
pubsubTopicsToShardInfo(this.pubsubTopics)
|
pubsubTopicsToShardInfo(this.pubsubTopics)
|
||||||
);
|
);
|
||||||
|
|
||||||
const peer = await this.peerStore.get(peerId);
|
const peer = await this.libp2pComponents.peerStore.get(peerId);
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
return {
|
return {
|
||||||
shardInfo: null,
|
shardInfo: null,
|
||||||
|
|
|
@ -47,7 +47,7 @@ export class WakuPeerExchange extends BaseProtocol implements IPeerExchange {
|
||||||
numPeers: BigInt(numPeers)
|
numPeers: BigInt(numPeers)
|
||||||
});
|
});
|
||||||
|
|
||||||
const peer = await this.peerStore.get(peerId);
|
const peer = await this.components.peerStore.get(peerId);
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
return {
|
return {
|
||||||
peerInfos: null,
|
peerInfos: null,
|
||||||
|
|
Loading…
Reference in New Issue