chore: bump versions for web-chat (#245)

* migrate to latest @waku/react and @waku/interfaces

* use @waku/sdk

* remove utils package

* up peer-exchange

* up dns package

* remove declare module

* bump version to 0.0.2

* up version

* use enrTree from the lib
This commit is contained in:
Sasha 2023-06-24 00:18:03 +02:00 committed by GitHub
parent 3ada67d8f9
commit bc0d8113f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1173 additions and 952 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,11 @@
"@libp2p/bootstrap": "^5.0.0", "@libp2p/bootstrap": "^5.0.0",
"@livechat/ui-kit": "^0.5.0-24", "@livechat/ui-kit": "^0.5.0-24",
"@multiformats/multiaddr": "11.0.7", "@multiformats/multiaddr": "11.0.7",
"@waku/react": "0.0.1-a", "@waku/react": "^0.0.2",
"@waku/byte-utils": "^0.0.2", "@waku/sdk": "^0.0.16",
"@waku/core": "^0.0.10", "@waku/dns-discovery": "^0.0.14",
"@waku/create": "^0.0.4", "@waku/interfaces": "^0.0.15",
"@waku/dns-discovery": "0.0.5", "@waku/peer-exchange": "^0.0.13",
"@waku/interfaces": "^0.0.7",
"@waku/peer-exchange": "^0.0.3",
"process": "^0.11.10", "process": "^0.11.10",
"protons-runtime": "^3.1.0", "protons-runtime": "^3.1.0",
"react": "^17.0.2", "react": "^17.0.2",

View File

@ -1,4 +1,4 @@
import { utf8ToBytes, bytesToUtf8 } from "@waku/byte-utils"; import { utf8ToBytes, bytesToUtf8 } from "@waku/sdk";
import * as proto from "./proto/chat_message"; import * as proto from "./proto/chat_message";
/** /**

View File

@ -88,7 +88,7 @@ function connections(waku: LightNode | undefined): string[] {
} }
let response: string[] = []; let response: string[] = [];
let strConnections = " connections: \n"; let strConnections = " connections: \n";
waku.libp2p.connectionManager.getConnections().forEach((connection) => { waku.libp2p.getConnections().forEach((connection) => {
strConnections += connection.remotePeer.toString() + ", "; strConnections += connection.remotePeer.toString() + ", ";
strConnections += JSON.stringify(connection.stat); strConnections += JSON.stringify(connection.stat);
strConnections += "; " + JSON.stringify(connection.streams); strConnections += "; " + JSON.stringify(connection.streams);

View File

@ -2,10 +2,6 @@ import { Protocols } from "@waku/interfaces";
export const CONTENT_TOPIC = "/toy-chat/2/huilong/proto"; export const CONTENT_TOPIC = "/toy-chat/2/huilong/proto";
const PUBLIC_KEY = "AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM";
const FQDN = "test.waku.nodes.status.im";
export const ENR_TREE = `enrtree://${PUBLIC_KEY}@${FQDN}`;
export const PROTOCOLS = [ export const PROTOCOLS = [
Protocols.Filter, Protocols.Filter,
Protocols.Store, Protocols.Store,

View File

@ -1,12 +1,12 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { generate } from "server-name-generator"; import { generate } from "server-name-generator";
import { Message } from "./Message"; import { Message } from "./Message";
import { Decoder } from "@waku/core/lib/message/version_0";
import type { import type {
Peer, Peer,
PeerProtocolsChangeData, PeerProtocolsChangeData,
} from "@libp2p/interface-peer-store"; } from "@libp2p/interface-peer-store";
import type { LightNode, StoreQueryOptions, Waku } from "@waku/interfaces"; import type { LightNode, StoreQueryOptions, Waku } from "@waku/interfaces";
import type { waku } from "@waku/sdk";
import { useFilterMessages, useStoreMessages } from "@waku/react"; import { useFilterMessages, useStoreMessages } from "@waku/react";
@ -27,7 +27,7 @@ export const usePersistentNick = (): [
type UseMessagesParams = { type UseMessagesParams = {
node: undefined | LightNode; node: undefined | LightNode;
decoder: undefined | Decoder; decoder: undefined | waku.Decoder;
options: StoreQueryOptions; options: StoreQueryOptions;
}; };
@ -109,7 +109,6 @@ type UsePeersResults = {
storePeers?: undefined | Peer[]; storePeers?: undefined | Peer[];
filterPeers?: undefined | Peer[]; filterPeers?: undefined | Peer[];
lightPushPeers?: undefined | Peer[]; lightPushPeers?: undefined | Peer[];
peerExchangePeers?: undefined | Peer[];
}; };
/** /**
@ -134,14 +133,12 @@ export const usePeers = (params: UsePeersParams): UsePeersResults => {
handleCatch(node?.store?.peers()), handleCatch(node?.store?.peers()),
handleCatch(node?.filter?.peers()), handleCatch(node?.filter?.peers()),
handleCatch(node?.lightPush?.peers()), handleCatch(node?.lightPush?.peers()),
handleCatch(node?.peerExchange?.peers()),
]); ]);
setPeers({ setPeers({
storePeers: peers[0], storePeers: peers[0],
filterPeers: peers[1], filterPeers: peers[1],
lightPushPeers: peers[2], lightPushPeers: peers[2],
peerExchangePeers: peers[3],
}); });
}; };

View File

@ -2,20 +2,20 @@ import React from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import { ThemeProvider } from "@livechat/ui-kit"; import { ThemeProvider } from "@livechat/ui-kit";
import { LightNodeProvider, ContentPairProvider } from "@waku/react"; import { LightNodeProvider, ContentPairProvider } from "@waku/react";
import { wakuDnsDiscovery } from "@waku/dns-discovery"; import { wakuDnsDiscovery, enrTree } from "@waku/dns-discovery";
import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange"; import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange";
import "./index.css"; import "./index.css";
import App from "./App"; import App from "./App";
import { ENR_TREE, CONTENT_TOPIC, PROTOCOLS } from "./config"; import { CONTENT_TOPIC, PROTOCOLS } from "./config";
const NODE_OPTIONS = { const NODE_OPTIONS = {
libp2p: { libp2p: {
peerDiscovery: [ peerDiscovery: [
wakuDnsDiscovery(ENR_TREE, { wakuDnsDiscovery([enrTree.TEST], {
store: 1, store: 1,
filter: 2, filter: 2,
lightpush: 2, lightPush: 2,
}), }),
wakuPeerExchangeDiscovery(), wakuPeerExchangeDiscovery(),
], ],

View File

@ -1,2 +1 @@
declare module "@livechat/ui-kit"; declare module "@livechat/ui-kit";
declare module "@waku/dns-discovery";