chore(relay-reactjs-chat): bump js-waku to 0.27.0

This commit is contained in:
fryorcraken.eth 2022-09-14 22:40:15 +10:00
parent 5e710b63c6
commit 8e451be56e
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 495 additions and 647 deletions

View File

@ -7,7 +7,7 @@
"@testing-library/jest-dom": "^5.16.5", "@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0", "@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",
"js-waku": "0.24.0-63bfb9b", "js-waku": "0.27.0",
"protobufjs": "^7.0.0", "protobufjs": "^7.0.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
@ -19,6 +19,9 @@
"test": "exit 0", "test": "exit 0",
"eject": "craco eject" "eject": "craco eject"
}, },
"browser": {
"crypto": false
},
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [
"react-app", "react-app",

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
import {WakuMessage, waitForRemotePeer} from "js-waku"; import { WakuMessage } from "js-waku";
import * as React from "react"; import * as React from "react";
import protobuf from "protobufjs"; import protobuf from "protobufjs";
import {createWaku} from "js-waku/lib/create_waku"; import { createWaku } from "js-waku/lib/create_waku";
import { waitForRemotePeer } from "js-waku/lib/wait_for_remote_peer";
const ContentTopic = `/relay-reactjs-chat/1/chat/proto`; const ContentTopic = `/relay-reactjs-chat/1/chat/proto`;
@ -22,8 +23,7 @@ function App() {
setWakuStatus("Starting"); setWakuStatus("Starting");
(async () => { (async () => {
const waku = await createWaku({ defaultBootstrap: true });
const waku = await createWaku({defaultBootstrap: true})
setWaku(waku); setWaku(waku);
await waku.start(); await waku.start();
@ -36,12 +36,12 @@ function App() {
const processIncomingMessage = React.useCallback((wakuMessage) => { const processIncomingMessage = React.useCallback((wakuMessage) => {
if (!wakuMessage.payload) return; if (!wakuMessage.payload) return;
const {text, timestamp} = SimpleChatMessage.decode(wakuMessage.payload); const { text, timestamp } = SimpleChatMessage.decode(wakuMessage.payload);
const time = new Date(); const time = new Date();
time.setTime(timestamp); time.setTime(timestamp);
const message = {text, timestamp: time}; const message = { text, timestamp: time };
setMessages((messages) => { setMessages((messages) => {
return [message].concat(messages); return [message].concat(messages);