chore(web-chat): bump @waku/*

This commit is contained in:
fryorcraken.eth 2022-11-18 15:46:00 +11:00
parent c4ef4d2893
commit 165835d868
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
8 changed files with 560 additions and 551 deletions

View File

@ -4,9 +4,13 @@
"private": true,
"homepage": "/web-chat",
"dependencies": {
"@libp2p/bootstrap": "^5.0.0",
"@livechat/ui-kit": "^0.5.0-20",
"@multiformats/multiaddr": "^10.4.0",
"js-waku": "0.30.0",
"@multiformats/multiaddr": "11.0.7",
"@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",
"protons-runtime": "^3.1.0",
"react": "^17.0.2",
@ -29,7 +33,7 @@
"url": "^0.11.0"
},
"scripts": {
"start": "PORT=3003 react-scripts start",
"start": "GENERATE_SOURCEMAP=false PORT=3003 react-scripts start",
"build": "react-scripts build",
"test:unit": "exit 0",
"fix": "run-s fix:*",

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,5 @@
import { useEffect, useReducer, useState } from "react";
import "./App.css";
import { PageDirection, Protocols } from "js-waku";
import handleCommand from "./command";
import Room from "./Room";
import { WakuContext } from "./WakuContext";
@ -10,13 +9,14 @@ import { Message } from "./Message";
import {
Fleet,
getPredefinedBootstrapNodes,
} from "js-waku/lib/predefined_bootstrap_nodes";
import { waitForRemotePeer } from "js-waku/lib/wait_for_remote_peer";
import { PeerDiscoveryStaticPeers } from "js-waku/lib/peer_discovery_static_list";
import type { WakuLight } from "js-waku/lib/interfaces";
} from "@waku/core/lib/predefined_bootstrap_nodes";
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
import { Protocols, WakuLight } from "@waku/interfaces";
import process from "process";
import { createLightNode } from "js-waku/lib/create_waku";
import { DecoderV0, MessageV0 } from "js-waku/lib/waku_message/version_0";
import { createLightNode } from "@waku/create";
import { DecoderV0, MessageV0 } from "@waku/core/lib/waku_message/version_0";
import { PageDirection } from "@waku/interfaces";
import { bootstrap } from "@libp2p/bootstrap";
const themes = {
AuthorName: {
@ -203,9 +203,7 @@ async function initWaku(setter: (waku: WakuLight) => void) {
const waku = await createLightNode({
libp2p: {
peerDiscovery: [
new PeerDiscoveryStaticPeers(
getPredefinedBootstrapNodes(selectFleetEnv())
),
bootstrap({ list: getPredefinedBootstrapNodes(selectFleetEnv()) }),
],
},
});

View File

@ -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";
export class Message {

View File

@ -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 ChatList from "./ChatList";
import MessageInput from "./MessageInput";
@ -7,7 +7,7 @@ import { TitleBar } from "@livechat/ui-kit";
import { Message } from "./Message";
import { ChatMessage } from "./chat_message";
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 {
messages: Message[];

View File

@ -1,5 +1,5 @@
import { createContext, useContext } from "react";
import type { WakuLight } from "js-waku/lib/interfaces";
import type { WakuLight } from "@waku/interfaces";
export type WakuContextType = {
waku?: WakuLight;

View File

@ -1,4 +1,4 @@
import { utils } from "js-waku";
import { utf8ToBytes, bytesToUtf8 } from "@waku/byte-utils";
import * as proto from "./proto/chat_message";
/**
@ -20,7 +20,7 @@ export class ChatMessage {
text: string
): ChatMessage {
const timestampNumber = BigInt(Math.floor(timestamp.valueOf() / 1000));
const payload = utils.utf8ToBytes(text);
const payload = utf8ToBytes(text);
return new ChatMessage({
timestamp: timestampNumber,
@ -59,6 +59,6 @@ export class ChatMessage {
return "";
}
return utils.bytesToUtf8(this.proto.payload);
return bytesToUtf8(this.proto.payload);
}
}

View File

@ -1,5 +1,5 @@
import { multiaddr } from "@multiformats/multiaddr";
import type { WakuLight } from "js-waku/lib/interfaces";
import type { WakuLight } from "@waku/interfaces";
function help(): string[] {
return [
@ -44,7 +44,9 @@ function connect(
if (!peerId) {
return ["Peer Id needed to dial"];
}
waku.addPeerToAddressBook(peerId, [peerMultiaddr]);
waku
.dial(peerMultiaddr)
.catch((e) => console.error(`Failed to dial ${peerMultiaddr}`, e));
return [
`${peerId}: ${peerMultiaddr.toString()} added to address book, autodial in progress`,
];