chore(web-chat): bump @waku/*
This commit is contained in:
parent
c4ef4d2893
commit
165835d868
|
@ -4,9 +4,13 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "/web-chat",
|
"homepage": "/web-chat",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@libp2p/bootstrap": "^5.0.0",
|
||||||
"@livechat/ui-kit": "^0.5.0-20",
|
"@livechat/ui-kit": "^0.5.0-20",
|
||||||
"@multiformats/multiaddr": "^10.4.0",
|
"@multiformats/multiaddr": "11.0.7",
|
||||||
"js-waku": "0.30.0",
|
"@waku/byte-utils": "^0.0.2",
|
||||||
|
"@waku/core": "^0.0.6",
|
||||||
|
"@waku/create": "^0.0.4",
|
||||||
|
"@waku/interfaces": "^0.0.5",
|
||||||
"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",
|
||||||
|
@ -29,7 +33,7 @@
|
||||||
"url": "^0.11.0"
|
"url": "^0.11.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "PORT=3003 react-scripts start",
|
"start": "GENERATE_SOURCEMAP=false PORT=3003 react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test:unit": "exit 0",
|
"test:unit": "exit 0",
|
||||||
"fix": "run-s fix:*",
|
"fix": "run-s fix:*",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,5 @@
|
||||||
import { useEffect, useReducer, useState } from "react";
|
import { useEffect, useReducer, useState } from "react";
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
import { PageDirection, Protocols } from "js-waku";
|
|
||||||
import handleCommand from "./command";
|
import handleCommand from "./command";
|
||||||
import Room from "./Room";
|
import Room from "./Room";
|
||||||
import { WakuContext } from "./WakuContext";
|
import { WakuContext } from "./WakuContext";
|
||||||
|
@ -10,13 +9,14 @@ import { Message } from "./Message";
|
||||||
import {
|
import {
|
||||||
Fleet,
|
Fleet,
|
||||||
getPredefinedBootstrapNodes,
|
getPredefinedBootstrapNodes,
|
||||||
} from "js-waku/lib/predefined_bootstrap_nodes";
|
} from "@waku/core/lib/predefined_bootstrap_nodes";
|
||||||
import { waitForRemotePeer } from "js-waku/lib/wait_for_remote_peer";
|
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||||
import { PeerDiscoveryStaticPeers } from "js-waku/lib/peer_discovery_static_list";
|
import { Protocols, WakuLight } from "@waku/interfaces";
|
||||||
import type { WakuLight } from "js-waku/lib/interfaces";
|
|
||||||
import process from "process";
|
import process from "process";
|
||||||
import { createLightNode } from "js-waku/lib/create_waku";
|
import { createLightNode } from "@waku/create";
|
||||||
import { DecoderV0, MessageV0 } from "js-waku/lib/waku_message/version_0";
|
import { DecoderV0, MessageV0 } from "@waku/core/lib/waku_message/version_0";
|
||||||
|
import { PageDirection } from "@waku/interfaces";
|
||||||
|
import { bootstrap } from "@libp2p/bootstrap";
|
||||||
|
|
||||||
const themes = {
|
const themes = {
|
||||||
AuthorName: {
|
AuthorName: {
|
||||||
|
@ -203,9 +203,7 @@ async function initWaku(setter: (waku: WakuLight) => void) {
|
||||||
const waku = await createLightNode({
|
const waku = await createLightNode({
|
||||||
libp2p: {
|
libp2p: {
|
||||||
peerDiscovery: [
|
peerDiscovery: [
|
||||||
new PeerDiscoveryStaticPeers(
|
bootstrap({ list: getPredefinedBootstrapNodes(selectFleetEnv()) }),
|
||||||
getPredefinedBootstrapNodes(selectFleetEnv())
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { MessageV0 } from "js-waku/lib/waku_message/version_0";
|
import { MessageV0 } from "@waku/core/lib/waku_message/version_0";
|
||||||
import { ChatMessage } from "./chat_message";
|
import { ChatMessage } from "./chat_message";
|
||||||
|
|
||||||
export class Message {
|
export class Message {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { Message as WakuMessage } from "js-waku/lib/interfaces";
|
import type { Message as WakuMessage } from "@waku/interfaces";
|
||||||
import { ChatContentTopic } from "./App";
|
import { ChatContentTopic } from "./App";
|
||||||
import ChatList from "./ChatList";
|
import ChatList from "./ChatList";
|
||||||
import MessageInput from "./MessageInput";
|
import MessageInput from "./MessageInput";
|
||||||
|
@ -7,7 +7,7 @@ import { TitleBar } from "@livechat/ui-kit";
|
||||||
import { Message } from "./Message";
|
import { Message } from "./Message";
|
||||||
import { ChatMessage } from "./chat_message";
|
import { ChatMessage } from "./chat_message";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { EncoderV0 } from "js-waku/lib/waku_message/version_0";
|
import { EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
messages: Message[];
|
messages: Message[];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { createContext, useContext } from "react";
|
import { createContext, useContext } from "react";
|
||||||
import type { WakuLight } from "js-waku/lib/interfaces";
|
import type { WakuLight } from "@waku/interfaces";
|
||||||
|
|
||||||
export type WakuContextType = {
|
export type WakuContextType = {
|
||||||
waku?: WakuLight;
|
waku?: WakuLight;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { utils } from "js-waku";
|
import { utf8ToBytes, bytesToUtf8 } from "@waku/byte-utils";
|
||||||
import * as proto from "./proto/chat_message";
|
import * as proto from "./proto/chat_message";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,7 @@ export class ChatMessage {
|
||||||
text: string
|
text: string
|
||||||
): ChatMessage {
|
): ChatMessage {
|
||||||
const timestampNumber = BigInt(Math.floor(timestamp.valueOf() / 1000));
|
const timestampNumber = BigInt(Math.floor(timestamp.valueOf() / 1000));
|
||||||
const payload = utils.utf8ToBytes(text);
|
const payload = utf8ToBytes(text);
|
||||||
|
|
||||||
return new ChatMessage({
|
return new ChatMessage({
|
||||||
timestamp: timestampNumber,
|
timestamp: timestampNumber,
|
||||||
|
@ -59,6 +59,6 @@ export class ChatMessage {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return utils.bytesToUtf8(this.proto.payload);
|
return bytesToUtf8(this.proto.payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { multiaddr } from "@multiformats/multiaddr";
|
import { multiaddr } from "@multiformats/multiaddr";
|
||||||
import type { WakuLight } from "js-waku/lib/interfaces";
|
import type { WakuLight } from "@waku/interfaces";
|
||||||
|
|
||||||
function help(): string[] {
|
function help(): string[] {
|
||||||
return [
|
return [
|
||||||
|
@ -44,7 +44,9 @@ function connect(
|
||||||
if (!peerId) {
|
if (!peerId) {
|
||||||
return ["Peer Id needed to dial"];
|
return ["Peer Id needed to dial"];
|
||||||
}
|
}
|
||||||
waku.addPeerToAddressBook(peerId, [peerMultiaddr]);
|
waku
|
||||||
|
.dial(peerMultiaddr)
|
||||||
|
.catch((e) => console.error(`Failed to dial ${peerMultiaddr}`, e));
|
||||||
return [
|
return [
|
||||||
`${peerId}: ${peerMultiaddr.toString()} added to address book, autodial in progress`,
|
`${peerId}: ${peerMultiaddr.toString()} added to address book, autodial in progress`,
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue